finding number of a column in a cell (column that contains a specified string)
Ältere Kommentare anzeigen
how could it be done for finding first which array of a cell is equal a specified string and in second, what is number of column that contains this string
for example:
CELL={'a','b','c','d','e','f',...}
finding 'a' in CELL?(which row and column)
Akzeptierte Antwort
Weitere Antworten (2)
Harry MacDowel
am 21 Sep. 2011
find(char(CELL)=='a')
Does that help?
4 Kommentare
mohammad
am 21 Sep. 2011
Harry MacDowel
am 21 Sep. 2011
sorry should be
find(char(CELL)=='a');
Harry MacDowel
am 21 Sep. 2011
I corrected the answer up there.
mohammad
am 21 Sep. 2011
Grzegorz Knor
am 21 Sep. 2011
See in documentation:
doc strfind
strfind(CELL,'a')
5 Kommentare
mohammad
am 21 Sep. 2011
Grzegorz Knor
am 21 Sep. 2011
CELL={'a','b','c','d','e','f';'f','e','d','c','b','a'}
idx = strfind(CELL,'a');
[row col] = find(~cellfun(@isempty,idx))
mohammad
am 21 Sep. 2011
Jan
am 21 Sep. 2011
I definitely prefer Grzegorz's solution in the comment above:
find(strcmp(C, 'a'))
mohammad
am 21 Sep. 2011
Kategorien
Mehr zu String Parsing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!