Reputation: 23
MATLAB stores 00
and 01
as 0
and 1
respectively. How can I make MATLAB store 00
as 00
and 01
as 01
instead of 0
and 1
only...here is my code.. I am talking about the statements with <--
only..In fact I want to input the result as initial population(chromosome) to a genetic algorithm.
function [x]=abc()
r=randi([0 3],1,20);
for i=1:20
if r(i)==0
x(i)=00; %// <--
elseif r(i)==1
x(i)=01; %// <--
elseif r(i)==2
x(i)=10;
elseif r(i)==3
ex(i)=11;
end
end
end
Upvotes: 0
Views: 237