how to search specific data from matlab in excel
15 ビュー (過去 30 日間)
古いコメントを表示
how to search specific data from matlab to excel and then display the row that include the data i've searched to matlab, for example i have an excel data
R1280XS 11 12 10
B2015AT 14 10 10
D1112FM 10 14 15
tab = readtable('tubes18.xlsx');
T = input ('plate number :','s'); %and then i put R1280XS
tab(ismember(tab.(1), 'T'), :)
so 11 12 10 will display in matlab, but when i use that why the row (11 12 10) can't displayed ?
please help me, i'm stuck with it
0 件のコメント
採用された回答
Chris
2021 年 10 月 26 日
The last line is looking for a string 'T' in the first column of the table. You want to search for the variable T (no quotes). Try:
tab(ismember(tab.(1), T), :)
その他の回答 (1 件)
Aiman Zara
2023 年 6 月 4 日
in = input('F');
[num,txt,raw] = xlsread('ExcelData.csv');
p = strcmpi(in,raw(:,2));% Compare user input string with entries in the Excel sheet
rowNum = find(p==1)%Get Row number
tab = readtable('ExcelData.csv'); % see doc for more options
tab(ismember(tab.(1), 'Aphids'), :) % the row at which the input str matches the first table's column
I have used the above code, it works well when i enter any value(field) from coloumn 1 as it shows me the whole Row for that field but when I enter any field from any other coloumn then it shows me the empty table. Help me in this case, like if I enter data from the other coloumns too then it should show me the whole row as well, as it shows when I enter a field from C1
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!