フィルターのクリア

how to find the row name which corresponds to a certain value in a table

7 ビュー (過去 30 日間)
mohamed
mohamed 2016 年 3 月 18 日
コメント済み: Guillaume 2016 年 3 月 18 日
hello i named the rows of a table as follows
MT={'A','B','C','D','E'};
the other elements in the table are [S,Rd,Ratio,doi,kd] i want to display the MT at max(s), this is the code i used
for i=1:x
kd(i)=input('perm of damaged zone: ');
doi(i)=input('depth of invasion: ');
rd(i)=doi(i)+rw';
s(i)=((ko/kd(i))-1)*(log(rd(i)/rw))';
Rd=[rd]';
S=[s]';
ji=log(re/rw);
jd(i)=log(re/rw);
jo(i)=(log(re/rw))+(s(i));
R(i)=jd(i)/jo(i);
Ratio=[R]';
table(S,Rd,Ratio,doi,kd,'RowName',MT)

回答 (1 件)

Guillaume
Guillaume 2016 年 3 月 18 日
t = table(S,Rd,Ratio,doi,kd,'RowName',MT);
[~, maxrow] = max(t.S); %get row index of max
maxrowname = t.Properties.RowNames(maxrow) %get string corresponding to row index
  2 件のコメント
mohamed
mohamed 2016 年 3 月 18 日
編集済み: mohamed 2016 年 3 月 18 日
thank you
but can u tell me what does ~ this means?
Guillaume
Guillaume 2016 年 3 月 18 日
It means ignore this output. You don't care about the value of the max (1st output), just its position (2nd output).

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by