I created a cell array in Octave. Some columns contain floats, and some columns contain strings. I am able to sort the cell array by a column of strings (say col #4), using this command:
sortrows (mycellarray, 4);
But if the column I want to sort by is a column of floats, then I get this error message:
error: sort: only cell arrays of character strings may be sorted
Does anyone know how to sort a cell array, by a column of floats?
Convert the column with float values to a vector, sort it and get the sorting index. Then you can apply this index to your cell array.
In some versions of Octave, however, the tilde
~operator is not defined. In that case: