2015-12-16 31 views
-1

我有一个MATLAB代码,beggining代码未定义函数或MATLAB中的变量,如何设置参数?

function [hm,sm] = SKSClab(filename,data_type,maxk,true_labels,plot_flag) 
addpath('util') 

%Main check 
if(nargin<2) 

fprintf('\nPossible data types:\n') 
fprintf('\nnet_unw -> unweighted network\n') 
fprintf('\nnet_w -> weighted network\n') 
fprintf('\nvector -> (generic) data points\n') 
fprintf('\nts -> time series\n') 
fprintf('\nimg -> image\n') 
error('You should provide at least a data type as second argument to the SKSClab function!') 

末 %负荷数据

fprintf('\nLoading data...\n'); 

if(strcmp(data_type,'net_unw')) 

network = load([filename,'.txt'],'-ascii'); 

我试图像这样

SKSClab(proba.txt,3,6,1) 
Undefined variable "proba" or function "proba.txt". 

运行代码
Undefined variable "proba" or function "proba.txt". 

我应该改变什么?

+3

我敢肯定的字符串需要放置在引号中,尝试SKSClab('proba.txt ',3,6,1) – rossb83

+0

@ rossb83谢谢,那就是问题! – MPejic

+1

投票结束,作为一个简单的印刷错误。 – excaza

回答

0

呼叫与 SKSCLab('proba.txt',3,6,1) 功能的MATLAB否则不知道proba.txt是一个字符串,而不是变量

相关问题