cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Use call-by-reference in program blocks

PM_10276442
4-Participant

Use call-by-reference in program blocks

Hi

 

I am wondering, if it is somehow possible to directly change a global variable inside a program block like a call-by-reference function call.

 

Right now this is my work around:

1. The global variable is assigned to a local variable with same name.

2. The local variable is changed as desired

3. In the end the local variable is returned and assigned again to the global variable.

 

However as I am working with large matrices (sometimes even matrices containing matrices) I would expect a faster running program, if I got rid of the copying forth and back.

Cheers

 

Pascal

1 REPLY 1

I don't think that there is a way to do what you intend. In real Mathcad is was possible to use a scripted component to create/change a global worksheet variable and I guess that this component could have also called from within a program. But I doubt that this would have been more efficient and faster than passing the variable as argument. Furthermore this component sure would not work in Prime.

 

Top Tags