Hello All, I am working on the GUI of my code. I have start code which works in for loop. More the user inputs bigger loops. So I want to have a stop button which will close the process at the loop when it is pressed. So far I tried this with no luck:
For Stop button I have kept this:
function stop_Callback(hObject, eventdata, handles)% hObject handle to stop (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I1.kill=1;set(handles.stop, 'UserData', I1);
Now in my start button call back I have this:
I1= get(handles.stop, 'UserData');
And within the for loop I have added this:
for ii = 1:length(fVal) if I1.kill~=1
I know this is not correct and that's why I am getting:
Attempt to reference field of non-structure array.
But I would like to know a work around to make stop button.
Best Answer