How to apply for loop?

조회 수: 1 (최근 30일)
C PRASAD
C PRASAD 2022년 7월 19일
답변: David Hill 2022년 7월 19일
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';

답변 (1개)

David Hill
David Hill 2022년 7월 19일
for k=1:3
X(:,k)=X(:,k)+%whatever you are doing to the column
end

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by