Unable to perform assignment because the indices on the left side are not compatible with the size of the right side. What does this mean?

1 Ansicht (letzte 30 Tage)
%% input data matrix
DDD=load('data2.mat');
data=DDD.data;
N_max=length(data);
window_size=256*3; %% 256 for 1 second ==> 3 seconds
step_win=128*3; %% overlapping window ...by 50%
segment=zeros(4798,768);
count=0;
for n_start = 1:step_win:(N_max-window_size)
count=count+1;
Segment(n_start)=data(n_start:(n_start+ window_size-1));
end
plot(Segment)
xlabel('time')
grid on;
title('data of channel1');

Antworten (1)

James Tursa
James Tursa am 15 Okt. 2019
Look at this line:
Segment(n_start)=data(n_start:(n_start+ window_size-1));
and simply plug in the numbers for the first iteration to see what is going on:
Segment(1)=data(1:(1+ 256*3-1));
or
Segment(1)=data(1:768);
You can't stuff 768 elements into a 1 element spot.

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by