View Full Version : Matlab Minimum Value Search
I got a quick question, lets say I have an array of numbers for example [ 9 3 2 7 1 8 ]
and I want to find the minimum value ie: for this example it would be 1. How could I implement an optimization search like this??
jhae2.718
Apr20-11, 10:41 AM
[value index] = min(array)
I was looking for a way which I could write my own loop, I just am not familiar with matlab yet.
jhae2.718
Apr20-11, 10:50 PM
Well if you want to reinvent the wheel, you'll need to iterate through the list and keep track of the current lowest value...so to me that says for loop, comparison tests...
MATLABdude
Apr21-11, 05:25 AM
If you don't yet know how to do flow control in MATLAB, their documentation page is quite helpful:
http://www.mathworks.com/help/techdoc/learn_matlab/f4-1931.html
NOTE: You can bring up the built-in help in MATLAB for any function by typing
>> help <FUNCTION_NAME>
HINT: prod(size(MATRIX_A)) may help you with your flow control...
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.