How do I assign multiple variables the array data from multiple rows in a field
조회 수: 13 (최근 30일)
이전 댓글 표시
I am new to MATLAB programming and am having trouble even asking the right question. I am trying to assign 6 variables the array data from 6 vertical cells (rows), from a field called "analysis.opt_history.error". When I type this:
A = analysis.opt_history.error
I get the array from the first row (this is OK):
A =
1.068 0.749 0.749 0.737 0.737
However, I also want to retrieve the array data that is in Rows 2 through 6 and assign the values of each cell to B, C, D, E, F separately. I cannot figure out how to do this despite much time reading the community. Thanks!
Mark
댓글 수: 0
채택된 답변
Matt J
2023년 3월 15일
편집: Matt J
2023년 3월 15일
Is this what you mean?
data={1,2,3,4,5,6}'
[A,B,C,D,E,F]=deal(data{:})
댓글 수: 5
Matt J
2023년 3월 15일
@Mark Sloan You're welcome, but please Accept-click the answer to indicate that it worked.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!