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
本文详细介绍了MATLAB中disp函数的基本用法,包括如何输出数字、字符串、数字与字符串结合以及数组等内容,并通过实例展示了不同场景下disp函数的具体应用。
7152

被折叠的 条评论
为什么被折叠?



