Using a Database in RTWS and Simulink with the same code
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Sebastian
2011-1-25
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!