어때 대략 struct
s?
Joints.left_knee = [100 200];
Joints.head = [-1 -100];
동적과 같이 개별 항목을 참조 fieldnames
모든 필드를 받기 :
someVar = 'left_eye';
Joints.(someVar) = [200 250];
을 등 여러 관절이 일어날 경우, 모든 데이터의 동일한 종류를 필요로하지만, 그들은 모두에 속하는 동일한 시스템, 당신도 멀티 D 구조체를 만들 수 있습니다
0 :
그냥
Joints(1).left_knee = [100 200];
Joints(1).head = [-1 -100];
Joints(2).left_knee = [200 450];
Joints(2).head = [-10 -189];
Joints(3).left_knee = [-118 264];
Joints(3).head = [+33 78];
당신에게 멀티 D 구조체의 맥락에서 유용한 몇 가지 기술을 보여
>> someVar = 'head';
>> Joints.(someVar) % will be expanded cell-array, 1 entry for each dimension
ans =
-1 -100
ans =
-10 -189
ans =
33 78
>> [Joints.(someVar)] % will collect those data in regular array
ans =
-1 -100 -10 -189 33 78
>> {Joints.(someVar)} % will collect those data in cell array
ans =
[1x2 double] [1x2 double] [1x2 double]
>> [A,B,C] = deal(Joints.(someVar)); % will assign data to 3 separate vars
A =
-1 -100
B =
-10 -189
C =
33 78
help struct
자세한 내용은 관련 기능을 참조하십시오.
+1 문자열 변수를 사용하여 구조체 필드를 참조 할 수 있는지 잘 모르겠습니다. –