Search code examples
matlabsavemat

Unable to open file to write using specified name, but not another


I get an error with this code

>> save([params.datapath '/' configfilename{1}],'params')
Error using save
Unable to open file "C:\Users\Rik\Desktop\mps
project\ColdComplaintData/Data/filename-config_30-Jan-2016_20:25:46.mat" for output.

but not this code

>> save([params.datapath '/' 'ddd.mat'],'params')

What is the issue? Thanks.


Solution

  • Windows doesn't allow filenames with colons (:) in them

    The following reserved characters:
    < (less than)
    > (greater than)
    : (colon)
    " (double quote)
    / (forward slash)
    \ (backslash)
    | (vertical bar or pipe)
    ? (question mark)
    * (asterisk)