Sorting Cell stucture with different data types
Show older comments
I have a cell structure with 32 columns of data I read in the data in a cell Structure C = textscan(fid,'%s%f%s%f%s%f%f%f%f%f%f%f%f%f%f%f%s%s%f%f%f%f%f%f%f%f%s%f%f%s%f%s','delimiter',',');
I would like to sort the records by col 12 and keep all rows elements together, like sortrow
I tried this but it doesn't work [d,ix]=sort([C{:,1}]); cs=C(ix,:); I get his error ??? Index exceeds matrix dimensions.
===Begin Data == 3-Nov-00 9483 20-Jan-01 45 C 7.5 7.875 7.6875 1651 0 0.763201 0.649645 0.022872 -0.04417 0.081764 0.044075 A AGILENT TECHNOLOGIES INC. 20001103 9483 44.87318 44.93208 43.2243 44.10763 46.8125 0 N/A 0 0 N/A 0 N/A 3-Nov-00 9483 20-Jan-01 40 C 10.125 10.75 10.4375 1458 0 0.764967 0.763405 0.019358 -0.038622 0.069405 0.049576 A AGILENT TECHNOLOGIES INC. 20001103 9483 44.87318 44.93208 43.2243 44.10763 46.8125 0 N/A 0 0 N/A 0 N/A 3-Nov-00 9483 20-Jan-01 35 C 13.625 14.25 13.9375 98 0 0.786377 0.859066 0.01393 -0.030619 0.051442 0.051967 A AGILENT TECHNOLOGIES INC. 20001103 9483 44.87318 44.93208 43.2243 44.10763 46.8125 0 N/A 0 0 N/A 0 N/A 3-Nov-00 9483 20-Jan-01 30 C 17.625 18.25 17.9375 308 0 0.797738 0.931167 0.008332 -0.020541 0.031331 0.051155 A AGILENT TECHNOLOGIES INC. 20001103 9483 44.87318 44.93208 43.2243 44.10763 46.8125 0 N/A 0 0 N/A 0 N/A ==End Data ===
Accepted Answer
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!