Info

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

producing a directed edges from a data frame

조회 수: 1 (최근 30일)
fereshteh izadi
fereshteh izadi 2016년 1월 14일
마감: MATLAB Answer Bot 2021년 8월 20일
hi, I have a data frame as I attached, with below code I got an adjacency matrix
fid = fopen('Ara_GoldST.txt', 'rt');
datacell = textscan(fid, '%s%s%d', 'HeaderLines', 1);
fclose(fid);
TFLocus = datacell{1};
TargetLocus = datacell{2};
all_locus = unique([TFLocus; TargetLocus]);
num_locus = length(all_locus);
[~, TFidx] = ismember(TFLocus, all_locus);
[~, Targidx] = ismember(TargetLocus, all_locus);
adj_matrix = accumarray([TFidx(:), Targidx(:)], 1, [num_locus, num_locus]);
adj_matrix = adj_matrix > 0;
csvwrite('my.txt', adj_matrix);
my adjacency matrix seems contain underacted edges please someone help me to have an adjacency matrix contains only 0 and 1 with directed edge I need your kindly helps thanks a lot

답변 (0개)

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

Community Treasure Hunt

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

Start Hunting!

Translated by