for control=1:7
name=strcat('tau: ', num2str(TD(control)),' PLD: ', num2str(PLD(control)));
fprintf('Control: %i/7\n', control)
Maps(control) = struct('GradOFF', [], 'GradON', []);
for lin=1:size(data(subject).perf_w_off,1)
fprintf('Lin: %i/64\n', lin);
for col=1:size(data(subject).perf_w_off,2)
[x1, fval, exitflag, output] = fminunc(...)
Maps(control).GradOFF(lin,col) = abs(x1(2));
[x2, fval, exitflag, output] = fminunc(...)
Maps(control).GradON(lin,col) = abs(x2(2));
end
end
min1 = min(min(Maps(control).GradOFF));
min2 = min(min(Maps(control).GradON));
min = min([min1, min2]);
max1 = max(max(Maps(control).GradOFF));
max2 = max(max(Maps(control).GradON));
max = max([max1, max2]);
figure(map1);
subplot(2,7,control)
image1 = mat2gray(Maps(control).GradOFF,[min, max]);
imshow(image1,[]);
title(strcat(name, ' Grad Off'))
subplot(2,7, control+7)
image2 = mat2gray(Maps(control).GradON,[min, max]);
imshow(image2,[]);
title(strcat(name, ' Grad On'))
end
Nothing seems to go wrong with this code. The first loop (the one over control) is doing fine. However when going through the loop again (control = 2), then an error message appears when doing min1 = min(min(Maps(control).GradOFF))
. It says:
Subscript indices must either be real positive integers or logicals.
but when I'm doing mean(mean(Maps(control).GradOFF))
it is working. Could someone tell me what could go possibly wrong with min
that won't with mean
?