Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Accessing data within astructure
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I am trying to access data from a part of a structure, which I have not implemented myself.
It looks like:
>> whos
Name Size Bytes Class Attributes
anotace 1x1 2648 struct
then:
anotace.borders
ans =
1x5 struct array with fields:
Y
H
type
>> anotace.borders.Y
ans =
106.0000 106.0000 164.5000 164.5000
685.2500 733.2500 733.2500 685.2500
ans =
368.5000 368.5000 440.5000 440.5000
604.2500 661.2500 661.2500 604.2500
ans =
351.5448 351.5448 421.5945 421.5945
461.3955 521.8930 521.8930 461.3955
ans =
356.3209 356.3209 432.7388 432.7388
306.9677 369.0572 369.0572 306.9677
ans =
337.2164 337.2164 423.1866 423.1866
192.3408 252.8383 252.8383 192.3408
I would like to access anotace.borders.Y and use its data as an array of arrays(each ans as one array). When I try to assign its value I only get the first ans into my new variable.
Thanks for help.
댓글 수: 0
답변 (2개)
Amit
2014년 1월 19일
you can access each array as anotace.borders.Y{i} where i is the i'th array in the structure.
댓글 수: 4
Jan
2014년 1월 19일
@Amit: Using EVAL to create variables dynamically is a very bad programming practize and there is always a better solution.
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!