I am trying to process a datasets, count number of occurrence of entries less than a given error rate, plot a bar chart for each dataset(X) with the occurrence(Y). It seems that the output of count is stored in cell type, which is not recognized by bar. How can I store it in an array, instead of cell type?
DATASET_SIZE = 100;
PRUN_MAX_ERROR = 2;
PRUN_MISSING_DATA = -1.000;
ERROR_RATE = 0.2;
for i=1:DATASET_SIZE
fid = fopen(strcat('log',int2str(i),'.txt'),'r');
C(i) = textscan(fid, '%.3f');
fclose(fid);
end
%% convert cell type to matrix & process data
for i=1:DATASET_SIZE
D = cell2mat(C(i));
% removing unwanted entries
D(D == PRUN_MISSING_DATA) = [];
D(D > PRUN_MAX_ERROR) = [];
% count number of occurence below certain error rate
% E = [E sum(D <= ERROR_RATE)];
E{i} = sum(D <= ERROR_RATE);
end
figure;
bar(E);
But I get this error:
Undefined function 'real' for input arguments
of type 'cell'.
Error in xychk (line 42)
x = real(y); y = imag(y);
Error in bar (line 54)
[msg,x,y] =
xychk(args{1:nargs},'plot');
Error in checkSeqEffects (line 53)
bar(E);