Please pay attention to these paragraph from MATLAB help :
You cannot use any cross-validation name-value pair argument along with the 'OptimizeHyperparameters' name-value pair argument. You can modify the cross-validation for 'OptimizeHyperparameters' only by using the 'HyperparameterOptimizationOptions' name-value pair argument.
OptimizeHyperparameters values override any values you set using other name-value pair arguments. For example, setting OptimizeHyperparameters to 'auto' causes the 'auto' values to apply.
MATLAB divides all elements of the predictor matrix X by the value of KernelScale. Then, the software applies the appropriate kernel norm to compute the Gram matrix. Therefore a high value for kernel scale means all elements of the predictor matrix must be divided to a big value.
KernelScale can be between [1e-3,1e3]. Fitcsvm searches among positive values, by default log-scaled in the range [1e-3,1e3].
If you specify KernelScale and your own kernel function, for example, 'KernelFunction','kernel', then the software throws an error. You must apply scaling within kernel.