Read in data from an external file during RTW
1 次查看(过去 30 天)
显示 更早的评论
I'm using RTW to generate a c-code (dll), which is used in ADAMS to simulate the model. I'm using a c code in my Simulink model to read in body parameters from an external file. I would like to read the variabls from an excel file using a .m code. However, I do not want to create a new dll everytime the variables are changed. I want the dll to read the variables everytime I run the simulation, rather than the variable values getting compiled during the code generation. I would appreciate if I could get some help with this.
Thanks.
3 个评论
Walter Roberson
2012-10-23
I would have thought RTW would imply that you were using an operating system other than MS Windows (the only family of operating systems that support COM servers) ?
采纳的回答
Walter Roberson
2012-10-23
You would find this easier if you used a text file instead of an excel file. Microsoft Excel format (especially the binary format) is not a simple one (if memory serves me correctly); you would need to include fair portions of code such as has been written for OpenOffice.
0 个评论
更多回答(1 个)
Sandeep
2012-10-24
2 个评论
Walter Roberson
2012-10-24
I have never worked with RTW, but what I have seen of it looked as if it supported standard C buffered I/O routines such as fopen() and fscanf(). If not directly in the modelling language, then due to the fact that it is C and those are standard features of C for all but embedded device purposes.
另请参阅
类别
在 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!