フィルターのクリア

Error: The variable VAC in a parfor cannot be classified

2 ビュー (過去 30 日間)
Homayoon
Homayoon 2016 年 3 月 14 日
コメント済み: Walter Roberson 2022 年 2 月 9 日
Dear All,
I read some of the solutions to the error mentioned in the subject of this question but they all seemed vague to me. I have a code as follows:
VAC = zeros(taw_max ,2);
parpool ('local',12)
parfor taw = 0:1:taw_max
taw_matrix = zeros(n-taw , 1);
for t = 0:(n-1-taw)
allmatrix = zeros (nt,1);
for i=1:nt
allmatrix (i,1) = mh * dot (s_t , s_t_taw )/dot(s_t , s_t); %where s_t . s_t_taw and mh are all defined values
end
taw_matrix (t+1 ,1) = sum(allmatrix);
end
VAC (taw +1 ,2) = mean (taw_matrix);
VAC (taw +1 ,1) = taw ;
end
it seems that the parfor loop can not classify the VAC matrix so that I can not write the output of my calculations into the corresponding cell of the VAC matrix. Would you please help me with a solution to this matter?
Thank you so much

採用された回答

Edric Ellis
Edric Ellis 2016 年 3 月 14 日
編集済み: Edric Ellis 2016 年 3 月 15 日
I think you simply need to ensure that you make only a single assignment into VAC, as the code analyzer message suggests. Like this:
VAC(taw + 1, :) = [taw, mean(taw_matrix)];
  3 件のコメント
Homayoon
Homayoon 2016 年 3 月 14 日
Thank you so much Edric and Ced!
Edric Ellis
Edric Ellis 2016 年 3 月 15 日
Fixed my answer to put the elements in the correct order - well spotted Ced!

サインインしてコメントする。

その他の回答 (1 件)

mohchali Alichina
mohchali Alichina 2022 年 2 月 9 日
編集済み: Walter Roberson 2022 年 2 月 9 日
I have a function and I need to apply this function to an electrician field ( apply waveform to ion motion) . Kindly can anyone guide me to do it! thanks in advance
Fs=25.8e6;
%run swiftfunccycle10ms function
[y,swiftT] = swiftfunccycle10ms(100,10e3,300e3,67e3,80e3,20e3,67e3,80e3);
%------------------------------------
s=real(swiftT);
[cfs,frq] = cwt(s,Fs); %continues wavelet transform
tms = (0:numel(s)-1)/Fs;%length of s
figure
subplot(2,1,1)
plot(tms,s)
axis tight
title('swiftT Scalogram')
xlabel('Time (s)')
ylabel('Amplitude')
subplot(2,1,2)
surface(tms,frq,abs(cfs))
axis tight
shading flat
xlabel('Time (s)')
ylabel('Frequency (Hz)')
%set(gca,'yscale','log')
ylim([10000 500000]);
%---------------------------------------------
%run swiftfunccycle function
[y, signalT]=signalfunccycle(0.1,10000,300000,67000,80000,200000);
%---------------------------------------------
s=real(signalT);
[cfs,frq] = cwt(s,Fs); %continues wavelet transform
tms = (0:numel(s)-1)/Fs;%length of s
figure
subplot(2,1,1)
plot(tms,s)
axis tight
title('signalT Scalogram')
xlabel('Time (s)')
ylabel('Amplitude')
subplot(2,1,2)
surface(tms,frq,abs(cfs))
axis tight
shading flat
xlabel('Time (s)')
ylabel('Frequency (Hz)')
%set(gca,'yscale','log')
ylim([10000 500000])
  1 件のコメント
Walter Roberson
Walter Roberson 2022 年 2 月 9 日
Where you are using parfor that this might apply?
Your signalfunccycle and swiftfunccycle10ms are not found anywhere on the Internet that I can see, so we cannot test your code.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeParallel for-Loops (parfor) についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by