Don't have release late enough to include it but from the online doc's
doesn't appear TMW thought of that -- unless
dt=datetime([]);
will work but I suspect it, too, will error. As said, can't test it here.
Submit an enhancement request; the query should be sufficient "why" and
"how I would use it" for the justification part.
Presuming the above doesn't work--maybe you can figure a way to factor
your app so that only need to call the exist() function once or at least
a relatively few number of times and then can make most functions only
get called when you know it does exist.
If that doesn't work, you can save some execution time for another
logical variable that you keep that is set that is T IFF the object has
been created and not yet destroyed. This would need to be a GLOBAL or a
property of a structure or somesuch so it's always available, of course.
But,
if ~dtExist, dt=datetime(whatever); dtExist=T; end
is probably noticeably faster in timing altho no less coding than
if ~exist('dt','class'), ....
I guess the other workaround would be to created the object but use a
default dummy value for the start time although one hates to rely on
magic numbers as a general rule. What happens if you try a Datevector
of zeros, for instance? Does it "blow up" or give a nonsensical but
consistent result that can test?
--