Using loop to plot numbers on a single plot while simultaneously giving each number/data point a different marker symbol.

Hello! I have been stuck for ages on this and would greatly appreciate any help. I have created an array of complex numbers (variable z) and want to plot them on a single plot. However, I want each number to have a different marker symbol so I created a string (variable markers) with the desired symbols. When I run the code, the plot only uses the last symbol marker from the character string. I know the issue is with my for loop and using hold on does not work so I am very confused. I have included a screenshot of my code. Thank you.

 採用された回答

Kevin Phung
Kevin Phung 2019 年 1 月 21 日
編集済み: Kevin Phung 2019 年 1 月 21 日
You need to do,
for i = 1:12
plot(z(i),'Marker',markers{i})
hold on
end

2 件のコメント

rkrk
rkrk 2019 年 1 月 21 日
編集済み: rkrk 2019 年 1 月 21 日
Thank you so much for your quick reply! It worked! Really appreciate it. Hope you have a great day.
You're welcome! Glad to have helped :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

質問済み:

2019 年 1 月 21 日

コメント済み:

2019 年 1 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by