Fortran调用Matlab
2011年12月27日
【试验环境】Windows 2003 server std,matlab r2007b,MinGW gcc 4.2 (sjlj)。Visual Studio 2005
【试验任务】实现在fortran程序中调用matlab编译生成的DLL。
【试验步骤】首先,创建一个简单的m代码,这里用拙作《深入浅出matlab7.x混合编程》中用到的mcctest01.m作为例子,它是一个很简单的m方程,程序代码如下:
代码:function [b]mcctest01
[/b]% MCCTEST01 Create some data and draw a 2D x-y plot
% mcctest01 is used to demonstrates how to convert M-functions into
% library files and how to use created library files with MFC
% applications.
%
% Inputs:
% None
%
% Output:
% None
%
% Copyright (c) 2005 Dong Weiguo
% create data
x = 0:.01:20;
y = x.*sin(x);
% draw a plot
plot(x,y);
xlabel('x');
ylabel('y');
然后在matlab中编译mcctest01,生成[b]libmcctest01.dll[/b]。注意,如果这是你第一次在mat
2011年12月27日
【试验环境】Windows 2003 server std,matlab r2007b,MinGW gcc 4.2 (sjlj)。Visual Studio 2005
【试验任务】实现在fortran程序中调用matlab编译生成的DLL。
【试验步骤】首先,创建一个简单的m代码,这里用拙作《深入浅出matlab7.x混合编程》中用到的mcctest01.m作为例子,它是一个很简单的m方程,程序代码如下:
代码:function [b]mcctest01
[/b]% MCCTEST01 Create some data and draw a 2D x-y plot
% mcctest01 is used to demonstrates how to convert M-functions into
% library files and how to use created library files with MFC
% applications.
%
% Inputs:
% None
%
% Output:
% None
%
% Copyright (c) 2005 Dong Weiguo
% create data
x = 0:.01:20;
y = x.*sin(x);
% draw a plot
plot(x,y);
xlabel('x');
ylabel('y');
然后在matlab中编译mcctest01,生成[b]libmcctest01.dll[/b]。注意,如果这是你第一次在mat