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

조회 수: 34 (최근 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 CenterFile Exchange에서 MATLAB 入門에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!