Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Trouble with using f2matlab

  1. Apr 23, 2007 #1
    Hi!
    I've got some trouble with using f2matlab.
    I need to convert a f90 source code into matlab code.In order to do this i type on matlab command window:
    >>f2matlab('filename.f90');
    but matlab displays the following error:

    ??? Subscript indices must either be real positive integers or logicals.

    Error in ==> f2matlab at 130
    if ~inastring_f(filestr(temp7(temp6(j)):temp7(temp6(i))),temp7(temp6(i))-temp7(temp6(j))+1)


    Does anybody know how to fix it?
    :cry:
     
  2. jcsd
  3. Apr 23, 2007 #2

    J77

    User Avatar

    I would think that your i (or j) goes from 0,1,2,3,...

    temp6(0), temp6(1),...

    Matlab doesn't reference elements at zero.

    Maybe try rewriting the fortran code so that i and j go from 1,2,3,...

    temp6(1), temp6(2),... =equal the old temp6(0), temp6(1),...

    (I haven't used f2matlab but would have assumed that it reassigned these calls automatically (same if I ever wanted to convert C to Matlab).)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Trouble with using f2matlab
  1. Fprintf trouble (Replies: 3)

  2. Maltab trouble (Replies: 0)

Loading...