function sp_no = get_fit_sp(path)
%Author:shizhixin
%Email:szhixin@gmail.com
%Blog:http://blog.csdn.net/shizhixin
%Date:2012-02-29
%function:%读取文件夹中的fit文件名,并且提取第11-12字符的数
% 如文件名ssy04_1_sp15.fit,提取后的数位15
% 注意文件夹中的文件名格式必须是长16,并且第6和8个字符为'_'
%example:
%path = '20091118\' %文件夹中的文件有ssy04_1.txt ssy04_1_sp09.fit ssy04_1_sp15.fit
%sp_no = get_fit_sp(path)%sp_no = 9 15
sp_no = [];
fit_files = dir([path,'*.fit']);
n_fit = length(fit_files)
for i=1:n_fit
filename_fit = fit_files(i).name;%ssy04_1_sp15.fit
if length(filename_fit)~=16 | filename_fit(6)~= '_' | filename_fit(8)~= '_'
disp 'error! filename format error!'
return;
end
sp_no = [sp_no str2num(filename_fit(11:12))];
end
end