Borrar filtros
Borrar filtros

Calling a opening function in a programmatic GUI

4 visualizaciones (últimos 30 días)
E. H.
E. H. el 23 de Feb. de 2019
Comentada: E. H. el 28 de Feb. de 2019
I designed a GUI programmatically that gets called in a script with an input argument.
For initalising before any of the GUI gets executed I would like to call an opening function and an output function, in the same way it's done, when I design a GUI with the tool GUIDE.
I have the suspicion, that my opening function doesn't gets executed and so it's impossible for me to work with passed input arguments from the script
Is that possible?
  2 comentarios
Luna
Luna el 23 de Feb. de 2019
Can you share the code? and the script how you call it?
E. H.
E. H. el 25 de Feb. de 2019
thank you for your fast answer, luna... I wrote a code example for the script and the GUI, how I'd like it to work... the varargin and varargout are still troubling me...

Iniciar sesión para comentar.

Respuestas (1)

Krishna Zanwar
Krishna Zanwar el 26 de Feb. de 2019
Hi,
The error in this code is caused in the function calc_button_callback as the variables a, b, c are not initiated. I am not sure what to replace these variables with, so I just put a constant there.
There is no output to the function gui. You can just remove the varargout from the function declaration or you have to make sure that you set some value to varargout.
If these two changes are made the errors in the function are resolved.
Varargin is used when you don’t know how many input arguments to expect when the function is called. Varargin acts as a Cell array of all the input arguments no matter how many are called. But if you have a difficulty working with varargin you can just replace it with normal variables as you already know how many variables are called. Same goes with varargout.
There are some basic coding mistakes in your code which need to be corrected.
For example, while defining the calc_button_callback you are taking handles as an input but you are not passing handles while calling the function.
Here are some links that should help you understand the functions properly.
  1. Callbacks examples.
  2. Varargin, varargout.
  3. Functions.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by