![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/732359/image.jpeg)
AppDesignerで作成したアプリの起動時に読み込んだデータが使えない
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
現在、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 commentaires
Réponse acceptée
Kojiro Saito
le 8 Sep 2021
decorderNetやencoderNetがApp Designerのfunctionの中でのローカル変数になってしまって他の関数から認識されていない状態のようです。
「コードビュー」の左側の「コードブラウザー」からプロパティを追加し、
properties (Access = private)
end
の中に
decoderNet
encoderNet
の2行を追加してみてください。
こんなイメージです。
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/732359/image.jpeg)
そして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
これでいけるはずです。
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur イメージを使用した深層学習 dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!