Helllo everyone
i have a problem to change element of array with iteration approach. refer to https://www.mathworks.com/matlabcentral/answers/8817-how-to-replace-the-elements-of-a-matrix-using-the-conditions-if-else , i have same problem but little different. for instance i have mut1 = [.11 .12 .13 .14 .15 .16 .17 .18 .19 .20] and constan number 0.5. i want to replace element of mut1 with 'random number between' if random number(rmi) < 0.5. so this is what iam doing.
mutC = zeros(size(mut1));pm = 0.5;for i = 1:numel(mut1) rmi = rand(1,1) rCm = rbC+(raC-rbC).*rand(1,1) if rmi<pm mutC = rCm else mutC = mut1 endend
but the final result is always mutC = mut1. there is no number from rCm.
I will appreciate any help. thank you.
Best Answer