Start date and end date uipicker = Having issue to plot it on UI Axes using excel data of particular selected start and end date

So i have attached my excel file and app. I am trying to plot that data in ui axes which i am not able to plot it . I have tried using uidate picker as i want to plot specific data of some specific date. Plz guide me with program how can i write it and how i can plot it in uiaxes.I am having issues using using uidate picker after even after reading its specification . I am able to plot the data using list box but it plots all the data .I want to plot it of specific selected date.Plz anyone can help me out as it is my urgent project which needs to be submitted as early as possible.

 Accepted Answer

Please see the modified app attached.
In keeping with the existing design where the plot is updated when the Generate Plot button is pressed, I modified GeneratePlotButtonPushed to use the date pickers' Values and only plot data within the selected date range.

10 Comments

Thank you soo much Voss. The app is working great and it helped me a lot in my project. Got to know how to use date picker for my further projects too.
Thanks & Regards,
Aditya.
The app is running fine but just having one issue i am not able to plot all the values it plots 50 values which it selects on its own. Is it possible to all the values or the values we select???/
I'm not sure what you mean. When I run it, if I don't select a start or end date, the app plots all the data.
The example data in the file you shared has dates going from March 1 to March 5, and that's what I see plotted when no start or end date is selected:
Yes you are right it plots all the data when date in date picker is not selected. But i am saying that i have a data of 5 march in which it has 60 value but after selecting the date in uidate picker it only plots 40 data which it selects on its own. I want to plot all the data or the data selected by myself. Did u get it what i am trying to say????
Thanks & Regarsds
The data in Dhalipur.xls (confirm that is the file you are using) has 102 rows in total, with 43 rows corresponding to March 5, 2024. When you select start date = March 5, 2024 and end date = March 5, 2024, then those 43 rows are what is plotted. (I just ran the app and tested it.) You can put a breakpoint in GeneratePlotButtonPushed and step through the code to see which rows are plotted; check the values of start_idx and end_idx.
I have attached the screenshot. I want to say that the works it plots the data. But if i selec 5 th to 6th March then it plots on 50-55 data which it select on its own. You can check the screenshot. I want it to plot all the data in table . Is it possible???? Can you help me out with this.
Here's what the app looks like for me when I make the same selections you have made:
Note:
  • The x-axis goes from 09:13 to 09:19 on March 5, 2024 in my screen shot. The x-axis goes into March 6 on your screen shot. The data file I have only has data up to March 5, so I suspect you are using a different data set than I am.
  • Your app window is resizeable, but mine is not, and the plot's xlabel is different in your screen shot vs mine, so I suspect you have changed the app.
How can I hope to fix any problems you have with the app if I am not running the same code with the same data? Please provide the actual app and actual data you are actually running.
Furhermore, I still don't see what the problem is, so I'd only be guessing even if I did have the same app and data. You say, "I want it to plot all the data in table." OK, then
  1. don't select a start or end date, or
  2. select a start date at or before the first date in the file and an end date at or after the last date in the file
Yes i got your point . I have attached my application with excel file and a screenshot. When i select 2 march to 6 march for an eg as shown in screenshot. It is plotting a total of 55-60 data the rest data is not being plotted.Even if i select direclty without the ui date picker it is not plotting all the data. So thats my issue did u get it.????????
Thanks for the updated app and data file. I am able to reproduce your screen shot. I don't agree that it is plotting 55-60 data points. I find that all the data is being plotted. To be sure of this, I put a breakpoint in GeneratePlotButtonPushed and checked the values of start_idx and end_idx (exactly as I recommended you do in a previous comment); I found start_idx is 2 and end_idx is 123 which means 123-2+1 = 122 data points are plotted, which is everything in the file (ignoring the first row of app.t, which starts with NaT and is due to a blank row in the file immediately after the column names). What makes you say only 55-60 points are plotted?
Note that the data look like three spikes because there is only data within three relatively small time ranges: 02-Mar-2024 14:06-14:11 (~5 minutes), 05-Mar-2024 09:13-09:18 (~5 minutes), and 06-Mar-2024 17:10-17:24 (~14 minutes). When plotted against a range of several days, these brief few minutes where there is data look like narrow spikes, but if you zoom in horizontally you will see all the data is there.

Sign in to comment.

More Answers (0)

Products

Release

R2023b

Asked:

on 12 Mar 2024

Commented:

on 19 Mar 2024

Community Treasure Hunt

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

Start Hunting!