Borrar filtros
Borrar filtros

GUIDE and selecting functions to apply on data

2 visualizaciones (últimos 30 días)
Brian
Brian el 16 de Mzo. de 2013
I need to make a GUI in which different functions can be selected from a pop-down menu to work with data already loaded into the workspace. I just need to know the syntax in the m file for the gui:
if (function name) in list is selected
use this function
Apologies, this is a basic question, I have tried looking it up for a while and couldn't find anything. Thanks

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 16 de Mzo. de 2013
You can use str2func function
  1 comentario
Brian
Brian el 18 de Abr. de 2013
Thanks for the reply, sorry for the delay, I thought an email would be sent when it was answered. How do I put this code under the Callback(hObject... or CreateFcn(hobject... ? thanks

Iniciar sesión para comentar.

Más respuestas (1)

Jan
Jan el 16 de Mzo. de 2013
List = {'sin', 'cos', 'tan'}; % String of the listbox
Value = 2; % Value property of the listbox
Selected = List{Value};
Data = 1.1415; % "data already loaded into the workspace"
result = feval(Selected, Data)
  3 comentarios
Jan
Jan el 18 de Abr. de 2013
Editada: Jan el 18 de Abr. de 2013
I guess you want it in the callback. Simply try it.
Brian
Brian el 18 de Abr. de 2013
I'm really lost, sorry. Thanks very much, I'll work away on that

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by