Sharing data between callback functions
Show older comments
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 Comments
By the way, if you'd typed what you wrote as the title of this question into the Matlab help, this would have been one of the first 3 links it takes you to - it should always be your first port of call as it is often much faster than asking in the forum and you learn more often too!
Oliver Ferenczi
on 10 Feb 2020
Guillaume
on 10 Feb 2020
I have attempted these techniques
Then show us what you tried, so we can tell you how to fix it. Also, state if this is using App Designer or GUIDE.
Oliver Ferenczi
on 10 Feb 2020
Rik
on 10 Feb 2020
Since it wants a numeric variable, are you sure you don't need to read the image instead of providing a file name?
Oliver Ferenczi
on 10 Feb 2020
Rik
on 11 Feb 2020
Then it probably makes sense to imread. Whether you want to set the image or the path as property is up to you.
Don't forget to validate the user input (so check if the user actually did select a file).
Oliver Ferenczi
on 11 Feb 2020
Oliver Ferenczi
on 11 Feb 2020
Accepted Answer
More Answers (0)
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!