MATLAB: How to sort a struct sortstruct Is it possible to sort a struct? I want to sort the third column. 0 should be in the first row and the highest value at the end (last row). The other values are not important and should be the same ranking. Thank you. Best Answer You can try like this.% a = somestruct;[~,index] = sortrows([a.Var3].'); a = a(index); Related SolutionsMATLAB: How to sort one field of a structure based on the values of another field The sort function returns the order of indices of an array for sorting. So[A_sorted,ind] = sort(A);can be used to sort another array B byB_sorted_by_A = B(ind); MATLAB: Sort fieldnames in a structure alphabetically ignoring case [~, neworder] = sort(lower(fieldnames(yourstructure)));newstructure = orderfields(yourstructure, neworder)would be one way Related QuestionHow to sort a structure array based on a specific fieldCreate matrix with different type of data and sort it based on one of its columnsHow to arrenge the calculated distances in ascending orderLooping over table variable to access structureSorted two different arrays
Best Answer