Loop to perform calculation from table data and store each result
Show older comments
I would like MATLAB to read a table from excel that contains travel arrival and depature data. From this data, I want to calculate the time between each arrival and the departure that follows. I wish to store each result in a new table. I have a very basic outline of what I am trying to achieve already.
I have another minor problem with the "remove first row if movement type is 'D'", with an error message stating:
Operator '==' is not supported for operands of type 'cell'.
Any help with these queries would be appreciated.
% import excel spreadsheet
T_Data = readtable('GGF1.xlsx');
% remove first row if movement type is 'D', else keep
if T_Data{1,1} == 'D'
T_Data{1,:} = [];
end
% -----------------------------------------------------------------------
% --- This will have to be updated to loop entire dataset and store each
% --- route time on ground.
% --- Loop should do row2 - row1; row4 - row3; row6 - row5 etc. and save
% --- each result in a new table
% take first route from the table for analysis
Route1 = T_Data(1:2,:);
% Determine time on ground for first route
OnGround = Route1{2,2} - Route1{1,2};
% -----------------------------------------------------------------------
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!