It's possible to index property of class that it's in cell array. If i have a class with a property value and i have a cell array that containig one instances of class for each cell there is a way to do (like a struct):
{cell.value} or [cell.value]

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2018년 6월 19일

0 개 추천

I tried this. It looks better to construct an array of objects, not a cell array of objects.
a=[timer,timer]
a.Period
c={timer,timer}
c{1}.Period
c.Period

댓글 수: 2

Andrea Stevanato
Andrea Stevanato 2018년 6월 19일
I already tried this and it doesen't work!
Fangjun Jiang
Fangjun Jiang 2018년 6월 19일
What do you mean " it doesn't work"?
My example was trying to suggest putting multiple objects of a class into an array (using []), not a cell array (using {}). Then you can get the same property of the multiple objects in one shot like a.Period above.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Structures에 대해 자세히 알아보기

질문:

2018년 6월 19일

댓글:

2018년 6월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by