https://blog.csdn.net/winone361/article/details/45457485
- 輸入語句
- 輸入數值
x=input('please input a number:')
please input a number:22
x = 22
輸入字符串
x=input('please input a string:','s')
please input a string:this is a string
x = this is a string
- 輸出語句
- 輸出顯示
- 命令自由格式 (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\n', area) % 注意輸出格式前須有%符號,
%跳行符號須有\符號
The area is 12.56637 % 輸出值為8位數含5位小數
在這里你如果學過c語言就能很好的理解了。
-
- 錯誤消息顯示命令
error('this is an error')
this is an error