Skip to main content
1-Visitor
October 22, 2013
Solved

"on error" problem under version 15

  • October 22, 2013
  • 1 reply
  • 5313 views

I have a program (enclosed) that will define an undefined variable which works fine on version 14 but in version 15 it tells me the variable "rLSL" is undefined and to get it to work, I must define it prior to calling this program which defeats the purpose of the program.

on_error.JPG

Best answer by Werner_E

It shows the variable undefined prior to calling the program .

No, there is no way to "undefine" a variable in Mathcad (prior to Prime). You may undefine it for the symbolic processor via rLSL:=rLSL but there is no way to undefine a variable for the numeric processor.

Try to evaluate rLSL immediatly after the supposed undefinition before your routine - I bet it has a value and it will be already 0.

EDIT: Correction, there is a clumsy way to undefine a variable. You may undefine rLSL by assigning it an undefined variable, e.g.: rLSL:=xyz_123

1 reply

25-Diamond I
October 22, 2013

Are you sure that "onerror" catched undefined variables in older versions of Mathcad?

JohnTesko1-VisitorAuthor
1-Visitor
October 22, 2013

Works fine in version 14.

25-Diamond I
October 22, 2013

John Tesko wrote:

Works fine in version 14.

No, it doesn't!

I just found an older machine with Mathcad 14 M020 on it and tried. Your file throws the same error as MC15.

"onerror" does not catch undefined variables and, as I suspected, never did.

I can't think of a method to catch that error with Mathcad's native commands - it may be possible using scripted components.