How to separate two graphs plotted in one figure into two separate figures?

31 ビュー (過去 30 日間)
Soeun Lee
Soeun Lee 2021 年 8 月 6 日
回答済み: Peter Perkins 2021 年 8 月 6 日
Hi all,
What I am trying to do is to have one plot with the orange graph and another plot with the blue graph. However, right now the orange and blue graphs are being plotted together in one plot. How should I modify my code so that they are no longer plotted together in one plot?
Thanks in advance for your help.
  2 件のコメント
Chunru
Chunru 2021 年 8 月 6 日
copy the code instead of screen capture.
Soeun Lee
Soeun Lee 2021 年 8 月 6 日
init_time=input('Initial time (s):')
init_mn=fix(init_time/60);
init_s= floor(init_time-(init_mn*60));
init_ms=(init_time-(init_s+(init_mn*60)))*1000;
end_time=input('End time (s):')
end_mn=fix(end_time/60);
end_s= floor(end_time-(end_mn*60));
end_ms=(end_time-(end_s+(end_mn*60)))*1000
for di=1:length(CHANNEL)
load (append('210603_bare-210727-182826','ch',string(CHANNEL(di))))
neural = timetable(RawData,'SampleRate',fs);
neural.Properties.VariableNames{1} = 'raw';
neural.Properties.VariableUnits{1} = 'Volts';
HighPass = 300;
LowPass = 5000;
[Z, P, K] = butter(5, [HighPass LowPass]/(fs/2), "bandpass");
sos = zp2sos(Z, P, K);
neural.raw = double(neural.raw);
neural.spikes = sosfilt(sos,RawData);
figure; plot(neural.Time,neural.spikes)
%for idx=1:NO_CHAN
%figure(idx)
%plot(neural.Time,neural.spikes)
%end
xlim([duration(0,init_mn,init_s,init_ms) duration(0,end_mn,end_s,end_ms)])
ylim([-1e-4 1e-4])
end

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

採用された回答

Dave B
Dave B 2021 年 8 月 6 日
編集済み: Dave B 2021 年 8 月 6 日
Is neural.Spikes two columns?
If so:
figure;
nexttile % starting in R2019b, in older versions subplot(1,2,1)
plot(neural.Time,neural.spikes(:,1))
nexttile % starting in R2019b, in older versions subplot(1,2,2)
plot(neural.Time,neural.spikes(:,2))
(If it's two rows, replace the (:,1) with (1,:) and (:,2) with (2,:))
Example:
t = 1:100;
spks = rand(100,2);
nexttile;
plot(t,spks(:,1))
nexttile
plot(t,spks(:,2))

その他の回答 (1 件)

Peter Perkins
Peter Perkins 2021 年 8 月 6 日
If spikes were two separate variables in a timetable (see splitvars), this would just be stackedplot(neural).

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by