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

조회 수: 18 (최근 30일)
Matteo Niccoli
Matteo Niccoli 2015년 3월 24일
댓글: Matteo Niccoli 2015년 3월 24일
I have some data in a cell array,
data2={[50,1;49,1;26,1];...
[36,2;12,2;37,2;24,2;47.3,2];}
and names in another cell array,
names2={'xxx/01-ab-07c-0fD3/0';'xxx/01-ab-07s-0fD3/6';}
I want to extract a subset of the data,
data2_subset=data2{1,:}(:,1);
then a temporary file name,
tempname2=char(names2(2));
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:
names={'12-05';'14-03'};
data={[50,1;29,1;25,1];[35,2;22,2;16,2;38,2];[40,3;32,3;10,3;44,3;43,3];};
data_subset=data{1,:}(:,1);
tempname=char(names(2));
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?

채택된 답변

the cyclist
the cyclist 2015년 3월 24일
MATLAB is interpreting the "/" characters as separators in a directory structure. It is looking for a directory and subdirectory
xxx/01-ab-07s-0fD3
  댓글 수: 4
the cyclist
the cyclist 2015년 3월 24일
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 2015년 3월 24일
You are right, there is no other solution than replacing those slashes.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by