用Matlab处理谐波数据。WT5000采集数据

Limti为澳洲标准,按照当前电流的基准值计算

% Step 1: Set file path
file_path = 'C:\Users\guochangfeng\Desktop\V41\10\新建文件夹';
limit =[100	1	4	1	4	1	4	1	2	0.5	2	0.5	2	0.5	1	0.5	1	 0.5	1	0.5	0.6	0.5	0.6	0.5	0.6	0.5	0.6	0.5	0.6	0.5	0.6	0.5	0.6];
% Step 2: Get the contents of all csv files under the path
csv_files = dir(fullfile(file_path, '*.csv'));

for i = 1:length(csv_files)
    % Step 3: Open a csv file and select data starting from line 109
    data = readmatrix(fullfile(file_path, csv_files(i).name), 'Range', 'A110');

    % Step 4: Find the average of each column
    column_averages = mean(data);
    base = column_averages(1,16);
    percent_data = column_averages/base*100;
    
    setting = column_averages(1,1:1+32);

    % Step 5: Transpose the data
    transposed_data = column_averages';
    
    % Step 6: Save to 'xlsx' file
%     [~, name, ~] = fileparts(csv_files(i).name);
%     writematrix(transposed_data, fullfile(file_path, [name '.xlsx']));
%     writematrix(percent_data', fullfile(file_path, [name '.xlsx']));
    
    precompare_data = percent_data(1,16:16+32);
    result = precompare_data<limit;
    
     [~, name, ~] = fileparts(csv_files(i).name);
    
    xls_filename = fullfile(file_path, strcat(name, num2str(i), '.xlsx'));
    xlswrite(xls_filename, [setting', column_averages(1,16:16+32)', percent_data(1,16:16+32)',limit',result'], 'Sheet1');

    % Display completion message
    disp(['Processed file ' num2str(i) ' of ' num2str(length(csv_files))]);
   csv_files(i).name
   result 

end
  • 9
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值