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!