0

I have the problem, that I have to access a funktion form a dll in matlab/Simulink in the rtw. This should work with a s function, but I have the needed parameters in a array of structures organized.

The question is now how I can reach them when I want to call my DLL function?

Or is there a better way (e.g. level 2 Matlab files or something similar)? The pure simulation (without RTW) worked pretty well with level 2 m files but I am not able to write a tlc file for compiling them. I did not find much on the net and the documentation only about C sources.

Thanks Christian

3 Answers 3

1

For signals in Simulink, what you are asking for is an array of buses. There is similar support for using arrays of structs for parameters. For calling an external function, you might want to look at the legacy code tool. You might also be able to use the MATLAB function block to call your external dll.

Sign up to request clarification or add additional context in comments.

Comments

0

In addition to what @MikeT says:

Generating code from Level 2 M-S-Functions is problematic. Read this: http://www.mathworks.co.uk/help/toolbox/simulink/sfg/f7-67622.html#brgscav-1

Also, M-S-functions are generally slow, because they run in the MATLAB interpreter: http://blogs.mathworks.com/seth/2010/10/28/tips-for-simulation-performance/

Comments

0

In the end I coded the problem in C and used an array where I defined to order of the elements. Then I wrote some interface functions to access this "virtual" struct.

This is not very good coding but the easiest way I have found and it is portable.

Thanks

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.