首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

请大家帮小弟我阅读以下matlab代码 十分感谢

2012-03-16 
请大家帮我阅读以下matlab代码 十分感谢!function [] complexTestOneCluster( trainedModelF, testFeaOn

请大家帮我阅读以下matlab代码 十分感谢!
function [] = complexTestOneCluster( trainedModelF, testFeaOneCluster, predictedOuputF, featureChoiceFlag, trainMethodchoice )

if ( nargin <5 )
  trainMethodchoice = 'svm'; 
end 

garbage_file = '../../temp/temp.test.log';
testCSVfile = 'd:/temp.test.csv'; 
temp_test_file = '../../temp/temp.test';

% ---- combine the feature file into one csv format data file -------
vfeature = testFeaOneCluster ; 
fid = fopen( testCSVfile ,'w');
fprintf(fid,'%.6f', vfeature(1) );
for j =2: length( vfeature )
  fprintf(fid,',%.6f', vfeature(j) );  
end 
fprintf(fid,',1\n'); 
fclose(fid); 

% ---- testing by the trained model -------
if strcmp(trainMethodchoice, 'svm')
  % convert the sets into SVML format
  cv_cmd = sprintf('!perl ../trainTest/convert_file_forSvm.pl %s %s > %s', testCSVfile, temp_test_file, garbage_file); 
  eval(cv_cmd); (这里eval的作用不是很清楚)

  % set up commands 
  classifier = 'f:\svm_classify.exe';
  test_cmd = sprintf('!%s %s %s %s > %s', classifier, temp_test_file, trainedModelF, predictedOuputF, garbage_file) ;
  eval(test_cmd);  
end 

另外:predictedOuputF是一个输出文件,它的输出格式以及内容是?
十分感谢大家的帮助!

[解决办法]
代码里没有 predictedOuputF 的格式信息

看看 svm_classify.exe 相关的说明吧
[解决办法]
eval 就是调用外部的命令

这里就是执行一个 perl 脚本

热点排行