xticks not looping correctly?
2 views (last 30 days)
Show older comments
Hello,
I've created a series of subplots but I'm running into an issue where each suplot's x axis ticks are off. So where subplot 2 should be 31-60, subplot 3 should be 61-90, etc. But instead it looks like this the screenshot I've attached.
Here is the code I've written:
figure;
RTkeys=(SRTT.RT(find(SRTT.Correct_Key==1)));
numRTkeys=1:numel(RTkeys);
x=length(RTkeys)/7;
plotNames={'1', '2', '3', '4', '5', '6', '7'};
sgtitle('Key 1 Reaction Times','fontsize',16,'fontweight','bold');
for k = 1:7
subplot(7,1,k);
plot(numRTkeys((1 + (k-1)*x):k*x), RTkeys((1 + (k-1)*x):k*x), '-o');
title(sprintf('Block %s', plotNames{k}))
xlabel('Key Occurance');
ylabel('Reaction Time');
end
I assume it has to do with the line:
plot(numRTkeys((1 + (k-1)*x):k*x), RTkeys((1 + (k-1)*x):k*x), '-o');
Does anyone have any ideas?
Thank you in advance!
Answers (0)
See Also
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!