Simulink: Source (from workspace) running order

2 views (last 30 days)
I need to have a From Workspace block running AFTER other blocks are evaluated in simulink. I use From WS to get ARMAX results.
How can I implement a sort of sequence of evaluations? As From WS block has no input, I cannot rely on wires to get the correct runnning order.
I'm used to LabVIEW environment and there I can place a sequence structure.
Thanks, Gabriele

Accepted Answer

Gabriele Fantechi
Gabriele Fantechi on 5 Nov 2012
Triggered by what? ARMAX has no output, and if I use its input... it is useless.

More Answers (3)

Gabriele Fantechi
Gabriele Fantechi on 5 Nov 2012
Are you really saying that, to get data from WS being sure they were already written I have to use such an intricate mechanism?
I'm quite perplexed; there must be a simpler way to do this. I do not love MATLAB but I'm sure it can be smarter than this.

Kaustubha Govind
Kaustubha Govind on 5 Nov 2012
I'm confused about why you need a From Workspace block at all if you simply need the output of other Simulink blocks. If the signal you actually need is a MATLAB function of other Simulink signals, why not use an Interpreted MATLAB Function block, a MATLAB Function block or a MATLAB S-function block to directly call your MATLAB function within the flow of your Simulink model. Please refer to these blocks' corresponding rows on the Comparison of Custom Block Functionality page to choose the block that is correct for your application.

Gabriele Fantechi
Gabriele Fantechi on 5 Nov 2012
I need to access the output of ARMAX block (<http://www.mathworks.it/it/help/ident/ref/armaxestimator.html>) which is written to workspace. More in detail, I need to use the value of one of the coefficient of the idpoly (ARMAX output).
From the help of ARMAX block:
----------------------------------
Model Name Name of the model.
Whether you specify the model name determines the output format of the resulting models, as follows:
If you do not specify a model name, the estimated models display in the MATLAB Command Window in a transfer-function format. If you specify a model name, the resulting models are output to the MATLAB workspace as a cell array.
------------------------------------------
I specified the model name,e.g. M, then in Simulink I need to access the array named M.A (here M is an idpoly object).
It would be simpler (and logic) to have the coefficients as outputs of the ARMAX block but... they are not there. So, any idea how to get these data from the WS?
  1 Comment
Kaustubha Govind
Kaustubha Govind on 5 Nov 2012
Gabriele: I don't have experience with the ARMAX block, but should you really be using the output of this block continuously in a serial connection with other Simulink blocks? I'm guessing that the ARMAX block only writes to the workspace after the model finishes execution and not during execution. It seems to be that you should first finish running the ARMAX model and then use those results in a new simulation. You can do this using the SIM command to first simulate the ARMAX model, which writes to the workspace. You can perform MATLAB operations (like M.A) to extract the required information, and then, issue another SIM command to the second model which will use the From Workspace block to read the extracted information.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!