Search code examples
arraysmatlabfile-iosavecell

Saving cells from MATLAB


I have a cell array which contains 7 matrices of varying column and length size. I have tried using the function 'dlmcell' which is downloadable from the MATLAB website but is says "Text exceeds maximum line length of 25000 characters for Command Window Display".

I have looked at a few other examples of saving the arrays but none of them seem to be able to deal with the structure of the cell or the size of the file.

The main aim for me is to save the cell so that I may later import it. Is there no specific format that MATLAB uses (like .mat for example) to store the cell arrays?

Thanks in advance!


Solution

  • Just using save like normal works for me:

    >> cellarray = {1:1000; 'my cell array'}
    
    cellarray = 
    
        [1x1000 double]
        'my cell array'
    
    >> save('cellarray','cellarray')
       %# filename---^   ^--- variable name
    >> clear all
    >> load('cellarray')
    >> cellarray
    
    cellarray = 
    
        [1x1000 double]
        'my cell array'
    

    cellarray.mat is saved as a matfile in the current directory. You can load it just as easily, with load. Am I missing something? Is it more complicated than this?