Hello all,
I have a dataset array for example called measurement which contains a subfield called tempSequence containing single digits stored as strings (eg. '1', '2', etc.) I want to perform a check for the contents of this field and am using a combination of isempty and strfind and can't seem to get a TRUE return.
Specifically, I want to check that the field contains both a '1' and a '5' like so:
if( ~isempty(strfind(measurement.TempSequence, '1')) && isempty(strfind(messung.TempSequence, '5')) ) % Both 1 and 5 are present, perform operation on different subfield.
end
If tempSequence is as follows:
K>> measurement.TempSequenceans = '3' '4' '5' '2'
And strfind returns:
K>> strfind(measurement.TempSequence, '1')ans = [] [] [] []
Why why why:
K>> isempty(strfind(measurement.TempSequence, '1'))ans = 0
Is it something to do with it being a dataset and therefore has attached metadata? Am I using strfind in a dumb way? What am I missing?
Why:
K>> isempty(strfind(measurement.TempSequence, 'foobar'))ans = 0
Thank you for reading! Marshall
Best Answer