[英]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: 我有一个矩阵A,在其中找到了具有最小值的行索引:
[val, ind] = min (S)
how to get the value of this row at column 1? 如何获得此行的第1列的值?
The data I use in text file A: 我在文本文件A中使用的数据:
dat Y S
100 0.86 105
...
20 0.4 145
I Find the min of S column. 我找到S列的最小值。 index the row 'ind' and need to return 'dat' column value of the correpsong row. 对行“ ind”进行索引,并需要返回对应行的“ dat”列值。
So eg S(min) = 105, [ind]=1, i need to return dat = 100. 因此,例如S(min)= 105,[ind] = 1,我需要返回dat = 100。
Sorry for basic question. 很抱歉出现基本问题。
Thanks 谢谢
I assume that you have read your textfile into the variable A
我假设您已将文本文件读入变量A
[val, ind] = min(A(:,3))
ind
is now your row number. 现在, ind
是您的行号。
Then you just do 那你就做
A(ind,1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.