Sum values for a spreedsheet of excel

1 回表示 (過去 30 日間)
Tony Castillo
Tony Castillo 2016 年 9 月 23 日
コメント済み: Tony Castillo 2016 年 10 月 4 日
Hello, i want to do this:
  1. load a excel spreedsheet
  2. read that excel spreedsheet
  3. set a stepsize of 4 numbers
  4. sum from 4 by 4 the elements of the column vector
  5. generate a new column vector only with the the new values (for instance if at the begining i had 8 values now i should has only 2 values)
this was the code that i did for it,
k = 1;
stepsize = 4;
xlsread('DatosCM.xlsx', 1, 'c2:c10');
for nn = 2:stepsize:10-stepsize
partsum(k) = sum(vekt(nn:nn+stepsize-1));
k = k+1;
end
that code send me this error Index exceeds matrix dimensions.
Error in consumo2 (line 7) partsum(k) = sum(vekt(nn:nn+stepsize-1));
  1 件のコメント
Adam
Adam 2016 年 9 月 23 日
Surely you need to assign the output of xlsread to a variable?

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

採用された回答

Image Analyst
Image Analyst 2016 年 9 月 24 日
Try
vekt = xlsread(............
  1 件のコメント
Tony Castillo
Tony Castillo 2016 年 10 月 4 日
Thanks so much, is correct your solution.

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

その他の回答 (0 件)

カテゴリ

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