Why cannot run the coding ?

17 次查看(过去 30 天)
MAVIS LIM
MAVIS LIM 2018-4-21
评论: MAVIS LIM 2018-4-29
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{:});

回答(1 个)

Walter Roberson
Walter Roberson 2018-4-21

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.

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by