Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
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.
Thanks and Regards
Solved! Go to Solution.
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
Delete the local assigment and both black stre and just leave the expression which is in red now.
No change, same error.
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
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.