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

35 ビュー (過去 30 日間)
taichi muto
taichi muto 2020 年 7 月 10 日
コメント済み: taichi muto 2020 年 7 月 12 日
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をどのように表記すべきなのか教えていただきたいです。

採用された回答

madhan ravi
madhan ravi 2020 年 7 月 10 日
編集済み: madhan ravi 2020 年 7 月 10 日
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 件のコメント
taichi muto
taichi muto 2020 年 7 月 12 日
Thanks to your answer, I could solve it.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB 入門 についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!