Why cannot run the coding ?

18 views (last 30 days)
MAVIS LIM
MAVIS LIM on 21 Apr 2018
Commented: MAVIS LIM on 29 Apr 2018
Please help me with my problem, i cannot run the file that and command window write there is an error, can someone told me what is that error because i not understand
Error using load
Unable to read MAT-file . Not a binary MAT-file. Try LOAD
-ASCII to read as text.
Error in matlab.graphics.internal.figfile.FigFile/read (line 36)
hgDataVars = load(filename, '-mat', '-regexp', '^hg[M]');
Error in matlab.graphics.internal.figfile.FigFile (line 104)
Error in loadFigure (line 31)
Error in openfig>localOpenFigure (line 73)
h = loadFigure(filename, visibleAction);
Error in openfig (line 47)
figOut = localOpenFigure(filename, reuse, visibleAction);
Error in gui_mainfcn>local_openfig (line 286)
gui_hFigure = openfig(name, singleton, visible);
Error in gui_mainfcn (line 159)
gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);
Error in gui (line 42)
gui_mainfcn(gui_State, varargin{:});

Answers (1)

Walter Roberson
Walter Roberson on 21 Apr 2018

In order to run your code with the name "gui", there needs to be a "gui.fig" file. That file needs to be a MATLAB binary .mat file internally. In MATLAB, .fig files are .mat files with particular variables stored in them.

MATLAB is looking at your .fig file and finding that it is not a .mat file internally.

Perhaps at some point you did something like imwrite() of an image on top of the .fig file.

You should use your operating system to have a look to see what it thinks the file is. On Mac and Linux you could

   !file gui.m

to try to identify the file contents.

You will probably need to recreate the gui.fig file -- or restore it from backup.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!