Filter löschen
Filter löschen

How to sort orders of rows?

1 Ansicht (letzte 30 Tage)
Laliguras
Laliguras am 27 Mär. 2013
Hi, I have a matrix, which I need to sort in two group: First group: Pick first 5 rows (and all columns) and leave next five rows and again pick another five, leave next five and so on. Second group: Pick only those which were not selected in first group.
Thanks in advance.
  1 Kommentar
Laliguras
Laliguras am 28 Mär. 2013
As follow-up to previous question, how do I get the average value (mean) of each of those picked 5 rows?
Thanks

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 27 Mär. 2013
Bearbeitet: Azzi Abdelmalek am 27 Mär. 2013
Example
A=rand(20,6);
idx=reshape(1:size(A,1),5,[]);
m=size(idx,2);
idx1=idx(:,1:2:end);
idx2=idx(:,2:2:end);
A1=A(idx1(:),:)
A2=A(idx2(:),:)

Weitere Antworten (0)

Kategorien

Mehr zu Shifting and Sorting Matrices 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!

Translated by