MATLAB: Do I receive an error when I open a FIG-file in MATLAB from Windows Explorer

.mfigfileloadm-filematMATLABopen

Why do I receive an error when I open a FIG-file in MATLAB from Windows Explorer?
I receive this error in the MATLAB command window when I try to open a FIG-file from Windows Explorer by double clicking on the file in Explorer:
>> load('C:\MATLAB6p5\work\testopenfig.fig')
??? Error using ==> load
Number of columns on line 2 of ASCII file C:\MATLAB6p5\work\testopenfig.fig
must be the same as previous lines.
See FILEFORMATS for a list of known file types and the functions used to read them.

Best Answer

You may receive an error when opening a FIG-file from Windows if the file association is improperly linked.
This can be solved by reinstalling MATLAB, or by changing the setting manually. The following example demonstrates how to change the setting manually in Windows 2000.
1. Open "My Computer" and choose "Tools\Folder Options" from the pulldown menus.
2. Choose the "File Types" tab from the window that comes up.
3. Choose "FIG MATLAB figure file" from the "Registered file types" menu.
4. Click the Advanced button at the bottom right.
5. Click "New..." and type "openfig" in the "Action" field.
6. Type
$MATLAB\bin\win32\matlab.exe -r open('"%1"')
where $MATLAB is the path to your MATLAB installation, in the "Application used to perform action" field.
7. Leave "Use DDE" unchecked and click "OK".
8. Select the new action you created ("openfig") and click "Set Default".
9. Click "OK" on both of the windows you opened.
Now the FIG-file should open properly in MATLAB when you double-click on it. Opening a MATLAB file from the Windows Explorer will always bring up a new instance of MATLAB. The way to work around this is to open files from the Current Directory Browser in MATLAB. Toggle that by choosing "View\Current Directory" from the pulldown menu within MATLAB.