In the below code I want to trace the value of y.*win in each iteration so basically I am trying to create y_1 to y_5, the else part is the only one that has its total condition iterate and i'd rather keep it short like this but is there no solution to create the rest y_2 to y_4 without having to use elseif each time?
y = 1:10000 %for example
for winSize=[16,64,256,1024,4096] if winSize == 16 win=zeros(size(y)); win(winSize:winSize*4) = 1; y_1=y.*win; elseif winSize == 4096 win=zeros(size(y)); win(winSize/2:winSize) = 1; y_5=y.*win; else win=zeros(size(y)); win(winSize/2:winSize*4/2) = 1; end end
Best Answer