
simulink to workspace indexing error
5 views (last 30 days)
Show older comments
Hi, last week I was running the same simulink model and was receiving an array that was very large. This week I am trying to export data but the output is only a 1x1 double timeseries. I didn't change anything other than the data I am extracting so I'm not sure what could have changed in my simulink model. I have attached the file and here is the code I am using to extract data
When I run the code I get the error "Index in position 2 exceeds array bounds (must not exceed 1)."
RBE500_Week5_Model_barsoumian_tina
%defining variables to plot
EE = out.EE_Position_Velocity;
Position = EE(:,2:4);
LVelocity = EE(:,5:7);
AVelocity = EE(:,8:10);
0 Comments
Answers (1)
Sai Sri Pathuri
on 5 Mar 2020
In your code, EE is a timeseries data with following properties
Common Properties:
Name: ''
Time: [51x1 double]
TimeInfo: [1x1 tsdata.timemetadata]
Data: [51x9 double]
DataInfo: [1x1 tsdata.datametadata]
The variable has two fields - Time and Data as shown below

To extract data, you may use the dot indexing
Position = EE.Data(:,1:3);
LVelocity = EE.Data(:,4:6);
AVelocity = EE.Data(:,7:9);
0 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!