简体   繁体   中英

how to find a row value of the row index matlab?

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 eg S(min) = 105, [ind]=1, i need to return dat = 100.

Sorry for basic question.

Thanks

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM