how to connect a GUI to a program

2 vues (au cours des 30 derniers jours)
Maroua BEKKAR
Maroua BEKKAR le 11 Sep 2020
Modifié(e) : Mario Malic le 12 Sep 2020
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 commentaires
Mario Malic
Mario Malic le 12 Sep 2020
Modifié(e) : Mario Malic le 12 Sep 2020
Explain "the program", what is it, is it a MATLAB script/function or something completely different?
Maroua BEKKAR
Maroua BEKKAR le 12 Sep 2020
it's a script .

Connectez-vous pour commenter.

Réponses (1)

Mario Malic
Mario Malic le 12 Sep 2020
Modifié(e) : Mario Malic le 12 Sep 2020
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

Catégories

En savoir plus sur File Operations dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by