Skip to main content
1-Visitor
February 22, 2020
Solved

How to drop out of loop

  • February 22, 2020
  • 16 replies
  • 6503 views

Here is my FORTRAN statements:

      DO 1010 I=1,L

        DO 1010 J=1,NC119

          X119(I,J) = 0.

          X132(J,I) = 0.

          IF(YEN(J) -YV(I)) 1010,1000,1000

 1000       X119(I,J) = 1.0

 1010 CONTINUE

      JAK = 1

      DO 1040 I=1,NC119

        DO 1020 J=JAK,L

          IF(YE(J)) 1020,1020,1030

 1020   CONTINUE

      GO TO 1040

 1030   X132(I,J) = 1.0

        JAK = J+1

 1040 CONTINUE

I include my attempt, results and what I want.

Best answer by LucMeekes

Are you looking for this?

LucMeekes_0-1582411861840.png

Success!
Luc

16 replies

23-Emerald IV
February 22, 2020

Your Prime  and Fortran programs are different.

Assuming the Fortran code functions according to your desired behaviour (whatever that may be), these are the differences I see so far:

JAK <- JAK+1 should be JAK<J+1

You to place this JAK assigment immediately below the X132 assignment, not below/outside of thye entire IF statement.

 

Success!
Luc

1-Visitor
February 22, 2020
X132i,j  1
JAK  j + 1
gives me a 1x12 matrix, not a 2x16.
Ken
23-Emerald IV
February 22, 2020

The "IF(YE(J))" in your Fortran code looks like an IF statement at first sight, but it isn't because it is NOT followd by "THEN".

What does it do? Especially the three numbers following the IF() are puzzling. Are they line numbers? And how are they processed?

In the first Mathcad program (X119) you translated the IF(argument) with "if argument >=0" in X132 you translated a similar construct IF(argument) with 'if argument <=0". Which one of the two is right, 'less than or equal', or 'larger than or equal' ?

 

It might help a lot if you could explain what functionality you wanted to program. What is the effect that your function should accomplish, in plain text.

 

Success!
Luc