How can I set multiple variables to the same initial value efficiently?
古いコメントを表示
I hate using the following way of defining variables;
a= 5, b=a, c=a, d=a, etc
I have a lot of variable taking the same intial value, how can do it efficiently?
Thanks in advance!
1 件のコメント
Stephen23
2018 年 12 月 6 日
"I have a lot of variable taking the same intial value, how can do it efficiently?"
Simple: store your data in one array.
Having "a lot of variables" is a sign that you should be using arrays anyway.
採用された回答
その他の回答 (1 件)
Anteneh Zewdu
2018 年 12 月 6 日
0 投票
3 件のコメント
madhan ravi
2018 年 12 月 6 日
編集済み: madhan ravi
2018 年 12 月 6 日
Dude that's exactly what I answered , it's not nice to accept your own answer after someone has answered !
Anteneh Zewdu
2018 年 12 月 13 日
madhan ravi
2018 年 12 月 13 日
No problem , anytime :)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!