MATLAB: How to extract certain data from a table

dataextractfilterfindMATLAB and Simulink Student Suitetabletall array

I'm working on a tall array, which contains multiple flightplan data (size over 100k rows, 5 columns) and I want to extract just certain flight routes (departureairport –> arrivalairport) and continue to work with them.
The table looks approximately like this:
flightno. depart.airp arr.airp depart.time arr.time
--------- ----------- -------- ----------- --------
111 BOS LAX ... ...
321 JFK DEN ...
121 BOS JFK
222 DEN BOS
333 BOS DEN
For the further data analysis I only want to work with flight data departuring from BOS.
Could someone help me on this issue? Thanks

Best Answer

I'd guess the ID column isn't a float but an integer number; need to ensure you've imported it with sufficient precision to be correct.
Then convert flight airport IDs to categorical arrays...
T(:,1:3)=categorical(T(:,1:3)); % where T is your table variable
That will make selection simple to write--
B=T(T.departure=='BOS',:);
You can write similar things with cell strings, but in general the syntax is more messy and the categorical variable type has some useful builtin utility functions for summaries and the like that can be helpful.