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: problem in if else !!!!!!!!!!!!
Replies: 1   Last Post: Apr 19, 2013 10:05 AM

Advanced Search

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

Posts: 1
Registered: 4/19/13
problem in if else !!!!!!!!!!!!
Posted: Apr 19, 2013 12:00 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

in this prgm bin contains 0s and 1s in random.
now i want to print 'after mutation' when bin value contains 0 and 'after mu' when bin value contains 1.

clc;
clear all;
% >> Inititalizing Population...
m=0.47;s=5;
z=1;
popdec=cell(20,5);
popbin=cell(20,5);
vi(1,1)=0;low=0;
for i=1:20
for j=1:5
if j==1
lim=low+(80-low)*(rand);
popdec{i,j}=ceil(lim); % Generating random numbers b/w 1 to 90
z=j;
else
lim=popdec{i,z}+(90-popdec{i,z})*rand;
popdec{i,j}=ceil(lim);
z=j;
end
end
end

for i=1:20
for j=1:5
store=popdec{i,j}; % population in decimal
popbin{i,j}=dec2bin(store,8); % population in binary
end
end
bin=cell2mat(popbin);
for i=1:20
for j=1:40
z=mod(j,2);
if z==1
v1(1,1)=bin(i,j);
t=v1(1,1)
else
v2(1,1)=bin(i,j);
t=v2(1,1)
end

if t==0
disp('aftr mutation');

else
disp('aftr mut');
end
end
end



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.