How can i take specific values from a matrix and put them into another matrix?

4 Ansichten (letzte 30 Tage)
I have a 2170x2 matrix: the first column is filled with my values and the second one goes from 1 to 12 over and over again (1 to 12 representing each month of the year).
I need to regroup the values corresponding to each month together ( all the values from the first column that have the same number in the second column) but I can't figure it out.

Akzeptierte Antwort

Matt J
Matt J am 29 Nov. 2018
Bearbeitet: Matt J am 29 Nov. 2018
Let's say your matrix is A,
Matrices=splitapply(@(z){z},A,A(:,2))

Weitere Antworten (1)

Matt J
Matt J am 29 Nov. 2018
Bearbeitet: Matt J am 29 Nov. 2018
sortrows(yourMatrix,2)
  1 Kommentar
Samy Ben Thabet
Samy Ben Thabet am 29 Nov. 2018
That worked to separate everything but they are all still in one matrix. Is there a way to separate them all into different ones? (all the ones in one matrix, the twos in another matrix...)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by