read table in excel file and save under a different name

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

답변 (2개)

Peter Perkins
Peter Perkins 2015년 2월 27일

0 개 추천

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.

댓글 수: 1

Thanks. I need to read the attach Excel file and I have two table sets separetd by one blank row (see the attached test_new.xls file) and need to output the two tables separately as ASTRIDE.xls and BABIOLA.xls.

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

Image Analyst
Image Analyst 2015년 2월 27일
Why not just copy it with copyfile()?
copyfile('test.xls', 'ALDA.xls');

댓글 수: 2

Thanks.
As I mentioned above, I need to read the attach Excel file and I have two table sets separetd by one blank row (see the attached test_new.xls file) and need to output the two tables separately as ASTRIDE.xls and BABIOLA.xls.
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);

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

카테고리

질문:

2015년 2월 27일

댓글:

2015년 2월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by