% Create figure to use as GUI in your main function or a subfunction
figure_handle = figure();
% create structure of handles
myhandles = guihandles(figure_handle);
% Add some additional data as a new field called numberOfErrors
myhandles.自定义变量 = 0;
% Save the structure
guidata(figure_handle,myhandles)