Plot points with different symbols

7 ビュー (過去 30 日間)
Emi
Emi 2013 年 12 月 20 日
コメント済み: Emi 2013 年 12 月 20 日
I have a text file that contains x and y coordinates and one value that determine the "type" of the point.
File looks like this:
41 31 1
16 10 0
3 2 1
20 37 1
10 49 1
27 49 0
In each line (or row), the first value represents x coordinate, the second value represents y coordinate, and last value represents the "type" of the point.
I'd like to plot these points using '*' if it is a point of type 0, and 'O (blank circle)' if it is a point of type 1.
Could anyone help?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 12 月 20 日
編集済み: Azzi Abdelmalek 2013 年 12 月 20 日
a=dlmread('file.txt')
x=a(:,1)
y=a(:,2);
ii=a(:,3);
idx=ii==1
scatter(x(idx),y(idx),'*')
hold on
scatter(x(~idx),y(~idx),'o')
  1 件のコメント
Emi
Emi 2013 年 12 月 20 日
Worked like a charm. Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by