Filter löschen
Filter löschen

how to run the m-file several times

1 Ansicht (letzte 30 Tage)
muhammad ismat
muhammad ismat am 21 Okt. 2015
Bearbeitet: Thorsten am 21 Okt. 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

Antworten (1)

Thorsten
Thorsten am 21 Okt. 2015
Bearbeitet: Thorsten am 21 Okt. 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');

Kategorien

Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by