How to read multiple cells in excel?

2 ビュー (過去 30 日間)
Mary Ng
Mary Ng 2015 年 12 月 5 日
コメント済み: Walter Roberson 2015 年 12 月 5 日
I would like to read multiple cells in excel, for example:
I want the average of the values between A1:A50 A60:100. (So ideally 90 cells in total)
I've tried;
x = xlsread('filename','A1:A50, A60:90'); (THIS AND THE THE ONE BELOW, GIVES ME TWO DIFFERENT ANSWERS. SO CONFUSED.)
x = xlsread('filename','A60:A90, A1:A50); (DIFFERENT ANSWER TO THE ONE ABOVE, WHY??)
x = xlsread('filename','A60:A50'); (100 is the last cell and this gave me a completely different answer.)
And sooo many more.
I know it's not correct because I've already calculated the average manually, and it does not match the one above.
I've attached photo to show what I want. The 183.564 is the sum of all the variables. But when I tried to do it on matlab, it doesn't give me the answer I want. Only on excel it seems to work.
Sorry if I'm not clear, and thank you!
  1 件のコメント
Walter Roberson
Walter Roberson 2015 年 12 月 5 日
The photo did not get attached.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 12 月 5 日
  2 件のコメント
Mary Ng
Mary Ng 2015 年 12 月 5 日
編集済み: Walter Roberson 2015 年 12 月 5 日
So.. something like this?
x1 = xlsread('filename','A1:A50');
x2 = xlsread('filename', 'A60:100');
x = (x1 + x2);
I've tried and it still isn't giving me what I want.. :/
sorry, I've attached the photo now.
Walter Roberson
Walter Roberson 2015 年 12 月 5 日
x = [x1; x2];
mean(x)

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

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by