MATLAB: I can not get a “GUIDE” to open

guideMATLABone after anotheropen

Goodnight. I have the following problem. I have 2 "Guides", one called "form1" and the other "form2". The process is to press a button of the "form1" must make a series of calculations and at the end of all those calculations must open my "form2" (taking some data from my "form1"). I already tried several solcutions that I found on the internet, but I can not get my "form2" open, in fact I have not been able to create an .m file for that Guide. Please, I need your help with this. I am very new in Matlab and I still do not know much about this tool. thank you.

Best Answer

  • Invoke guide and tell it to create new GUI, and give it the name form2 . Put all relevant controls in it. Save it as normal, with .fig and .m file.
    Inside form1, you can use
    handles.data_form2_will_need = whatever;
    form2_h = form2();
    to get the handle of form2 in order to communicate with it.
    Inside the OpenFcn for form2 you can use,
    %we are inside form2 here, handles refers only to form2's handles
    handles.form1_h = findobj(groot, 'tag', 'form1');
    handles1 = guidata(handles.form1_h); %this is form1's handles
    handles.data_form2_needs = handles1.data_form2_will_need;
    guidata(hObject, handles)