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 Comment

How is printFooter being invoked ?

Answers (0)

This question is closed.

Asked:

on 1 Apr 2019

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!