How to apply for loop?

2 Ansichten (letzte 30 Tage)
C PRASAD
C PRASAD am 19 Jul. 2022
Beantwortet: David Hill am 19 Jul. 2022
I have a signal of 100*1 size and I have applied the below commands on the signal.Now if I have 100*3 size and I need to apply the same commands for each column seperately with the help of for loop .How can I use for loop here .If My signal is X=round(randn(100,3),0).Then How can i apply the commands for each column
X=round(randn(100,1),0);
[locx ~]=find(X>0);
mg_f(locx)=X(locx);
[locx ~]=find(X<0);
mg_f(locx)=-X(locx);
mg_r=mg_f';

Antworten (1)

David Hill
David Hill am 19 Jul. 2022
for k=1:3
X(:,k)=X(:,k)+%whatever you are doing to the column
end

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