入力引数が不足しています。

34 vues (au cours des 30 derniers jours)
taichi muto
taichi muto le 10 Juil 2020
Commenté : taichi muto le 12 Juil 2020
function hyouka = M04_FitnessFunction(x)
HKA=[x(1) x(2) x(3) x(4) x(5) x(6) x(7) x(8) x(9) x(10) x(11) x(12) x(13) x(14) x(15) x(16) x(17) x(18)]
end
mファイルにて,上記のようなスクリプトを書いて実行したのですが,下に記すようなエラー文が出てしまいます。
>>M04_FitnessFunction
入力引数が不足しています。
エラー:M04_FitnessFunction(line 4)
HKA=[x(1) x(2) x(3) x(4) x(5) x(6) x(7) x(8) x(9) x(10) x(11) x(12) x(13) x(14) x(15) x(16) x(17) x(18)]
x(1),・・・,x(18) が入力引数なのですが,これが計算する上で足りていないために,HKA=[x(1)・・・の行でエラーが出てしまっているのでしょうか。
また,実行した際に下記のような内容が書かれた黄色の吹き出しが表示されます。
M04_FitnessFunction(x)
ここで入力引数を与え,Enterキーを押して実行してください。
入力引数が多数ある場合,xをどのように表記すべきなのか教えていただきたいです。

Réponse acceptée

madhan ravi
madhan ravi le 10 Juil 2020
Modifié(e) : madhan ravi le 10 Juil 2020
x = 1:18
M04_FitnessFunction(x) % assuming M04_FitnessFunction is save in a separate file called M04_FitnessFunction.m
doc function % please read it
Note: HKA is simply
HKA = x(1:18)
  1 commentaire
taichi muto
taichi muto le 12 Juil 2020
Thanks to your answer, I could solve it.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB 入門 dans Help Center et File Exchange

Tags

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!