MATLAB: Invalid value for OPTIONS parameter InitialPopulationMatrix.

Global Optimization Toolboxinitialpopulationmatrix

following is my code.while executing it is generating the following error:
Error using validate (line 286)
Invalid value for OPTIONS parameter InitialPopulationMatrix.
Error in gacommon (line 65)
[options,nvars,FitnessFcn,NonconFcn] = validate(options,type,nvars,fun,nonlcon,user_options);
Error in ga (line 336)
NonconFcn,options,Iterate,type] = gacommon(nvars,fun,Aineq,bineq,Aeq,beq,lb,ub, ...
Error in template (line 29)
[chromosome,~,~,~,~,~]=ga(fitnessfcn,nVars,options) ;
i would really appreciate if anyone can guide me through it following is the implementation code:
import java.security.*;
import java.math.*;
import java.lang.*;
md = MessageDigest.getInstance('SHA-256');
hash = md.digest(uint8(all));
si=reshape( (dec2bin(typecast(hash, 'uint8'),8) - '0').', 1, []);
%selection of best feature using genetic algorithm
tournamentSize=2;
options = gaoptimset('InitialPopulation',si,...
'PopulationSize',200,...
'Generations',100,...
'PopulationType', 'bitstring',...
'SelectionFcn',{@selectiontournament,tournamentSize},...
'MutationFcn',{@mutationuniform, 0.01},...
'CrossoverFcn', {@crossoverarithmetic,0.8},...
'EliteCount',0.05*1,...
'StallGenLimit',100,...
'PlotFcns',{@gaplotbestf},...
'Display', 'iter');
rng('Shuffle','v5normal')
fitnessfcn = @FitFunc;
nVars = 1;
[chromosome,~,~,~,~,~]=ga(fitnessfcn,nVars,options) ;
Best_chromosome = chromosome; % Best Chromosome
Feat_Index = find(Best_chromosome==1); % Index of Chromosome
end
function [FitVal] = FitFunc(Population)
FitVal = mean(Population == 1) * 0.01;
end

Best Answer

To look if your code is working you could set si = 25 and see if it works.
Are there any zeros or negative values in your si variable? Also a value of one would not really make sense.
If using a vector for population size matlab works with subpopulations. Perhaps you can start using a double variable with one number instead.