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

1 回表示 (過去 30 日間)
Dmitry
Dmitry 2012 年 3 月 6 日
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.

採用された回答

Jan
Jan 2012 年 3 月 6 日
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 件のコメント
Dmitry
Dmitry 2012 年 3 月 6 日
thx, i will try
Dmitry
Dmitry 2012 年 3 月 6 日
thx. it is working

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by