how to search specific data from matlab in excel
12 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Chris
on 26 Oct 2021
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), :)
More Answers (1)
Aiman Zara
on 4 Jun 2023
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 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!