MATLAB Answers

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

4 views (last 30 days)
Rostislav Teryaev
Rostislav Teryaev on 13 Apr 2018
Answered: Birdman on 14 Apr 2018
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.

  0 Comments

Sign in to comment.

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.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!