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

1 Ansicht (letzte 30 Tage)
Dmitry
Dmitry am 6 Mär. 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.

Akzeptierte Antwort

Jan
Jan am 6 Mär. 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 Kommentare
Dmitry
Dmitry am 6 Mär. 2012
thx, i will try
Dmitry
Dmitry am 6 Mär. 2012
thx. it is working

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by