Skip to main content
1-Visitor
May 11, 2018
Solved

For Loop function in nested matrix/vector

  • May 11, 2018
  • 1 reply
  • 14657 views

Attempting to do basic "For Loop" program on a nested matrix/vector using Mathcad prime 4.0. As you can see below the right "test" program snippet is displaying an error.The error message I get is reads "This operation can only be performed on an array". The left "test" program snippet is performing the evaluation when the "k" counter is omitted from "chk" variable. In this case returning result for "k" = 4. I was anticipating right "test" program snippet returns a [4x1] matrix or vector after evaluating for each "k" value.

 

Would someone help with an insight on how to resolve this issue?

 

Best answer by LucMeekes

Essentially you attempting to create a nested array from scratch. That does not work in this way.

You can create an array, or a matrix, from scratch using a for loop, but to create a nested array (or matrix) you first have to create the element before you can put it into the array.

 

Attached is an explanation (Prime 4).

 

Success!
Luc

1 reply

23-Emerald IV
May 11, 2018

Please attach your prime worksheet.

Look in the 'Anouncement' to the right of this column, below the advertorial picture, for tips on attaching.

 

Success!
Luc

StrucEngr1-VisitorAuthor
1-Visitor
May 11, 2018

Luc,

See attached. This Mathcad prime file is not identical to the PNG file I posted earlier, but has the same kind of issue.

LucMeekes23-Emerald IVAnswer
23-Emerald IV
May 11, 2018

Essentially you attempting to create a nested array from scratch. That does not work in this way.

You can create an array, or a matrix, from scratch using a for loop, but to create a nested array (or matrix) you first have to create the element before you can put it into the array.

 

Attached is an explanation (Prime 4).

 

Success!
Luc