One variable, two 'To Workspace' blocks simulink
Ältere Kommentare anzeigen
Hello, is there a way to update single struct variable using two or more 'To Workspace' blocks at different locations in simulink (2017b) ??
2 Kommentare
Fangjun Jiang
am 2 Jul. 2020
what do you mean "update"?
"struct" data type is not supported in Simulink.
Manu Agarwal
am 2 Jul. 2020
Antworten (1)
Fangjun Jiang
am 2 Jul. 2020
0 Stimmen
"Res" is the variable created in the based workspace after simulation is done to log your simulation data
- You can't have two "To Workspace" blocks in the model with the same variable name "Res".
- You can log more than one signals to the same variable "Res" with just one "To Workspace" block. To do that, use a Mux block or Bus Creator block to combine all those signals together and then feed it to the "To Workspace" block. Observe the "Res" data after simulation to figure how to access the data inside it.
4 Kommentare
Manu Agarwal
am 2 Jul. 2020
Fangjun Jiang
am 2 Jul. 2020
In model configuration parameters, Data Import/Export, check "single simulation output". It will combine all the "To Workspace" variable into one structure or object. I think this can help you.
Manu Agarwal
am 2 Jul. 2020
Fangjun Jiang
am 2 Jul. 2020
Don't quite understand the use case of your particular saving format.
- Do post processing, combine out.Res and out.Res1 into out.Res
- Use global Goto/From block to avoid signl routing but Mux all the needed signals together
- Not to use "To Workspace" block, use individual signal logging by setting signal line properties, then post processing, combine signals by name, i.e. out.FrontWheelSpeed and out.RearWheelSpeed to out.WheelSpeed
Kategorien
Mehr zu Prepare Model Inputs and Outputs finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!