Sorting variable names in alphabetical order
9 次查看(过去 30 天)
显示 更早的评论
Using the workspace window, wow can I sort variables defined inside a struct object in alphabetical order? clicking on the Field column doesn't sort them.
0 个评论
采纳的回答
更多回答(1 个)
Daniel Shub
2012-11-20
Assuming you mean the variable editor and not the workspace window, I think this is a possible bug. There seems to me no good reason to have the ability to sort by field, and not have it perform an alphabetical sort.
2 个评论
James
2016-1-5
I don't think it is a bug... same issue here with MATLAB 2015a. Clicking on "Field" in the Variables window sorts the fields, but it appears to be a random sort; it is not alphabetical.
Walter Roberson
2016-1-6
MATLAB structs are field order dependent.
A = struct('field1', [], 'field2', []);
B = struct('field2', [], 'field1', []);
A(2) = B;
Subscripted assignment between dissimilar structures.
However, [A;B] is fine
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!