MATLAB: Minimum value array issue

arrayindexminimum

I am using the following code line to get the minimum value of the matrix dn and the corresponding index of the minimum value
[TransmiterNode,ind]=min(dn(:));
what I want to do is on the next run of this code line I do not want the old minimum value to be considered

Best Answer

If you know that all the values in dn are different:
%init

ind = [];
%for ...

dntemp = dn;
dntemp(ind) = [];
[TransmiterNode,ind]=min(dntemp(:));
%...

%end

If not:
%init
%TransmiterNode = NaN; %or any other unused value in dn
%for ...
dntemp = dn;
dntemp(find(TransmiterNode)) = [];
[TransmiterNode,ind]=min(dntemp(:));
%...
%end
Related Question