Last active
September 22, 2022 15:54
-
-
Save jgillis/58176f12c21680bc7e4fad4af9f33b2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [casadi_expr] = mupad2casadi(mupad_expr,mupad_var,casadi_var) | |
s = size(mupad_expr); | |
assert(numel(s)<=2, 'Tensors not supported. Make a vector or matrix from the mupad expression first.'); | |
mupad_expr = mupad_expr(:); | |
matlabFunction(symfun(mupad_expr,mupad_var),'File','temp_fun.m'); | |
clear temp_fun | |
args = vertsplit(casadi_var); | |
casadi_expr = temp_fun(args{:}); | |
%casadi_expr = reshape(casadi_expr,s); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment