"Alexandr " <email@example.com> wrote in message news:firstname.lastname@example.org... > Please, can anybody explain next features?! > > M-file code: > function pushbutton1_Callback(hObject, eventdata, handles) > handles.myValue=999; > disp(5); > disp(handles); > > If start this code from M-file with F5 button in the command windows > shows: > > 5 > figure1: 173.0032 > pushbutton1: 179.0032 > axes1: 174.0032 > output: 173.0032 > myValue: 999 > > But if start clicking the .fig file, you will see only: > > 5 > myValue: 999
The function file associated with the GUI includes initialization code that MUST run before you interact with the GUI. Double-clicking the figure file bypasses the function file and does not execute that initialization code.
ALWAYS start a GUIDE-generated GUI by executing the function file, NOT by opening the figure.
> In Matlab HELP it is said: > "When the GUI is fully initialized, the handles structure contains only > handles to all the components in the GUI and custom data added in any > CreatedFcn callbacks and/or the OpeningFcn." > > but at the same time I see error messages about missing fields in the > handles structure.
Note the first part of that sentence. The GUI is only fully initialized once the associated function file executes.