I want to create my own function in MATLAB which check some conditions but I don't know how to send handles
in there. In the end, I want to print some text in the GUI from this other function. I can't use handles.t1
directly in this function because it is not accessible from within the function. How can I pass it there?
function y = check(tab)
if all(handles.tab == [1,1,1])
set(handles.t1, 'String', 'good');
else
set(handles.t1, 'String', 'bad');
end
end
Edit
After comment and first answer I decided to put whole callback where I call my function:
function A_Callback(hObject, eventdata, handles)
if handles.axesid ~= 12
handles.axesid = mod(handles.axesid, handles.axesnum) + 1;
ax = ['dna',int2str(handles.axesid)];
axes(handles.(ax))
matlabImage = imread('agora.jpg');
image(matlabImage)
axis off
axis image
ax1 = ['dt',int2str(handles.axesid)];
axes(handles.(ax1))
matlabImage2 = imread('tdol.jpg');
image(matlabImage2)
axis off
axis image
handles.T(end+1)=1;
if length(handles.T)>2
check(handles.T(1:3))
end
end
guidata(hObject, handles);