Date: Mar 30, 2013 8:07 PM
Author: mohammed
Subject: i want to simplify this code

hi guys ..
i have this code

[x2,y2,z2]=find(S==2);
for n2=1:length(x2);
I(x2(n2):x2(n2)+1,y2(n2):y2(n2)+1)=100;
end
[x4,y4,z4]=find(S==4);
for n4=1:length(x4);
I(x4(n4):x4(n4)+3,y4(n4):y4(n4)+3)=200;
end
[x8,y8,z8]=find(S==8);
for n8=1:length(x8);
I(x8(n8):x8(n8)+7,y8(n8):y8(n8)+7)=255;
end
[x16,y16,z16]=find(S==16);
for n16=1:length(x16);
I(x16(n16):x16(n16)+15,y16(n16):y16(n16)+15)=150;
end
[x32,y32,z32]=find(S==32);
for n32=1:length(x32);
I(x32(n32):x32(n32)+31,y32(n32):y32(n32)+31)=50;
end

but i feel it is too long and want to make it more simple
could anybody to help me ?