How automatic insert (once defined) symbolic expression from script or workspace to function?

1 view (last 30 days)
Hi. I have symbolic expressions in a script file (that represent calculated partial derivatives. Because I need, at each iteration, that get the numeric value of the symbolic expression depending on the new set values of variables, I created a function, that compute this) Since that symbolic expression is different from case to case, is there a possibility that the expression automatic import in function without manual typing these expressions. I want to define this expression in one place in the script file, and than when you call functions, this expression be automatically loaded in function. Thank you in advance.

Accepted Answer

Walter Roberson
Walter Roberson on 15 Mar 2013
Perhaps you want to use matlabFunction() ?
  5 Comments
Walter Roberson
Walter Roberson on 15 Mar 2013
Be careful, matlatFunction idea of which order the variables should be in are not necessarily the same as yours. To avoid surprises I recommend using the 'vars' parameter if there are multiple variables.
Vladimir
Vladimir on 15 Mar 2013
I tried it and I got burned. You're right, it must be noted the order of the variables using the 'vars'. Greetings!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!