% Count the number of trailing zeros on a given string s function n = count_zeros(s); i=length(s); while i >= 1 & s(i) == '0' i=i-1; end n = length(s)-i; end