MATLAB Answers

please would you change this python program to matlab ?

1 view (last 30 days)
yared Zeleke
yared Zeleke on 7 Apr 2018
Commented: yared Zeleke on 10 Apr 2018
genepool =[]
for i in range(0,GENSIZE);
dna = [random.choice(string.printable[:-5]) for j in range(0, len(target))]
fitness = calc_fitness{'dna':dna,'fitness':fitness}


Show 1 older comment
yared Zeleke
yared Zeleke on 9 Apr 2018
target = "Hello, World!"
def calc_fitness(source, target):
fitval = 0
for i in range(0, len(source)):
fitval += (ord(target[i]) - ord(source[i])) ** 2
return(fitval) here is the calc fitness function
Walter Roberson
Walter Roberson on 10 Apr 2018
This looks like a portion of
yared Zeleke
yared Zeleke on 10 Apr 2018
yes it is would you change it that please to matlab program?i tried half way

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 9 Apr 2018
Do you need to convert the program or do you just need to use the program? If using this Python program is sufficient, you may be able to do so using the ability of MATLAB to call Python libraries that was introduced in release R2014b.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!