- Navigate to Component Browser, Select the push button in app tree, then define button clicking callback function name
Open an image when push button is clicked in app designer
50 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Amit Patankar
el 11 de Mzo. de 2021
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 ?
0 comentarios
Respuesta aceptada
Eli Chen
el 12 de Mzo. de 2021
Editada: Eli Chen
el 12 de Mzo. de 2021
Hi,
Assume you have the target image file at your working directory, for example, MatlabLogo.png. And you have a push button in your app. These steps can help you opening the image by clicking on the push button:
2. Click the blue icon next to function name, you will be navigated to code view
3. Inside push button clicking callback function, you can use syntax like this:
% Button pushed function: Button
function showImage(app, event)
img = imread('MatlabLogo.png');
image(img);
end
When you run your app, and click this button, the image should be opened in Matlab Figure without browsing it
3 comentarios
Eli Chen
el 15 de Mzo. de 2021
The error message says something is wrong at Line 202 in your app code, can you show me what code at Line 202?
Más respuestas (1)
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!