how to find the corresponding elements in a matrix/excel

3 ビュー (過去 30 日間)
Aiman Zara
Aiman Zara 2023 年 4 月 10 日
回答済み: Image Analyst 2023 年 4 月 10 日
Like if I name the Stage 2 then it should display the disease name(Alternaria leafspot) occuring at that stage. Sample file attached
  2 件のコメント
Image Analyst
Image Analyst 2023 年 4 月 10 日
If you name what "the Stage 2"? Display the disease name how???? On a GUI? In the command window? In the workspace panel?
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Aiman Zara
Aiman Zara 2023 年 4 月 10 日
編集済み: Aiman Zara 2023 年 4 月 10 日
@Image Analyst In a given table, if I select any element and need to find a value related to that specific element from another row or coloumn, how would I do that? can you provide me a sample code of doing that?
the output should be displayed in the command window

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

採用された回答

Image Analyst
Image Analyst 2023 年 4 月 10 日
Try this:
t = readtable('FinalBookExcel.csv')
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
t = 5×3 table
CottonStage DiseaseSeverity Disease ___________ _______________ _______________________ {'Stage1'} {'harmful' } {'Fusarium wilt' } {'Stage2'} {'harmful' } {'Alternaria leafspot'} {'Stage3'} {'Critical'} {'Fusarium wilt' } {'Stage4'} {'Medium' } {'Fungal' } {'Stage5'} {'Medium' } {'worm' }
% Lets specify row 2, column 1 and get the value there.
row = 2;
t21 = t.CottonStage(row)
t21 = 1×1 cell array
{'Stage2'}
% Now let's get the "DiseaseSeverity" value for that same row
t22 = t.DiseaseSeverity(row)
t22 = 1×1 cell array
{'harmful'}
% Now let's get the "Disease" value for that same row
t23 = t.Disease(row)
t23 = 1×1 cell array
{'Alternaria leafspot'}

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by