Displaying a dynamic image that changes with programming into the MATLAB app designer. Is it possible/what functions would I need?
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Is there a good way/capablility to display a changing image with a changing menu or selection in MATLAB App Designer. For example, in the app designer, if I change the scale of the image from a spinner, how do I get that change reflected in the image immeadietly upon selection, and how/what functions would I use to program the original image getting scaled. In other words, how do I program and display a dynamic image in MATLAB app designer, and does the app designer allow for this operation. Thanks
2 commentaires
Walter Roberson
le 24 Mai 2023
Sure, just program a ValueChanging or ValueChanged callback and have the callback change the CData of the existing image object then drawnow()
Réponses (1)
prabhat kumar sharma
le 20 Nov 2023
Hello Griffin,
I understand you are facing an issue with the immediate scaling of the image.
I will suggest you use a valueChanged Callback and in that callback, you can change the positions of the image according to the value of the spinner.
function SpinnerValueChanged(app, event)
value = app.Spinner.Value
app.Image.Position(3) = value %width of the image
app.Image.Position(4) = value %Height of the image
end
If you are looking to automatically update the width of the image and want to track the width updating immediately then you can use the 'drawnow'. You can refer to the below code, here I have tried to update the width in 1000 iterations using a loop.
function SpinnerValueChanged(app, event)
x = linspace(0,10,1000);
for k = 1:length(x)
app.Spinner.Value = k;
app.Image.Position(3) = k;
drawnow
end
end
To know more on 'drawnow' you can refer to the following documentation: https://www.mathworks.com/help/matlab/ref/drawnow.html
I hope it helps!
0 commentaires
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!