필터 지우기
필터 지우기

Concatenate 2/more graphs into 1 graph

조회 수: 9 (최근 30일)
Edoardo
Edoardo 2023년 4월 7일
댓글: Star Strider 2023년 4월 7일
I've a problem to combine 2 graphs into 1 graph. The data is taken from Read EDF file. Then I did the plotting for 2 different graphs. Then I get this graph
if you look at those graphs closely, actually both of them can be concatenated together, so that the second graph on the right started from 10-20, continuing the first graph on the left. But I can't figure it out how to do it. For your info, I also attached the code in here, so that it's clear what I mean. Thank you
tt = edfread('example.edf');
info = edfinfo('example.edf');
fs = info.NumSamples/seconds(info.DataRecordDuration);
recnum = 1;
signum = 1;
t = (0:info.NumSamples(signum)-1)/fs(signum);
y1 = tt.(signum){recnum};
recnum = 2;
signum = 1;
y2 = tt.(signum){recnum};
subplot(1,2,1); plot(t,y1); subplot(1,2,2); plot(t,y2)

채택된 답변

Star Strider
Star Strider 2023년 4월 7일
I do not have your files, however this is straightforward —
t1 = linspace(0, 10, 250);
signal1 = randn(size(t1));
t2 = linspace(0, 15, 250);
signal2 = randn(size(t2));
figure
tiledlayout(1,2)
nexttile
plot(t1,signal1)
nexttile
plot(t2,signal2)
figure
plot(t1, signal1)
hold on
plot(t2+t1(end), signal2)
hold off
I kept them different colours for clarity, and they will be plotted this way by default. It is straightforward to set the colours to be the same.
.
  댓글 수: 2
Edoardo
Edoardo 2023년 4월 7일
by the way, the file can refer to here, the "example.edf" file provided in the MATLAB. Anyway, it already works, thank you :)
Star Strider
Star Strider 2023년 4월 7일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Networks에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by