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

 채택된 답변

Bhaskar R
Bhaskar R 2019년 12월 26일

0 개 추천

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

추가 답변 (1개)

Stephen23
Stephen23 2019년 12월 26일
편집: Stephen23 2019년 12월 26일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

질문:

2019년 12월 26일

편집:

2019년 12월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by