clcclearclose alldata=importdata(data.txt);wholeData=data.data;%交叉验证选取训练集和测试集cv=cvpartition(size(wholeData,1),holdout,0.04);%0.04表明测试数据集占总数据集的比例cvpartition(n,holdout,p)创建一个随机分区,用于在n个观测值上进行保持验证。该分区将观察分为训练集和测试(或保持)集。参数p必须是标量,当0p1时,cvpartition为测试集随机选择大约p*n个观测值。当p是整数时,cvpartition为测试集随机选择p个观测值。p的默认值是0.1trainData=wholeData(training(cv),:);testData=wholeData(test(cv),:);label=data.textdata;attributeNumber=size(trainData,2); size(A,2):获取矩阵A的列数。attributeValueNumber=5;%将分