Importing Continuous data into Simulink from Matlab Workspace

조회 수: 2 (최근 30일)
Does anyone have direction or help on how I can continuously import values from the Matlab workspace into Simulink? They can be in array format or structure. The values are variables and as they are updated, the values in Simulink must update as well??
Thanks
  댓글 수: 2
Fangjun Jiang
Fangjun Jiang 2011년 3월 8일
Can you be specific how the values of the variables are updated?
Daniel Restrepo
Daniel Restrepo 2011년 3월 8일
I have tried using a Matlab fcn block, but my values are being updated via a dll file and some of the syntax in my script is not supported by the fcn block. the values are signals coming from a HID (Human Interface Device)

댓글을 달려면 로그인하십시오.

채택된 답변

Guy Rouleau
Guy Rouleau 2011년 3월 9일
Based on the description, it looks like you should write a C/C++ s-function that would interface with your HID dll properly, whithout going through the MATLAB workspace.
If you really need to "communicate" with the MATLAB workspace, I would use a Level-2 MATLAB S-function, you will be able to use any MATLAB command. But this will definitely be less robust than creating a proper interface to your dll in C/C++.

추가 답변 (1개)

Paulo Silva
Paulo Silva 2011년 3월 8일
Try with the Matlab fcn block, if the variable is just a number you just need to put the name of the variable, if it's something else be careful and insert the proper code in order for the output of the fcn block be just what you want.
  댓글 수: 2
Daniel Restrepo
Daniel Restrepo 2011년 3월 8일
I have tried using a Matlab fcn block, but my values are being updated via a dll file and some of the syntax in my script is not supported by the fcn block. the values are signals coming from a HID (Human Interface Device)
Kaustubha Govind
Kaustubha Govind 2011년 3월 8일
If you are using an Embedded MATLAB block, you can use the eml.extrinsic directive to call unsupported functions. If you are indeed using a MATLAB Fcn block, can you post the error message that you see on calling into the DLL?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by