I have a binary vector, if I find a 0
in the vector I want to make the adjacent elements 0
if they are not already.
For example if input = [1 1 0 1 1]
I want to get output = [1 0 0 0 1]
I tried the following but it's messy and surely there is a neater way:
output=input;
for i = 1:length(input)
if(input(i) == 0)
output(i-1)=0;
output(i+1)=0;
end
end