excel

조회 수: 1 (최근 30일)
ricco
ricco 2011년 11월 17일
In order to get an excel worksheet into matlab I have used the following:
files = dir('*.xls');
for i=1:length(files);
File_Name{i}=files(i,1).name;%Removes the file names from %'files'
[num{i},txt,raw] = xlsread(File_Name{i},'Ble min');
end
Which takes the worksheet 'Ble min' from each spreadsheet I have in a folder.
However, the time column is in the following format:
1 instead 0f 01:00
2200 instead of 22:00
2100 instead of 21:00
...etc
Does anyone know of a way to convert this to give the correct values?
thanks
  댓글 수: 2
Jan
Jan 2011년 11월 17일
Are you sure that "01:00" is converted to [1], but "22:00" is converted to [2200]? This does not look consistent.
ricco
ricco 2011년 11월 17일
Sorry I worte that wrong, the column is in hhmm so 1 would actually be 00:01. Is there any way of conveting them?

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

답변 (1개)

Walter Roberson
Walter Roberson 2011년 11월 17일
Your input loop is storing the "num" output of xlsread, but not the "txt" output. Depending exactly how that column was stored in Excel, you will either get the internal Excel time representation or an interpretation of "01:00" (and so on) in to integer form.
You cannot retrieve a colon-delimited time in a numeric column: numeric matrices are not able to store the ':' character.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by