Is there an effcient way to loop through individual, very large EEGlab data files consisting of 3-D data matrices (channels-by-samples-by-epochs)?
As a general Matlab rule, pre-allocating memory, as opposed to sequentially allocating memory as a matrix increases in size over time, may substantially reduce overall computing time. If very large data files are to be converted, this may be an important consideration. The example script EEGlab_Loop_Epochs.m contains three different instructions to obtain CSD data from a “Channels × Sample Points × Epochs” data file used by EEGlab. The first set of instructions loops through all epochs and submits each epoch as a “Channels × Sample Points” 2-D data matrix to the CSD.m routine, which is fine; however, without the initial memory pre-allocation for the CSD data output, this would be unnecessarily time consuming as the content of the final CSD data matrix is copied every time the matrix size is increased. The second set of instructions uses the Matlab reshape.m function to temporally reorganize the “Channels × Sample Points × Epochs” 3-D data matrix into a “Channels × (Sample Points * Epoc