how to use find command to find data?

1 回表示 (過去 30 日間)
Rohit Bhoi
Rohit Bhoi 2016 年 2 月 19 日
回答済み: Andrei Bobrov 2016 年 2 月 19 日
I have excel sheet now in that excel sheet I have two rows one is temp and elong. now I have to take user input and find that value in temp row and also find corresponding elong value available in next cell. how can I find that?? for example excel sheet data is something shown below. temp 31.223 31.789 32.569 elong 0.5,0.6,0.7 now if user give value 31 then matlab have find nearest value to 31 which is 31.223 from temp row and should return me corresponding elong value which is 0.5. how to do that? and how can I use find function to solve above problem??

採用された回答

Andrei Bobrov
Andrei Bobrov 2016 年 2 月 19 日
temp = [ 31.223 31.789 32.569];
elong = .5:.1:.7;
inp = 31;
[~,k] = min(abs(temp - inp));
out = elong(k);

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by