open-discussion > .edge file creation
Dec 6, 2024  09:12 PM | celiavic
.edge file creation

Hello everyone!


I have an M matrix of size 448x448 on matlab (attached here in M.xlsx document).


I'm trying to convert it to a .edge text file so I can represent the connections between my nodes (data.node). 


1) I've tried the fprintf function:
for i = 1:size(M, 1)
    fprintf(fid, '%f ', M(i, :)); % Writes each element with a space as separator
    fprintf(fid, '\n'); % Adds a line feed at the end of each line
end


The result is attached as frprint_file.edge


 2) I've also tried save('m.edge','M','-ascii'). 


The result is attached as Save_file.edge


 


In both cases, a file is created and I can represent the connections (see illustration), but I have the data is being transformed or the recording isn't being done correctly, as only positive connection values are represented and the maximum value corresponds to the minimum value in my original matrix, as if there were a problem in the sign management...


Do you have a simple and reliable method for transforming a matrix into the format desired by BrainNet (on matlab or directly from excel)? 


Thank you in advance for you help!


CĂ©lia


 

Attachment: Bug Edge.zip