lxl723
2010-03-29, 21:25
小弟想用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.
不知道是不是能这样调用函数的原因?望高手解答下!先谢谢了!
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.
不知道是不是能这样调用函数的原因?望高手解答下!先谢谢了!