フィルターのクリア

Inputting a Value from a Matrix into a command for automation using looping statements .

1 回表示 (過去 30 日間)
RS
RS 2020 年 7 月 23 日
コメント済み: RS 2020 年 7 月 23 日
I have the following answers A = 20 B = 30 C = 40, D = 50, E = 90. There is a command I need to input these values in which only accepts their input as numbers i.e. command(A).
In my actual problem I have a much larger set of values labelled from A-z (so 26 numbers). Is there anyway using loops I can input these 26 numbers with assigned names (such as B = 30) into this command?
Many Thanks
  4 件のコメント
Stephen23
Stephen23 2020 年 7 月 23 日
編集済み: Stephen23 2020 年 7 月 23 日
"Do you know a way I can take each value of this matrix and input it into a comannd, like command (123)? "
Very basic MATLAB concepts, such as how to use indexing, are introduced in the "Getting Started" tutorials:
You will see that the "Array Indexing" tutorial explains how to use basic indexing, which is what you should use. The "Programming and Scripts" tutorial shows how to use basic loops, which you should use.
RS
RS 2020 年 7 月 23 日
Thank you, I manged to find what I was looking for here.

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

回答 (1 件)

madhan ravi
madhan ravi 2020 年 7 月 23 日
for k = 1:numel(Time)
command(Time(k)) % who knows what this function does, perhaps it can be easily vectorised
end
  2 件のコメント
RS
RS 2020 年 7 月 23 日
Doing this gives me the following, for example:
ans = 1
ans = 2
ans = 3
etc
Is there any way to group these answers in a matrix in an automated way i.e. not just wriritng [ans ans ans]?
Many thanks
madhan ravi
madhan ravi 2020 年 7 月 23 日
If you read the links that Stephen shared above, you will get the desired result. Thanks.

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

カテゴリ

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