I am trying to plot within a for loop, but it is only plotting the last set of data. How would I get all three sets of data in the same graph. The code is included

조회 수: 2 (최근 30일)
for i=1:num_cols
x=[1:num_rows];
Y=ffscores(:,i);
y=Y.';
plot(x,y)
hold off
xlabel=('Week');
ylabel=('Scores');
title=('Fantasy Football Scores');
grid on
end

답변 (1개)

James Tursa
James Tursa 2017년 5월 5일
편집: James Tursa 2017년 5월 5일
Change
hold off
to
hold on
Also, I assume those labels and title were meant to be on the plot, not set as actual variables that shadow the MATLAB functions. So change these lines
xlabel=('Week');
ylabel=('Scores');
title=('Fantasy Football Scores');
to these
xlabel('Week');
ylabel('Scores');
title('Fantasy Football Scores');

카테고리

Help CenterFile Exchange에서 Probability Distributions and Hypothesis Tests에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by