read table in excel file and save under a different name

3 visualizzazioni (ultimi 30 giorni)
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

Risposte (2)

Peter Perkins
Peter Perkins il 27 Feb 2015
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 Commento
Damith
Damith il 27 Feb 2015
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.

Accedi per commentare.


Image Analyst
Image Analyst il 27 Feb 2015
Why not just copy it with copyfile()?
copyfile('test.xls', 'ALDA.xls');
  2 Commenti
Damith
Damith il 27 Feb 2015
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.
Image Analyst
Image Analyst il 28 Feb 2015
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);

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by