read table in excel file and save under a different name
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi,
How can I read the table in a excel file with numbers and letters? This is saved as test.xls (see the attachment). Then I need to save as ALDA.xls.
Thanks in advance.
1999 ALDA 1/14/1999 12:00 1999 1 14 12 -20.2 36.1
1999 ALDA 1/14/1999 15:00 1999 1 14 15 -20.3 36.25
1999 ALDA 1/14/1999 18:00 1999 1 14 18 -20.4 36.4
1999 ALDA 1/14/1999 21:00 1999 1 14 21 -20.35 36.3
1999 ALDA 1/15/1999 0:00 1999 1 15 0 -20.3 36.2
1999 ALDA 1/15/1999 3:00 1999 1 15 3 -20.25 36.2
댓글 수: 0
답변 (2개)
Peter Perkins
2015년 2월 27일
Damith, if you have a recent version of MATLAB (R2013b or newer), you should be able to read the spreadsheet with the readtable function. If you happen to have ER2014b, some of those data look like you could convert to datetimes in the table that readtable will return.
Image Analyst
2015년 2월 27일
Why not just copy it with copyfile()?
copyfile('test.xls', 'ALDA.xls');
댓글 수: 2
Image Analyst
2015년 2월 28일
Well you've probably figured it out by now but I couldn't get back to it until now. But for what it's worth, here is my code:
filename = 'test_new.xls';
[num, txt,raw] = xlsread(filename);
dividerRow = find(isnan(num(:,1))) + 1;
ca1 = raw(1:dividerRow-1,:)
xlswrite('Astride.xlsx', ca1);
ca2 = raw(1,:); % Get header line.
ca2 = [ca2;raw(dividerRow+1:end, :)]
xlswrite('Babiola.xlsx', ca2);
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!