Variable isn't showing in the input command (A little square appears instead)
11 ビュー (過去 30 日間)
古いコメントを表示
Hey, I'm new in Matlab but have been searching and didn't find anything that solves my question.
I wrote this:
for i=1:NEOx
VNEOx(i) = input(['Introduzca la Masa Molar del elemento ' i ': ']);
end
But what I am getting in return isn't the variable "i", which should be firstly 1, then 2...etc. Instead I am getting some little squares:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/287181/image.png)
Any idea about what I am doing wrong?
Thank you very much
0 件のコメント
回答 (1 件)
Tommy
2020 年 4 月 24 日
Try either
for i=1:NEOx
VNEOx(i) = input(['Introduzca la Masa Molar del elemento ' num2str(i) ': ']);
end
or
for i=1:NEOx
VNEOx(i) = input(sprintf('Introduzca la Masa Molar del elemento %d: ', i));
end
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!