Reading the exact time and date as in excel sheet !
Show older comments
Time that is being displayed in workspace editor !!
0,0104166666666667
0,0208333333333333
0,0312500000000000
0,0416666666666667
0,052083333333333
Original time stamp !!
0:15
0:30
0:45
1:00
1:15
[Houseload,text,rawdata] = xlsread('Haushalt-Lastprofil.xls','Profil');
time = Houseload (:,1);
what is the next code line to be implemented ! here are few things i implemented based on few examples discussed in the forum but was not sucessful .
1) timecolomn = datestr(datenum(time(:,1)), 'hh:mm');
2) datestr(Houseload,'mm/dd/yyyy hh:mm:ss')
I would also like to know the code to read if the following format it existed !
01.01.2017 01:15:00
thanks !
5 Comments
Jan
on 22 Jan 2019
What are the problems with the two shown commands? Does this work:
timecolomn = datestr(time(:,1), 'hh:mm')
Where does "the following format exist"? Is this a string or a date displayed in Excel?
chamant swarup
on 22 Jan 2019
madhan ravi
on 22 Jan 2019
Answer moved here:
doc readtable
i use matlab 2007 so this command does not work in older versions according to few similar questions in the forum but still i tried and was not successful !
madhan ravi
on 22 Jan 2019
Edited: madhan ravi
on 22 Jan 2019
In that case you should upload your original excel file to experiment so that others can give you a precise result , next time when you ask a question make sure you fill "Products" and "Release" field so that this type of confusions can be avoided.
chamant swarup
on 22 Jan 2019
Accepted Answer
More Answers (1)
Peter Perkins
on 23 Jan 2019
0 votes
chamant, you will be much better off using readtable, and durations, if you have anythign like a recent version of MATLAB.
3 Comments
chamant swarup
on 23 Jan 2019
per isakson
on 24 Jan 2019
Yes, but don't forget
T = readtable( _____, 'DatetimeType', 'exceldatenum' )
Peter Perkins
on 24 Jan 2019
readtable has had a lot of functionality added over the last couple years, so check the documentation for the version you are running. Notably, recent versions of readtable work with detectimportoptions. If you have a recent enough version of MATLAB, that's the way to go. If not, still I would recommend readtable, and if the dates come in as strings, convert them to datetime.
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!