I have a database in excel like numbers, text and dates and I am not able to import the dates correctly. I'm using the following code
path(path, 'C:\Users\vinic\thesis\Matlab')
[data, textdata, rawdata]=xlsread('Teste',1);
Viewing rawdata the dates were imported as follows. However, the first date didn’t come just the day
'Time Stamp'
'01/06/2017'
'01/06/2017 00:10:00'
'01/06/2017 00:20:00'
'01/06/2017 00:30:00'
'01/06/2017 00:40:00'
'01/06/2017 00:50:00'
'01/06/2017 01:00:00'
'01/06/2017 01:10:00'
'01/06/2017 01:20:00'
'01/06/2017 01:30:00'
How can solve this problem?
I need the first item to appear as follows
'01/06/2017 00:00:00'

댓글 수: 1

dpb
dpb 2020년 5월 4일
The first date is still ok; it was just zero minutes and simply a formatting issue in the spreadsheet.
As the documentation notes, xlsread has been deprecated; I suggest the readtable function instead -- the resulting table will in all likelihood be much easier to work with going forward...if it is time-specific data, converting then to a timetable is probably even better.

댓글을 달려면 로그인하십시오.

 채택된 답변

Cris LaPierre
Cris LaPierre 2020년 5월 5일

0 개 추천

If you are unfamiliar with readtable, start by using the import tool. It is on the toolstrip in the Home tab. This video from the Practical Data Science with MATLAB course can help. Once you have the datatypes and formatting set the way you want, import the data, covert the settings to code, or generate an import function for repeated use.

댓글 수: 3

Vinicius Teixeira
Vinicius Teixeira 2020년 5월 5일
편집: Vinicius Teixeira 2020년 5월 5일
Unfortunately in my case it is impossible to import manually because I have several databases. My problem is that on all dates and in different files it is not displayed like this XX / XX / XXXX 00:00:00
Cris LaPierre
Cris LaPierre 2020년 5월 5일
편집: Cris LaPierre 2020년 5월 5일
You can use the import tool to create an import function that can be used to automate the import process of all files with the same formatting. The first video I shared showed you how to use the Import Tool. If you do want to create an importing function, this video shows you how to generate and reuse your code.
And if you have a lot of files, this video shows you how to use the import function you have created in conjunction with a datastore to import multiple files.
Vinicius Teixeira
Vinicius Teixeira 2020년 5월 5일
Thanks for your help, I was able to solve the problem by importing and generating the script according to the video

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by