How to give a dynamic variable name in for loop?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi everybody,
I have a 4500x3 sized matrix. First two columns of the matrix contains the x and y value of the data set and third column contains the class labels as a numeric value like 7,3,1 sizes of the classes are not same and changing accourding to the user input. I want to sort each class from this main matrix to class1,class2, classn in a for loop.
2 Commenti
dpb
il 8 Mar 2020
"I want to sort each class from this main matrix to class1,class2, classn..."
That may be what you want to do, but it's almost certainly NOT the way to proceed.
Instead, read the data into an array and use the CLASSID variable as a grouping variable to process the data by group.
Showing a small subset of the file would help folks to see what it actually is...
John D'Errico
il 8 Mar 2020
It may be what you think you want to do.
Instead, do some reading there, and recognize it may not be a good idea.
Instead, learn to use arrays of the many types available in MATLAB. Perhaps a cell array if necessary.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!