I have a very simple question. Based on a matrix like this one:
A = [repmat({'Yes'},3,1) , repmat({'2'},3,1); repmat({'No'},3,1) , repmat({'2'},3,1)];
I want to flip the sign of column 2 if the entry in colum one is 'No', but leave it as is if the entry in colun one is 'Yes'.
The result should be the following:
B = [repmat({'Yes'},3,1) , repmat({'2'},3,1); repmat({'No'},3,1) , repmat({'-2'},3,1)];
I suppose I can do this using one line of code using cellfun, but I am not sure what is the most optimized way.
Thx for your help!
Best Answer