Sort every sixth column

Hi
I have a big matrix (5X30), and i want to sort every sixth column in ascneding order.
I have tried to use sortrow(matrix,column) in a foor loop, but the problem is that the command only sort the last column in the for loop. It does not save alle the sort columns.
Any advice for this?
Thanks

Antworten (1)

Matt J
Matt J am 7 Apr. 2020
Bearbeitet: Matt J am 7 Apr. 2020

0 Stimmen

matrix(:,1:6:end)=sort(matrix(:,1:6:end))

2 Kommentare

Eivind Jamessen
Eivind Jamessen am 7 Apr. 2020
Thanks, it almost worked.
but i get this: Subscripted assignment dimension mismatch.
I can't see why...
Matt J
Matt J am 7 Apr. 2020
Try now.

Diese Frage ist geschlossen.

Tags

Gefragt:

am 7 Apr. 2020

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by