Do you want the chromosomes to be a character array (when all rows are the same size) or an array of cells (with a variable size of the ith element)?
In the first case, you define the variable as:
chromosomes = char(zeros(POPULATION_SIZE,NO_PARAMETERS*NO_BITS_PATAMETER));
or
chromosomes = repmat(' ',POPULATION_SIZE,NO_PARAMETERS*NO_BITS_PATAMETER);
Then into the for loop:
chromosomes(i,(j-1)*NO_BITS_PATAMETER+1:j*NO_BITS_PATAMETER) = c;
In the case of an array of cells:
chromosomes = cell(POPULATION_SIZE, NO_PARAMETERS); % each paramater in separate cell
for i=1:POPULATION_SIZE
for j=1:NO_PARAMETERS
c=dec2bin(parameters(j),NO_BITS_PARAMETER);
chromosomes{i,j} = c;
end
end
or
chromosomes = cell(POPULATION_SIZE,1); % all parameters in a single cell per i
for i=1:POPULATION_SIZE
for j=1:NO_PARAMETERS
c=dec2bin(parameters(j),NO_BITS_PARAMETER);
chromosomes{i} = [chromosomes{i} c];
end
end
EDIT
DEC2BIN . parameters i- . :
c = dec2bin(parameters,NO_BITS_PARAMETER);
chromosomes = reshape(c',1,[]);
chromosomes = repmat(chromosomes,POPULATION_SIZE,1);