Borrar filtros
Borrar filtros

Plotting data from GML files

5 visualizaciones (últimos 30 días)
Isaac Osei Agyemang
Isaac Osei Agyemang el 25 de Sept. de 2018
Comentada: Isaac Osei Agyemang el 26 de Sept. de 2018
Please can someone help me the plotting of data from a gml file, never worked with such file before. The dataset can be downloaded from http://www-personal.umich.edu/~mejn/netdata/dolphins.zip

Respuesta aceptada

KSSV
KSSV el 25 de Sept. de 2018
Editada: KSSV el 25 de Sept. de 2018
fileName = 'dolphins.gml';
inputfile = fopen(fileName);
l=0;
k=1;
A = zeros([],2) ;
while 1
% Get a line from the input file
tline = fgetl(inputfile);
% Quit if end of file
if ~ischar(tline)
break
end
nums = regexp(tline,'\d+','match');
if ~isempty(nums)
if l==1
l=0;
A(k,2)=str2double(nums{1});
k=k+1;
continue;
end
A(k,1)=str2double(nums{1});
l=1;
else
l=0;
continue;
end
end
fclose(inputfile) ;
G = zeros([],[]) ;
for i=1:length(A)
G(A(i,1)+1,A(i,2)+1) = 1;
G(A(i,2)+1,A(i,1)+1) = 1;
end
figure
g = graph(G) ;
plot(g)
figure
L=diag(sum(G))-G;
[v,~]=eig(L);
xy=v(:,[2 3]) ;
gplot(G,xy,'.-r')
  8 comentarios
KSSV
KSSV el 26 de Sept. de 2018
You getting any error?
Isaac Osei Agyemang
Isaac Osei Agyemang el 26 de Sept. de 2018
yes please, it runs without any output, I've got the dataset in a mat file, can I send it to you via email?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by