| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1015 人关注过本帖
标题:求助 MATLAB 接口编程
只看楼主 加入收藏
hebutyll
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2008-7-29
收藏
 问题点数:0 回复次数:0 
求助 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-07-29 11:21
快速回复:求助 MATLAB 接口编程
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014384 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved