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 visualizzazione (ultimi 30 giorni)
%% 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');

Risposte (1)

James Tursa
James Tursa il 15 Ott 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.

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by