MATLAB: Couldn’t find what’s wrong

this is my code
clc; clear all; close all;im=imread('images.jpg');size(im);fid=fopen('document.txt','r');c = fread(fid, 'uint8=>char')';bin=dec2bin(c);a=size(bin,1)*size(bin,2);b=1delta=20wi=bin(3)f=im(3,3)m=floor(f/((2^b)*delta))r=f-(2^b)*m*deltaf1=(2^b)*m*delta+wi*delta+r/(2^b)in executionb =       1delta =      20wi =1f =      7m =      0r =      7f1 =    255
the value of f1 should be 24
I think the problem is in saving wi=bin(3) value in matlab because when I put wi=1; manually in my code it gives me 24 but my main code involves a loop and every time wi will take a new value from bin table
why is f1=255??
thank you