Open an image when push button is clicked in app designer
Show older comments
HI !
I have a push button in the app. I want the push button to open an image file ( file name will be pre-defined in the code) .
I do not want to browse the image file.
What syntax should I use to get this worked ?
Accepted Answer
More Answers (1)
Amit Patankar
on 17 Mar 2021
0 votes
9 Comments
Eli Chen
on 17 Mar 2021
I saw you have 2 'end' after push button call back function. Can you please check if the last 'end' was valid?
Amit Patankar
on 17 Mar 2021
Eli Chen
on 17 Mar 2021
I saw you might have another invalid 'end' above the error line?
Amit Patankar
on 17 Mar 2021
Eli Chen
on 17 Mar 2021
Ok. It looks like the 'end' is not causing problem. Can you revert your changes(adding those end back) and try to comment out the pushbutton callback content? Like:
function showImage(app, event)
% img = imread('MatlabLogo.png');
% image(img);
end
If this still causes 'Unexpected Matlab Expression' error, then the problem could be you have created the pushbutton click callback funtion in wrong way
Amit Patankar
on 17 Mar 2021
Eli Chen
on 17 Mar 2021
Is it possible that you upload your app file and let me help debug with?
Amit Patankar
on 17 Mar 2021
Categories
Find more on Develop Apps Using App Designer 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!






