dimanche 15 novembre 2020

Sort a matrix by a column in Octave

I have to create a recursive (using 'if', not 'for' or 'while' allowed) function in Octave (similar to Matlab) that sort the n rows of an array (the entry is just the array) by one of its columns. I get stuck in the recursive step.

function Msorted=sort_array(M)
  [n,m]=size(M);
  if n<2
    Msorted=M
  else

Basically my question would be, how should I write my recursive step, how should I continue?

Aucun commentaire:

Enregistrer un commentaire