MATLAB: Hello there, I have a short question, as for some reason a for loop doesn’t function.

for loop stuck

RT is a matrix and krit_out1 is a vector. There is no error message, but the loop is stuck in the first row of the matrix and I don't find the reason.. Can someone help me?
for i = 1:50
RT(RT(:,i)> krit_out1(i)) = NaN;
end

Best Answer

RT=ones(50,50);krit_out1=zeros(50,1);
for i=1:50
for j=1:50
if(RT(j,i)>krit_out1(j))
RT(j,i)=NaN;
end
end
end
Try this.