Efficiency: how can I define in a single line n matrices corresponding to n elements in a cell?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Samuele Bolotta
am 2 Apr. 2020
Beantwortet: Ameer Hamza
am 2 Apr. 2020
I have cell wholedff, which contains 11 elements.
wholedff={one,two,three,four,five,six,seven,eight,nine,ten,eleven};
I want to define 11 separated matrices out of that cell; so I would do:
dff1 = wholedff{1};
dff2 = wholedff{2};
dff3 = wholedff{3};
... And so on. Is there a way to do this in a single line of code? Thank you!
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 2 Apr. 2020
Although possible using eval(), there is a whole bunch of reason why it should never ever be done: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval
Always use arrays, they are efficient and easy to debug.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!