split and plot data loop

I have a dataset of 3 columns, and 221488 columns. In the first and second column is the x and y data, the third column is the name of the series, each series consist of 1000-4000 rows. how do i plot each x and y data for each different series and different color each plot using loop?

Answers (1)

One possible way:
[group, seriesname] = findgroup(yourdataset.nameofthirdcolumn);
figure; %create figure;
hold on;
splitapply(@(x, y, g) plot(x, y, 'DisplayName', seriesname{g(1)}), yourdataset.x, yourdataset.y, group, group); %the repeat of group is intentional. 'DisplayName' assumes that series name are char arrays

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Asked:

on 12 Jul 2018

Answered:

on 12 Jul 2018

Community Treasure Hunt

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

Start Hunting!