Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
pavlos
pavlos le 2 Mar 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

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by