
Technical discussion about Matlab and issues related to Digital Signal Processing.
Hi all,
I am so interesting nowadays in calling a fortrun code from the Matlab or ,what I need is,
converting a Fortran code to a Matlab code.
(How I can run a Fortran file as if it's a Matlab file?).
I tried to learn how to do this from the "mathworks.com":
--------------------------------------------------------
There exist two topics (in "mathworks.com"):
1. Calling C and Fortran Programs from MATLAB Command Line
2. Calling MATLAB Software from C and Fortran Programs
I do not know which of them can help.
For the first topic in creating "Mex-files" to call fortran programs or creating
fortran Mex-files
(http://www.mathworks..com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdo
c/matlab_external/f23224.html&http://www.google.co.uk/search?hl=en&q=fortrun+to+matlab&
amp;meta=),
there are "Examples of Fortran Source MEX-Files":
http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/
matlab_external/f23224.html&http://www.google.co.uk/search?hl=en&q=fortrun+to+matlab&am
p;meta=.
I tryed to follow the examples discussed in the latter link:
1. I entered the following in the MATLAB command window:
edit([matlabroot '/extern/examples/refbook/timestwo..F']);
Then, Matlab opened a file "timestwo.F"
2. At the command prompt, I typed:
mex timestwo.F
But, Matlab prints:
[
C:\PROGRA~1\MATLAB\R2008A\BIN\MEX.PL: Error: 'timestwo.F' not found.
??? Error using ==> mex at 207
Unable to complete successfully.
]
While it's supposed that (as written in the "mathworks.com"):
"
This command creates the binary MEX-file called timestwo with an extension corresponding to the
machine type on which you're running. You can now call timestwo as if it were an M-function.
Type:
x = 2;
y = timestwo(x)
MATLAB displays:
y =
4
"
3. When I type in the command window:
>>x = 2;
>> y = timestwo(x)
(the Matlab prints this error message)
??? Error using ==> timestwo
MEX level2 S-function "timestwo" must be called with at least 4 right hand arguments
___________________________________________________________________
Please, would you mind to help me understanding why the Matlab do not type what should by typed
when I follow the examples discuseed in the
"mathworks.com"(http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/acc
ess/helpdesk/help/techdoc/matlab_external/f23224.html&http://www.google.co.uk/search?hl=en&
amp;q=fortrun+to+matlab&meta=).?
Again, what I am trying to do is running a Fortran file from the Matlab (or even as if it's a
Matlab file).
Please, would you mind to help me to do this?
Thanks,
Best Regards,
math_beam.