Filter löschen
Filter löschen

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

10 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 25 Mär. 2014
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 Kommentar
Steven Lord
Steven Lord am 29 Mai 2020
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Produkte


Version

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by