Sharing data between callback functions
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
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
채택된 답변
  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
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!