Below presented a table where the third column is a cell array of doubles and the last column is a cell array of chars. I would like to delete row number 248 based on the condition that 'Subject moved a bit at the beginning of 2nd minute' contains the digit 2, which equals to the value of the third column of this row. I have implemented it by the following:
commentMinNum = regexp(cellfun(@string, T2.comments(:)),'\d','Match');
commentMinNumInd = find(~cellfun(@isempty, commentMinNum));
extractMinNum = cell2mat(cellfun(@double, commentMinNum, 'UniformOutput', false));
deleteCond = T2.minNum(commentMinNumInd) == extractMinNum;
T2(commentMinNumInd(deleteCond), :) = [];
This implementation seems complex and wordy for such a simple task. I would like to know if there is a more straightforward approach. Do I miss anything or Matlab wants me to suffer? :)