Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8480073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:12:14+00:00 2026-06-10T19:12:14+00:00

I’m currently translating code from Fortran to MATLAB manually, and I am unsure of

  • 0

I’m currently translating code from Fortran to MATLAB manually, and I am unsure of how to translate part of it. (The entire code actually is a 2,000 line subroutine.) The code is below.

C  Has series crossed neckline?
120        neckext=x(trough(peaknum-1))+
 *              dydx*real((t-trough(peaknum-1)))


        if(x(t).lt.neckext) goto 130
C      NO.  Here if series has not crossed neckline, nor new trough found
C           Check to see if new trough has been found.
        t=t+1
        if(t.ge.lastobs) goto 900
        if(x(t).lt.min) then
              min=x(t)
              mindate=t
              end if
        troughid=min*(1.0+cutoff)
        if(x(t).ge.troughid) goto 150
        goto 120

C      YES. Here if series crossed neckline before new trough found
130         dblcount=0
      if(poscount.ge.1) then
          DO 132 i=1,poscount
           if((enterdt(i)-2.le.t).and.(t.le.enterdt(i)+2)) then
           dblcount=dblcount+1
           end if    
132          continue
           if(dblcount.ge.1) then
C                write(30,2583) t,Cutnum
2583            format('DoubleCounting episode occurred at ',I5,
 *             ' with Cutoff = ',F3.1)
            goto 150
          end if
       end if

My problem is with this part of the code:

        if(x(t).ge.troughid) goto 150
        goto 120

When I was translating this part in MATLAB, I was writing something like:

if x(t,:)>=troughid
    t=marker;
    minimum=x(t,:);
end

But I don’t know what to do with the label 120. When I translate it, do I write that part again? Because from what I understand, when I go back to 120, the code will be running again. Thanks!

EDIT: As a response to Chris’s question on what labels 150 and 900 do, I’ll post them here.

150        t=marker
           min=x(t)

And this is for the label 900.

C  Last observation found.  This iteration finished.
900        continue
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:12:15+00:00Added an answer on June 10, 2026 at 7:12 pm

    As it should be clear by now, Matlab does not include any variant of a “goto” command. The core Matlab command set appear to be designed around the “structured programming” philosophy. (Which, if I remember my CS ancient history correctly, was the great debate prior to object oriented programming.) Wikipedia has a decent discussion of structured programming.

    In the dark days before structured programming, people used to be very excited about flow charts, since that was one of the easiest ways to visualized and understand a piece of code using a lot of goto statements (now usually referred to as spaghetti code).

    I suspect that you will need to flowchart the entire subroutine, and then decide which control flow constructs can best be used to recreate your code. If it is a relatively simple diagram, then you should be able to recreate the entire code with if statements or case statements, although a series of small helper functions may be more elegant. If it has a more complex structure, then it may take a little more creativity to translate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.