필터 지우기
필터 지우기

array of structures in matlab

조회 수: 1 (최근 30일)
sweta arya
sweta arya 2015년 10월 10일
댓글: Walter Roberson 2015년 10월 10일
how to create array of structure,and array contains 100 element. i want to sort array on the basis of second field of array.

채택된 답변

Walter Roberson
Walter Roberson 2015년 10월 10일
YourStructureName(100) = struct('firstfield', [], 'secondfield', []);
And there you have a struct array of 100 elements, each of which has two fields.
  댓글 수: 2
sweta arya
sweta arya 2015년 10월 10일
how to sort this array on the basis of second field.thank you
Walter Roberson
Walter Roberson 2015년 10월 10일
There is no basis for sorting an array based upon empty fields. If the fields are not empty then you need to define how to determine whether one field content sorts before another. For example if YourStructure(317).secondfield = {'Red Rover', 17}, should that sort before or after YourStructure(111).secondfield = [1/1000-3/507i, inf; nan, -5099e42] ?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by