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

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

Unresolved Error: Vector Creation

ptc-5051640
1-Newbie

Unresolved Error: Vector Creation

Hiya,

Kindly can anyone resolve error shown in the image below.

The code is simple creating a vector from random numbers. Before it was working fine, untill I added another for loop below.

error_str.jpg

Thanks and Regards

1 ACCEPTED SOLUTION

Accepted Solutions

Near the top of the program structure you have time_err with a single subscript, i, so Mathcad thinks it's a vector. Near the bottom you have time_err with 2 sub scripts L and m so Mathcad thinks it's a matrix. Get these two consistent and the program should work.

Alan

View solution in original post

8 REPLIES 8

Delete the local assigment and both black stre and just leave the expression which is in red now.

No change, same error. time_err.jpg

Upload your worksheet. Mathcad's error messages aren't always very good at telling you what is wrong, and, in particular, telling you where something has gone wrong. (Have you right-clicked on the red area and chosen Trace Error?).

Alan

nothing is shown in trace error. Iam uploading my code.

Near the top of the program structure you have time_err with a single subscript, i, so Mathcad thinks it's a vector. Near the bottom you have time_err with 2 sub scripts L and m so Mathcad thinks it's a matrix. Get these two consistent and the program should work.

Alan

Thanks, but isn't Mathcad dynamically locate sizes. as in start I assigned one dimension but later

assigned two dimensions.

Regards.

Mathcad will dynamically resize. However, once it has constructed a matrix, the next time you give it just a single row index, i, how is it to know which column to use?

Alan

It's not the double index which throws the error but the single (vector) index in the i loop when the L-loop come to L=5.

You can see this more clearly if you delete the inline evaluation of time_err. Then Mathcad shows the error at the correct place.

Top Tags