MATLAB: Using min() on vectors with double

decimalsdoubleminvectors

I have several variables of the double type, each around 450×1 in size. I would like to find the minimum value of each of them, but when I use min(vector), MATLAB returns "Subscript indices must either be real positive integers or logicals." Does this mean that min() cannot work with decimals? If so, is there another function I can use that will? An example of my code is below. As you can see, I have set up a matrix that has two columns, one with a single integer and another with the minimum value of the vector.
min_set = [974,min(blg0974);975,min(blg0975);976,min(blg0976)];
Update: All my vectors have positive values with decimal places up to the ten thousandth's place.

Best Answer

Kylie - try typing
which min
to see if min refers to the function to find the minimum value of an array or if min refers to a local variable. If you are seeing the above error message when you call min(vector), then this suggests that you are trying to access elements in an array named min with non-integer indices (which would be the floats or doubles in your vectors/arrays). If this is the case, then you can easily fix this problem by renaming your local variable to something else which will not correspond to a built-in MATLAB function.