Interfacing .m file and GUI .m file

Hello all, I new to MATLAB GUI. I am facing difficulty in changing text of 'Edit Text' box in GUI.What I am doing based on a condition in .m script file (not GUI .m file) I want to change text in 'Edit Text' Box. I have tried with get command but not succeeded. Here is my dummy code : Please suggest some solution
% Main .m File-----------
global hu
hu= 0;
for i =1:10
if i >5
hu =1;
else
hu = 0;
end
Change % my gui . m file
end
--------------------------------------------
% GUI .m file
function Change_Callback(hObject, eventdata, handles)
% hObject handle to Change (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 Change as text
% str2double(get(hObject,'String')) returns contents of Change as a double
global hu
if hu==1
set(hObject,'String','OFF');
end
---------------
I have also tried with finding object using findobj('Tag','Change') and then try to change string using set command but not found any success. here 'Change' is my Tag for edit box

Réponses (0)

Cette question est clôturée.

Tags

Clôturé :

le 20 Août 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by