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개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!