Quantcast
Channel: PTC Community: Message List - Must be a scalar or a matrix
Viewing all articles
Browse latest Browse all 6

Re: Must be a scalar or a matrix

$
0
0

As Fred say, you can't add range variables.  A range variable is an implied iterator - it provided the major form of iteration in the early versions of Mathcad before programming was added to provide the for loop. 

 

A range variable is quite distinct from a vector.   A vector is a one-column array in Mathcad whereas a range variable is a variable that holds a range, a specialized data type of the form "start,next..end". You can't perform arithmetic on this data type, hence you can't add them together.  Whenever Mathcad encounters a range variable in an expression it automatically iterates over each of the values obtained by expanding the range.  When Mathcad encounters a vector (or other array) it operates on the vector as a whole.

 

To allow me to make better use of range variables I created a general purpose function called vec that will convert a range variable into a vector - see attached worksheet for it application to your worksheet.

 

Stuart


Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images