フィルターのクリア

Slider GUI for multiple images

8 ビュー (過去 30 日間)
Ravin Rayeok
Ravin Rayeok 2020 年 6 月 3 日
回答済み: Amit Dhakite 2023 年 3 月 14 日
Hello,
I have several images in a folder, and i want to create a slider GUI.
And as I slide the time parameter, different image appears.
This is more or less the simple sketch:
:

回答 (1 件)

Amit Dhakite
Amit Dhakite 2023 年 3 月 14 日
Hi Ravin,
As per my understanding, you want to create an image viewer which changes the images according to the value selected in the Slider.
In order to do that, you can consider the following steps:
  1. Create a slider with a valueChangedCallback, which updates the image in the figure depending on the value of the slider.
% Here I am showing an example which shows two images, 'one.jpg' for value
% less than 50 and 'two.jpg' for value greater than 50.
% Value changed function: Slider
function updateImage(app, event)
value = app.Slider.Value;
if(value <= 50)
im = uiimage(app.fig1);
im.ImageSource = 'one.jpg';
else
im = uiimage(app.fig1);
im.ImageSource = 'two.jpg';
end
end
2. You have to create a public property fig1:
properties (Access = public)
fig1 = uifigure(); % This will create the figure
end
For further information about the functions used above, kindly refer to the following links:
  1. uiimage(): https://www.mathworks.com/help/matlab/ref/uiimage.html
  2. uifigure(): https://www.mathworks.com/help/matlab/ref/uifigure.html

カテゴリ

Help Center および File ExchangeDevelop uifigure-Based Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by