How to give a dynamic variable name in for loop?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
dpb
am 8 Mär. 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
am 8 Mär. 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.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!