HELP with for loop plots and changing symbol styles
Show older comments
Hi all, I am trying to generate a plot that looks like the attachment (that I generated without using for loops), using the code pasted below. However there seems to be an error somewhere as all of my symbols are coming out as black dots (not coloured black, red, and blue). This is my first time trying to use for loops to create figures, so the issue is likey in my loops. Can anyone see a mistake? I've attached the data file in case anyone wants to try to run it.
% code
load('trilobite_a.mat')
% plot original data
[N,M]=size(X);
figure;
hold on
col={'ro', 'r*', 'rd', 'bo', 'b*', 'bd', 'ko', 'k*', 'kd'};
for ii = 1:N;
hold on
for k=1:length(col);
plot(X(ii,:), col{k});
end
end
hold off
legend('A1','A2','A3','D1','D2','D3','P1','P2','P3');
xlabel('Variable');
ylabel('Trilobite Measurements');
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!