I have an if statement as follows:
coeff = zeros(1,255);
for ii = 1:255
if (alpha1 == 0)
error('Trying to retrieve the multiplicative inverse of 0!')
elseif (alpha1 == 1)
coeff(ii) = ii;
elseif (ii == 1)
coeff(ii) = alpha1;
else
coeff(ii) = func( ii, alpha1 );
end
end
where func
is another function. How could I make my code faster because when I check time-consuming, the elseif state takes a lot of time? Thanks
Aucun commentaire:
Enregistrer un commentaire