Displaying a dynamic image that changes with programming into the MATLAB app designer. Is it possible/what functions would I need?

18 visualizaciones (últimos 30 días)
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 comentarios
Walter Roberson
Walter Roberson el 24 de Mayo de 2023
Sure, just program a ValueChanging or ValueChanged callback and have the callback change the CData of the existing image object then drawnow()

Iniciar sesión para comentar.

Respuestas (1)

prabhat kumar sharma
prabhat kumar sharma el 20 de Nov. de 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!

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by