How do I define symblic variable in a subfunction in matlab? Getting: “Attempt to add ”bar“ to a static workspace.”

I'm trying to define a symbolic variable in a sub function foo (see below)
function [ ] = test2( )
();
function [] = foo ()
syms bar;
end
end
I get the following error and am not sure how I can resolve this:
EDU>> test2 Error using assignin Attempt to add "bar" to a static workspace. See MATLAB Programming, Restrictions on Assigning to Variables for details.
Error in syms (line 66) assignin('caller',x,sym(x));
Error in test2/foo (line 6) syms bar;
Error in test2 (line 3) foo();
Would appreciate any help to sort out the above

Categories

Find more on Software Development in Help Center and File Exchange

Tags

Asked:

Mem
on 28 Mar 2013

Commented:

on 7 Apr 2024

Community Treasure Hunt

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

Start Hunting!