Sum of arrays - correct procedure
1 view (last 30 days)
Show older comments
I have four columns (e1,1; e1, 2; e2,1; e2,2) and I would like to develop matlab code to calculate the following: sum(1:5,1:2)+sum(1:5,3:4). There is a code that I used in berkeley madonna (arraysum[]) for this operation but i am not sure what the comparable feature is in matlab.
Thanks in advance.
Gerhart
Col 1 Col 2
0.929016407 0.111360717
0.055954481 0.740384808
0.893120011 0.4678698
0.687421283 0.57525318
0.99112996 0.01059374
Col 3 Col 4
0.031051504 0.461001395
0.957717397 0.085951332
0.831641253 0.382142599
0.563459302 0.927500217
0.514750022 0.171610893
1 Comment
the cyclist
on 25 Apr 2014
Two questions to clarify:
How are your four "columns" currently stored? Do you mean you have four separate variables? Or is e1 a 5x2 array and e2 also a 5x2 array? Or something else?
For the example you give, what is the correct final answer?
These things may seem clear or obvious to you, but you need to explain them to us.
Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!