필터 지우기
필터 지우기

GUIDE and selecting functions to apply on data

조회 수: 2 (최근 30일)
Brian
Brian 2013년 3월 16일
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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 16일
You can use str2func function
  댓글 수: 1
Brian
Brian 2013년 4월 18일
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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jan
Jan 2013년 3월 16일
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
Jan
Jan 2013년 4월 18일
편집: Jan 2013년 4월 18일
I guess you want it in the callback. Simply try it.
Brian
Brian 2013년 4월 18일
I'm really lost, sorry. Thanks very much, I'll work away on that

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by