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

1 view (last 30 days)
nines on 4 Mar 2021
Edited: nines on 4 Mar 2021
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): 