Effacer les filtres
Effacer les filtres

reordering structure based on the content of one field

5 vues (au cours des 30 derniers jours)
Abdelwahab Fawzy
Abdelwahab Fawzy le 30 Déc 2016
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

Réponses (1)

Image Analyst
Image Analyst le 30 Déc 2016
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);

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by