Suppose I had a class named Foo, with a datenum property named DateTime. If I had a cell array collection of Foo objects, how would I sort that according to each object\'s D
The simplest approach is to extract the time-values into a vector, sort that, and use the new order to sort the original array.
%# extract DateTime from the cell array fooCell
dateTime = cellfun(@(x)x.DateTime, fooCell);
[~,sortIdx] = sort(dateTime);
%# reorder fooCell
fooCell = fooCell(sortIdx);