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

25 views (last 30 days)
taichi muto
taichi muto on 10 Jul 2020
Commented: taichi muto on 12 Jul 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をどのように表記すべきなのか教えていただきたいです。

Accepted Answer

madhan ravi
madhan ravi on 10 Jul 2020
Edited: madhan ravi on 10 Jul 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 Comment
taichi muto
taichi muto on 12 Jul 2020
Thanks to your answer, I could solve it.

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB 入門 in Help Center and File Exchange

Tags

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!