필터 지우기
필터 지우기

I would like to concatenate a loop.

조회 수: 1 (최근 30일)
Francis Herman
Francis Herman 2017년 9월 13일
답변: Helper 2017년 9월 15일
Hello, I have a 20000x100 dataset, I know how to run a function (generate surrogate values) for each 100 columns as shown in the code below. "theta" and "AHGT" are each 20000x100 datasets
AHGT1=AHGT(:,1)
Theta1=theta(:,1)
for s=1:numsurrogate
surrogate_amp1=[AHGT1(skip(s):end); AHGT1(1:skip(s)-1)];
surrogate_m(s)=mean(surrogate_amp1.*exp(i*Theta1));
end
What I would like to do is create a loop for each 100 columns and whose output surrogate_m(:,x) array concatenates into a single matrix. This is what I have tried, unsuccessfully.
for w=1:100
AmplitudeHighGamma(w)=AHGT(:,w);
ThetaPhase(w)=theta(:,w);
for s=1:numsurrogate
surrogate_amplitudetotal1=[AmplitudeHighGamma(skip(s):end); AmplitudeHighGamma(1:skip(s)-1)];
surrogate_mtotal(s)=mean(surrogate_amptotal1.*exp(i*ThetaPhase));
end
loopsurrogate=[surrogate_mtotal(w)]
end
Any advice is appreciated.
  댓글 수: 1
KSSV
KSSV 2017년 9월 13일
what is skip..you can achieve your task without for loops.....

댓글을 달려면 로그인하십시오.

답변 (1개)

Helper
Helper 2017년 9월 15일
Maybe change "loopsurrogate=[surrogate_mtotal(w)]" to "loopsurrogate=[loopsurrogate, surrogate_mtotal(w)]" will be helpful

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by