I want to output the results of the matlab function 'why' in GUI. But i am unable to do so.. I can output numbers or specific text but i cannot output a result of another function when the answer is in the form of a string.

1 view (last 30 days)
%i
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a1 = why;
set(handles.text1,'String',a1)
I want to output the results of 'why' in a static text box called 'text1' when i push a push button called 'pushbutton4'.
Thank you for your help.

Accepted Answer

Joseph Cheng
Joseph Cheng on 9 Mar 2015
Edited: Joseph Cheng on 9 Mar 2015
The built in why function does not contain outputs. you can make a modified why called mywhy(n) which all you really need to modify is to change the top line to
function a = mywhy(n)
and maybe if you do not want to have it display in the command window, comment out line 21 where it says disp(a);

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!