How do you set every other row as well as every other column to zero?
20 views (last 30 days)
Dave B on 16 Nov 2021
Edited: Dave B on 16 Nov 2021
To remove every other column, set it to empty. You can do "every other" generally using A:2:B where A is the first value and B is the last value, and you can stick this in as an index.
a1(1:2:end,:)= % remove every other row
a2(2:2:end,:)= % remove every other row starting at the second row
a3(:,1:2:end)= % remove every other column
a4(:,1:2:end)=0 % set every other row/column to 0
% If you really feel like you have to do both at once, you can. But it
% would be much easier to just do rows and columns sequentially.
ind=sub2ind(size(a5),r(mod(r,2)==0 | mod(c,2)==0),c(mod(r,2)==0 | mod(c,2)==0));
Note if your goal is to resize the image or the fft by half, imresize will give you more options