How can I create the slider in my data range and how can my slider auto scroll until my data ends in app designer?

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)

Ö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

Sorry for the late response. To put it as follows: I am mapping the ionosphere TEC data, and in the data file I use, in one day data file, a map is created every 2 hours in some years, and in other years, a map is created every 1 hour. The reason I say 13 and 25 is because there is 1 hour or 2 hours of data. I want my slider, which I want to create when I draw a map in different formats and app.UIAXES, and that map goes up to 13 or 25, according to this function. For example, as a day with 13 maps flows, the slider value will increase in each map, and if 13 maps are the last value, I expect the last value to be 25 and 25 maps. I tried some things but I was not successful. I don't know how I can solve this problem. I am working on a graduation project.
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?
Ö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.
So if you have the slider object, then you can just adjust the limits. Or does that code (referenced in the link) not work?
I haven't tried this exactly right now. Because I can't run the code I wrote very well. Maybe I can ask you when I'm talking to you here, if there is no problem answering for you, can I answer this question:
I create a figure inside figure window, normally my maps from 1 to 13 flow from right to left one by one. However, even though I run and show my code, it is in a for loop, only my last map in app.UIAxes appears. I can't show all my maps. How can I do that? If I can fix this code, I think it will be easier for me to create a slider accordingly. I just started working with App Designer, I'm not so dominant. Thank you for your answer in advance.
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')
end
This is the code I want to create maps. I want my 13 maps or 25 maps in the form of gifs that I added to shift from the right to the left. How can i do that?
Thanks.
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...
Thank you very much Pause worked. I had to use copyobj, otherwise I could not show my maps in the figure window. How else could it be?
In fact, copyobj is troubled, for example my north and south axes are reversed because of copobj. I couldn't fix it. I am trying to draw a coastline in it, but borders are drawn upside down due to copyobj.
I'm not sure why the copyobj might reverse the axes. perahps someone else can respond to that.

Sign in to comment.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Asked:

on 25 May 2020

Commented:

on 8 Jun 2020

Community Treasure Hunt

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

Start Hunting!