Matlab - sort cell array of objects by property -


suppose had class named foo, datenum property named datetime. if had cell array collection of foo objects, how sort according each object's datetime property?

i have seen references overloading sort method , working arrays of objects, i'm using cell array due dynamic sizing , instructions aren't holding up. got suggestions? cheers

the simplest approach extract time-values vector, sort that, , use new order sort original array.

%# extract datetime cell array foocell datetime = cellfun(@(x)x.datetime, foocell);  [~,sortidx] = sort(datetime);  %# reorder foocell foocell = foocell(sortidx); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -