I have an matrix of size 128X12. For each row I want to find the minimum value and also the row number and column number where that particular minimum value occurs.
Best Answer
A = magic(6); % Given array.
[MN,I] = min(A,[],2) % Minimum of each row, and index
Also, whenever you have a question like this, you should turn to the MATLAB documentation. For example, you know you want to find the minimum, so do this:
If‘V’ is your column vector,‘Vmin’ will be the minimum value, and‘Idxmin’ will be the index of thefirst occurrence of the minimum. If you have more than one value of the minimum, use thefind function:
Idxmin = find(V == min(V));
It will return the indexes (row numbers) of all values of the minimum.
Best Answer