How to plot data with classes

29 views (last 30 days)
Kong on 13 Apr 2020
Commented: KSSV on 13 Apr 2020
I'm a beginner in Matlab.
I want to plot data with classes.
X = 1305 x 6
Y = 1305 x 1 (class : 0,1,2,3,4,5,6)
Could I get an idea to plot this data with legend?
I want to get this kind of picture.
clear all
close all
X = csvread('data.csv');
Y = csvread('class.csv');

Accepted Answer

KSSV on 13 Apr 2020
KSSV on 13 Apr 2020
You can chnage the name of class to what you is given out there.

Sign in to comment.

More Answers (1)

David Hill
David Hill on 13 Apr 2020
It is unclear what you are going to use as your x,y coordinates in your data set.
c=lookup(Y+1);%convert 0-6 to colors
  1 Comment
Kong on 13 Apr 2020
Thank you so much.
I got the error. X and Y have different length's vector.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!