Why can't I move a file to destination './Raw_+1:00' in MATLAB R2013b on Windows?

조회 수: 10 (최근 30일)
I am using "movefile" to move a MAT-file from the MATLAB Curent Folder to a sub-folder named "Raw_+1:00". Here is my code:
>> movefile('test.mat', './Raw_+1:00')
Error using movefile
Cannot write to destination: C:\Documents\MATLAB\Raw_+1:00. Use the 'f' option to override.
I then try with the 'f' option as suggested by the error message and get:
>> movefile('test.mat', './Raw_+1:00', 'f')
Error using movefile
Unknown error occurred.
Am I doing something wrong?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2014년 3월 25일
Colon (:) is an illegal character and cannot be used in the name of a file or a directory on Windows. The error message was changed in MATLAB R2014a to better reflect the cause of the issue:
Error using movefile
The filename, directory name, or volume label syntax is incorrect.
The full set of invalid characters can vary by file system. For example, on Windows-based desktop platforms, invalid path characters might include ASCII/Unicode characters 1 through 31, as well as quote ("), less than (<), greater than (>), pipe (|), backspace (\b), null (\0) and tab (\t).
  댓글 수: 1
Steven Lord
Steven Lord 2020년 5월 29일
Here's what Microsoft has to say on the matter of file names, in part.
"Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following:
  • The following reserved characters:
  • < (less than)
  • > (greater than)
  • : (colon)
  • " (double quote)
  • / (forward slash)
  • \ (backslash)
  • | (vertical bar or pipe)
  • ? (question mark)
  • * (asterisk)
"
The file name in the original question contains the colon character which appears on the list of reserved characters.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품


릴리스

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by