声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1277|回复: 1

[混合编程] 为什么输入变量个数不对

[复制链接]
发表于 2006-9-6 22:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
mex文件如下:
  void main0(double *input[5],double output[2])
{}
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
    double *input[5],*output[2];
        int mrows0,ncols0;
...
}

.m文件如下:
clc;
clear;
options=optimset('largescale','off','diagnostics','off','display','iter','tolx',1e-6,'tolfun',1e-6,'MaxFunEvals',500);
input0=[4.0;6.4;3.6;1800;2800];
xiajie=[0.0;0.0;0.0;0.0;0.0];
shangjie=[18;18;18;10000;10000];
mex fourthmex.c
[input,fval,flag,output]=fmincon('dandaofun',input0,[],[],[],[],xiajie,shangjie,[],options);

function [overloading,range]=dandaofun(input);
[overloading,range]=fourthmex(input);

出来的结果是:
FMINCON cannot continue because user supplied objective function failed with the following error:
Five inputs required.
Error in ==> youhua at 9
[input,fval,flag,output]=fmincon('dandaofun',input0,[],[],[],[],xiajie,shangjie,[],options);

求牛人解答   不胜感激
回复
分享到:

使用道具 举报

发表于 2006-9-8 02:33 | 显示全部楼层
估计是vb不能识别空矩阵[]
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-20 23:20 , Processed in 0.053101 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表