When to use “to workspace” block vs “outport” block
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Birdman
2018-4-14
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!