Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: i want to simplify this code
Replies: 14   Last Post: Apr 22, 2013 7:11 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
mohammed

Posts: 18
From: egypt
Registered: 12/10/07
i want to simplify this code
Posted: Mar 30, 2013 8:07 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 ?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.