フィルターのクリア

vector in a sting input

2 ビュー (過去 30 日間)
Raphael Esquenazi Muniz
Raphael Esquenazi Muniz 2020 年 6 月 1 日
編集済み: Hank 2020 年 6 月 1 日
Hello, im wondering if i can include a value i ( vector that goes i=1:n) inside the input so that the user so can write me back a string.
Example : B(i)=input('Expecify the type of nod(SL,PQ,PV) for the nod ' i ' ,'s')
I want the user to receive
Expecify the type of nod(SL,PQ,PV) for the nod 1
and 1 should be i ( the vector 1:n).
This question should repeat itself until the vector ends
thanks a lot
  1 件のコメント
madhan ravi
madhan ravi 2020 年 6 月 1 日
It's unclear , you need to illustrate with an example with an expected result.

サインインしてコメントする。

回答 (1 件)

Hank
Hank 2020 年 6 月 1 日
編集済み: Hank 2020 年 6 月 1 日
You need this syntax for string concatenation:
B(i) = input( ['Node: ' num2str(i)], 's' )
or
B(i) = input( sprintf('Node: %s', i), 's' )
An interesting way to do this in one line is to use arrayfun
B = arrayfun(@(i) input(['Node ' num2str(i) ': '],'s'), 1:4, 'uni', 0)

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by