Info
This question is closed. Reopen it to edit or answer.
producing a directed edges from a data frame
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!