Hello there, I am using Matlab 2019a and use app designer and I have problem with importing dates from csv file and plot them from uitable. This is my code
First Button
[filename,path] = uigetfile(... {'*.csv', 'Text file CSV (*.csv)'}, 'Load File', 'MultiSelect', 'on'); onefile = readtable(filename, 'Delimiter', '\t ;', 'MultipleDelimsAsOne', true); app.uitable1.Data = onefile; setappdata(0,'table',onefile);
Second Button
T = getappdata(0, 'table');A = table2cell(T); ydata1 = cellfun(@mean,A(:,3)); ydata2 = cellfun(@mean,A(:,7));Times = cellfun(@mean,A(:,2)); str = convertCharsToStrings(A(:,1));DateString = datestr(str); DateNumber = datenum(DateString); Dates = datetime(DateNumber, 'convertFrom', 'datenum','Format', 'dd.MM.yy HH:mm'); xdata = Dates + Times;plot(app.axes1,xdata,ydata2);
It is doing that that convert the format and make the date March 2nd to February 3rd. I also tried table2timetable but it thinks that the column with dates is text so it doesnot work. So I have table which is in cell array and contains character. How can solve this please?I tried almost everything and look through this FAQs, but I still doesnot found that will helps me.
Best Answer