It looks like you have the code already, but are looking for suggestions how to avoid memory errors. I have two:
1. Convert to SINGLE or other memory saving data type.
2. Use decimation of data, e.g. take only every 2nd, 10th, etc. data point.
I often observe that users create more data than they really need just "because it is possible". I can't assess your project, but this is a general observation.
If you have control over the Simulink model, you can apply those steps even within Simulink for double benefits.
There was a suggestion about splitting up the file - in this case doing it for all 24 channels can be good.
Just to make sure: You have 64 Bit MATLAB on a 64 system?