Hello,
I have a cell array that looks like :
{A, E, B, A, D, C; B, A, A, D, C, E}
for 9×28 cell
I want to replace A's with 5 for columns 1, 2, 4, 6, 8, 11, 14, 17, 19, 22, 23 ,24 ,26 27 and replace E's with 5 for columns 3, 5, 7, 9, 10, 12, 13, 15, 16, 18, 20, 21, 25, 28
so that for some columns, A-E ranges from 5-1 and for others A-E ranges from 1-5.
i have tried:
mydata = cell2mat(mydata);
mydata(mydata == 'A') = '1';
mydata(mydata == 'B') = '2';
mydata(mydata == 'C') = '3';
mydata(mydata == 'D') = '4';
mydata(mydata == 'E') = '5';
but this of course is not column specific. is there anyway i can isolate columns?
also, when i try to convert it back to a double with:
mydata= str2double(mydata) I get all NaN values
this does not work either:
y = sprintf('%s', mydata{:}):
x = sscanf(y,'%f');
i get the error: Expression or statement is incomplete or incorrect.
what can i do?
Thank you so much for your time and help!
Best Answer