Trying to use for loop in get function

  • Follow


Hello, 

I am trying to run a for loop in the get function and keep encountering problems. Thanks in advance for help and suggestions to resolve this problem. I created a GUI and have three editable textboxs taged text1, text2, and text3 and a push button taged pushbutton1. The code below is in pushbutton1 function. Please find code and error message below.

code: 

for b= 1:3
    target_temp_string(b) = get(handles.textb, 'String');
end

for c= 1:3
    target_temp_string(c)
end

error message: 

??? Error using ==> struct2handle
Undefined function or method 'test' for input arguments of type 'char'.

??? Error using ==> test('text3_CreateFcn',gcbo,[],guidata(gcbo))
Error using ==> struct2handle
Undefined function or method 'test' for input arguments of type 'char'.

??? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn

??? Error using ==> struct2handle
Undefined function or method 'test' for input arguments of type 'char'.

??? Error using ==> test('text2_CreateFcn',gcbo,[],guidata(gcbo))
Error using ==> struct2handle
Undefined function or method 'test' for input arguments of type 'char'.

??? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn

??? Error using ==> struct2handle
Undefined function or method 'test' for input arguments of type 'char'.

??? Error using ==> test('text1_CreateFcn',gcbo,[],guidata(gcbo))
Error using ==> struct2handle
Undefined function or method 'test' for input arguments of type 'char'.

??? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn

??? Undefined function or method 'test' for input arguments of type 'char'.

??? Error using ==> test('pushbutton1_Callback',gcbo,[],guidata(gcbo))
Undefined function or method 'test' for input arguments of type 'char'.

??? Error while evaluating uicontrol Callback
0
Reply Victor 5/19/2010 9:44:04 PM

On May 19, 2:44=A0pm, "Victor " <victoro...@yahoo.com> wrote:
> Hello,
>
> I am trying to run a for loop in the get function and keep encountering p=
roblems. Thanks in advance for help and suggestions to resolve this problem=
.. I created a GUI and have three editable textboxs taged text1, text2, and =
text3 and a push button taged pushbutton1. The code below is in pushbutton1=
 function. Please find code and error message below.
>
> code:
>
> for b=3D 1:3
> =A0 =A0 target_temp_string(b) =3D get(handles.textb, 'String');
> end
>
> for c=3D 1:3
> =A0 =A0 target_temp_string(c)
> end
>
> error message:
>
> ??? Error using =3D=3D> struct2handle
> Undefined function or method 'test' for input arguments of type 'char'.
>
> ??? Error using =3D=3D> test('text3_CreateFcn',gcbo,[],guidata(gcbo))
> Error using =3D=3D> struct2handle
> Undefined function or method 'test' for input arguments of type 'char'.
>
> ??? Error using =3D=3D> struct2handle
> Error while evaluating uicontrol CreateFcn
>
> ??? Error using =3D=3D> struct2handle
> Undefined function or method 'test' for input arguments of type 'char'.
>
> ??? Error using =3D=3D> test('text2_CreateFcn',gcbo,[],guidata(gcbo))
> Error using =3D=3D> struct2handle
> Undefined function or method 'test' for input arguments of type 'char'.
>
> ??? Error using =3D=3D> struct2handle
> Error while evaluating uicontrol CreateFcn
>
> ??? Error using =3D=3D> struct2handle
> Undefined function or method 'test' for input arguments of type 'char'.
>
> ??? Error using =3D=3D> test('text1_CreateFcn',gcbo,[],guidata(gcbo))
> Error using =3D=3D> struct2handle
> Undefined function or method 'test' for input arguments of type 'char'.
>
> ??? Error using =3D=3D> struct2handle
> Error while evaluating uicontrol CreateFcn
>
> ??? Undefined function or method 'test' for input arguments of type 'char=
'.
>
> ??? Error using =3D=3D> test('pushbutton1_Callback',gcbo,[],guidata(gcbo)=
)
> Undefined function or method 'test' for input arguments of type 'char'.
>
> ??? Error while evaluating uicontrol Callback

Instead of get(handles.textb, 'String');
try:
get(handles.(sprintf('text%d',b)),'String');


-Nathan
0
Reply Nathan 5/19/2010 9:52:05 PM


1 Replies
176 Views

(page loaded in 0.04 seconds)

Similiar Articles:













7/17/2012 3:37:47 AM


Reply: