how to run the m-file several times

1 view (last 30 days)
muhammad ismat
muhammad ismat on 21 Oct 2015
Edited: Thorsten on 21 Oct 2015
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

Answers (1)

Thorsten
Thorsten on 21 Oct 2015
Edited: Thorsten on 21 Oct 2015
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');

Categories

Find more on Language Fundamentals in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!