Simulink To workspace outputs empty arrays
5 views (last 30 days)
Show older comments
I am doing simulations on an umbilical cable, modelled as a lumped-mass-spring model.
For this I am trying to do a simulation of 1000 seconds, 2000 m cable and 201 nodes, for testing/assumption proving purposes.
The changed settings for the to workspace block, node_positoins, are: Save format = Structure with time. The rest is default.
The output I would then get should be a (n,m,t), where n are the rows, m is the coloumns and t is the timesteps, where for this case it would be (201,3,10000001), since i would have 201 nodes positions for (N,E,D) (North, East and Down reference frame) and then for 1000 seconds with a timestep of 0.0001 s gives 10000001 timesteps.
The simulation runs fine, no problems and in the SimulationOutput in MATLAB it also shows the time variable and all other model information and no error messages. But the node_positions and all other structs with the same format are empty arrays.
Should I use other formats for saving or what is the issue here?
0 Comments
Answers (1)
Ganapathi Subramanian
on 31 Mar 2023
Hi Mika Fabricius,
It is my understanding that you are working on umbilical cable which is modelled as a lumped mass spring model and have trouble in accessing the logged data to workspace in ‘Structure with time’ format.
In ‘Structure with time’ format, Simulink saves the model states and outputs in structures not arrays. It saves output in two top-level fields(time and signals). The ‘signals’ field contains an array of substructures, each of which corresponds to a model output port.
If the output at the corresponding output port is N*M matrix, then the ‘values’ field under ‘signals’ is a 3D array of dimension N*M*t as you have stated above. Try to access the data in the ‘values’ field inside ‘signals’ field of output variable.
Refer the below documentation to get more information regarding ‘Structure with time’.
Refer the same link above to get more information regarding various data format to log data and its conditions.
See Also
Categories
Find more on General Applications 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!