for loop in order to put matrix elements in single row vectors

1 view (last 30 days)
Hello,
I have a nxk (10x20) matrix called M and I am setting its rows in 1x20 vectors with
n=10;
for i=1:1:n
vector1(1,:)=M(1,:);
...
vector10(1,:)=M(10,:);
Afterwards, I do some operations with the vectors like
sum(vector1,...,vector10)
I need to form a loop that it considers the changing of n within a range, for example
2<n<40
The operation sum should be done for each n seperately,
for n=2; sum2=
. . .
for n=40; sum40=
Any help please?
Thank you very much.
Best,
Pavlos

Answers (0)

Categories

Find more on Loops and Conditional Statements 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!