Using a Database in RTWS and Simulink with the same code
1 view (last 30 days)
Show older comments
Hi,
i'm developing a model which will be used to simulate and verify some FSM and write the results into a database.
Currently im using SQLite via extrinsics aka mksqlite, which works perfectly in the simulation. Of course it won't work after building embedded target code because there are no equivalent c functions for mksqlite.
My plan is to rewrite all database operations to use S-functions but this causes problems. I know that RTWS can specify an initialisation function for the embedded target where i could open the database etc. but this wont work in the simulation.
how can i open my database in an initialisation function written in C which is executed in the simulation and the embedded target? is this possible?
regards,
Jan
0 Comments
Answers (1)
Sebastian
on 25 Jan 2011
I cannot comment on the task or feasibility to rewrite all database operations as S-functions. However, within a C-code S-function you can use the preprocessor symbol MATLAB_MEX_FILE to do host (simulation) and target specific things:
#ifdef MATLAB_MEX_FILE /* host/simulation */
/* simulation code, typically nothing */
#else /* target */
/* code to access I/O board */
#endif
So I would use this in the initialization part of your S-function.
0 Comments
See Also
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!