I have csv files from an imaging technique, where each file is the scalars of a plane along the y-axis. At the extreme ends of the y-axis (top and bottom), there are not enough pixels to accurately represent the image.
What I am trying to do is set a lower limit for the amount of pixels, and then use only the files that meet the criteria. I have seen a few ways to set the limits on the data (see below), but I am not quite sure how to use the data after the limits are set.
function y=bound(p,bl,bu)
y=min(max(x,bl),bu);
end
Using this method, I can't put anything after the function.
x = (p >= bl) & (p <= bu);
After this, I'm not sure how to go about using the data from only those limits.
Here is my code to cycle through the files and get the pixel number from the csv files. PS is the standard deviation of the number of pixels and PA is the average number of pixels for all the files combined. bl and bu are the upper and lower limits.
csvFiles=dir(fullfile(folder,'*.csv'));
[~,reindex]=sort(str2double (regexp({csvFiles.name}, '\d+','match','once')))
N=csvFiles(reindex);
numfiles=length(N);
for k=1:numfiles
M=csvread(fullfile(folder, N(k).name), 1, 0);
p(k)=length(M(:,2));
end
PS=std(p)
PA=mean(p)
bl=PA-PS
bu=PA+PS