How can I create a subplot from for loop with an if statement
3 次查看(过去 30 天)
显示 更早的评论
Hi All,
I have two threshold values that I would like to run through my for loop, and subsequently plot each 'meanMUA' (for that threshold value) as a subplot.
I attempted the following, but the 'meanMUA' for threshold1 is subplotted in both specified positions, rather than the 'meanMUA' for threshold1 (in position 1) and threshold2 (in position 2):
threshold1 = 0.018;
threshold2 = 2*threshold1;
figure;
for threshold = 1:2
for trial = 1:50
for channel = 1:16
for bin = 1:10000
%%access data from bins, using sliding window
bindata = absData(((bin*binWidth)+1-binWidth : bin*binWidth), channel, trial);
if threshold == threshold1 || threshold == threshold2
%%calculate mua above threshold
mua(bin, channel, trial) = sum(bindata >= threshold);
end
end
end
end
meanMUA = (mean(mua,3)).';
subplot(1,2, threshold);
clims=[0 1];
imagesc(meanMUA,clims)
end
Does anyone know how I can solve this? Your help is appreciated.
Thank you in advance.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!