How to convert this FORTRAN code in to Matlab code
1 view (last 30 days)
Show older comments
Saurabh Kumar
on 30 Apr 2015
Commented: Saurabh Kumar
on 1 May 2015
Hi guys, I am having problems converting this Fortran code in Matlab
_if (test.lt.temp)then
check=.false.
return
end if_
this " if loop " is inside a " Do loop "
I can understand that " end if " ends the if loop but why is there a " return " statement? someone pls help....
0 Comments
Accepted Answer
James Tursa
on 30 Apr 2015
Edited: James Tursa
on 30 Apr 2015
The return statement in Fortran does the same thing as the return statement in MATLAB ... it immediately exits the routine and returns to the calling routine. You can leave that line exactly as written.
One issue you might run into with an early return like this in MATLAB is potentially not having the output variables set. So you may have to add some dummy code for this in MATLAB to avoid "output variables not set" warnings in MATLAB.
More Answers (0)
See Also
Categories
Find more on Fortran with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!