How to convert fields in a struct into an int?
조회 수: 23 (최근 30일)
이전 댓글 표시
I have a struct with 48 fields each 1X128 int32 in it.
I want to combine all the fields into a single 48X128 int32, how do I accomplish it?
댓글 수: 2
답변 (1개)
Stephen23
2023년 1월 21일
편집: Stephen23
2023년 1월 21일
This would be much easier if your data were better designed, exactly as I recommended in your last question (which you have so far not responded to):
The data design means more steps are required. For example, where S is your 1x1 structure:
C = struct2cell(S);
M = vertcat(C{:})
댓글 수: 2
Stephen23
2023년 1월 26일
편집: Stephen23
2023년 1월 26일
"Dimensions of arrays being concatenated are not consistent."
Indeed, we can see that some of the arrays (e.g. 42, 43, 44) have size 1x129, not size 1x128 as you described.
Clearly they have incompatiable sizes and cannot be concatenated together vertically.
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!