Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab for loop with decreasing loop counter

this for is not working and I can figure out why, can you help me?

for l = (300:1:-1)
    gauss = fspecial('gaussian',[1 round(1+0.15*l)], 0.015*l);
    filter_g(l,:,1) = filter2(gauss, img_d(l,:,1));
    filter_g(l,:,2) = filter2(gauss, img_d(l,:,2));
    filter_g(l,:,3) = filter2(gauss, img_d(l,:,3));

end
like image 605
SamuelNLP Avatar asked Dec 25 '12 19:12

SamuelNLP


1 Answers

The vector (300:1:-1) will evaluate to empty.

Vectors are start:step:end. Thus, you want 300:-1:1

like image 84
Jonas Avatar answered Sep 21 '22 17:09

Jonas