【发布时间】:2013-12-29 12:32:51
【问题描述】:
我正在尝试将 CSV 文件转换为 LIBSVM/SVMlight 格式。我找到了以下代码:
SPECTF = csvread('SPECTF.train'); % read a csv file
labels = SPECTF(:, 1); % labels from the 1st column
features = SPECTF(:, 2:end);
features_sparse = sparse(features); % features must be in a sparse matrix
libsvmwrite('SPECTFlibsvm.train', labels, features_sparse);
我在特定文件的 Octave 上使用了它,它工作正常。 但是,在 MATLAB 上尝试时,我收到了错误:
Undefined function 'libsvmwrite' for input arguments of type 'char'.
“labels”和“features_sparse”都不是字符...(它们是双精度数)。我的错误在哪里?谢谢!
【问题讨论】:
标签: matlab csv octave libsvm mex