Skip to main content
1-Visitor
July 11, 2025
Question

Using a user-defined variable in a program block in MathCad Prime 11

  • July 11, 2025
  • 3 replies
  • 384 views

I define a vector variable X (using a program block) in one part of the MathCad document.

The variable is computed correctly and I can access any element Xi later on by the expression Xi :=

However when I try to call Xi inside another program block further down, I get "This variable is undefined" error.

Would appreciate any suggestions.

3 replies

23-Emerald IV
July 11, 2025

Please attach your worksheet file and state which version of Mathcad you are using.

 

Success!

Luc

25-Diamond I
July 11, 2025

What you describe should work, given that you use ranges or for-loops the correct  way and use the correct type of index.

See simple example below.

We would have to see your worksheet to be able to find what you did wrong.

Werner_E_0-1752270603162.png

 

Community Moderator
August 12, 2025

Hi @ptc-4809306,

 

I wanted to see if you got the help you needed.

If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation. 

 

Thanks,
Anurag