Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
初级会员
注册日期: 2010-03-28
帖子: 3
声望力: 0 ![]() |
![]()
小弟想用embeded matlab function 模块,里面代码如下:
function[p,v,h,s]=tx(t,x) p=psaturation(t); [vwater,hwater,swater]=ptwater(p,t); [vsteam,hsteam,ssteam]=ptsteam(p,t); v=vwater+x*(vsteam-vwater); h=hwater+x*(hsteam-hwater); s=swater+x*(ssteam-swater); 其中p=psaturation(t); vwater,hwater,swater]=ptwater(p,t); [vsteam,hsteam,ssteam]=ptsteam(p,t); 是三个M函数,运行时正确无误,但当运行这个embeded matlab function 模块时出现以下错误: 1,Expected either a logical, char, single, or double. Found an mxArray. mxArrays are returned from calls to the MATLAB interpreter and are not supported inside expressions. They may be used on the right-hand side of assignments and as arguments to MATLAB calls. Function 'tx' (#82.131.137), line 6, column 13: "vsteam" 2,Expected either a logical, char, single, or double. Found an mxArray. mxArrays are returned from calls to the MATLAB interpreter and are not supported inside expressions. They may be used on the right-hand side of assignments and as arguments to MATLAB calls. Function 'tx' (#82.159.165), line 7, column 13: "hsteam" 3,Expected either a logical, char, single, or double. Found an mxArray. mxArrays are returned from calls to the MATLAB interpreter and are not supported inside expressions. They may be used on the right-hand side of assignments and as arguments to MATLAB calls. Function 'tx' (#82.187.193), line 8, column 13: "ssteam" 4,Errors occurred during parsing of Embedded MATLAB function 'tx'(#82) 5,Embedded MATLAB Interface Error: Port width mismatch. Input port "x"(#89) expects a scalar. The signal is a one dimensional vector with 1 elements. 不知道是不是能这样调用函数的原因?望高手解答下!先谢谢了! |
![]() |
![]() |
![]() |
#2 |
初级会员
注册日期: 2010-04-01
年龄: 39
帖子: 1
声望力: 0 ![]() |
![]()
在应用函数时应该
p=@psaturation(t);、、、、、、、 |
![]() |
![]() |
![]() |
#3 |
初级会员
注册日期: 2010-03-28
帖子: 3
声望力: 0 ![]() |
![]()
首先谢谢楼上的回答,我试了下,还是报错,不过已找到解决办法,即把调用函数的代码写在此模块里就没有问题,和C的用法很相似。
|
![]() |
![]() |