Run .m script from GUI

조회 수: 12 (최근 30일)
Tom
Tom 2012년 9월 11일
댓글: Tadgh 2014년 1월 16일
I have a GUI that takes user defined inputs, and I want the user to be able to press a pushbutton on the GUI that then runs the .m script using the variables.
So i have, for the push button:
% --- Executes Setup Balance on button press
function pb_balance_Callback(hObject, eventdata, handles)
% hObject handle to pb_balance (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run BalanceSetup
Where the button is called pb_balance and the .m script is called BalanceSetup. Will this work or do i need a different command to run it? The .m file is 500 lines long so i don't want to include it in my .m file for the GUI.
Thanks

채택된 답변

Matt Fig
Matt Fig 2012년 9월 11일
You don't need to type run. Just the name of the script will cause the script to execute.
  댓글 수: 9
Tadgh
Tadgh 2014년 1월 16일
Yes but I can't get it to work using what is discussed in that thread. I was hoping if somebody else had another idea on how to get it to work.
Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by