Indexing error.How out of bound elements in case of indexing error occurs can be replaced by zeros(or by interpolation)

조회 수: 1 (최근 30일)
Hey guys could u help me out to solve this indexing error.I want when indexing error occurs in this the out of bound elemnts should be replaced by zeros(or by interpolation
frame1=rand(200,25)
wsizeR=4
wsizeC=4
wsizeR2=4
wsizeC2=4
wshiftR=2
wshiftC=2
[row,col]=size(frame1);
num_dispR = fix((row - max([wsizeR wsizeR2]) + wshiftR)/wshiftR);
num_dispC = fix((col - max([wsizeC wsizeC2]) + wshiftC)/wshiftC);
prevR=3.*ones(num_dispR)
prevC=2.*ones(num_dispC)
for k=1:num_dispR-3
for l=1:num_dispC-2
locR = (k-1)*wshiftR+1;
locC = (l-1)*wshiftC+1;
tmp1 = frame1(locR:locR+wsizeR-1,locC:locC+wsizeC-1)
tmp2 = frame1(locR+prevR(k,l):locR+wsizeR2-1+prevR(k,l),locC+prevC(k,l):locC+wsizeC2+prevC(k,l)-1)
end
end)

답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by