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 Center および File ExchangeMultidimensional Arrays についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by