prdata.m

来自「模式识别工具包」· M 代码 · 共 41 行

M
41
字号
%PRDATA Read data files% % 	A = prdata('file')% % Reads PR data into the dataset A. The first word of each line is % interpreted as label data. Each line is stored row-wise and % interpreted as the feature values of a single object.% % 	A = prdata('file',0)% % No labels assumed. The first word of each line is now interpreted % as data.% % See also datasets% Copyright: R.P.W. Duin, duin@ph.tn.tudelft.nl% Faculty of Applied Physics, Delft University of Technology% P.O. Box 5046, 2600 GA Delft, The Netherlandsfunction a = prdata(file,labels)if nargin < 2, labels = 1; endfid = fopen(file);if fid < 0	error('Error in opening file')ends = fread(fid,inf,'uchar');if computer=='MAC2', ss=13; else ss=10; endi = find(s==ss);n = length(sscanf(setstr(s(1:i(1))),'%e'));fseek(fid,0,'bof');[a,num] = fscanf(fid,'%e',inf);a = reshape(a,n,num/n)';if labels	lab=a(:,1);	a(:,1)=[];	a = dataset(a,lab);else	a = dataset(a);endreturn

⌨️ 快捷键说明

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