필터 지우기
필터 지우기

Sum absolute values in an array from .csv file

조회 수: 3 (최근 30일)
P
P 2013년 12월 3일
댓글: sixwwwwww 2013년 12월 3일
My array contains a string in the first row
how can I sum the array from the 2nd row to the Nth/1442th row (as in my example) disregarding the negative signs present in the column?
for example, my code for an array called data2 is:
S = sum(data2(2,15):data2(1442,15));
so sum all of the elements from row 2 to row 1442 in column 15. This doesn't work but it also does not have anything to deal with the absolute value of whatever row its checking
data is from an excel file as .csv:

채택된 답변

sixwwwwww
sixwwwwww 2013년 12월 3일
did you try
S = sum(abs(data2(2,15):data2(1442,15)));
  댓글 수: 2
P
P 2013년 12월 3일
Sorry, I didn't mention it was a cell array.
The answer is:
GlobalRadiationSum = sum(abs([data2{2:1442,15}]));
sixwwwwww
sixwwwwww 2013년 12월 3일
Nice work dear. Good luck!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by