modify simulink model for running in Real-Time Workshop mode

Hi, all. I have a simulink model that contains MatlabFcn functions. Hence, it doesn't work in Real-Time Workshop mode. Googling I have found a solution: I need to rewrite my function in Matlab Embedded Fcn or in S-Function (C or C++). The problem is my function uses spval, fsolve, reads some structores from .mat file; and Embedded Fcn doesn't support such functionality. I'm looking for easiest way to adapt my code.

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 11 月 6 日

0 投票

Use Matlab function, it does'nt work on real-time workshop but support all available functions

2 件のコメント

cupuyc a
cupuyc a 2012 年 11 月 6 日
I have to run my model in Real-Time mode.
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 11 月 6 日
with real time windows target, you can use a real time simulation, in normal mode, I think this mode supporte matlab function, That also, depends on your matlab version, which seems to be less then 2011
Kaustubha Govind
Kaustubha Govind 2012 年 11 月 6 日

0 投票

If you need to generate code from your model, you cannot use MATLAB code that is unsupported for code-generation. Unfortunately, the only way to get around this is to have your own implementation in C/C++ that you can use to create an S-function.

5 件のコメント

cupuyc a
cupuyc a 2012 年 11 月 6 日
There exists the seconds way. It is using Embedded Matlab Functions. I dubt what will be better.
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 11 月 6 日
編集済み: Azzi Abdelmalek 2012 年 11 月 6 日
cupuyc do you need to just simulate on real time mode or to generate a code? because, you can simulate on real time without generating any code
cupuyc a
cupuyc a 2012 年 11 月 6 日
I need to simulate on real-time.
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 11 月 6 日
Real Time Windows target toolbox allows simulation on real-time with normal mode which does'nt requiert code generation (External mode requiert code generation).
cupuyc a
cupuyc a 2012 年 11 月 7 日
May be I was wrong, so with connecting setup my code is not compiled. There is thrown fail: in Real-Time bla bla bla.. So I need to remove all the MATLAB functions.
As I saw, I need to rewrite spval and fsolve on C. What is the simplest way? I tried to do it using 'emlc' MATLAB command, but I saw that it will be necessary to rewrite also many others functions. Such as 'diff', 'sort' and some on...

この質問は閉じられています。

製品

質問済み:

2012 年 11 月 6 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by