data import error in line 1

Hi I am trying to import a excel document to matlab by using the code below. However I am getting the message error in line one. I have try differents approached such as data = load but no results. Any help will be aprreciated.
data = xlsread('station.xlxs' ,1,'A2:E457');
pi = 3.14159;
jun_aug_1 = data(:,1);
jun_aug_2 = data(:,2);
dec_feb_1 = data(:,3);
dec_feb_2 = data(:,4);

4 件のコメント

Walter Roberson
Walter Roberson 2019 年 10 月 1 日
What is the error message?
Walter Roberson
Walter Roberson 2019 年 10 月 1 日
Have you tried using readtable() ?
desert_scientist90
desert_scientist90 2019 年 10 月 1 日
Hi, Walter.
Yes, I tried both. It might be a silly error but is driving me crazy.
Error in hw21 (line 1)
data = xlsread('station.xlxs' ,1,'A2:E457');
Error in hw21 (line 1)
data = readtable('station.xlxs' ,1,'A2:E457');
Steven Lord
Steven Lord 2019 年 10 月 10 日
As an aside, there's no need for you to define pi. MATLAB already has a function for that.

サインインしてコメントする。

回答 (1 件)

desert_scientist90
desert_scientist90 2019 年 10 月 1 日

0 投票

Found the error I fliped the excel format, below is the right code
data = xlsread('station.xlsx',1,'A2:E457');
pi = 3.14159;
jun_aug_1 = data(:,1);
jun_aug_2 = data(:,2);
dec_feb_1 = data(:,3);
dec_feb_2 = data(:,4);

1 件のコメント

Walter Roberson
Walter Roberson 2019 年 10 月 1 日
Ah, you had an error in the file extension so the file did not exist.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeData Import from MATLAB についてさらに検索

質問済み:

2019 年 10 月 1 日

コメント済み:

2019 年 10 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by