Hi everyone, very simple question here:
I have this:
Acell = 3×3 cell array '0+1/R1' '0-1/R1' '1' '0-1/R1' '0+1/R1+1/R2' '0' '1' '0' '0'
Apart from that, I have this:
R1 = '1000'; R2 = '1000';
My goal is to convert the original string to a double array so I could perform calculations afterwards, like this:
A = [ 1/1000 -1/1000 1; -1/1000 1/1000+1/1000 0; 1 0 0;];
What I tried so far was:
Acell = strrep(Acell,'R1','1000');Acell = strrep(Acell,'R2','1000');A = str2double(Acell);
Obtaining:
A = NaN NaN 1 NaN NaN 0 1 0 0
Any thoughts? This is just a little example, my idea is doing that job for much more elements so I'm not sure about using 'strrep' too.
Many thanks in advance
Best Answer