When to use “to workspace” block vs “outport” block

2 views (last 30 days)
I can use both blocks for getting output from simulink to matlab, but if there are two of them there should be difference in the way they are used but I can not figure it out.

Answers (1)

Birdman
Birdman on 14 Apr 2018
Actually, there is no certain answer for that and also, they are not intended to be used for just logging the simulation data. Let's mention their properties separately to actually see what is going on:
Firstly, outport blocks are a part of any kind of Subsystems and they help us to organize and identify the outputs within a subsystem or a referenced model. Also, an outport block has several properties where you can specify its own sampling time, port dimensions and units. Also, in its Data types part, you can specify its data configuration as fixed point or floating point with several types. You can specify a special name for that outport to ensure that in code generation, it can be easily detected.
On the other hand, To Workspace block helps you to specify the Save format of the logged data to be specified separately as an Array, Structure or Timeseries. In either case, it enables you to plot or use the data at the end of the simulation with its changing properties due to its save format. Also, you can specify sampling time for To Workspace block but you can not change the output data type of a To Workspace block within its mask, or you can not specify any unit for it. It also does not provide any useful contribution to be used within a subsystem, since logging simulation data can also be done from Configuration Parameters section of Simulink.
There are more things to be mentioned but I think this will be enough for now.

Categories

Find more on Simulink Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!