Suppose I have a dataset called data that was created from dataset(xls2struct('file.xls'):
subj_CDI: {1166x1 cell}
age_at_test_CDI: [1166x1 double]
developmental_age_CDI: [1166x1 double]
The expression:
data(data.developmental_age_group_CDI==3, 'subj_CDI')
Will return cells from data.subj_CDI. No problem.
However, if I try to search by a cell matching “HA18”, by this expression:
data(data.subj_CDI=={'HA18'}, 'developmental_age_group_CDI')
I get this error:
??? Undefined function or method 'eq' for input arguments of type 'cell'.
I understand that this is a data mismatch, but I can’t figure out how to get around it…I’ve tried to convert data.subj_CDI to a struct, but wasn’t successful accessing it…
Thanks
You should use
strcmpinstead. It will give you the index of the element (or elements!) that you are looking for.Then to get the value/values, use