Having issue in Start date and end date picker to plot data to graph from excel data
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Voss
am 6 Mär. 2024
Bearbeitet: Voss
am 6 Mär. 2024
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.
Akzeptierte Antwort
Voss
am 6 Mär. 2024
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.
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Bar Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!