help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cell arrays of strings in "sort" and "unique"


From: Keith Goodman
Subject: Cell arrays of strings in "sort" and "unique"
Date: Mon, 13 Sep 2004 15:19:38 -0700

I noticed that the functions "sort and "unique" do not support cell
arrays of strings. And that sort does not support strings.

As a work around for unique, I'm using

function [z,i] = unique_cell(x)
x = x(:);
y = str2num(num2str(-1*char(x)));
[ignore,i] = unique(y);
z = x(i,:);

Could the above technique of converting a cell array to a char array
to a number matrix to a string array to a number array be used in sort
and unique to handle cell arrays of strings?



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]