Sharing data between callback functions

2 ビュー (過去 30 日間)
Oliver Ferenczi
Oliver Ferenczi 2020 年 2 月 10 日
コメント済み: Oliver Ferenczi 2020 年 2 月 11 日
Hi, so in one callback function, I have the code,
file = uigetfile('*.jpg');
I would like to acess this file from a different callback function. However when I run the second callback, i get the error, "unrecognized function"
How do I allow the file to be acessed from other callback functions?
  9 件のコメント
Oliver Ferenczi
Oliver Ferenczi 2020 年 2 月 11 日
The issue with imread is that I need to access the file that was chosen in another callback function. So I am not sure how to get the file name from the other callback function.
Oliver Ferenczi
Oliver Ferenczi 2020 年 2 月 11 日
Thanks to everyone who helped.

サインインしてコメントする。

採用された回答

Guillaume
Guillaume 2020 年 2 月 11 日
"The issue with imread is that I need to access the file that was chosen in another callback function. So I am not sure how to get the file name from the other callback function."
You already have done it! The issue with your original error, as pointed out by Rik is that you never read the image, just passed the filename instead of the image to the face detector.
So instead of:
bboxes = step(faceDetector, app.file);
simply:
faceimage = imread(app.file); %actually read the image
bboxes = step(faceDetector, faceimage);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by