How to Resolve Subscript Indices Error in f2matlab Conversion?

  • Context: MATLAB 
  • Thread starter Thread starter cre_96
  • Start date Start date
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 5K views
cre_96
Messages
2
Reaction score
0
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:
 
Physics news on Phys.org
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).)