indexing multiple subjects and then making multiple different lines for each subject?

1 回表示 (過去 30 日間)
nines
nines 2021 年 3 月 4 日
編集済み: nines 2021 年 3 月 4 日
Hello!
I have a for loop for two subjects where I am graphing their time series.
I want to 1) manually put and index certain time segments for sleep, e.g. lines = [30:35, 60:70] [10:20, 65:70].
and then 2) I want to use this index to plot two lines on each graph that have different values.
I've used the yline and then now the line function which works but I need it to be the sleep index instead:
lines = [30:35, 60:70] [10:20, 65:70]
for k = 1:length(subj)
%plotting
subplot(2,1,k); hold on
plot(whole_ts{k}, detrend_ts{k}); hold on
line([30,60],[y,y], 'LineWidth',8) %THIS IS THE LINE
%yline(-15,'LineWidth',8)
yl.Color = [.80 0 .40];
ylim([-15 15])
end
this is along the lines of what I want:
lines = [30:35, 60:70] [10:20, 65:70]
for k = 1:length(subj)
%plotting
subplot(2,1,k); hold on
plot(whole_ts{k}, detrend_ts{k}); hold on
line(lines,[y,y], 'LineWidth',8) %THIS IS THE LINE
%yline(-15,'LineWidth',8)
yl.Color = [.80 0 .40];
ylim([-15 15])
end
can anyone help me?
here is an example of what i want to do (the red line):

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by