how to connect a GUI to a program

Hello,
I am working on a program which resolve transportation problem and a GUI for this program.
the user will enter n : numbber of sources , m : number of distinations , demand of each distination ,the supply for each source and costs , and the program will calculate a matrix A ,, a vector b using demand and supply and a vector c using costs , and i will use the function Linprog on A,b,c to calculate the optimal solution .i have the program, i made a GUI where the user can enter all those data but i don't know how to connect between them , i wish if there's a method to use the program directly , or if there's not i wish someone can help me .

댓글 수: 6

Samir Mitha
Samir Mitha 2020년 9월 12일
Did you use the MATLAB GUI options? or is the GUI external?
Maroua BEKKAR
Maroua BEKKAR 2020년 9월 12일
No , the GUI is external
Mario Malic
Mario Malic 2020년 9월 12일
편집: Mario Malic 2020년 9월 12일
How do you send the data to the program, without the GUI you made?
Can you tell the program to run an input file through cmd, or does it have support for actxserver?
Maroua BEKKAR
Maroua BEKKAR 2020년 9월 12일
the program is totally separated from the GUI , i made it a months ago , but now i want to make a GUI for it , so for the data , i run the program and type them one by one , i don't know if this is the right answer for your question , maybe i didn't understand you well
Mario Malic
Mario Malic 2020년 9월 12일
편집: Mario Malic 2020년 9월 12일
Explain "the program", what is it, is it a MATLAB script/function or something completely different?
Maroua BEKKAR
Maroua BEKKAR 2020년 9월 12일
it's a script .

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

답변 (1개)

Mario Malic
Mario Malic 2020년 9월 12일
편집: Mario Malic 2020년 9월 12일

0 개 추천

Now that I know that it's a script, I can answer the question.
I assume you're using GUIDE, unfortunately I have never used it, but idea is the same.
Create a button in the program, and make a callback for the button that runs the function with input arguments, or pass the whole application. In second case, define your variables as public properties so you can access them in TheProgram function.
% Callback for button clicked (I am not sure if callback written correctly)
function ButtonClicked(app,event)
TheProgram(app)
% or
% TheProgram(app.var1, app.var2, app.var3)
end
Function
% In your function if you passed the app
function TheProgram(app)
app.var1
app.var2
end
% If you pass variables
function TheProgram(var1, var2, var3)
% the code
end

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

릴리스

R2019a

질문:

2020년 9월 11일

편집:

2020년 9월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by