Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

clc; clear; fileID = fopen('C:\Users\TR RAO\Deskto​p\rao1.txt​','r'); C = textscan(fileID, '%s %s'); fclose(fileID); C1 =cell2mat(C{1,1}); C2 =cell2mat(C{1,2}); CC = [C1,C2] s=C1;t=C2; nodes = unique(CC); n_nodes = size(nodes,1) S0=eye(n_nodes); adjace

조회 수: 1 (최근 30일)
TR RAO
TR RAO 2017년 9월 28일
댓글: TR RAO 2017년 9월 28일
I am trying to form a transition matrix for a list of edges from a text file. The above program is working for six edges. Then I tested with 50000 edges. It is showing the following error. Kindly resolve this one. Error using cat Dimensions of matrices being concatenated are not consistent.
Error in cell2mat (line 83) m{n} = cat(1,c{:,n});
Error in readingfile1 (line 14) C1 =cell2mat(C{1,1});
  댓글 수: 3
Stephen23
Stephen23 2017년 9월 28일
@TR RAO: I closed your question because it is unreadable. Please edit your question and do these three things:
  • Put the code into the body of the question, not in the title.
  • Format the code properly (select the code text, click the Code {} button).
  • Put a useful title that summarizes your question.
TR RAO
TR RAO 2017년 9월 28일
C = textscan(fileID, '%s %s'); fclose(fileID); C1 = cell2mat(C{1,1}); C2 = cell2mat(C{1,2}); CC = [C1;C2]; % union of left and right side nodes s=C1;t=C2; nodes = unique(CC); n_nodes = size(nodes,1) S0=eye(n_nodes); adjacency_matrix = false(n_nodes); for idx = 1:size(C1,1) adjacency_matrix(C1(idx)==nodes,C2(idx)==nodes) = 1; end adjacency_matrix n_elements = sum(adjacency_matrix,2); transition_matrix = adjacency_matrix./repmat(n_elements, 1, n_nodes); transition_matrix(isnan(transition_matrix)) = 0; P=transition_matrix; The above program is working for 6 edges. But not working for the attached dataset.

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by