フィルターのクリア

Displaying loop index in a string

5 ビュー (過去 30 日間)
C Meek
C Meek 2012 年 6 月 28 日
Hi all,
I'm just curious as to how to do this (or if it can even be done). If I'm using the input prompt in a loop, how can I get it to display the loop index in the string?
For example,
for k=1:NS
ele(k) = input('input value for ele(k)');
end
So essentially each time I would like this to say:
input value for ele(1)
input value for ele(2)...etc
Can this be done?
Thanks!
Craig

採用された回答

Honglei Chen
Honglei Chen 2012 年 6 月 28 日
input(sprintf('input value for ele(%d)',k))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by