Issue
let's consider this is the intended matrix; I need to find the location of the minimum in each column, but there is a condition that the ind(min1) < ind(min2) < ind(min3) < ..... <ind(minN)
where IND is the index so in another word is the location of the minimum. This matrix is okay, but I want to make an automatized process for future use.
[[ 0.91018066 4.48975932 2.09120921]
[ 0.99666765 6.20469762 4.39193871]
[255.09412294 1.0510132 3.18827888]
[ 10.04494426 1.02542159 2.41095802]
[ 1.10101048 7.75462488 1.55075049]
[ 1.16764376 1.56933637 2.33618634]
[ 0.67289877 4.27517897 2.53459737]
[ 4.82191354 0.717983 3.14042209]
[ 0.35376553 3.01928107 2.05515314]
[ 11.29192073 0.4509206 4.48405362]
[ 2.77928849 2.57319267 0.44103186]
[ 1.53813319 3.11950628 4.82088164]
[ 1.67829804 2.40947038 5.49557038]
[ 69.7214563 2.96405783 4.52767726]
[ 1.97205265 4.57095239 8.45765019]
[ 13.12256504 1.45513654 35.58973711]
[ 8.96582583 7.37919581 1.63986824]
[ 2.01843202 3.73197058 1.8612331 ]
[ 6.54770837 2.43552378 6.16662901]
[ 6.34760671 2.42883926 6.23632993]
[ 12.1397713 2.27797639 4.18868256]
[ 5.58218562 2.82203753 3.41404581]
[ 3.66370152 2.97445241 3.34320906]
[ 2.56132298 2.81115595 1.13722405]
[ 4.302606 3.24668351 3.81259428]
[ 3.3940013 2.32417808 38.78896462]
[ 72.86244959 3.75110755 6.08713172]
[ 17.04329424 1.49873191 3.69710865]
[ 2.13217024 13.5293613 4.24590484]
[ 4.11955718 2.60752147 95.89256472]]
Solution
I think the example is a bit odd if i understand your question correctly. It seems that you want to find the minimum of the whole first column (index 9, value 0.35376553) and then the minimum of column 2 index 9:end (index 10, value 0.4509206) etc. So it seems, that your indices are 9, 10 and 11:
I called you matrix M
:
minimumRow = 1;
for iColumn = 1:size(M,2)
[a,iRow]=min(M(minimumRow:end,iColumn));
minimumRow = minimumRow + iRow -1
end
Answered By - Solstad
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.