sum every 5 rows of a column, Is the part of code right
이전 댓글 표시
I am trying to sum every 5 rows of a column, Is my part of code right
instdec = (instdec_t+instdec_d)/2;
startdec1 = (instdec >= 0.25*overalldec);
startdec2=zeros(npts,1);
while decpt==1
for j = 2:npts-4
startdec2(j) = sum(startdec1(j:j+4));
if startdec2(j)== 5
decpt=j-1;
break
end
end
I keep getting wrong answers, the second row becomes 2, and everything else is zeros
I would appreciate any support since I am very new to matlab
댓글 수: 2
Jan
2013년 6월 17일
I've applied a more readable indentation. Now it is obvious that an end is missing.
The purpose of your code is not clearly explained. All we have is the code you have shown here. Then it is impossible to guess, if it satisfies your needs. Please add a detailed description of the aim of the program - by editing the original question, not as comment and not as answer. Thanks.
Tom
2013년 6월 17일
can you provide some example data to test with?
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Variables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!