reordering structure based on the content of one field
5 次查看(过去 30 天)
显示 更早的评论
if there is a structure (S) for 10 nodes. the three fields of the structure are (xd , yd and ID) where,,
S.xd ==> X-dimension , S.yd ==> Y_dimension , S.ID ==> node's order or its ID , S.E ==> Energy
I wanna reorder the structure of these nodes based on their residual energy
0 个评论
回答(1 个)
Image Analyst
2016-12-30
Maybe this:
se = [S.E]; % String together all S.E items.
% Now sort in ascending order
[sortedSE, sortIndexes] = sort(se, 'ascend');
% Now sort the structure array.
S = S(sortIndexes);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!