Error: Too many outputs to function

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 ExchangeMATLAB 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