Clear Filters
Clear Filters

Error using save Cannot create '_' because '_____' does not exist.

13 views (last 30 days)
I have some data in a cell array,
and names in another cell array,
I want to extract a subset of the data,
then a temporary file name,
an save the subset to a text file with
save (tempname2, 'data2_subset', '-ASCII');
But I get this error message: _
Error using save
Cannot create '6' because 'xxx/01-ab-07s-0fD3' does not exist.
To try to understand what is happening, I created a mock dataset with simpler names:
save (tempname, 'data_subset', '-ASCII');
in which case the save command works properly.
Unfortunately I still do not understand what the problem is in the first case. Any suggestions as to what is happening, and possible solutions?

Accepted Answer

the cyclist
the cyclist on 24 Mar 2015
MATLAB is interpreting the "/" characters as separators in a directory structure. It is looking for a directory and subdirectory
the cyclist
the cyclist on 24 Mar 2015
I'm not sure what you want to do. You can't make MATLAB write that filename, because the operating system won't allow a filename with slashes in it. Right?
Matteo Niccoli
Matteo Niccoli on 24 Mar 2015
You are right, there is no other solution than replacing those slashes.

Sign in to comment.

More Answers (0)


Find more on Characters and Strings in Help Center and File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!