finding number of a column in a cell (column that contains a specified string)
이전 댓글 표시
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)
채택된 답변
추가 답변 (2개)
Harry MacDowel
2011년 9월 21일
find(char(CELL)=='a')
Does that help?
댓글 수: 4
mohammad
2011년 9월 21일
Harry MacDowel
2011년 9월 21일
sorry should be
find(char(CELL)=='a');
Harry MacDowel
2011년 9월 21일
I corrected the answer up there.
mohammad
2011년 9월 21일
Grzegorz Knor
2011년 9월 21일
See in documentation:
doc strfind
strfind(CELL,'a')
댓글 수: 5
mohammad
2011년 9월 21일
Grzegorz Knor
2011년 9월 21일
CELL={'a','b','c','d','e','f';'f','e','d','c','b','a'}
idx = strfind(CELL,'a');
[row col] = find(~cellfun(@isempty,idx))
mohammad
2011년 9월 21일
Jan
2011년 9월 21일
I definitely prefer Grzegorz's solution in the comment above:
find(strcmp(C, 'a'))
mohammad
2011년 9월 21일
카테고리
도움말 센터 및 File Exchange에서 String Parsing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!