The cell array consists of 400×1 elements in double (and may extend to 1,000,000 x 1).
I would like to filter all entry with -1.000.
What is the best way to filter floating value?
Should I do it in cell array or matrix?
Or should I do it by just creating a for loop, runs through each element, and store non -1.000 entry into new array?
I read the value from file using textscan, and later convert it to matrix in order to plot a cdf graph. However I’d like to eliminate all entry with -1 from the graph.
fid = fopen('t1_error.txt','r');
C = textscan(fid, '%.3f');
fclose(fid);
A = cell2mat(C);
[ycdf,xcdf] = cdfcalc(A);
ycdf = ycdf(2:length(ycdf));
plot(xcdf, ycdf, 'LineWidth', 2);
@Ansari has the right idea, but I’m pretty sure in your case there is no need to look at the tolerance since -1 is a flag for an invalid value, and is represented exactly in floating point, and therefore you won’t get any weird rounding issues which the tolerance trick is meant to resolve.