how to search specific data from matlab in excel
12 次查看(过去 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!