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

32 visualizzazioni (ultimi 30 giorni)
taichi muto
taichi muto il 10 Lug 2020
Commentato: taichi muto il 12 Lug 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をどのように表記すべきなのか教えていただきたいです。

Risposta accettata

madhan ravi
madhan ravi il 10 Lug 2020
Modificato: madhan ravi il 10 Lug 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 Commento
taichi muto
taichi muto il 12 Lug 2020
Thanks to your answer, I could solve it.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su MATLAB 入門 in Help Center e File Exchange

Tag

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!