using variable inside input function
古いコメントを表示
I am trying to get user input for node coordinates. For some reason the ouput in the command window does not show the variable number, but instead a square:
Input
for i =1:2
x(i)=input(['coordinate for x ' i ' in metres: ']);
end
Output
coordinate for x in metres:
1 件のコメント
Dr. Kelsey Joy
2021 年 11 月 27 日
編集済み: Dr. Kelsey Joy
2021 年 11 月 27 日
num2str(i) so it doesn't just convert the number to a character position
I agree sprintf or fprintf may be a better approach.
(refer to this example with fprintf: https://www.mathworks.com/matlabcentral/fileexchange/102644-educational-building-arrays-with-for-loops-d-d?s_tid=prof_contriblnk)
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Automated Driving Toolbox についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!