disp的用法
在matlab中help disp
DISP Display array.
DISP(X) displays the array, without printing the array name. In
all other ways it's the same as leaving the semicolon off an
expression except that empty arrays don't display.
If X is a string, the text is displayed.
意思是输出数组类型的数据,也可以把string类型的数据看做数组输出
(1)输出数字
>> num = 1;
>> disp(num)
1
(2)输出字符串
>> disp('this is string')
this is string
>>
(3)输出数字和字符串
>> num = 1;
>> disp(['num:',num2str(num)])
num:1
(4)输出数组
>> a=[1 2 3];
>> disp(a)
1 2 3