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?
답변 (1개)
Guillaume
2018년 7월 12일
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
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!