i have an array whose size is 467*320 = 149440 i mean,
Y = [y1 y2 ... y149440] and i'd like to do that :
Y_1 =[y1+y2+y3...+y320 y321+y322+y321+...y640 .....]
y11=y1+y2+...+y320
y12=y321+y322...+y640
:
:
that is to say; the first element of Y_1 is sum of the first 320 elements and the second element of that is sum of the second 320 elements and going on like this and the size of Y_1 will be 1x467(1x149440/320)...
And i will have Y_2 like Y_1
for Y_2 : Y_2=[y1+y2+y3+...+y320 ..... .... ](1x467)
y21=y1+y2+y3+...+y320
:
:
at the end i create X-array that is
X = [y11+y21 y12+y22 y13+y23 ......]
this is my question :)
i thank you for your helps...

 채택된 답변

Matt Fig
Matt Fig 2011년 3월 23일

1 개 추천

I am a little confused, do you mean like this:
Y = reshape(1:18,6,3) % A manageable dimension.
Y_1 = sum(Y,2)
So in your case it would be
Y_1 = sum(Y,2).';
.
.
Or do you mean, more like this:
Y = 1:18
Y_1 = sum(reshape(Y,3,6))
So in your case it would be
Y_1 = sum(reshape(Y,320,467))

댓글 수: 4

osman yurdakul
osman yurdakul 2011년 3월 23일
let me explain step-by-step:
first of all i have an array called Y whose dimension is 1x149440
Y =[y1 y2 y3 .......... y149440];
and i want to make Y_1 array whose dimension is 1x467
Y_1 = [y1+y2+y3+...+y320 y321+y322+y323+...+y640];
i mean the first element of Y_1-array is sum of the first 320(1:320) elements of Y-array and the second element of Y_1-array is sum of the second 320(321:640) of Y-array
osman yurdakul
osman yurdakul 2011년 3월 23일
Y_1 = [y1+y2+y3+...+y320 y321+y322+y323+...+y640 ...........];
i mean the first element of Y_1-array is sum of the first 320(1:320) elements of Y-array and the second element of Y_1-array is sum of the second 320(321:640) of Y-array and going on like this..dimension of Y_1 is 1x467...
Matt Fig
Matt Fig 2011년 3월 23일
So then my second example is the solution to your problem, correct?
Y = rand(1,149440);
Y_1 = sum(reshape(Y,320,467));
size(Y_1)
ans =
1 467
osman yurdakul
osman yurdakul 2011년 3월 23일
yes it is...
i tried and saw it was running :D thank you for your helping...

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

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기

제품

태그

Community Treasure Hunt

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

Start Hunting!

Translated by