How to create a matrix out from the output of a formula... I am trying to find the ave of the data entered but it just stores the final ave computed from a list of data, im trying to create a loop that will store the results in a matrix s
1 view (last 30 days)
Show older comments
function [] = reportGraph(data, scores, stats)
% print report and draw graph
% print table
fprintf('2020 AU Softball Batting Stats as of 03/01\n')
fprintf('Date Scores W/L AB Runs Hits HRuns Ave\n')
for i=1:(data)
ave=stats(3,i)/stats(1,i);
i=i+1;
end
disp (ave)
for x= 1:length(data)
if scores(1,x) > scores(2,x)
fprintf('%02.0f/%02.0f %02.0f-%02.0f W %2.0f %2.0f %2.0f %2.0f %5.3f\n', data(:,x),scores(:,x), stats(:,x),i)
else
fprintf('%02.0f/%02.0f %02.0f-%02.0f L %2.0f %2.0f %2.0f %2.0f %5.3f\n', data(:,x),scores(:,x), stats(:,x),i)
end
end
scoreAuAve = mean(scores(:,1));
scoreOpAve = mean(scores(:,2));
abAve = mean(stats(1,:));
runsAve = mean(stats(2,:));
hitsAve = mean(stats(3,:));
hrunsAve = mean(stats(4,:));
aveAve = mean(i(:));
fprintf('Ave: %03.1f-%03.1f %4.1f %3.1f %3.1f %3.1f %5.3f\n', scoreAuAve,scoreOpAve,abAve,runsAve,hitsAve,hrunsAve,aveAve)
plotGraph(scores)
end
5 Comments
Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!