From Workspace block using Data Dictionary

조회 수: 1 (최근 30일)
Thomas Kotwal
Thomas Kotwal 2018년 11월 6일
답변: Thomas Kotwal 2018년 11월 12일
How can I use a timeseries as a simulation input in a Simulink subsystem or model reference, when the model uses a Data Dictionary?
I tried using a 'From Workspace' block, which I think should be possible, since the documentation for the block has a section on Use with Data Dictionary. Here's what it says:
To access simulation input data, store the target variable in the base workspace and set the Data parameter by using a call to the evalin function. In the call to evalin, specify the ws argument as 'base' so that the block seeks the variable in the base workspace instead of the data dictionary. For example, if the name of the variable is myTimeseriesObject, set Data to evalin('base','myTimeseriesObject').
But, right after adding a 'From Workspace' block to my model a get a popup error message saying this:
This model cannot contain From Workspace block 'MyModelName/Input_Processing/From Workspace' because the model is linked to a data dictionary. For a test harness model, configure it to use the base workspace instead of a data dictionary. Otherwise, replace this block with a root Inport or other source block.
Thank you.

채택된 답변

Thomas Kotwal
Thomas Kotwal 2018년 11월 12일
I figured it out, or at least I figured out why it's not working with a From Workspace block. I'm using Simulink Release 2016b, and the ability to use a From Workspace block with a model that uses a data dictionary was added in Release 2017a.
See 2017a release notes for details:

추가 답변 (2개)

Arunkumar M
Arunkumar M 2018년 11월 9일
Even when model is linked to data dictionary, you can use evalin function to access variables which are defined in base workspace - refer attached image
-Other method is to create a referenced subsystem and pointing to the model which is linked to data dictionary and the reference subsystem can be linked to base workspace. Then the input from base workspace shall be propagated to the model linked to data dictionary

Thomas Kotwal
Thomas Kotwal 2018년 11월 9일
Arunkumar, Are the source blocks in your image 'From Workspace' blocks? When I try to use a 'From Workspace' block in my model, I always get the error message that I mentioned in my original post, even when trying to use the evalin function in the Data field of the block.
  댓글 수: 2
Arunkumar M
Arunkumar M 2018년 11월 10일
No They are constant blocks? Do you specifically want to use From Workspace blocks?
Thomas Kotwal
Thomas Kotwal 2018년 11월 12일
What I'd like to do is access a timeseries object from within Simulink, but it doesn't necessarily need to be using a From Workspace block.
For now, I've got it working by saving the timeseries to a file and then accessing it using a From File block. That's ok, but it's a little cumbersome, and the documentation for the From Workspace block indicates that it shold work with From Workspace.
I'd be fine with saving the timeseries to the Data Dictionary and accessing it from there, but I'm not sure how to do that.
By the way, I was able to replicate your example for accessing a constant. It's not what I need right now, but might be useful later. Thanks.

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

카테고리

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

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by