From: Kenzo Mendoza on
Let's say I have the following vector

numb= [1.35, 4.62, 0, .53, .433, 0, 2.5 ]

and I'm supposed to declare a variable that has the smallest value in numb vector, but zero is omitted

So, .433 would be called out, not the 0's

smallest_variable= .433

Any suggestions?
From: Loren Shure on
In article <hkv0kb$3el$1(a)fred.mathworks.com>,
kenzo_mendoza(a)knights.ucf.edu says...
> Let's say I have the following vector
>
> numb= [1.35, 4.62, 0, .53, .433, 0, 2.5 ]
>
> and I'm supposed to declare a variable that has the smallest value in numb vector, but zero is omitted
>
> So, .433 would be called out, not the 0's
>
> smallest_variable= .433
>
> Any suggestions?
>

Perhaps eliminate the 0s and the look for the minimum? Or look for the
minimum, and if it's not 0, you're okay... Or sort the array and check
the first value - if it's 0, check the next one, etc.

--
Loren
http://blogs.mathworks.com/loren
http://matlabwiki.mathworks.com/MATLAB_FAQ
From: ImageAnalyst on
Kenzo Mendoza:

numb= [1.35, 4.62, 0, .53, .433, 0, 2.5 ] % Generate sample data
numbNoZeros = numb; % Make a copy.
numbNoZeros(numb==0) = []; % Get rid of zeros.
[minValue minIndexes] = min(numbNoZeros) % Find the min value and
position, not including zeros which are now gone.
From: Matt J on
min(nonzeros(numb))