I have a have that reads data from a device. I have made a GUI with GUIDE with a 'Read' and 'Stop Read" button.
The program contains a callback function for the Read, and the stop button and the Read callback uses the f_Read() function to read the data. I want the program to stop executing f_Read when i press the stop button. I was thinking that the while loop could evaluate handles.stop == 0, so that while handles.stop = 0, f_Read() will be executed, and then when i press the stop button handles.stop =1 and the while loop would stop. But it seems like it doesnt discover that handles.stop = 1, when i press the stop button, and therefore it just keeps executing f_Read(). What am i doing wrong? Or should i do it in a different kind of way?
function Read_button_Callback(hObject, eventdata, handles)
while handles.stop == 0
[data] = f_Read(2,2)
function Stop_button_Callback(hObject, eventdata, handles)
handles.stop = 1