MATLAB的输入与输出
生活随笔
收集整理的這篇文章主要介紹了
MATLAB的输入与输出
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.MATLAB的輸入語句input函數用于接收用戶的輸入:
a.輸入數據
| 1 2 3 4 | >> x=input('please input a number:') please input a number:22 x = ???22 |
b.輸入字符串
| 1 2 3 4 | >> x=input('please input a string:','s') please input a string:this is a string x = this is a string |
2.MATLAB輸出語句包括自由格式(disp)和格式化輸出(fprintf)兩種
| 1 2 3 4 5 6 7 8 9 10 11 12 | >> 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 >> area=12.56637889; >> fprintf('The area is %8.5f\n',area) The area is 12.56638 >> |
總結
以上是生活随笔為你收集整理的MATLAB的输入与输出的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CoInitialize\CoCreat
- 下一篇: python连连看小游戏_利用Pytho