How to plot a definite range of values in a for loop?

1 回表示 (過去 30 日間)
Emrys
Emrys 2017 年 10 月 17 日
コメント済み: Andrei Bobrov 2017 年 10 月 18 日
Hi guys, I have a file of 8760 values ( 24 hours *365 days) i need to plot only the data from 11am to 3 pm for each day of the year, can someone help me? I think a for loop could be the solution but i cannot compute it.

回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2017 年 10 月 17 日
Let Y - your data (24 x 365);
plot(Y(12:15,:))
  2 件のコメント
Emrys
Emrys 2017 年 10 月 17 日
Thank you for the answer but i still have a problem, i tried with for i=1:365
plot (Y((11+24.*(i-1)):(16+24.*(i-1))));
but i can not compute the command "hold on" into a for loop
Andrei Bobrov
Andrei Bobrov 2017 年 10 月 18 日
for ii = 1:size(A,2)
plot(Y((11+24.*(ii-1)):(16+24.*(ii-1)));
if ii == 1
hold on;
end
end

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by