How to create vector of Objects

조회 수: 14 (최근 30일)
Abebe Haftu Fitur
Abebe Haftu Fitur 2018년 5월 7일
댓글: Tomas Hindrich 2020년 4월 14일
I want to put all objects in form of a vector, none of the things I look on the internet doesn't help me to solve my problem, is there anyone can help on how to save them on a single variable, with possible to access back the by referencing them. Just like this vairbale= [radarmotion1 radarmotion2 radarmotion3 radarmotion4 ], you can look from the script below how my objects are created.
radarmotion1 = phased.Platform('InitialPosition',[0;0;0.5],'Velocity',[radar_speed1;0;0]); radarmotion2 = phased.Platform('InitialPosition',[0;0.5;0.5],'Velocity',[radar_speed2;0;0]); radarmotion3 = phased.Platform('InitialPosition',[0.5;0;0.5],'Velocity',[radar_speed3;0;0]); radarmotion4 = phased.Platform('InitialPosition',[0;0.5;1.5],'Velocity',[radar_speed4;0;0]);
Thanks!
  댓글 수: 1
Jan
Jan 2018년 5월 7일
What happens for
A = [radarmotion1 radarmotion2 radarmotion3 radarmotion4]
? Do you get an error message?

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

채택된 답변

Ameer Hamza
Ameer Hamza 2018년 5월 7일
편집: Ameer Hamza 2018년 5월 7일
You can use a cell array,
variable = {radarmotion1, radarmotion2, radarmotion3, radarmotion4}
Use curly brackets. Access each element also using curly brackets notataion, variable{1}, variable{2}, ...
  댓글 수: 2
Priya Mittal
Priya Mittal 2020년 4월 4일
So simple. Thank you!
Tomas Hindrich
Tomas Hindrich 2020년 4월 14일
Thank you very much

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Array Geometries and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by