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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!