Extracting Data from an Array of Arrays using a Loop?
Hello All,
Context: I am using Simulink and Simscape to simulate some system responses to motion. Simulation output writes to the Matlab workspace to an Array of Arrays (object maybe? Not super sure if that’s the right nomenclature) called "out". Our model is set up such that it iterates over a range of values for a single parameter. One test might have 5 iterations, the next might have 50, and so on. This means "out" changes size each time we run our model.
Problem: Now on to the issue. I am trying to extract data from each iteration and put them all into a Matrix. I can access all the data I want manually, using the notation "out(1,1).RollAngle.Data" for the first iteration, "out(1,2).RollAngle.Data" for the second iteration, and so on. However, this is too cumbersome since most of our tests are going to have 20-plus iterations.
Can anybody help me create a for loop that would append each data series as a new column in a matrix? This might be super obvious, but it’s a new problem for me…
Thanks!Hello All,
Context: I am using Simulink and Simscape to simulate some system responses to motion. Simulation output writes to the Matlab workspace to an Array of Arrays (object maybe? Not super sure if that’s the right nomenclature) called "out". Our model is set up such that it iterates over a range of values for a single parameter. One test might have 5 iterations, the next might have 50, and so on. This means "out" changes size each time we run our model.
Problem: Now on to the issue. I am trying to extract data from each iteration and put them all into a Matrix. I can access all the data I want manually, using the notation "out(1,1).RollAngle.Data" for the first iteration, "out(1,2).RollAngle.Data" for the second iteration, and so on. However, this is too cumbersome since most of our tests are going to have 20-plus iterations.
Can anybody help me create a for loop that would append each data series as a new column in a matrix? This might be super obvious, but it’s a new problem for me…
Thanks! Hello All,
Context: I am using Simulink and Simscape to simulate some system responses to motion. Simulation output writes to the Matlab workspace to an Array of Arrays (object maybe? Not super sure if that’s the right nomenclature) called "out". Our model is set up such that it iterates over a range of values for a single parameter. One test might have 5 iterations, the next might have 50, and so on. This means "out" changes size each time we run our model.
Problem: Now on to the issue. I am trying to extract data from each iteration and put them all into a Matrix. I can access all the data I want manually, using the notation "out(1,1).RollAngle.Data" for the first iteration, "out(1,2).RollAngle.Data" for the second iteration, and so on. However, this is too cumbersome since most of our tests are going to have 20-plus iterations.
Can anybody help me create a for loop that would append each data series as a new column in a matrix? This might be super obvious, but it’s a new problem for me…
Thanks! arrays, simulation output, append data to matrix, matlab MATLAB Answers — New Questions