Share variables between two level 2 s-function blocks

조회 수: 2 (최근 30일)
Yikai Xu
Yikai Xu 2019년 8월 13일
답변: Dinesh Yadav 2019년 10월 30일
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)

답변 (1개)

Dinesh Yadav
Dinesh Yadav 2019년 10월 30일
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.

카테고리

Help CenterFile Exchange에서 Block and Blockset Authoring에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by