plot many channels with same x axis and repeated y axis values

Hello Everyone,
I would like to know which method could be the best in order to get an image like the one in the attachments
it represent a linear probe that goes deep into the brain surface, whith 16 channels in Y axis. As you could see, each channels displays different values, but they share the same x-y axis range.
i have a matrix with 2000 time points filled with values x 16 channels. I would like to get an image close to the one displayed, plus the function should make easy to change the range of channels displayed (16 now and then 5 channels only)
Thanks so much in advance

 Accepted Answer

X = rand(20, 200); % Some test data
XX = X + (0:19).'; % Shift vertically
plot(1:200, XX)

5 Comments

hi @Jan,
thanks for your reply. Unfortunately, the function failed in providing the proper solution. The visualization layout is amazing (exactly what I was looking for) but the line within the graph are flat (no actual data are being showed in the graph). any idea how to fix it?
@Jan the code being used
new_ch_32 = new_ch(:,1:32); %new_ch is a 6478848 x 33 matrix, I'm getting rid of ch 33
new_c_swap = permute(new_ch_32,[2,1]); % use this to swap the index
XX = new_c_swap + (1:32).'; % Shift vertically
plot(1:6478848, XX)
%axis([ylim 0 90000]) % Set Axis Limitsnew_ch_32 = new_ch(:,1:32);
permute(X, [2,1]) can be simplified to X.' , because this is transposing.
Maybe your data have to be scaled:
Y = new_ch(:, 1:32).';
Y = Y ./ max(abs(Y), [], 1); % Divide by maximum value
% Then all values are between -1 and 1
Y = Y + (1:32).';
plot(1:width(Y), Y);
it worked so nice! thanks @Jan!
just one more question. i should label with vertical dotted lines many time point in the x axis which represent trigger events. how could I proceed?
X = rand(20, 200); % Some test data
XX = X + (0:19).'; % Shift vertically
plot(1:200, XX);
YL = get(gca, 'YLim');
T = rand(1, 20) * 200; % Some time points
line([T; T], YL, 'LineStyle', ':', 'Color', 'k', ...
'LineWidth', 1.5);

Sign in to comment.

More Answers (0)

Products

Release

R2022b

Asked:

on 30 Oct 2022

Edited:

Jan
on 1 Nov 2022

Community Treasure Hunt

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

Start Hunting!