How to create vector of Objects

16 ビュー (過去 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 Center および File ExchangeArray Geometries and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by