Got Questions? Get Answers.
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:
reading input from a GUI

Subject: reading input from a GUI

From: Thiago Jota

Date: 4 Feb, 2008 02:36:01

Message: 1 of 3

Folks,

Simple question. I'm avoiding "inputdlg" in order to
customize my GUI, but I need something similar. How can I
store what I enter in a text field?

Subject: reading input from a GUI

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 4 Feb, 2008 04:56:44

Message: 2 of 3

In article <fo5tmh$h2s$1@fred.mathworks.com>,
Thiago Jota <thiago@mathworks.com> wrote:

>Simple question. I'm avoiding "inputdlg" in order to
>customize my GUI, but I need something similar. How can I
>store what I enter in a text field?

If you mean "store into a variable that which is already
in a text field", then the answer is that you get() the 'String'
property of the text field handle. The result will be a string.
If you need the numeric equivilent of a number represented
by the string, then after validating that the string looks like
a number, you can call str2num or str2double or sscanf .

If you mean "Put a value into a text field", then the answer
is that you set() the 'String' property of the text field with
a string. If your existing value is a number, then you can
form a string representation of the number by calling num2str
or sprintf.
--
   "Beware of bugs in the above code; I have only proved it correct,
   not tried it." -- Donald Knuth

Subject: reading input from a GUI

From: Vihang Patil

Date: 4 Feb, 2008 05:20:02

Message: 3 of 3

"Thiago Jota" <thiago@mathworks.com> wrote in message
<fo5tmh$h2s$1@fred.mathworks.com>...
> Folks,
>
> Simple question. I'm avoiding "inputdlg" in order to
> customize my GUI, but I need something similar. How can I
> store what I enter in a text field?

Hello
There is a simple gui program on the File Central
(http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=18212&objectType=file)
You can modify it according to your requirement to send
output to the workspace. Instead of a radio button make a
edit box and get the value from the get() .
HTH
Vihang

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