Matlab Gui. Retrieve the output of a function (external .m file) within a push button. Could anyone explain how to do it?

1 次查看(过去 30 天)
Hello I'm new about use the Matlab Gui. I'm struggling to retrieve the output of a function (external .m file) in a push button. Could anyone explain how to do it?
%code
function Simulate_Callback(hObject, eventdata, handles)
% hObject handle to Simulate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global w DP
T=str2double(get(handles.inT,'string'));
P=str2double(get(handles.inP,'string'));
delta=str2double(get(handles.indelta,'string'));
Comp=str2double(get(handles.Comp,'data'));
Comp=Comp(:,1);
[w,DP]=external_Function(T,P,delta,Comp);

采纳的回答

Davide Dall'Acqua
Davide Dall'Acqua 2017-9-23
Thanks for your quick reply. I found my error. It was a waitbar in my external function that once completed the function it closed the entire gui

更多回答(1 个)

ES
ES 2017-9-23
编辑:ES 2017-9-23
Whatever you have done so far is fine. Just that there needs to be a external_Function.m file with the function defined as [w,DP]=external_Function(T,P,delta,Comp).
of course you need not specify w and DP as globals.

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by