Undefined operator '*' for input arguments of type 'cell'

I am getting this error-"Undefined operator '*' for input arguments of type 'cell'".
T1=T(i,1);
u1=u(i,1);
Rn1=Rn(i,1);
RH1=RH(i,1);
e=0.61078*exp(17.269*{T1}/(237.3+{T1}));
d=e*(17.269/(237.3+{T1}))*(1-({T1}/(237.3+{T1})));
y=0.665-3*96.7;
G=0.5*Rn1;
ET=(0.408*(d(T1))*(Rn1-G(Rn1))+y*(900/({T1}+273))*u1*e(T1)*(1-RH1))/(d(T1)+y*(1+0.34*{u1}));

답변 (1개)

Star Strider
Star Strider 2017년 10월 30일
You are using curly brackets ‘{}’ here and in later assignments:
e=0.61078*exp(17.269*{T1}/(237.3+{T1}));
They define a cell, and since cells can contain anything — including character variables — arithmetic operators are not defined for them. You have to remove numeric data from cell arrays to use them in numeric calculations.
Since we can assume ‘T1’ is numeric, the solution is simply to remove the curly brackets:
e = 0.61078*exp(17.269*T1/(237.3+T1));
Unless matrix ‘T’ has previously been defined as a cell array (we can’t tell from the code you posted), that should work.

댓글 수: 8

Still not resolved! The error is in ET step! I have attached a formula which I want to write! Help me resolve!
ET=(0.408*(d)*(Rn1-G)+y*(900/(T1+273))*u1*e*(1-RH1))/(d+y*(1+0.34*u1));
@Walter Roberson now its showing "undefined operator '+' for input arguments of type 'cell'"
Stephen23
Stephen23 2017년 10월 31일
편집: Stephen23 2017년 10월 31일
@Vraj Pandya: that is exactly the same problem, and the solution is exactly the same too. Read Star Strider's answer and Walter Roberson's comment again.
@Walter — Thank you!
@Stephen — Thank you!
T1=T(i,1);
u1=u(i,1);
Rn1=Rn(i,1);
RH1=RH(i,1);
e=0.61078*exp(17.269*T1/(237.3+T1));
d=e*(17.269/(237.3+T1))*(1-(T1/(237.3+T1)));
y=0.665-3*96.7;
G=0.5*Rn1;
ET=(0.408*(d)*(Rn1-G)+y*(900/(T1+273))*u1*e*(1-RH1))/(d+y*(1+0.34*u1));
Thanks a lot @Walter @Stephen @Strider code worked :)
Our pleasure!

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Time Series Objects에 대해 자세히 알아보기

질문:

2017년 10월 30일

댓글:

2017년 10월 31일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by