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