Clear Filters
Clear Filters

How can I fix this error?

5 views (last 30 days)
Nguyen Tuan
Nguyen Tuan on 17 Jul 2015
Answered: Walter Roberson on 17 Jul 2015
I tried to create a new GUI file but I received a message:
??? Error using ==> copyfile
'attrib' is not recognized as an internal or external command,
operable program or batch file.
Error in ==> guidetemplate at 88
copyfile(srcfigfile, targetfigfile, 'writable');
Error in ==> guide at 61
filename = guidetemplate;
Can you help me with this?

Accepted Answer

Walter Roberson
Walter Roberson on 17 Jul 2015
It appears that you are trying to run MATLAB R14, R14SP1, or R14SP2. The problem was fixed in R14SP3. The problem is so old that the Support Solution 1-QDJCT has been removed, so I post a copy here, extracted from http://www.lawebdelprogramador.com/foros/imprimir.php?id=1139121
=== begin text ===
Subject: Why do I receive an error when opening a template in GUIDE or when using COPYFILE in MATLAB 7.0 (R14)?
Problem Description: When I open GUIDE and select a template, I receive the following error: ??? Error using ==> copyfile Error in ==> guidetemplate at 88 copyfile(srcfigfile, targetfigfile, 'writable');
Error in ==> guide at 61 filename = guidetemplate; Alternatively, some customers experience an error message such as the following: ??? Error using ==> copyfile 'attrib' is not recognized as an internal or external command, operable program or batch file.
Solution: There is a bug in MATLAB R14 in the way it opens templates in GUIDE. It issues operating system commands like copy, attrib and when such commands are not found on the OS it throws these errors.
This bug has been fixed in Release 14 Service Pack 3 (R14SP3) in a way that it no longer depends on OS commands to open templates.
For previous product releases, read below for possible workarounds:
These error messages appear when your operating system's file copying command does not work as expected with MATLAB. To verify this, try using the "copy" command from a DOS command prompt.
1. Select "Run" from the "Start" menu. 2. Type "cmd" or "command" in the dialog box and click "OK". 3. At the DOS command prompt, type:
copy /? If there is no output, then it is likely that the "copy" command is not on your system path.
If you are receiving an error regarding "attrib" not being recognizable, it indicates the "attrib" command is not on your system path. Similarly to the copy function, you can confirm this by typing the following in a DOS command window:
attrib /? These files should be present in the windowssystem32 directory and this directory should be present in the system's path. If you are not able to locate these files on your system, please contact your system administrator or Microsoft's technical support department, since these files are not provided by MATLAB itself, but rather by the operating system.

More Answers (1)

Image Analyst
Image Analyst on 17 Jul 2015
Why do you think 'writable' is an option that you can use? I don't see it in the documentation. Try it without it:
copyfile(srcfigfile, targetfigfile);

Categories

Find more on Startup and Shutdown 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!