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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

simple doubt using two for

M_U
9-Granite
9-Granite

simple doubt using two for

Hello, I have a problem with my file and I don't know how to solve it. It should be pretty simple, but I don't know how to solve it. I'm including the files and my program. My question is as follows. In the first for (counter j), when it starts from zero to 3, it gives me some values, when I start from 3 to 3, it gives me another value.

 

M_U_0-1641841258175.pngM_U_1-1641841285012.png

Somebody can help me?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:M_U)

Resetting h_maior for every run of the outer loop should do the trick.

You may assign it any scalar value or, like I did, NaN.

Werner_E_0-1641844418815.png

The reason why this is necessary is because the number of rows (iteration steps of the inner loop) differ and of a lower number follows a higher one, not all data of the previous vector h_maior is overwritten.

 

View solution in original post

6 REPLIES 6
Werner_E
24-Ruby V
(To:M_U)

Looks like you forgot to attach your Mathcad sheet. I just see your four data files attached.

 

Its also not clear to me what the goal of the program seen in your pic is.

You assign the very same value in every row of matrix H and then you calculate the mean value (which obviously will be this very value)?

M_U
9-Granite
9-Granite
(To:Werner_E)

Hello,

 

I upload my mathcad sheet.

Thank you

Werner_E
24-Ruby V
(To:M_U)

Resetting h_maior for every run of the outer loop should do the trick.

You may assign it any scalar value or, like I did, NaN.

Werner_E_0-1641844418815.png

The reason why this is necessary is because the number of rows (iteration steps of the inner loop) differ and of a lower number follows a higher one, not all data of the previous vector h_maior is overwritten.

 

BTW, your program is equivalent to this:

Werner_E_0-1641844980588.png

 

M_U
9-Granite
9-Granite
(To:Werner_E)

Hello,

 

it is true. I will use this sheet to do other calculations, in this part, that i sent, i am testing my sheet.

M_U
9-Granite
9-Granite
(To:Werner_E)

Thank you, its works very well.

Top Tags