How can I create the slider in my data range and how can my slider auto scroll until my data ends in app designer?
Show older comments
I have a function I know the map numbers and I want the slider to change as each map number changes. Map counts vary according to years, some years 13 maps, some years 25 maps. How can I make the slider occur according to my changing map count in the APP DESIGNER? I also want this slider value to change constantly from map 1 to map 13. Thank you in advance for your help.
I would like to point out that while the map count is 13, I want the slider to be 0 to 13, and if the map count is 25, I want the slider to be 0 to 25.
Answers (1)
Geoff Hayes
on 25 May 2020
0 votes
Özge - I think that all you need to do is to change the slider limits so that you can change the mininmum value (0) and the maximum (13, 25, etc.).
As for the auto scroll, you could use a for loop or timer to change the slider value. When that value changes, do you expect an action to occur?
11 Comments
Özge
on 25 May 2020
Geoff Hayes
on 26 May 2020
and if 13 maps are the last value, I expect the last value to be 25 and 25 maps... I don't really follow this statement. If you know whether there are 13 or 25 maps for the day, can't you just set the slider limit as such?
Geoff Hayes
on 26 May 2020
Özge's answer moved here
Sorry for the bad explanation. What I mean is this: if the day I will create the map has 2 hours of data and consists of 13 maps, I expect a slider to go from 0 to 13. If the day I chose was 1 hour of data and it consisted of 25 maps, I mean I expect a slider from 0 to 25 to occur.
Geoff Hayes
on 26 May 2020
So if you have the slider object, then you can just adjust the limits. Or does that code (referenced in the link) not work?
Özge
on 27 May 2020
Geoff Hayes
on 28 May 2020
Try pausing for a half second on each iteration of the loop. That should help you in seeing all images.
for UTCHR = 0:map-1
iUTCHR = UTCHR + 1;
tecUHR = NN(:,:,iUTCHR);
h = worldmap([min(lat) max(lat)], [min(long) max(long)]);
geoshow(app.UIAxes,h,tecUHR,R1,'DisplayType','texturemap');
load coastlines
plotm(coastlat,coastlon,'Color','black')
hold(app.UIAxes,'on')
colormap(app.UIAxes ,'jet')
colorbar(app.UIAxes)
axis equal
axis tight
title(app.UIAxes,[datestr(datenum(date(iUTCHR)) ,'yyyy-mm-dd HH:MM:SS')]);% Store the output handle
hCopy = copyobj(h.Children, app.UIAxes); % Copy all of the axis' children to your app axis
delete(h.Parent)
hold(app.UIAxes,'on')
pause(0.5); % <---- pause here to let the image be shown
end
I'm surprised that you need to create a map object just to copy it to the UIAxes...I've never used this toolbox so I guess this is what you have to do to get the image to appear in your axes...
Özge
on 6 Jun 2020
Özge
on 6 Jun 2020
Geoff Hayes
on 8 Jun 2020
I'm not sure why the copyobj might reverse the axes. perahps someone else can respond to that.
Özge
on 8 Jun 2020
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!