Having issue in Start date and end date picker to plot data to graph from excel data
1 次查看(过去 30 天)
显示 更早的评论
So i have attached my excel file and app. I am trying to plot that data in ui axes with 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 . Plz anyone can help me out as it is my urgent project which needs to be submitted.
Thanks Regards
2 个评论
Voss
2024-3-6
编辑:Voss
2024-3-6
Have you gotten the app to work without the uidatepickers yet? I mean, are you able to load a file, select columns, and plot all of their data (without regard to the start/end date, just plotting all the selected columns' data)?
It doesn't work for me when I try it, so if I were you, I would get that working first and then try to get the uidatepickers working.
The problem I ran into is that table app.t's columns are all cell arrays of character vectors. You cannot plot a cell array; you'll either have to modify the readtable call to give you a table containing something you can plot, or convert the app.t's contents to some plottable class (numeric or datetime in this case) at some point - either when you first load the file or just before you plot.
采纳的回答
Voss
2024-3-6
Here's one way to get the table app.t to contain data in a form that's convenient for plotting, rather than cell arrays of character vectors.
% Read the Excel data
filename = fullfile(app.folder,filename);
opts = detectImportOptions(filename); % get the import options for this file;
opts.VariableTypes{1} = 'datetime'; % tell readtable the first column is datetime
opts.VariableTypes(2:end) = {'double'}; % and the rest are double, and
app.t = readtable(filename,opts); % read the file
Of course this assumes that the first column of the file is datetime and the other columns are numeric, which may not always be the case.
Modify your calls to readtable as above, and you'll be able to make some plots.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Bar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!