Undefined function or varible
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
I keep getting "Undefined function or varible 'wins' " although wins has a value of 22 in the workspace. I do not understand whats wrong. I have a separate user defined function in the same folder as my file below. I have code from the file as to where I got my values from, as well as the function code below that. Can someone help explain what I might be doing wrong?
File:
[month, day, year, atvs, opponent, auburnSc, oppSc] = textread(FILENAME,...
'%f %f %f %s %s %f %f', 31);
dates = [month, day, year];
scores = [auburnSc, oppSc];
wins = length(find( auburnSc > oppSc)); % wins = 22
losses = length(find( oppSc > auburnSc)); % losses = 9
User defined funtion:
function [] = printFooter( scores, wins, losses )
% print number wins, losses; highest and lowest points
fprintf('Season wins: %2.0f\n', wins)
fprintf('Season losses: %2.0f\n', losses)
mostPts = max(scores);
leastPts = min(scores);
fprintf('Most pts: %3.0f %3.0f\n', mostPts)
fprintf('Least pts: %3.0f %3.0f\n', leastPts)
end
1 个评论
Walter Roberson
2019-4-1
How is printFooter being invoked ?
回答(0 个)
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!