f2matlab

  • Follow


Hi Guys, 

If possible could someone give me a brief method of how to use the f2matlab program created by Ben Burrows. my programming skills are limited but i have a 200 line FORTRAN program which needs to be converted to MATLAB. 

Im basically tuck at the first hurdle - i opened the file called f2matlab and in the first line where it says f2matlab(filename) i substituted my fortran program which has the extension: C:\Users\Kane\Documents\msphere.f
but in doing so a whole hows of errors occurred. is says in the program "Call with the full function name as a string, including extension." but again i dont know what format it actually wants it in. 

so any help in getting me up and running would be of unbelievable use!!!

Thanks alot

Kane
0
Reply Kane 2/11/2011 11:04:04 AM

"Kane " <kanemiller@hotmail.com> wrote in message <ij3533$8be$1@fred.mathworks.com>...
> Hi Guys, 
> 
> If possible could someone give me a brief method of how to use the f2matlab program created by Ben Burrows. my programming skills are limited but i have a 200 line FORTRAN program which needs to be converted to MATLAB. 
> 
> Im basically tuck at the first hurdle - i opened the file called f2matlab and in the first line where it says f2matlab(filename) i substituted my fortran program which has the extension: C:\Users\Kane\Documents\msphere.f
> but in doing so a whole hows of errors occurred. is says in the program "Call with the full function name as a string, including extension." but again i dont know what format it actually wants it in. 
> 
> so any help in getting me up and running would be of unbelievable use!!!
> 
> Thanks alot
> 
> Kane

I haven't used the f3matlab program but I suspect what you want to do is:

  1. Put the f2matlab file in C:\Users\Kane\Documents
  2. Open matlab and add the documents directory to your matlab path
      - put "addpath 'C:\Users\Kane\Documents' " at the matlab command prompt.
  3. Call the f2matlab function with your fortran program name:
      - put " f2matlab('msphere.f') " at the matlab command prompt

I' suggest you try some of the Matlab tutorials http://www.mathworks.com/academia/student_center/tutorials/launchpad.html
(Please don't take the instructions as patronizing, I'm trying to err on the side of caution.)
0
Reply Hazel 2/11/2011 11:44:06 AM


Thank you Hazel for replying so quickly, and no i dont find it patronising i like clear instrucions... less room for ambiguity. 

I did what u said and the program started running then i got the following error:

??? Too many outputs requested.  Most likely cause is missing [] around
left hand side that has a comma separated list expansion.

Error in ==> findendSub_f at 80
         sublist{slLen+1,7}=sublist{temp6,1};

Error in ==> f2matlab at 899
 [sublist,funstr,funstrnumbers,funstrnumbers_b,funstrnumbers_e,funstrwords,funstrwords_b,funstrwords_e,fs_good]=findendSub_f([],sublist,s,funstr,funstrnumbers,funstrnumbers_b,funstrnumbers_e,funstrwo 

Any idea what this means?

kane
0
Reply Kane 2/11/2011 12:09:04 PM


"Kane " <kanemiller@hotmail.com> wrote in message 
news:ij3533$8be$1@fred.mathworks.com...
> Hi Guys,
> If possible could someone give me a brief method of how to use the 
> f2matlab program created by Ben Burrows. my programming skills are limited 
> but i have a 200 line FORTRAN program which needs to be converted to 
> MATLAB.
> Im basically tuck at the first hurdle - i opened the file called f2matlab 
> and in the first line where it says f2matlab(filename) i substituted my 
> fortran program which has the extension: C:\Users\Kane\Documents\msphere.f
> but in doing so a whole hows of errors occurred. is says in the program 
> "Call with the full function name as a string, including extension." but 
> again i dont know what format it actually wants it in.
> so any help in getting me up and running would be of unbelievable use!!!

Do you need to convert this code into MATLAB code or do you just need to 
make use of it in MATLAB?

If the latter is the case, perhaps writing a Fortran MEX-file interface that 
serves as a translator between MATLAB and your Fortran program would be 
sufficient for your needs.  See the External Interfaces section of the 
MATLAB documentation for a description of how to write Fortran MEX-files, 
including a description of the signature of the MEX-file interface.

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 

0
Reply Steven_Lord 2/11/2011 2:29:30 PM

Ideally i would like to convert it into matlab because i need to expand on the existing code.  I will however investigate the use of a mex file. 

kane  
0
Reply Kane 2/11/2011 2:50:04 PM

"Kane " <kanemiller@hotmail.com> wrote in message <ij3ias$l8r$1@fred.mathworks.com>...
> 
> Ideally i would like to convert it into matlab because i need to expand on the existing code.  I will however investigate the use of a mex file. 
> 
> kane  

Kane,

Did you go through the README included with f2matlab? That gives some examples of how to run f2matlab. It also gives some pointers on what the fortran code needs to look like. For example, your program might be in the older fortran77 fixed format, but f2matlab works better with fortran90 free format. Also make sure there is a program statement at the beginning of the file and no goto's in the program.

If you still can't get it going, post the code here or PM me and I can take a quick look at the code.

Ben Barrowes
0
Reply Ben 2/12/2011 2:37:03 PM

"Hazel " <haz.duncan@tiscali.co.uk> wrote in message <ij37e6$8ar$1@fred.mathworks.com>...
> "Kane " <kanemiller@hotmail.com> wrote in message <ij3533$8be$1@fred.mathworks.com>...
> > Hi Guys, 
> > 
> > If possible could someone give me a brief method of how to use the f2matlab program created by Ben Burrows. my programming skills are limited but i have a 200 line FORTRAN program which needs to be converted to MATLAB. 
> > 
> > Im basically tuck at the first hurdle - i opened the file called f2matlab and in the first line where it says f2matlab(filename) i substituted my fortran program which has the extension: C:\Users\Kane\Documents\msphere.f
> > but in doing so a whole hows of errors occurred. is says in the program "Call with the full function name as a string, including extension." but again i dont know what format it actually wants it in. 
> > 
> > so any help in getting me up and running would be of unbelievable use!!!
> > 
> > Thanks alot
> > 
> > Kane
> 
> I haven't used the f3matlab program but I suspect what you want to do is:
> 
>   1. Put the f2matlab file in C:\Users\Kane\Documents
>   2. Open matlab and add the documents directory to your matlab path
>       - put "addpath 'C:\Users\Kane\Documents' " at the matlab command prompt.
>   3. Call the f2matlab function with your fortran program name:
>       - put " f2matlab('msphere.f') " at the matlab command prompt
> 
> I' suggest you try some of the Matlab tutorials http://www.mathworks.com/academia/student_center/tutorials/launchpad.html
> (Please don't take the instructions as patronizing, I'm trying to err on the side of caution.)


It works.

Thank you so much.
0
Reply 5kevingarnett (1) 4/3/2013 2:52:13 PM

6 Replies
237 Views

(page loaded in 0.06 seconds)

Similiar Articles:
















7/22/2012 4:04:24 PM


Reply: