index out of bounds because size(BP)=[0,0].

1 visualización (últimos 30 días)
Dmitry
Dmitry el 6 de Mzo. de 2012
function [ BPw ] = BPSlidingWindow( BP, n )
m = size(BP,1);
MeanMatrix = zeros(m+n+1, m+2);
MeanMatrix(1:n, :) = 1/n;
Tmp = circshift(MeanMatrix(:), n);
Tmp = reshape(Tmp(1:(end-m-2)), m+n, m+2);
mp = Tmp((n+1):end, 1:(end-2));
Tmp = Tmp./repmat(sum(Tmp, 1), size(Tmp,1), 1);
BPw = [BP(:,1), ( (Tmp')*BP(:,2:end))];
end
Attempted to access BP(:,1); index out of bounds because size(BP)=[0,0].
Error in BPSlidingWindow (line 14) BPw = [BP(:,1), ( (Tmp')*BP(:,2:end))];
Can u help me, Thanks.

Respuesta aceptada

Jan
Jan el 6 de Mzo. de 2012
The input BP is empty. Therefore you cannot process its elements. There is no BP(:,1) vector.
Solution:
function BPw = BPSlidingWindow(BP, n)
if isempty(BP)
BPw = [];
return;
end
m = size(BP,1);
...
  2 comentarios
Dmitry
Dmitry el 6 de Mzo. de 2012
thx, i will try
Dmitry
Dmitry el 6 de Mzo. de 2012
thx. it is working

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by