Matlab, loop for. Problem.
Afficher commentaires plus anciens
Hi.
How to simplify the bolded code. I would like to put it in a loop. But it does not really work out. Maybe someone will tell you.
In the attachment I added the data (Ma and Nf) need for the program.
for i=1:10
Moment_sredni(:,i)=mean(Ma((10:130),i));
Moment_NF(:,i)=Moment_sredni(i)/1.15;
ind(:,i)=Ma(:,i)<Moment_NF(:,i);
end
I would like the code below to simplify and put in a loop
Nf1=Nf(:,1); trwalosc1=Nf1(ind(:,1)); TRWALOSC1=trwalosc1(1);
Nf2=Nf(:,2); trwalosc2=Nf2(ind(:,2)); TRWALOSC2=trwalosc2(1);
Nf3=Nf(:,3); trwalosc3=Nf3(ind(:,3)); TRWALOSC3=trwalosc3(1);
Nf4=Nf(:,4); trwalosc4=Nf4(ind(:,4)); TRWALOSC4=trwalosc4(1);
Nf5=Nf(:,5); trwalosc5=Nf5(ind(:,5)); TRWALOSC5=trwalosc5(1);
Nf6=Nf(:,6); trwalosc6=Nf6(ind(:,6)); TRWALOSC6=trwalosc6(1);
Nf7=Nf(:,7); trwalosc7=Nf7(ind(:,7)); TRWALOSC7=trwalosc7(1);
Nf8=Nf(:,8); trwalosc8=Nf8(ind(:,8)); TRWALOSC8=trwalosc8(1);
Nf9=Nf(:,9); trwalosc9=Nf9(ind(:,9)); TRWALOSC9=trwalosc9(1);
Nf10=Nf(:,1); trwalosc10=Nf10(ind(:,10)); TRWALOSC10=trwalosc10(1);
1 commentaire
Anusha Sridharan
le 9 Jan 2019
[Answers Dev] Restored edits
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!