please would you change this python program to matlab ?

GENSIZE=20
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}

4 件のコメント

Michelle Hirsch
Michelle Hirsch 2018 年 4 月 9 日
Note that you won't get vary far without also translating calc_fitness.
yared Zeleke
yared Zeleke 2018 年 4 月 9 日
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 2018 年 4 月 10 日
This looks like a portion of
https://www.mathworks.com/matlabcentral/answers/392466-i-want-to-change-this-python-program-to-matlab
yared Zeleke
yared Zeleke 2018 年 4 月 10 日
yes it is would you change it that please to matlab program?i tried half way

サインインしてコメントする。

回答 (1 件)

Steven Lord
Steven Lord 2018 年 4 月 9 日

0 投票

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.

1 件のコメント

yared Zeleke
yared Zeleke 2018 年 4 月 10 日
just i need to convert to matlab

サインインしてコメントする。

カテゴリ

質問済み:

2018 年 4 月 7 日

コメント済み:

2018 年 4 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by