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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

simple doubt using two for

M_U
10-Marble
10-Marble

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

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(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
25-Diamond I
(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
10-Marble
10-Marble
(To:Werner_E)

Hello,

 

I upload my mathcad sheet.

Thank you

Werner_E
25-Diamond I
(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.

 

Werner_E
25-Diamond I
(To:Werner_E)

BTW, your program is equivalent to this:

Werner_E_0-1641844980588.png

 

M_U
10-Marble
10-Marble
(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
10-Marble
10-Marble
(To:Werner_E)

Thank you, its works very well.

Announcements

Top Tags