From: Loris Barton on 11 Feb 2010 15:13 Do you know if there is a manner or a function that allow me to create a variable with the content of a cell (string), for example if I have the cell P='0.5x(1)+x(2)' ; I want to create the variable A=0.5x(1)+x(2)
From: us on 11 Feb 2010 15:37 "Loris Barton" <loris819(a)msn.com> wrote in message <hl1och$320$1(a)fred.mathworks.com>... > Do you know if there is a manner or a function that allow me to create a variable with the content of a cell (string), for example if I have the cell P='0.5x(1)+x(2)' ; I want to create the variable A=0.5x(1)+x(2) one of the solutions - if(f) i understand you correctly... c={'0.5*x(1)+x(2)'}; % <- note: correction of typo... fun=str2func(['@(x)',c{1}]); x=[1,10]; fun(x) % ans = 10.5 us
|
Pages: 1 Prev: Matlab 7.9.0 (R2009b) in OS X 10.6.2 Next: colorbar trick Label in log scale |