Using an external function in GUI closes the interface
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello!
I am using an external function I made outside GUI (heart_rate.m) and I am using it in a push button in GUI. The problem is that every time I press the button, the functions runs and returns the value I want, but after the interface just closes by itself.
At the moment the code is something really basic like this:
function pushbutton_connect_Callback(hObject, eventdata, handles)
(..)
global HR;
HR = heart_rate(data1,sr);
msgbox(sprintf('Your heart rate is: %3.f', HR));
The msgbox appears and shows the correct number for data1, but then the thing just closes. I have also used a different external function just to test and the behaviour is the same.
Any idea on what is the problem? I am relatively new to guide, so I apologize in advance for any mistakes I may say :)
3 Kommentare
Akzeptierte Antwort
Geoff Hayes
am 17 Jul. 2014
The heart_rate function, if like that in the above link, has as its first line
close all; clc;clear all;
Calling close all would close the GUI yet still allow the message box to display. Try removing this line and re-running the application.
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!