Merging Arrays in a Struct and Sorting them

Hello, I have a struct like this:
talha4.JPG
I want to join its two arrays into one array and then sort them in ascending order, I am trying this code, but it is not giving me results:
c = [v(1) v(2)]
sort_c = sort(c);

 Akzeptierte Antwort

Bhaskar R
Bhaskar R am 26 Dez. 2019

0 Stimmen

result = sort(struct2array(v), 'ascend')

Weitere Antworten (1)

Stephen23
Stephen23 am 26 Dez. 2019
Bearbeitet: Stephen23 am 26 Dez. 2019

0 Stimmen

A more robust solution, where v is your 2x1 structure:
out = sort([v.IndividualStiffnessMatrix])
Note that your field name is misspelled "Indivual..."

Kategorien

Mehr zu Software Development Tools finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 26 Dez. 2019

Bearbeitet:

am 26 Dez. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by