필터 지우기
필터 지우기

Sum values for a spreedsheet of excel

조회 수: 2 (최근 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 CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by