Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Beginner question GUI

Subject: Beginner question GUI

From: Tim Franke

Date: 6 Oct, 2013 20:20:36

Message: 1 of 2

Hi,
I have made my first steps within GUIDE having created a push button and
axes. Saving the files creates a .fig and a .m file where I placed
the source code. Everything went well until I opened again the .fig file
in GUIDE and added a statc text field with the TAG "text4".
After saving the .fig it seems that the new text field is not known to
the code since a command "disp(text4.string)" gave the error message:
"Undefined variable "text4" or class "text4.String"."

What didn't I understand in the relationship between the .fig and the
m-file?

Best regards,
Tim

Subject: Beginner question GUI

From: matt dash

Date: 7 Oct, 2013 01:10:05

Message: 2 of 2

Tim Franke <tim_franke@gmx.de> wrote in message <bbdv0lF4p7gU1@mid.individual.net>...
> Hi,
> I have made my first steps within GUIDE having created a push button and
> axes. Saving the files creates a .fig and a .m file where I placed
> the source code. Everything went well until I opened again the .fig file
> in GUIDE and added a statc text field with the TAG "text4".
> After saving the .fig it seems that the new text field is not known to
> the code since a command "disp(text4.string)" gave the error message:
> "Undefined variable "text4" or class "text4.String"."
>
> What didn't I understand in the relationship between the .fig and the
> m-file?
>
> Best regards,
> Tim

Nothing. The error is unrelated to that. You meant handles.text4... you can't refer to it as just text4 unless you previously did text4=handles.text4. Also you can't reference the string property like you can in java... you need to do get(handles.text4,'string')

so: disp(get(handles.text4,'string'))

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us