Почему этот код закрывает систему Windows?

Я использовал следующий код, чтобы получить симметричную матрицу смежности из невзвешенного и неориентированного графа. Как только я запускаю его, система Windows выключается напрямую

fidneighb2= fopen('neighborfile2.txt','rt'); 
format = repmat('%q',[1 2]);
AA = textscan(fidneighb2,format,'Delimiter', '\t');
fclose(fidneighb2);
AAneighb2= [AA{:, 1} , AA{:, 2}];
    [r,c] = size(AAneighb2);                        %# Get the matrix size
diagVec1 = repmat([ones(c-1,1); 0],r,1);  %# Make the first diagonal vector
                                          %#   (for horizontal connections)
diagVec1 = diagVec1(1:end-1);             %# Remove the last value
diagVec2 = ones(c*(r-1),1);               %# Make the second diagonal vector
                                          %#   (for vertical connections)
adj = diag(diagVec1,1)+...                %# Add the diagonals to a zero matrix
      diag(diagVec2,c);
adj = adj+adj.';                      %'# Add the matrix to a transposed

https://drive.google.com/open?id=0B6u8fZadKIp2TFc1c1FmNnJ3TTA

0 ответов

Другие вопросы по тегам