Receive and send values in GUI

3 Ansichten (letzte 30 Tage)
Igor Felipe Gallon
Igor Felipe Gallon am 28 Mai 2015
Hello people. I'm new on Matlab and i have some problems with GUI. I made an application that uses the GUI interface to get input values, send this values to an algorithm and i want plot in the same GUI window a graphic with data after processed on that algorithm. I don't know how to do this because i can't pass in varargin the data that the algorithm didn't calculate yet. Thank you all!
  2 Kommentare
Jan
Jan am 28 Mai 2015
Bearbeitet: Jan am 28 Mai 2015
Without seeing the relevant part of the code and a detailed description of the problem, it is impossible to suggest a solution. What exactly is "send these values to an algorithm" and why can't you catch the outputs of the algorithm directly?
Igor Felipe Gallon
Igor Felipe Gallon am 28 Mai 2015
Bearbeitet: Igor Felipe Gallon am 28 Mai 2015
Sorry Jan, i made an cartesian genetic program and i want use the GUI interface to get "Number of generations", "Number of individual" and the "Mutation rate". When i press the "Run" button, my program get these values and after each generation, generates a "father" vector, in this case the best fitness. So i have a function that plots these "Father" vector in cartesian coordinates. In my main program i have this:
[nger,ncrom,l,c,n,s,nLinhas,taxaMut,saidas]=ae_gui;
The GUI "ae_gui" returns these values for the genetic algorithm and after generates the "Father" vector and i want send this to the GUI file and plot it in the box.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Ingrid
Ingrid am 28 Mai 2015
in your gui you need an edit text box (or equivalent, depending on which input values you require, it is not clear from your question). You also need a pushbutton with a callback that will start your algorithm when you click on it. In this callback function you write your algorithm and than you plot the data by selecting the axes where you want to plot your data first and than just use the normal plot command. No varargin required so problem solved.
  1 Kommentar
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh am 28 Mai 2015
Hi
I'm just gonna add some more tips to Ingrid's post.
To pass variables from one function to another within your GUI you can either use the handle structure
handle.mydata.voltage = 10;
You also neat to update handle at the end of each function if you're assigning new values to it.
or you can define some variables as global inside each and every function (I prefer the first option).
To create a GUI you can use GUIDE to facilitate your work, from there you can insert an axis on the same GUI and plot inside the GUI!
Thats all, you can probably download any GUI based program and look inside it to learn.
Good Luck!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by