read table in excel file and save under a different name

5 ビュー (過去 30 日間)
Damith
Damith 2015 年 2 月 27 日
コメント済み: Image Analyst 2015 年 2 月 28 日
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 日
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 件のコメント
Damith
Damith 2015 年 2 月 27 日
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 件のコメント
Damith
Damith 2015 年 2 月 27 日
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 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 ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by