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
1 回表示 (過去 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
0 件のコメント
回答 (1 件)
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');
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!