Share variables between two level 2 s-function blocks

2 views (last 30 days)
Hello,
I am implementing a data process program im simulink. I have a interpolator(a c++ mex function) that creats a trajectory with inputing some 'via points'. I want to seperate this block into two parts. One is for computation, one is output the trajectory with a trigger and time scaler.
Now the issue is, block two need to get the result from block one. I don't want to make the trajectory as a input to block two. Is there some way that makes the output from block 1 accessible from block 2 ?
I have tried DWork vector, it works only in one block(for example, sharing variables between mdlstart and mdloutput). Alternative way I found is creat a dll library. But it's time consuming, is there a better way?
For simple, I just want to get the variable in test and have the same output in test2, like this figure.
Screenshot from 2019-08-13 11-34-31.png
(Both this two are integrated c++ s_functions)

Answers (1)

Dinesh Yadav
Dinesh Yadav on 30 Oct 2019
There are 2 methods only to solve your problem and both you already know either give a physical connection between the two blocks or create a .dll file.There is no other way. I would recommend using direct connection.

Community Treasure Hunt

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

Start Hunting!