%%++++++++++++++++++++++++++++++++ clc; clear; % close all % tic; % i=20003001; for i = 20003001 : 20003030 % path = [‘E:\0_gradute_design\0_1音频\test_and_train_26_110\‘,[num2str(TRC),‘_‘,num2str(TRS)],‘.wav‘];%如0_1~0_10 filedir=[‘F:\Neural network and pattern recognition\20003-2017-03\20003-2017-03\‘]; % 设置路径 % filename=‘20003002#2017-03.csv‘; % 设置文件名 filename=[ [num2str(i)],‘#2017-03‘,‘.csv‘ ]; fle=[filedir filename] ; % 构成完整的路径和文件名 data=csvread(fle, 1 , 2); % 读入数据文件 name = strcat(‘data_‘,num2str(i),‘.mat‘); save (name,‘data‘, ‘-v7.3‘) kk=0; filepath=‘F:\home_work\‘;%文件夹的路径 load([ filepath ‘data_‘ num2str(i) ‘.mat‘]) end %%+++++++++++++++++ clear % load data_20003002.mat load break_number.mat break_number data_goalg = 26*4+12-2; Fault_type_No = unique( break_number ); [full_cat,~] = size(Fault_type_No); %% 计算每种类别的总数 data_catgory_size data_catgory_size =zeros(58,30); load data_catgory_size.mat %% data_all_cat_size = []; for i = 1: full_cat data_all_cat_size(i,1) = sum(data_catgory_size(i,:)); end for i = 43: full_cat data_b= []; for j = 20003001 : 20003030 filepath=‘F:\home_work\‘;%文件夹的路径 name = [ ‘data_D_‘ num2str(j) ‘_‘ num2str(i) ‘.mat‘] % exist(name,‘file‘) if exist(name,‘file‘)~=0 filepath=‘F:\home_work\‘;%文件夹的路径 load([ filepath ‘data_D_‘ num2str(j) ‘_‘ num2str(i) ‘.mat‘]) data_b =[data_b;data_a]; % [A,~] = size(data_a); clear data_a end end name = strcat(‘data_E_‘,num2str(i),‘.mat‘); save (name,‘data_b‘, ‘-v7.3‘) clear data_b kk=1; end
原文:https://www.cnblogs.com/hkkeryu/p/12121779.html