Generating C Code from Matlab Code containing ODE15s Solver
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi Everyone,
I'm trying to generate a c code from my matlab code using matlab coder. My matlab function contains a set of variable as an output from a ode15s solver. I have tried everything to define the output vector and matrice before calling the ode function but I receive the error "undefined variable or function" both for the time vectore "T" and the matrice of variables:
T=double(zeros((tdis*tend-tstart),1));
Y=double(zeros((tdis*tend-tstart),(z_n+1)*(n_seg*tet_n+1)+(n_seg*tet_n+1)+4));
[T,Y]=ode15s(@(ttt,y) ff8(ttt,y,Inputs),Tspan,IC,options);
Can anybode help me solving this issue?
Thanks
0 comentarios
Respuestas (1)
Harald
el 29 de Jun. de 2023
Hi Hossein,
it could be that you have not properly defined the input arguments of the function. My recommendation is to use the MATLAB Coder App (accessible through the Apps tab or by running coder from the Command Window). This will guide you through the workflow, particularly the proper definition of input arguments of the function.
If you continue to experience problems, please make the full function available that you are trying to generate code from, and the steps you are using to generate the code.
Best wishes,
Harald
6 comentarios
Harald
el 29 de Jun. de 2023
I also tried in R2022b with compiler Microsoft Visual C++ 2017, and it worked for me.
There is only one more aspect that I can think of: check if you are using a supported compiler for R2022b. If the compiler you currently use is not listed, I recommend switching to a supported compiler.
You can use mex -setup to identify the compiler currently used.
If this does not help, please contact the Technical Support team. Referring to this page will help the colleagues understand what you have already tried.
Best wishes,
Harald
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!