function re=lj(cp,cd,wz,bianhao)
%功能 为了方便利用西储大学的数据编写此函数
% 通过输入采样频率,采样端,故障位置,和数据编号,可以返回的得到数据的存储路径,便于数据读取。
% 通过适当的使用此函数,可以提取特定需求的实验数据。
%cp :采样频率(1表示12kHz,2表示48kHz)
%cd :采样端(驱动端为1,风扇端为2)
%wz :故障位置(0为无故障,1为滚动体,2为内圈,3为外圈)
%bianhao :轴承数据编号,即轴承数据末尾的数字。
%版本2
%% 基础数据
%这里放了每个文件夹对应的编号
%12k驱动端
bh1=[118 119 120 121 185 186 187 188 222 223 224 225 3005 3006 3007 3008];
str1={'B007_0_118';'B007_1_119';'B007_2_120';'B007_3_121';
'B014_0_185'; 'B014_1_186';'B014_2_187';'B014_3_188';
'B021_0_222';'B021_1_223';'B021_2_224';'B021_3_225';
'B028_0_3005';'B028_1_3006';'B028_2_3007';'B028_3_3008'};
bh2=[105 106 107 108 169 170 171 172 209 210 211 212 3001 3002 3003 3004];
str2={'IR007_0_105';'IR007_1_106';'IR007_2_107';'IR007_3_108';
'IR014_0_169'; 'IR014_1_170';'IR014_2_171';'IR014_3_172';
'IR021_0_209';'IR021_1_210';'IR021_2_211';'IR021_3_212';
'IR028_0_3001';'IR028_1_3002';'IR028_2_3003';'IR028_3_3004'};
bh3=[144:1:147 130:1:133 156 158 159 160 197:1:200 246:1:249 234:1:237 258:1:261 ];
str3={'OR007@3_0_144';'OR007@3_1_145';'OR007@3_2_146';'OR007@3_3_147';
'OR007@6_0_130';'OR007@6_1_131';'OR007@6_2_132';'OR007@6_3_133';
'OR007@12_0_156';'OR007@12_1_158';'OR007@12_2_159';'OR007@12_3_160';
'OR014@6_0_197';'OR014@6_1_198';'OR014@6_2_199';'OR014@6_3_200';
'OR021@3_0_246';'OR021@3_1_247';'OR021@3_2_248';'OR021@3_3_249';
'OR021@6_0_234';'OR021@6_1_235';'OR021@6_2_236';'OR021@6_3_237';
'OR021@12_0_258';'OR021@12_1_259';'OR021@12_2_260';'OR021@12_3_261'};
%12k风扇端
bh4=[282:1:293];
str4={'B007_0_282';'B007_1_283';'B007_2_284';'B007_3_285';
'B014_0_286'; 'B014_1_287';'B014_2_288';'B014_3_289';
'B021_0_290';'B021_1_291';'B021_2_292';'B021_3_293'};
bh5=[278 279 280 281 274 275 276 277 270 271 272 273];
str5={'IR007_0_278';'IR007_1_279';'IR007_2_280';'IR007_3_281';
'IR014_0_274'; 'IR014_1_275';'IR014_2_276';'IR014_3_277';
'IR021_0_270';'IR021_1_271';'IR021_2_272';'IR021_3_273'};
bh6=[298:1:301 294:1:297 302 305 306 307 310 309 311 312 313 316 317 318 315];
str6={'OR007@3_0_298';'OR007@3_1_299';'OR007@3_2_300';'OR007@3_3_301';
'OR007@6_0_294';'OR007@6_1_295';'OR007@6_2_296';'OR007@6_3_297';
'OR007@12_0_302';'OR007@12_1_305';'OR007@12_2_306';'OR007@12_3_307';
'OR014@3_0_310';'OR014@3_1_309';'OR014@3_2_311';'OR014@3_3_312';
'OR021@3_0_313';'OR021@3_1_316';'OR021@3_2_317';'OR021@3_3_318';
'OR021@6_0_315'};
%48k驱动端
bh7=[122 123 124 125 189 190 191 192 226 227 228 229 ];
str7={'B007_0_122';'B007_1_123';'B007_2_124';'B007_3_125';
'B014_0_189'; 'B014_1_190';'B014_2_191';'B014_3_192';
'B021_0_226';'B021_1_227';'B021_2_228';'B021_3_229'};
bh8=[109 110 111 112 174 175 176 177 213 214 215 217 ];
str8={'IR007_0_109';'IR007_1_110';'IR007_2_111';'IR007_3_112';
'IR014_0_174'; 'IR014_1_175';'IR014_2_176';'IR014_3_177';
'IR021_0_213';'IR021_1_214';'IR021_2_215';'IR021_3_217'};
bh9=[148:1:151 135:1:138 161:1:164 201:1:204 250:1:253 238:1:241 262:1:265];
str9={'OR007@3_0_148';'OR007@3_1_149';'OR007@3_2_150';'OR007@3_3_151';
'OR007@6_0_135';'OR007@6_1_136';'OR007@6_2_137';'OR007@6_3_138';
'OR007@12_0_161';'OR007@12_1_162';'OR007@12_2_163';'OR007@12_3_164';
'OR014@6_0_201';'OR014@6_1_202';'OR014@6_2_203';'OR014@6_3_204';
'OR021@3_0_250';'OR021@3_1_251';'OR021@3_2_252';'OR021@3_3_253';
'OR021@6_0_238';'OR021@6_1_239';'OR021@6_2_240';'OR021@6_3_241';
'OR021@12_0_262';'OR021@12_1_263';'OR021@12_2_264';'OR021@12_3_265'};
%正常数据
bh10=97:1:100;
str10={'Normal_0_97';'Normal_1_98';'Normal_2_99';'Normal_3_100'};
%文件夹所在位置
s0='E:\1研究\数据文件(轴承数据)\Case Western Reserve大学滚动轴承数据\';
%% 确定位置
%12k驱动端
if cp==1 && cd==1
s1='12k Drive End Bearing Fault Data';
if wz==1
s2='Ball';bh=bh1;str=str1;
end
if wz==2
s2='Inner Race';bh=bh2;str=str2;
end
if wz==3
s2='Outer Race';bh=bh3;str=str3;
end
end
%12k风扇端
if cp==1 && cd==2
s1='12k Fan End Bearing Fault Data';
if wz==1
s2='Ball';bh=bh4;str=str4;
end
if wz==2
s2='Inner Race';bh=bh5;str=str5;
end
if wz==3
s2='Outer Race';bh=bh6;str=str6;
end
end
%48k驱动端
if cp==2
s1='48k Drive End Bearing Fault Data';
if wz==1
s2='Ball';bh=bh7;str=str7;
end
if wz==2
s2='Inner Race';bh=bh8;str=str8;
end
if wz==3
s2='Outer Race';bh=bh9;str=str9;
end
end
%正常数据
if (wz==0)
s1='Normal Baseline Data';
bh=bh10;
str=str10;
s3=str(find(bianhao==bh));
re=strcat(s0,s1,'\',s3,'.mat');
re=char(re);
else
%% 确定编号在文件夹的文件名
s3=str(find(bianhao==bh));
%% 组合字符串
%返回路径字符串
re=strcat(s0,s1,'\',s2,'\',s3,'.mat');
re=char(re);
end