首页 > 其他 > 详细

MATLAB中的格式化处理

时间:2019-12-30 22:23:18      阅读:142      评论:0      收藏:0      [点我收藏+]
%%++++++++++++++++++++++++++++++++
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

  

MATLAB中的格式化处理

原文:https://www.cnblogs.com/hkkeryu/p/12121779.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!