![]() ![]() ![]() Use nested functions to pass fewer arguments Using the repmat function, array preallocation and for loops are other ways to work on nondouble data without requiring temporary storage in memory. This command displays each array in the MAT-file that you specify and the number of bytes in the array. Use the whos function with the - file option to preview the file. Many users are tempted to try and load the entire file first, and then process it with MATLAB. ![]() Only import into MATLAB as much of a large data set as you need for the problem you are trying to solve. Subject specific information should be added to the subject specific script. When using a high sampling frequency during acquisition, you may be able to downsample your data to save disk space and speed up all subsequent processing steps.ĭo make sure you save the important parameters (e.g., rejected trials) so you can always rerun your script. It will save you a lot of disk space if you only have to write your axial data to disk. For instance with MEG data it might not take that much time to calculate your planar gradient. When writing intermediate results, consider if you really need to save all intermediate steps in your analysis pipeline. However, the advantage is that you can easily manage the data, delete results that you don’t need any more, check that the results are complete for all subjects, check that the timestamps of the files with certain results are consistent for all subjects (e.g., after you have updated some parameters and rerun part of the analysis), … That will result in a lot of files in your data directory and in first instance you may consider that to look messy. When using FieldTrip for large analyses, it is recommended to save one MATLAB variable to a single file. If possible, the backup should include the presentation code that was used in the experiment and a small ASCII. Remember to always backup your original data that was acquired on external hard disks, CDs or DVDs for long-term storage. Remember to keep a copy of the cfg field on disk if you want to keep track of your analysis pipeline. Simply emptying this field (e.g., by doing freq. You can look at the cfg using ft_analysispipeline. This field can get quite large after many such steps and specifically after appending several data structures, because each cfg is stored in a cell array within the cfg. The cfg field in your FieldTrip data structures stores the history of the processing steps performed on the data.For instance, reloading a large dataset into the same variable may result in MATLAB allocating twice the memory you actually need. Note that MATLAB’s memory use might not be intuitive. Within a script or function make sure you clear large variables that you don’t need anymore using the clear statement.Perhaps most importantly – once in a while let someone else go through your scripts to see if they can be optimized.This might seem trivial, but many people assign unique variables to subjects and forget to clear them. If you are working on a single subject, make sure other subjects are no longer in memory.precision = 'single' in certain functions) Change data to single-precision (after preprocessing by using ft_struct2single or by using cfg.Downsample your data (but backup your original data), e.g., using ft_resampledata.Take a look here for a concise summary of the recommended style of programming. However, how to program MATLAB in a memory-efficient way is also not always obvious. It is important to pay attention on how much memory is used because a non-efficient analysis can result in “out of memory” errors in MATLAB. Neurophysiological data can become quite large with the result that disk space, RAM and processing time can become compromised. It does not provide information about any FieldTrip functions or any analysis steps. This tutorial gives advice about how to do data analysis in a memory-efficient way when large amount of data is analyzed. Once you get the hang of it, you can return to this tutorial which is more on the technical and coding aspects. You can read the introduction tutorial and then move on with the tutorials on preprocessing. If you are new to FieldTrip, we recommend that you skip this tutorial for now. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |