Help translating excel equation to matlab

4 次查看(过去 30 天)
I have the following equation in excel that I am trying to translate into matlab code...with much difficulty
=IF(M5>$AD$17,$AD$5+$AD$8,IF(N5>0,$AD$5+(O4-$AD$5)*EXP((IF(F5>273.16,$AD$11,$AD$14))*0.04167),0))
I don't know how to handle the last embedded IF statement...
This is what I have come up with, but I keep getting an error.
if T(t)>273.16;
Z(t)=DPp;
else
Z(t)=DPn;
end
if Ps(t)>SS; %Albedo
Albedo(t)=Amin+Aadd;
if SnowAge(t)>0;
Albedo(t)=Amin+(Albedo(t-1)-Amin)*exp(Z(t)*0.04167);
else
Albedo(t)= 0;
end
end
Thank you for any direction/help
  1 个评论
Geoff Hayes
Geoff Hayes 2016-2-4
Jessica - if I translate the Excel statement into something like pseudocode, wouldn't the above be
IF(M5>$AD$17)
x = $AD$5+$AD$8;
ELSE
IF(N5>0)
IF(F5>273.16)
y = $AD$11;
ELSE
y = $AD$14;
END
x = $AD$5+(O4-$AD$5)*EXP(y*0.04167);
ELSE
x = 0;
END
END
where x is the value of the cell that contains this Excel code (y is just a temporary value).

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by