Domanda

I have a matrix A where i found the row index with min value:

  [val, ind] = min (S)

how to get the value of this row at column 1?

The data I use in text file A:

dat    Y         S
100    0.86     105
 ...
20     0.4     145

I Find the min of S column. index the row 'ind' and need to return 'dat' column value of the correpsong row.

So e.g. S(min) = 105, [ind]=1, i need to return dat = 100.

Sorry for basic question.

Thanks

È stato utile?

Soluzione

I assume that you have read your textfile into the variable A

[val, ind] = min(A(:,3))

ind is now your row number.

Then you just do

A(ind,1)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top