Info

此问题已关闭。 请重新打开它进行编辑或回答。

producing a directed edges from a data frame

1 次查看(过去 30 天)
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