Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Please can anyone clear my doubt regarding Concatenation of data.

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

John D'Errico
John D'Errico il 21 Feb 2019
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.

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by