필터 지우기
필터 지우기

assigne values to multiple indexes of a struct array.

조회 수: 12 (최근 30일)
tafteh
tafteh 2013년 4월 2일
Hi all, I have a struct array A containing multiple fields. i.e A.time, A.frame and etc.
In the code I produce multiple instances of this variable and store them like following:
A(1).time
A(1).frame
A(2).time
A(2).frame
...
having an array B holding the interested indexes of A (i.e B = [1, 3, 5]), I want to set the value (update) of the specific field of those indexes I have in B. Say I would like t do A(B).time = 5;
is there anyway I can do that in Matlab? simply running the command above would give me an error.
However I can get the value of a specific field from multiple indexes of A by running following command:
C = [A(B).frame];
is there a similar approach to set the values?
Thanks,

채택된 답변

Jan
Jan 2013년 4월 2일
Look in the "Tips" in the documentation of deal.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by