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

3 visualizaciones (últimos 30 días)
NA
NA el 10 de Ag. de 2020
Editada: NA el 10 de Ag. de 2020
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.

Respuestas (0)

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by