How to name Array with each of my Arrays in a bulk folder?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
This is a simple problem yet I can't seem to solve it. I have a set of arrays in a file called 'results'. There are 8 in total, so far I want to separate all of them, to get Array1 = results{1,1}, Array2 = results{2,1}, etc. However, i can't seem to create a for loop that does this. I've tried i=1:length(results), which should give me i=1:8, but hw do i incorporate that into my Array name? Array(i) gives me the porperties of the array instead, which I do not want. Is there a simple way to get Arrayn = results{n,1}?
0 Commenti
Risposte (2)
Jan
il 28 Set 2021
Modificato: Jan
il 28 Set 2021
Do not hide an index in the name of variables. Although it is piossible to do this using the eval command, it increases the complexity of the code without any benefit, and impedes the processing such that the code can need up to 100 times more tome to be executed.
result{n} is ways better than Array1, Array2, ...
0 Commenti
Ravi Narasimhan
il 28 Set 2021
I believe what you are requesting (dynamically naming variables) can be done but is strongly discouraged. Here is a reference for why and how to achieve equivalent results in different ways. There are multiple links within that main one that are worth the time.
0 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!