Clear Filters
Clear Filters

code works in input but not when in a script

1 view (last 30 days)
i have a section of coding that works fine when i type it in directly but reports errors and never finishes running when in a script. the section in the script is
c=Z(1,c2);
syms x
sl1 = solve (cosh(x/(2*c)-(3*c)^2+5)==x);
SOL(1,c2)= sl1 ;
c2=c2+1;
it reports a problem with the line 'd = solve...' and errors within the solve command. i cant figure out whats wrong with it as when i type it in the main matlab command line it works fine. the exact errors are
In mupadengine/feval (line 150)
[S,err] = evalin(engine,stmt);
In solve (line 170)
sol = eng.feval('symobj::solvefull',eqns,vars);
In Untitled (line 9)
d = solve (tanh(x/(2*b))==x);
completely stumped so any help would be brilliant,thanks

Answers (1)

Walter Roberson
Walter Roberson on 13 Dec 2013
Do not have a space between "solve" and the "(".

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!