Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Please can anyone clear my doubt regarding Concatenation of data.

1 回表示 (過去 30 日間)
Rakesh Yadav Kodari
Rakesh Yadav Kodari 2019 年 2 月 21 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I came to know dynamic variables are bad idea. But i have a small doubt regarding Concatenation of data.
Suppose if i have data like A1,A2.....AN
and if I use strcat to Concatenatie data do i really need to type in all the variable in the work space
Like s = strcat(A1,A2,....AN) or can i say From A1 to AN ?
Thanks in Advance.

回答 (1 件)

John D'Errico
John D'Errico 2019 年 2 月 21 日
Sorry, but there are soooo many reasons why you do not want to create those numbered variables. Having now done so however, you still cannot just do something like "From A1 to AN". MATLAB does not support such an operation.
You need to convert your variables into an array. Learn to use arrays instead. I'm sorry. But just suck it up and get yourself out of the hole you climbed into. You can start over, creating an array, as you should have done in the beginning. Or you can type all those variable names. Hey, it is just once. It builds character. Or, you can dig even more deeply into that rabbit hole, finding a way to work with all those variables, perhaps still using eval. Good luck if you do that, if you choose to make the descent into programming hell. Better for you to simply climb out before the hole gets too deep.

Community Treasure Hunt

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

Start Hunting!

Translated by