Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

how to display texts in gui itself?

Asked by Sivakumaran Chandrasekaran on 8 Apr 2013

For my present code, output (abnormal (or) normal) will appear in command window only. I need to display it in gui itself... how to write it?

0 Comments

Sivakumaran Chandrasekaran

Tags

Products

1 Answer

Answer by Yao Li on 8 Apr 2013

Add an Edit Text (eg. edit1)

function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
res=4;
set(hObject,'String',num2str(res))

0 Comments

Yao Li

Contact us