Hi all, so I'll just cut to the chase
fidO = fopen('pvtsort.xls','w+');
d = dir('*txt');
for i = 1:length(d)
fid = fopen(d(i).name, 'r');
values = textscan(fid,'%*s%*s%s','HeaderLines',4, 'Delimiter','\t');
for n = 1
m = num2str(n * i)
fprintf(fidO,'%s%s\t','Trail',m);
end
for j = 1:length(values{1,1})
pvt = values{1,1}
fprintf(fidO,'%s\t',pvt{j});
end
fprintf(fidO,'\n')
for f = pvt{j}(pvt{j}~=['False start'])
s = str2double('f')
a = mean(s)
b = median(s)
g = prctile(s,5)
h = prctile(s,95)
k = prctile(s,10)
o = prctile(s,90)
fprintf(fidO,'%s\t%d\t%d\t%d\t%d\t%d\t%d\n','mean; median; lower%5; higher%5; lower%10; higher%10',a,b,g,h,k,o)
end
fid = fclose(fid);
end
fidO = fclose(fidO)
In the code above, I'm trying to have Matlab calculate the stats (mean, median, and a bunch of percentiles) for a string of data I pulled from several text files. Problem is, the values in the strings are not all numbers, some are 'False start'. How can I have Matlab ignore the 'False start' and calculate my stats without them? As you can see, I tried the ~= operator, but ran into issue with the error "Error using ~=. Matrix dimensions must agree.". I also tried NaN the "False start" but that seems even more problematic than using '~='. Any ideas how I can format my data so the matrices match for the ~= operator?
Attached is a screenshot of my workspace from when I ran into this error.
Thanks for looking into this.