
AppDesignerで作成したアプリの起動時に読み込んだデータが使えない
조회 수: 6 (최근 30일)
이전 댓글 표시
現在、AppDesignerで作成したアプリ上で事前に学習が完了している機械学習の分類を行おうとしています。
その際、アプリ起動時にこの学習済みのモデルを読み込む処理を行い、ボタンを押すと分類が始まるシステムの開発をしていますが上手くできません。
function startupFcn(app)
load("sample.mat",'decoderNet','encoderNet');
end
function ButtonPushed(app, event)
prediction(app,encoderNet,decoderNet);
end
sample.matにはdecorderNet,encoderNetが保存してあり、predictionは分類を行う関数です。
このpredictionの部分で「関数または変数 'encoderNet' が認識されません。」とエラーが返されます。
これは最初のsample.matが読み込めていないということでしょうか?
댓글 수: 0
채택된 답변
Kojiro Saito
2021년 9월 8일
decorderNetやencoderNetがApp Designerのfunctionの中でのローカル変数になってしまって他の関数から認識されていない状態のようです。
「コードビュー」の左側の「コードブラウザー」からプロパティを追加し、
properties (Access = private)
end
の中に
decoderNet
encoderNet
の2行を追加してみてください。
こんなイメージです。

そして2つの関数を以下のように変更します。
function startupFcn(app)
load("sample.mat",'decoderNet','encoderNet');
app.decoderNet = decoderNet;
app.encoderNet = encoderNet;
end
function ButtonPushed(app, event)
prediction(app, app.encoderNet, app.decoderNet);
end
これでいけるはずです。
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!