How can I create a subplot from for loop with an if statement

조회 수: 13 (최근 30일)
NA
NA 2020년 8월 10일
편집: NA 2020년 8월 10일
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개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by