help-octave
[Top][All Lists]
Advanced

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

Re: Sorting a structure array


From: veryhappy
Subject: Re: Sorting a structure array
Date: Fri, 18 Feb 2011 05:08:32 -0800 (PST)

I'd faced several troubles with structure arrays containing structure arrays
so i can help you with this one :)

% First we get the names in the tmp cell 
tmp=arrayfun(@(x) x.t(1).name,s,"UniformOutput",false)
% Then we sort them and keep the ordering indexes
[ordered,ord_idx]=sort(tmp)
% Last we order s with the ordering indexes
result=s(ord_idx)

I hope that help you with your problem
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/Sorting-a-structure-array-tp3312568p3312623.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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