Memory corruption running gui_mainfcn.m

This looks like a memory corruption problem, but I could use some help identifying what's going on and how to debug this.
Quick Summary
The C:\Program Files\MATLAB\R2018a\toolbox\matlab\guide\gui_mainfcn.m has this struct initialization on line 31 (at least in my copy):
gui_StateFields = {'gui_Name'
'gui_Singleton'
'gui_OpeningFcn'
'gui_OutputFcn'
'gui_LayoutFcn'
'gui_Callback'};
After that line executes, I set a breakpoint and evaluate gui_StateFields in the Command Window. The result I get is this:
K>> gui_StateFields
gui_StateFields =
6×1 cell array
{'敤䙒㸀 ' }
{'gui_Singleton' }
{'gui_OpeningFcn'}
{'gui_OutputFcn' }
{'gui_LayoutFcn' }
{'gui_Callback' }
While running this script, MATLAB did crash a couple times, forcing me to restart it.
A couple questions:
  • What could cause the value of the first cell to be different, right after the struct initialization is executed?
  • Is there a tool for looking at the memory space of the MATLAB script?
A fix isn't crucial, this is just a demo I'm trying. However, I want to understand what is going on and how to debug this, in case it occurs again when it is a critical project.
Additional Details
Running this on:
Windows 10 Pro 64 bit Version 1803
MATLAB Version: 9.4.0.885841 (R2018a) Update 3, 64-bit, Home License
The script I'm running is calling the function with the following input:
gui_State =
struct with fields:
gui_Name: 'bladeRF_rx_gui'
gui_Singleton: 1
gui_OpeningFcn: @bladeRF_fft_OpeningFcn
gui_OutputFcn: @bladeRF_fft_OutputFcn
gui_LayoutFcn: []
gui_Callback: @frequency_Callback
varargin =
1×4 cell array
Columns 1 through 3
{'frequency_Callb…'} {1×1 UIControl} {1×1 matlab.ui.eventdata.ActionData}
Column 4
{1×1 struct}
The problem occurs here (from C:\Program Files\MATLAB\R2018a\toolbox\matlab\guide\gui_mainfcn.m):
function varargout = gui_mainfcn(gui_State, varargin)
% GUI_MAINFCN...
gui_StateFields = {'gui_Name'
'gui_Singleton'
'gui_OpeningFcn'
'gui_OutputFcn'
'gui_LayoutFcn'
'gui_Callback'};
gui_Mfile = '';
% breakpoint next line
for i=1:length(gui_StateFields)
if ~isfield(gui_State, gui_StateFields{i})
% ERROR here. '敤䙒㸀 ' instead of 'gui_Name' in struct
error(message('MATLAB:guide:StateFieldNotFound', gui_StateFields{ i }, gui_Mfile));
elseif isequal(gui_StateFields{i}, 'gui_Name')
gui_Mfile = [gui_State.(gui_StateFields{i}), '.m'];
end
end
And the error I get:
Error using gui_mainfcn (line 40)
Could not find field '敤䙒㸀 ' in the gui_State struct in GUI MATLAB-file
I have tried restarting MATLAB, but I haven't tried rebooting yet.

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Graphics Object Properties 的更多信息

产品

版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by