Thread Subject: date validation

Subject: date validation

From: Christopher

Date: 10 Jun, 2009 12:34:31

Message: 1 of 2

I am trying to validate whether an input on a GUI is a date. The datenum function returns errors if it is something other than a date. How do I alert the user to only enter a date without command-line errors showing up (I want to compile the program eventually)?

Subject: date validation

From: John

Date: 12 Jun, 2009 15:55:19

Message: 2 of 2

Use a try-catch block around your datenum call and in the catch block, put an error/warning dialog that will point out that the input expected is a date format.This way, any error generated will be caught in the 'catch' block and your program can elegantly throw the error instead of terminating at that point.

See help try
        help catch
        help errordlg

"Christopher " <christophermcleester@removethisexeloncorp.com> wrote in message <h0o98n$2o9$1@fred.mathworks.com>...
> I am trying to validate whether an input on a GUI is a date. The datenum function returns errors if it is something other than a date. How do I alert the user to only enter a date without command-line errors showing up (I want to compile the program eventually)?

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
errordlg John 12 Jun, 2009 11:59:05
catch John 12 Jun, 2009 11:59:05
try John 12 Jun, 2009 11:59:05
gui Christopher 10 Jun, 2009 08:39:02
inputs Christopher 10 Jun, 2009 08:39:02
validation Christopher 10 Jun, 2009 08:39:02
date Christopher 10 Jun, 2009 08:39:02
rssFeed for this Thread

Contact us at files@mathworks.com