How do I get the output of a simulink run via the "Output" Data Import/Export section?

4 visualizzazioni (ultimi 30 giorni)
I am trying to set up my output in a simulink simulation in order to use the "Output" option in the Data Import/Export configuration Parameter.
My understanding is that if I put an "Output" sink in my model (see below):
And tick the configuration parameter options as shown below:
I should see yout in the workspace. Yet, the only array that I see is tout as shown below:
Simulink.SimulationOutput:
tout: [1000006x1 double]
SimulationMetadata: [1x1 Simulink.SimulationMetadata]
ErrorMessage: [0x0 char]
I understand that I can use the "To Workspace" block to get my output exported to workspace but isn't the method described above supposed to work as well? Thanks.
  9 Commenti
scc28x
scc28x il 24 Mag 2022
Modificato: scc28x il 24 Mag 2022
Good point. I re-ran a few sims and determined that it was caused by having selected "Log Dataset data to file: out.mat". There is no "yout" in the workspace after sim whenever this selectBox is ticked.
Fangjun Jiang
Fangjun Jiang il 24 Mag 2022
It might make sense because if saving to a file, why also saving to workspace. But it was not mentioned in the R2021a document below.
Another factor could be that the size of the data set is too big to fit in the momory. Do you have lots of outports? "1000006x1 double" indicates you have more than 1e6 data points for every signal.
Try a simple and small example. If it still behaves the same, then you can attach the model to the Mathworks Tech Support to report this as a pontnetial "bug". They might have an explaination or acceept it is indeed a "bug".

Accedi per commentare.

Risposta accettata

Harshit Rastogi
Harshit Rastogi il 26 Mag 2022
I understand that you are trying to get yout in the workspace. So, for that you have to uncheck the "Log Dataset data to file" . Otherwise the output will be saved only in the file and you wont get it on the worspace. What actually happens is that it adds all the checked parameter data to the 'out.mat' file. Which means, the 'logsout' output that you need is also stored in 'out.mat' and can be accessed by loading the .mat file in workspace.
An enhancement request has been submitted for a feature where the variables show up in the base workspace and in the '.MAT' file.
  1 Commento
Fangjun Jiang
Fangjun Jiang il 26 Mag 2022
I tried it in R18b and R19b. It happened when saving format is "Dataset". If format is "array", "yout" is always saved to workspace no matter "Log Dataset data to file".
Maybe now I undestand the meaning of "Log Dataset data to file", which seems to mean
  1. If a variable is checked under "save to workspace or file"
  2. and, if the saving format is "dataset" and that variable is supported by "dataset"
  3. and, if "Log Dataset data to file" is checked
Then, that variable is saved to the .mat file but no to the workspace.
This is quite a complex combination and logic. Anywhere in the document might indicate this?

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by