Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi all,
I am trying to add two range variables but I get the error "This value must be a scalar or a matrix". Please see the attachment.
Thanks
Solved! Go to Solution.
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
You can't add range variables. They work for plotting or for indices of vectors or matrices but they're not vectors so you can't operate on them.
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