フィルターのクリア

Selecting data from Excel sheet against input value

2 ビュー (過去 30 日間)
Mujtaba Tahir
Mujtaba Tahir 2020 年 3 月 19 日
回答済み: Walter Roberson 2020 年 3 月 23 日
I have a excel sheet which has four columns.1st column contains names of beams and other contains properties corresponding to it. I want to create a function or a script which asks user to input a beam name. Search the table if the beam exists. If it does it should put the properties of that beam equal to different variables.
  4 件のコメント
darova
darova 2020 年 3 月 20 日
Look into xlsread and strcmp
Mujtaba Tahir
Mujtaba Tahir 2020 年 3 月 23 日
I have tried looking into it but main problem is substituting variables with values of beam properties

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

採用された回答

Walter Roberson
Walter Roberson 2020 年 3 月 23 日
Use readtable() to read in the xlsx
ismember() the beam name against the first column of the table, giving a logical vector.
Use the vector as the row index into the table.
The result will be a table with 2 rows and the appropriate number of columns. You can extract portions of that table. For example,
YourSubTable{2,3} %second Ix value for the beam
The table will have two rows because each name is repeated on two lines. For example,
2×4 table
Designation mass per length (kg/m) Ix (x10^6 mm^4) Zx (x10^3 mm^3)
___________ ______________________ _______________ _______________
{'150UB'} 18 9.05 117
{'150UB'} 14 6.66 88.8

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by