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 次查看(过去 30 天)
%% 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');

回答(1 个)

James Tursa
James Tursa 2019-10-15
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.

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by