1

I use a VBScript component inside MathCAD. This component has an input variable. When I put an array of several vectors as input variable all is OK (VB gets it as Variant and I can loop over its elements). But when the input variable is an array of only one vector VB gets it as Double and the value of this double is -1.#QNAN. So I can't use the components of the vector for the next calculations.

enter image description here

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Igor Fomenko
  • 150
  • 1
  • 9
  • 2
    Please share the component VBS code, show how does it's usage implemented within MathCAD (i. e. how does it called), and what is the step the error detected on. I guess the value `-1.#QNAN` isn't detected while VBS is running, since it's not native for VB. – omegastripes Oct 11 '16 at 09:32
  • 1
    I would always make sure you have a valid array before attempting to iterate through it by using `If IsArray(M) Then`, that way when it isn't an array you can handle the that with the `Else`. – user692942 Oct 11 '16 at 15:44
  • Array is valid in both cases (with one or with several vectors inside).But VB change type of input variable if array have only one member.I tried to use If..then construction to check,but as I've wrote in case of one member input variable becomes Double type with NAN value. – Igor Fomenko Oct 11 '16 at 16:43
  • Ideally the code should be written in a code block in the question, not shown as an image. It would also be useful if you updated the code to show us what you have tried. – user692942 Oct 12 '16 at 00:00
  • Just for info ... The Mathcad 3D Plot component code is not available to the user. The only ways the user can interact with the component are via the input & output interfaces, a rather mandraulic dialog that provides control over some aspects of the component's behaviour and appearance, and a dialog-box scripting interface (VBScript or JScript) that provides some additional control via the component's (limited) API. A scripted component has 3 default skeleton subroutines Event_Start, Event_Exec and Event_Stop (ScriptObj is the name of the component in this instance). – Stuart Bruff Jan 17 '17 at 15:10

0 Answers0