How to call data from a structure?
조회 수: 7 (최근 30일)
이전 댓글 표시
I have a structure that is 1x36. Each of the cells has data that I would like to call and use. How can I do that?
댓글 수: 0
채택된 답변
James Tursa
2017년 10월 4일
편집: James Tursa
2017년 10월 4일
How do you want to use it? If you are talking about the results of your last Question, it is a "cell array" and not a "structure". Those are two different things in MATLAB. To use a cell array, just use the curly braces { } instead of parentheses ( ) when you are indexing. I.e.,
result = the cell array from your last question
:
... result{1} ... <-- some expression involving the first matrix from the result
etc
Note I used {1} instead of (1). The second matrix would be result{2}, etc.
E.g., suppose you wanted to add 2 to the third column of the 5th matrix. Then it would be:
result{5}(:,3) = result{5}(:,3) + 2;
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!