「 関数 (タイプ'double' の入力引数) が未定義です。」を解決したい。

66 views (last 30 days)
Huge Grave
Huge Grave on 3 Jul 2022
Answered: Atsushi Ueno on 3 Jul 2022
この質問を見ていただきありがとうございます。
簡単な択一問題のアプリを作ろうと思ったのですが、下記2枠目のようなエラーが繰り返し出てきています。
このエラーを解決するには何をするべきなのでしょうか?
methods (Access = private)
function BottonOn(app)
app.KaitouNomber = app;
if app.SeikaiNomber == app.KaitouNomber
app.TextArea= '正解';
else
app.TextArea='不正解';
end
     end
end
function ButtonPushed(app, event)
app = 1;
BottonOn(app);
end
関数 'BottonOn' (タイプ'double' の入力引数) が未定義です。

Accepted Answer

Atsushi Ueno
Atsushi Ueno on 3 Jul 2022
  • appはイベントが発生したオブジェクトの情報なので上書きせずに使用する必要があります
  • 関数は上記のappのフィールド名としてapp.BottonON()と指定します
function ButtonPushed(app, event)
app = 1; % temp = 1; に変更する
BottonOn(app); % app.BottonOn(temp); に変更する
end
  • BottonON()関数の定義部に引数を一つ追加します
function BottonOn(app) % 引数を追加しfunction BottonOn(app,temp)とする

More Answers (0)

Categories

Find more on App Designer を使用したアプリ開発 in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!