0

Dimensions of the EEG matrices indicate number of channels by number of sampling points by number of segments, i.e. in the EEG data holding segments of 10s duration, we have 8 channels, 5121 sampling points and 30 segments.

Properties:

sample_rate                1x1         8             
double ssvep0Hz            8x5121x30   9832320      
double ssvep10_7143Hz      8x5121x30   9832320     
double ssvep12_5Hz         8x5121x30   9832320     
double ssvep15Hz           8x5121x30   9832320    
double ssvep9_375Hz        8x5121x30   9832320    
double time                1x5121      40968      
double

I am not able to plot as it is 3d data and i dont know how to play with channels segments and sampling points.

MichaelTr7
  • 4,737
  • 2
  • 6
  • 21

1 Answers1

1

If I understand correctly, you want to plot a segment (3rd index) of the measured voltages stored in the ssvep* variables against time stored in the time variable. Have you tried the following to plot the 5th segment of the ssvep0Hz variable:

%% Generate some data
sampleRate = 5.120; % sample rate in kHz
nSamples = 10*(1000*sampleRate); % time_seconds*sampleRate_Hz)

ssvep0Hz = rand(8,nSamples,30)+repmat((1:8)',1,nSamples);
time=(1:nSamples)/(sampleRate*1000);

%% specify a segment and extract series
segmentNumber=5; % Specify segmentNumber
extractedSegment = ssvep0Hz(:,:,segmentNumber); % use colon operator `:` to extract all elements in the first two dimension and `segmentNumber to extract a specific index in the third dimension

%% Plot the data and format 
plot(time, extractedSegment);

% add axis label and legends
xlabel('Time (s)');
ylabel('Data');
legend;

Here is the plot from above code

Plot of 8 channels of data extracted from 8x5120x30 time series

Azim J
  • 8,260
  • 7
  • 38
  • 61
  • Thank you for the reply.sample_rate are 512, sorry i did not mentioned that, i need to Plot any segment of any raw data matrix, with time at the x-axis and the voltage (the actual data) at the y-axis, I dont underatand why you took only third index – Ankush Rahul khanna Jan 07 '21 at 12:24
  • @AnkushRahulkhanna I understood the third dimension represents each segment. So, I arbitrarily extract the 5th segment and plot the channels (first index) and sample number (second index) against `time`. If you want to plot a different segment you would change the value of `segmentNumber`. You could put this in a for-loop to generate a figure for each segment that updates the segment number and creates a new figure. Does that make sense? – Azim J Jan 12 '21 at 03:49