Matlab gui - invoking the same gui screen

I am trying to make in Matlab, a GUI, that the user enters points as an input and a connection between them.

I have 5 matlab files - screen1.m, screen2.m, screen3.m, screen4.m, globalParams.m

in globalParams I have global options, so I can use them from the screen GUI to the on-screen GUI. on screen 1, the user enters the number of nodes (for example, 5). when he clicks the "Next" button, the callback function calls " screen2();". in screen2.m the user enters the coordinate (x, y), and when he clicks the "Next" button, the callback function calls " screen3();".

Now I ask him to fill in the connection between Node i and Node j (he needs to fill in the Node numbers i and j). if there is only 1 connection, he will click the “Finish” button, and the callback function will call “ screen4();and everything will be fine. Else (there are more than 1 connection) he clicks the“ Next ”button and calls the callbacks screen3();. more than one connection, I again have a problem with calling screen3 ..

Also, is there a way when I call the next screen to close the last screen? because when we find a way to invoke screen 3 over and over, a lot of GUIs will open, and this can confuse and annoy the user.

some code:

in screen1, the following button:

function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
screen2();

on screen2, the following button:

function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

screen3();

3, , :

function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
screen3();

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
screen4();

3, :

function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double

global hopsMatrix;
i = str2num(get(handles.edit2, 'string'));
j = str2num(get(handles.edit1, 'string'));
hopsMatrix(i,j) = 1;
+3
1

screen3() . , .

(, edit2_Callback), "", , ,

set(handles.edit1, 'String', '');
set(handles.edit2, 'String', '');
set(handles.text1, 'String', sprintf('Connection (%d, %d) was added.',i,j));

-, ( text1).

, , , "", , "", .
edit2 Callback ( , , , - ).


, GUI handles.figure1, , . screen2();

close(handles.figure1);
screen2();
+1

All Articles