| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付买域名,送MP3、MP4
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY买空间,免费送域名(厦门中资源)
共有 350 人关注过本帖
标题:求助 MATLAB 接口编程
收藏  订阅  推荐  打印 
hebutyll
Rank: 1
等级:新手上路
帖子:8
积分:196
注册:2008-7-29
求助 MATLAB 接口编程

C函数代码
/*
*fact.c - returns the factorial of a nonnegative integer.
*
*MATLAB usage: p=fact(n)
*
*Mastering MATLAB 7 C MEX Example 1
*/

#include "mex.h"

void mexFunction( int nlhs,       mxArray *plhs[],
          int nrhs, const mxArray *prhs[] )
{
    double n, j, *p;
    int i;

    n=mxGetScalar(prhs[0]);
    plhs[0]=mxCreateDoubleMatrix(1.1,mxREAL);
    p=mxGetPr(plhs[0]);

    j=1.0;
    for (i=n;i>1;i--)
    j=j*i;
    *p=j;
}
当在matlab 中运行 mex fact.c 时出现下面的错误提示
fact.c(18) : warning C4244: 'function' : conversion from 'const double ' to 'int ', possible loss of data
fact.c(18) : error C2198: 'mxCreateDoubleMatrix_700' : too few actual parameters
fact.c(22) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
不胜感激!h
搜索更多相关主题的帖子: MATLAB  接口  
2008-7-29 11:21
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.048788 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved