Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
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?
Solved! Go to Solution.
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
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
Luc,
See attached. This Mathcad prime file is not identical to the PNG file I posted earlier, but has the same kind of issue.
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
Luc,
Thank you for the help and providing an explanation w/ example!
Hi,
Can you tell me what is wrong with this please:
This is a very simple routine!
Thanks
Got the answer sorry.
It's because in my routine i is just an indice… Such a time wasted for this stupid mistake^^
@AdriCreu wrote:
Got the answer sorry.
It's because in my routine i is just an indice… Such a time wasted for this stupid mistake^^
It also has its good - its very unlikely you will confuse Mathcads two types of indices in future worksheet - you will remember.
Its very common to confuse literal indices and vector indices.
Hi Luc,
I am quite new to mathcad. I have the same question and believe your scripts gonna help. But after I opened it, it is blank. Is it because I am still using prime 2? Thanks!
Here's a snapshot of Luc's worksheet for reference:
Thank you so much!
BTW you have any idea that why it is blank when I opened it in prime 2?
If you open in any version prior to Prime 4.0, you should get the following error:
Prime then opens a blank worksheet for your use, but it is not attempting to open the specified file.
PTC has decided that files should not be backwards compatible, so older versions cannot open files form newer versions, and newer versions cannot even save-as to an older version.
ok thanks!
In Prime, like many other products, early versions (2.0) cannot read later versions (3.0, 3.1, 4.0).
In Prime, unlike other products, later versions (4.0) cannot write earlier versions (3.1, 3.0, 2.0).
When you tried to open the file it failed, and Prime 2.0 opened a new blank worksheet.
thanks!
it would probably better for me to ask you a question directly here on converting a nested matrix to a clean one. I am dealing with the nested matrix in the attachment. Right now what I am doing is to match the row of the clean one with the nested. But since later the number of rows gonna be crazy, and I do not think I want to do the same thing. I tried using the loop but had a hard time with the index. Wonder if there is some reference I can look at. Thanks!
Can you post your Prime file? If you have 2.0, people with newer versions can open it.
Your picture does not explain the problem; from that picture you have a vector p3 (one subscript says only a single column), where at least one element is a six row by four column array where each array is a 101 element column vector.
There is no information about what you want to match. . .
Hi Werner_E,
I figured out it would be better to redefine the nested matrix instead of converting them to a 707*4 matrix.
As shown in the following link,
Luc suggested that we cannot create a nested matrix from scratch. I tried to create the element before I put it in but still did not work (please see attachment). Mine is a little bit complicated than Luc's example, since it involves multiply nested matrix and I do not want to redefine them one by one.
Thanks!
Please ignore my last question. I already figured it out. And thanks!
Hi Luc,
You suggested that we cannot create a nested matrix from scratch. I tried to create the element before I put it in but still did not work (please see attachment). Mine is a little bit complicated than Luc's example, since it involves multiply nested matrix and I do not want to redefine them one by one.
Thanks!
Please ignore my last question. I already got it figured out. thanks!