Find string (from table) in cell in matlab

조회 수: 56 (최근 30일)
Pafi Pafian
Pafi Pafian 2015년 1월 20일
댓글: Pafi Pafian 2015년 1월 21일
Hi,
I want to find the location of one string (which I take it from a table) inside of a cell: A is my table, and B is the cell.
I have tested :
strncmp(A(1,8),B(:,1),1)
but it couldn't find the location. I have tested many commands like: ismember,strmatch,find(strcmp),find(strcmpi)find(ismember),strfind and etc ... but they all give me errors mostly because of the type of my data !
So please suggest me a solution. I am currently using Matlab R2013b.

답변 (1개)

Niels
Niels 2015년 1월 20일
If your cell array contains mixed datatypes, then ismember indeed does not work.
However, something like find(strcmp('YourString',CellArray)) should work just fine.
One thing you should keep in mind is, just as with cells, the way you call data from your table.
If you do the following:
temp = A(1,8);
What data type do you get for your temp variable?

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by