I'm a student in an entree level programming class.
I'm using Freemat just in case that becomes a problem, but I have a hopefully simple question In my main script,
for i=2:5
T(i)=nodeTemperature(i,T,h);
end
then in the nodeTemperature script,
function nodeTemperature(i,T,h)
evalin('base','T(i-1) + T(i+1) + (h^2)*B*Ts / ( (h^2)*B+2)');
is giving me "Too many outputs" I've defined h and B already in my script and when I type out for instance "nodeTemperature(2,T,h)" in the command window it returns the value I am expecting. But when I try to set it equal to T(i)it gives me the error. I'm required to have the "T(i)" be defined by a function using evalin inside the function. I've gotten it to work when I eliminated the function but I won't get credit for the assignment.
I'm really really new to this and I could use the help, thanks

 채택된 답변

Walter Roberson
Walter Roberson 2014년 4월 28일
편집: Walter Roberson 2014년 4월 28일

0 개 추천

function r = nodeTemperature(i,T,h)
B = evalin('base', 'B');
Ts = evalin('base', 'Ts');
r = T(i-1) + T(i+1) + (h^2) * B*Ts / ( (h^2)*B+2));

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB Parallel Server에 대해 자세히 알아보기

질문:

2014년 4월 28일

편집:

2014년 4월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by