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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Global Definition

ldante
11-Garnet

Global Definition

Hi . Any one can help me to use the global definition in Mathcad prime. The situation is this. I have all the data in Exel sheet .  I only want to change the MATRIX INDEX as a variable. how can I get the assigned value base on the assigned matrix index ? I attached the exel file and the Mathcad prime for your reference.

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:ldante)

You have some fundamental misunderstandings about how Mathcad works.

Assignments:

The normal assignment is :=. It assigns a value (or values) to a variable at the worksheet level

The local assignment within a program is the left shaft (roughly <--).

The global assignment is the the triple bar.

Subscripts:

You get an array subscript using "['. this indexes into an array. If the subscript is a variable name, then the variable must be defined as a numeric value.

You get a literal subscript using <Ctrl> -. This is just part of the variable name. It is only cosmetic, and cannot subsequently be used for anything.

Your assignments are a seeming random mix of the above. On the LHS you have both literal and array subscripts, your assignments are either local program assignments or the normal worksheet assignment, and in many cases the || either side of the RHS indicates you have a one line program (functionally, this makes no difference, but it looks strange). In the cases where you have an array subscript on the LHS (e.g. ix[FW50) the subscript is undefined. The only reason you don't get an error is because you also use the local program assignment, but don't have any assignment at the worksheet level (i.e. no :=), so Mathcad just ignores the entire statement.

I've attached a worksheet that will hopefully get you started. It assigns the properties to a matrix, and then shows you how to index into that matrix.

View solution in original post

2 REPLIES 2
RichardJ
19-Tanzanite
(To:ldante)

You have some fundamental misunderstandings about how Mathcad works.

Assignments:

The normal assignment is :=. It assigns a value (or values) to a variable at the worksheet level

The local assignment within a program is the left shaft (roughly <--).

The global assignment is the the triple bar.

Subscripts:

You get an array subscript using "['. this indexes into an array. If the subscript is a variable name, then the variable must be defined as a numeric value.

You get a literal subscript using <Ctrl> -. This is just part of the variable name. It is only cosmetic, and cannot subsequently be used for anything.

Your assignments are a seeming random mix of the above. On the LHS you have both literal and array subscripts, your assignments are either local program assignments or the normal worksheet assignment, and in many cases the || either side of the RHS indicates you have a one line program (functionally, this makes no difference, but it looks strange). In the cases where you have an array subscript on the LHS (e.g. ix[FW50) the subscript is undefined. The only reason you don't get an error is because you also use the local program assignment, but don't have any assignment at the worksheet level (i.e. no :=), so Mathcad just ignores the entire statement.

I've attached a worksheet that will hopefully get you started. It assigns the properties to a matrix, and then shows you how to index into that matrix.

ldante
11-Garnet
(To:RichardJ)

got it. Thank you

Top Tags