Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
pavlos
pavlos am 2 Mär. 2012
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

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by