MATLAB 程式設計/在命令列輸入資料
外觀
input() 函式允許您的指令碼處理在命令列輸入的資料。所有輸入都將轉換為數值或陣列。input() 函式的引數是您想要它顯示的訊息或提示。輸入字串需要額外的 's' 引數。示例
%test.m
%let's ask a user for x
x = input('Please enter a value for x:')
然後執行指令碼將產生以下輸出
Please enter a value for x:3
x = 3
>>