how to automatically find the location of the element/text in excel

4 Ansichten (letzte 30 Tage)
Aiman Zara
Aiman Zara am 6 Apr. 2023
Beantwortet: Mathieu NOE am 6 Apr. 2023
I have to find a specific position/ location of any element in excel how would I do that? Like If I have to find the position of laptop from the table, then how to do that without even mentioning its row no or column number. I want it to be like: I name it (fan ) and it shows me its exact position. Also if that name resides in more than one location then it should also show those locations too.

Antworten (1)

Mathieu NOE
Mathieu NOE am 6 Apr. 2023
hello
here you are :
T = readcell('example.xlsx');
% T = 6×3 cell array
% {'Stage'} {'health' } {'Object'}
% {[ 1]} {'good' } {'chair' }
% {[ 2]} {'good' } {'table' }
% {[ 3]} {'bad' } {'fan' }
% {[ 4]} {'average'} {'bag' }
% {[ 5]} {'average'} {'laptop'}
[r,c] = find(strcmp(T,'fan')); % row and col position of 'fan' in T cell array
r = r -1; % do this if the header line ({'Stage'} {'health' } {'Object'}) must not be taken into account

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by