Choose order of input variables for matlabFunction
Show older comments
Is there a way to choose the ordering of the input variables when using matlabFunction on a symbolic expression?
I would like to use exactly those names for my symbolic variables as it makes it easier for me to follow along with the theory (backward Euler on Hamiltonian system - I have simplified my function to isolate the issue).
syms p11 p12 q11 q12 p01 p02 q01 q02
F = [p11; p12; q11; q12] - [p01; p02; q01; q02];
F = matlabFunction(F);
What I would like:
F =@(p11, p12, q11, q12, p01, p02, q01, q02) ...
What I get:
F =@(p01, p02, p11, p12, q01, q02, q11, q12) ...
Is there a better solution than the following?
FF =@(p11, p12, q11, q12, p01, p02, q01, q02) F(p01, p02, p11, p12, q01, q02, q11, q12);
Accepted Answer
More Answers (0)
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!