Thread Subject: Numeric Values Only

Subject: Numeric Values Only

From: PinkLab

Date: 25 Oct, 2009 10:12:01

Message: 1 of 4

How do I program to accept only numeric values for my edit text box? Please help

Subject: Numeric Values Only

From: Wayne King

Date: 25 Oct, 2009 11:19:01

Message: 2 of 4

"PinkLab " <hussains_k@hotmail.com> wrote in message <hc189h$tp$1@fred.mathworks.com>...
> How do I program to accept only numeric values for my edit text box? Please help

Hi,
Will using isnumeric() work for you?
>>doc isnumeric

wayne

Subject: Numeric Values Only

From: PinkLab

Date: 25 Oct, 2009 11:44:02

Message: 3 of 4

doesn't work....

i need to enter the simple code in text box call to define it should only accept numeric values otherwise display error message.....

any help please?


"Wayne King" <wmkingty@gmail.com> wrote in message <hc1c75$idk$1@fred.mathworks.com>...
> "PinkLab " <hussains_k@hotmail.com> wrote in message <hc189h$tp$1@fred.mathworks.com>...
> > How do I program to accept only numeric values for my edit text box? Please help
>
> Hi,
> Will using isnumeric() work for you?
> >>doc isnumeric
>
> wayne

Subject: Numeric Values Only

From: Rune Allnor

Date: 25 Oct, 2009 11:53:35

Message: 4 of 4

On 25 Okt, 12:44, "PinkLab " <hussain...@hotmail.com> wrote:
> doesn't work....
>
> i need to enter the simple code in text box call to define it should only accept numeric values otherwise display error message.....
>
> any help please?

Don't top post!

ISNUMERIC probably doesn't work because it tests the data type,
not contents. What you enter in a text box is necessarily text.

So either

1) Try and convert the text to a numeric value using STR2INT,
   STR2NUM or SSCANF and test if the conversion was successful.
2) Use a regular expression first and check if the entered text
   contains a valid number.

Rune


> "Wayne King" <wmkin...@gmail.com> wrote in message <hc1c75$id...@fred.mathworks.com>...
> > "PinkLab " <hussain...@hotmail.com> wrote in message <hc189h$t...@fred.mathworks.com>...
> > > How do I program to accept only numeric values for my edit text box? Please help
>
> > Hi,
> > Will using isnumeric() work for you?
> > >>doc isnumeric
>
> > wayne– Skjul sitert tekst –
>
> – Vis sitert tekst –

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com