Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Help regarding functions and variables

조회 수: 1 (최근 30일)
Muthu
Muthu 2012년 9월 26일
마감: MATLAB Answer Bot 2021년 8월 20일
I am creating a GUI and writing a script to simulate the random packing of carbon fibers. So the required output that I would be concerned is the graphic from the GUI itself. I am having problems calling a function that has variable argument outputs and variable argument inputs.This function needs to be called when I click on a pushbutton. Also, I have created a handle that stores the value of the pushbutton. I am having problems accessing the data in this handle like the value,string etc. Any kind of help would be appreciated. For your reference, these are the error messages I get.
Error in samplerandom1>pushbutton1_Callback (line 80)
if strcmp(handles.st,Start)
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in samplerandom1 (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)samplerandom1('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
I would like to know what these errors mean and how could they be solved.
Thanks in advance.

답변 (1개)

Titus Edelhofer
Titus Edelhofer 2012년 9월 26일
Hi,
it looks as if you want to compare the string value? In this case you need to retrieve it first, so
if strcmp(get(handles.st, 'string'), Start)
and in case that you mean the string Start instead of the value of a variable Start:
if strcmp(get(handles.st, 'string'), 'Start')
Titus
  댓글 수: 2
Muthu
Muthu 2012년 9월 26일
Hi,
could you also help with how to use functions with varargout and varargin? and how to call them when required? Thanks again.
Titus Edelhofer
Titus Edelhofer 2012년 9월 30일
Hi, for this I would take a look at the documentation that describes this much better than I could do this ;-).

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by