How can I put these subplots into a for loop?
Show older comments
Hello,
I have 1000 points of data (NumKey) I would like to divide into 10 different suplots each showing 100 points of the data. Every other data point is a random number which is why they are markered differently('*' being a random number). I started doing it manually, but am trying to figure out how to make it into a for loop.
I get a bit confused with nested for loops, so I would appreciate any advice.
Thank you in advance!
ntrials=1:100:1000;
figure;
subplot(10,1,1)
ntrials=1:numel(NumKey);
plot(ntrials(1:2:100),NumKey(1:2:100),'o');
hold on
plot(ntrials(2:2:100),NumKey(2:2:100),'*');
yticks([1 2 3 4]);
subplot(10,1,2)
ntrials=1:numel(NumKey);
plot(ntrials(101:2:200),NumKey(101:2:200),'o');
hold on
plot(ntrials(102:2:200),NumKey(102:2:200),'*');
yticks([1 2 3 4]);
Accepted Answer
More Answers (0)
Categories
Find more on Subplots 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!