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

78 Ansichten (letzte 30 Tage)
Huge Grave
Huge Grave am 3 Jul. 2022
Beantwortet: Atsushi Ueno am 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' の入力引数) が未定義です。

Akzeptierte Antwort

Atsushi Ueno
Atsushi Ueno am 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)とする

Weitere Antworten (0)

Kategorien

Mehr zu App Designer を使用したアプリ開発 finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!