Search All of the Math Forum:

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

Topic: problem in if else !!!!!!!!!!!!
Replies: 1   Last Post: Apr 19, 2013 10:05 AM

 Messages: [ Previous | Next ]
 Curious Posts: 2,357 Registered: 12/6/04
Re: problem in if else !!!!!!!!!!!!
Posted: Apr 19, 2013 10:05 AM

"KARTIK ARG" <argkarthik@yahoo.com> wrote in message <kkqfgb\$obt\$1@newscl01ah.mathworks.com>...
> 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.

So, whats the problem? Whats your question?

>
> 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

Date Subject Author
4/19/13 KARTIK ARG
4/19/13 Curious