- The parfor must increase by 1 (not 0.5)
- Look up transparency rules -- you can't call save within the parfor
Im having trouble fixing the "cannot be classified error" in my parfor loop (The variable perror in a parfor cannot be classified)
1 view (last 30 days)
Show older comments
close all;clear LSNR=0;USNR=1;limit=4; load code_k_mod G1=G; H1=H; rate=4; % Code rate R=1/rate ind=1; indx =1; fid=fopen('Parallel_k_n_L_test_16_6_2014.txt','wt'); parfor SNR=LSNR:0.5:USNR undetected_errors = 0; SNR % Intitializing counters frmerror=0; bitnerr=0; frames=0; while frmerror < limit frames=frames+1 if mod(frames,1000)==0 frames; frmerror; end b=rand_bit(size(G1,1),0.5); co=turbo_encoder_no_int(b,G1); cod1=co; cod=2*cod1-1; EbN0=10^((SNR)/10); si= 1/sqrt(2*(1/rate)*EbN0); noise = (si*randn(size(cod))); tran= cod+noise;
rcv=(tran);
% decoder
[success,kr,dd0,x_hat1]=turbo_decoder_infectious_no_int_z_9_6_2010(rcv,si,H1,co,fid,frames);
% ---------------------------------------------
dseq1=dd0;
% B E R ------------------
error=sum(abs(dseq1-b));
perror1=error/size(b,2);
perror(frames)=perror1;
if error~=0
frmerror=frmerror+1
bitnerr=bitnerr+error;
if success == 1
undetected_errors = undetected_errors +1;
c_w(indx,:) = co;
noise_w(indx,:) = noise;
b_w(indx,:) = b;
kr_w(indx,:) = kr;
x_hat1_w(indx,:) = x_hat1;
indx = indx +1;
save debug c_w noise_w b_w kr_w x_hat1_w x_hat2_w x_hat3_w
end
end
end
merror=mean(perror);
ferror(ind)=merror;
frmerr(ind)=frmerror;
ind=ind+1;
bits=frames*size(G1,1);
BER=bitnerr/bits
FER=frmerror/frames
end
fclose('all');
0 Comments
Accepted Answer
Raymond Norris
on 19 Aug 2014
The formatting of the code isn't displaying properly, so I may not have the same code you have. Could you reformat it? Assuming I have it right, there are a couple of issues, though not classifying perror wasn't one of them. Which version of MATLAB are you running?
More Answers (0)
See Also
Categories
Find more on Entering Commands in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!