reordering structure based on the content of one field

7 ビュー (過去 30 日間)
Abdelwahab Fawzy
Abdelwahab Fawzy 2016 年 12 月 30 日
回答済み: Image Analyst 2016 年 12 月 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

回答 (1 件)

Image Analyst
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);

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by