"parfor" skips or fail with filtfilt function
古いコメントを表示
Hi, I am trying to use 'parfor' to speedy a loop that performs 3 steps to a simple time series (SignCorr): 1 - Detrend 2 - Linear regression 3 - Low Pass Filtering Apparently, 'parfor' skip the step 3. I can run the same code just changing 'parfor' to 'for' and the results are different. Then I noticed that the difference is the LowPass Filtering Step. I am attaching the code only with the LPF and the 'parfor' results in a generic error: "Struct contents reference from a non-struct array object.".
Any idea? Thanks!
Fs = 1/2; % sampling frequency (Hz)
tp = 180; % Time Points
% LowPass Filter design
FpassLOW = 0.1; % passband frequency (Hz)
FstopLOW = 0.1 + (Fs/tp); % stopband frequency (Hz)
ApassLOW = 1;% passband ripple (dB)
AstopLOW = 50; % stopband attenuation (dB)
hLOW = fdesign.lowpass('Fp,Fst,Ap,Ast',FpassLOW,FstopLOW,ApassLOW,AstopLOW,Fs);
HdLOW = design(hLOW, 'equiripple');
EPIreshTMP = zeros(size(finalEPIresh));
tic
parfor tt3 = 1:size(EPIresh,2) % EPIresh = 180x176004 Matrix (Time x Spatial Dimensions)
SignCorr = EPIresh(:,tt3);
MMM = mean(SignCorr);
% Low Pass Filtering
s_filt2 = repmat(s_corr,6,1); % we use the center copy, avoinding phase distortion
s_filtAB1LOW = filtfilt(HdLOW.Numerator,1,s_filt2);
s_filtAB1LOW = s_filtAB1LOW((1+2*180):(3*180));
EPIreshTMP(:,tt3) = s_filtAB1LOW(:) + MMM; %giving the mean back
end
toc
newEPIresh = EPIreshTMP;
6 件のコメント
Edric Ellis
2018 年 9 月 12 日
I'm not sure what's going on here, and unfortunately I can't run this code - it would be really helpful for us reading your question, and probably for you too, if you could simplify your code to a "Minimal, complete, and verifiable example".
Brunno Machado de Campos
2018 年 9 月 12 日
Jan
2018 年 9 月 12 日
Please post the complete error message. It runs successfully in Matlab Online.
Brunno Machado de Campos
2018 年 9 月 12 日
@Brunno: If you post the complete error message, we could see, which line is causing the problem. It is very useful for a discussion, if the readers do not have to guess, where the problem occurs. So please do not post just a part, which seems to be relevant, but everything printed in red to the command window.
Brunno Machado de Campos
2018 年 9 月 13 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Chebyshev についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
