MATLAB 的输入与输出语句
输入语句
o 输入数值
?x=input('please input a number:')
please input a number:22
x = 22
o 输入字符串
?x=input('please input a string:','s')
please input a string:this is a string
x = this is a string
输出语句
o 输出显示命令
自由格式 (disp)
?disp(23+454-29*4)
361
?disp([11 22 33; 44 55 66; 77 88 99])
11 22 33
44 55 66
77 88 99
?disp('this is a string')
this is a string
格式化输出 (fprintf)。
fprintf('The area is %8.5f', area) % 注意输出格式前须有%符号,
%跳行符号须有\符号
The area is 12.56637 % 输出值为 8 位数含 5 位小数
评论0
最新资源