MATLAB: Find a vector of string in a Cell array

cell arrayfind

Hi all
Assume I have a cell array which is like a matrix like this Dataset=
{'DICL','Coating','Yes';
'DICL','Coating','No';
'DICL','Coating','Yes';
'DICL','Coating','NO'}
Now I want to find the index of a row of this array which is for example
uniquevalue={'DICL','Coating','NO'}
uniquevalue is another cell array which is like a 1*n array
When I wanted to convert the Dataset to Matrix with cell2mat,following error happened:
Error using cat: Dimensions of matrices being concatenated are not consistent.
Actually I wanted to convert these to cell arrays to the matrix and then use following statement
ind=strfind((NewstringsDataSet),(UniqueValuesSet(j,:)));
or
temp=find(strcmp(NewstringsDataSet,UniqueValuesSet(j,:)));
Are there any function in Matlab to find the index of a row of cell array
Best Regards Mojgan

Best Answer

[~,i1] = ismember(Dataset,uniquevalue);
index = find(all(diff(i1,1,2)==1,2));
other variant:
Dataset = {
'DICL' 'Coating' 'Yes'
'DICL' 'Coating' 'No'
'DICL' 'Coating' 'YES'
'DICL' 'Coating' 'NO'};
uniquevalue = {'DICL' 'Coating' 'YES'
'DICL' 'Coating' 'NO'};
[~,~,c] = unique([Dataset;uniquevalue]);
s = size(Dataset);
M = reshape(c,[],s(2));
[ii,index] = ismember(M(1:s(1),:),M(s(1)+1:end,:),'rows');
out = [find(ii),index(ii)]