⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 write_data_into_txt.m

📁 libsvm is a simple, easy-to-use, and efficient software for SVM classification and regression. It s
💻 M
字号:
function write_data_into_txt(Z,C,filename)


%    This function is to write Z and C into a text file, which will be used by SVM machine.

%    size(Z)=[N_train,  D] , D is the dimension of training data.
%    size(C)=[N_train,  1] , C_train is the class label of Z.



D=size(Z,2);
ZZ=zeros(size(Z,1),2*D);

ZZ(:,2:2:end)=Z;
ZZ(:,1:2:end-1)= ones(size(Z,1),1)*(1:1:D);


A=[C,ZZ];        %%% size(A)=[N_train, 1 + 2*D]


for j=1:D

    if j==1
        string='%+i  %i:%+6.4f';
    else
        string=[string '  %i:%+6.4f'];
    end

end
string=[string '\n'];


fid=fopen(filename,'wt');
fprintf(fid, string, A');
fclose(fid);

fclose all;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -