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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

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.

Somebody can help me?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
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.

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.

6 REPLIES 6
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)?

9-Granite
(To:Werner_E)

Hello,

Thank you

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.

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.

24-Ruby V
(To:Werner_E)

BTW, your program is equivalent to this:

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.

9-Granite
(To:Werner_E)

Thank you, its works very well.

Announcements
Top Tags