how to run the m-file several times

1 次查看(过去 30 天)
if i have karate.txt file us.txt file, s of karate and s for us. i wrote this code to run it on karate and us data sets, it run correctly on a single data set but i want previous code general to all data.
function auc=result(data)
adj=edgeL2adjj(data)
disp('Contents of workspace before loading file:')
whos
disp('Contents of s of karate.mat:')
whos('-file','s of karate.mat')
load('s of karate.mat')
disp('Contents of workspace after loading file:')
whos
f=size(adj,1);
[X,Y] = ndgrid(1:f,1:f);
D = [X(:).' ; Y(:).' ; adj(:).'];
v=D(end,:);
o=f*f;
testlink=(1:o);
[~,~,~,myAuc] = perfcurve(v,s(testlink), 1)
end

回答(1 个)

Thorsten
Thorsten 2015-10-21
编辑:Thorsten 2015-10-21
It is not entirely clear to me what you try to achieve. If you want to load s from different mat files, you can do so using
function auc=result(data, matfile)
% your code here
load(matfile, 's');
% your code here
And call it using
auc1 = result(mydata, 'karate.mat');
auc2 = result(mydata, 'us.mat');

类别

Help CenterFile Exchange 中查找有关 Language Fundamentals 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by