Why do I receive an error message when trying to open a FIG-file with a very long pathname in MATLAB?

4 views (last 30 days)
When I am trying to load a FIG-file to a directory with very long name (277 characters long), by using the command:
openfig('ZinAtPkg4CompletePkgWithVddOvddGnd_1.fig')
I receive the error message:
??? Error using ==> load
Unable to read file d:\\Program Files\\MATLAB704\\work\\om-From-Matlab7\\PCBandPKG\\Apples-Card\\ApplesCardWith33PortsAndA7PM-PkgWith22PortsNov9_2004\\ApplesCardWith33PortsAndA7pmPkgWith22Ports\\a7pmPkgComplete\\a7pmPkgComplete4VddOvddGndOnly\\FigureFiles\\ZinAtPkg4CompletePkgWithVddOvddGnd_1.fig:
No such file or directory.
Error in ==> hgload at 44
fileVars = load(filename,'-mat');
Error in ==> openfig at 84
[fig, oldvis] = hgload(filename, struct('Visible','off'));
Also when I am trying to save a FIG-file under a directory that has a very long name, I receive the error message:
Error using ==> print
Error using ==> graphics\private\name
Cannot create output file d:\\Program Files\\MATLAB704\\work\\om-From-Matlab7\\PCBandPKG\\Apples-Card\\ApplesCardWith33PortsAndA7PM-PkgWith22PortsNov9_2004\\ApplesCardWith33PortsAndA7pmPkgWith22Ports\\a7pmPkgComplete\\a7pmPkgComplete4VddOvddGndOnly\\FigureFiles\\ZinAtPkg4CompletePkgWithVddOvddGnd_1.fig

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
There is a limitation in Windows operating system when accessing a file with a full path name which is longer than 259 characters (including the file name itself).
To work around this issue, make sure that the full path name (including the file name) is less than 259 characters.

More Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!