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
2020년 9월 12일
Did you use the MATLAB GUI options? or is the GUI external?
Maroua BEKKAR
2020년 9월 12일
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
2020년 9월 12일
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
2020년 9월 12일
답변 (1개)
Mario Malic
2020년 9월 12일
편집: Mario Malic
2020년 9월 12일
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에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!