Simulink, Methods to extract data from blocks to Workspace (other than To Workspace)

1 visualizzazione (ultimi 30 giorni)
I would like to create a simulation libary which has in principle two types of blocks, a "calculation block" and a "stream information block". The idea being that you load up the calculation blocks and then add intermediary "stream blocks" which you use to read back the data and present it to the used (I don't need all the streams only a couple). The conncector streams running between the calculation blocks is a user generated bus (i.e. there are diffent value sets running on the bus). I am not interested in the running time data, only the after simulation has stopped data (i.e. a single point after the model converges),
My challange is that I cannot see how to extract the data from each of the simulink streams (or alternatively from a library block). I would have liked to use something like get_param(gcb, 'CurrentValue') of an output port to strip the current values straight out of the port but it seems that the only way is to the the "To Workspace" block. However, I can't put the a "To Workspace" becasue the it is creates a single workspace variable (simout) and I cannot modify the variable name as it sits within a libary block. I also can't set the stream to "log data" (it seems) and therefore I can't extract the data stream.
Broadly this question is to see if there is a way to access simulink stream or block data from the command line? (or a work around to be able to rename a workspace varible sitting inside a library block)
  1 Commento
Jaco Labuschagne
Jaco Labuschagne il 18 Set 2019
For reference after I did some more digging, when masking a block under the "Initialization" tab there is a checkbox called "Allow library block to modify its contents". When this is checked it is possible to modify the name of a variable (in this case the Workspace variable name) from callbacks associated with the block. I'm assuming this would be the same for other internal block parameters.
This is a workaround as I would still prefer to access stream data directrly from the commandline into the data of a stream (allowing for a cleaner more flexible solution to manipulating and reporting on data).

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Multicore Processor Targets in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by