将mat、txt、csv文件转换成arff文件

本文介绍了一种在Matlab中将.mat、.txt和.csv文件转换为Weka兼容的.arff文件格式的方法。通过定义函数functionMat2Arff,可以处理M*N数据格式,其中M为样本数量,N为特征和标签,前N-1列为特征,最后一列为样本标签。

有时候自己生成一些数据或者找到的数据格式不是arff文件时,可以在matlab中使用以下函数将mat、txt、csv文件转换成arff文件。
input_filename :待转换的格式文件路径及文件名
arff_filename :转换后的arff文件的路径及名称

function Mat2Arff(input_filename,arff_filename)
%
% This function is used to convert the input data to '.arff'
% file format,which is compatible to weka file format ...
%
% Parameters:
% input_filename -- Input file name,only can conversion '.mat','.txt'
% or '.csv' file format ...
% arff_filename -- the output '.arff' file ...

% NOTEs:
%The input 'M*N' file data must be the fo
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值