help > Export ROI-to-ROI matrices in csv format
Showing 1-3 of 3 posts
Display:
Results per page:
Feb 11, 2020  03:02 PM | aster_h
Export ROI-to-ROI matrices in csv format
Dear Developers, 

I really enjoy working with the CONN toolbox, so first of all thank you for that!

For some machine learning I would like to convert the ROI-to-ROI matrices (.mat) per subject into csv files, to then flatten the upper triangle into one dimension and finally merge all subjects into one csv with all subjects. Do you have an idea on how to convert the .mat files containing the connectivity matrices into those csv files? I am working on this for quite some time, but did not achieve that.

Thanks in advance, best regards,
Hans
Feb 11, 2020  04:02 PM | allison_shapiro - University of Colorado
RE: Export ROI-to-ROI matrices in csv format
Hi Hans,

I had worked a bit on this too. Here is the Matlab code that I used to extract the ROI matrix:

sub1_roi = load('resultsROI_Subject001_Condition003.mat');
csvwrite('sub1_roi.csv',sub1_roi.Z);

I've bolded the pieces that should be consistent across the CONN output files. You can find the 'resultsROI_Subject001_Condition003.mat' file in the '[CONN_project]/results/firstlevel/' folder.

If this is not correct, please let me know. Wouldn't want to lead you astray!

Allie
Feb 11, 2020  04:02 PM | aster_h
RE: Export ROI-to-ROI matrices in csv format
Hi Allie,

thanks a lot for your quick answer, this was exactly what i was looking for. Seems like python was the wrong way to go for this. And I forgot, that the file has substructures and Z has to be choosen before converting. Thanks!

Kind Regards
Hans


Originally posted by allison_shapiro:
Hi Hans,

I had worked a bit on this too. Here is the Matlab code that I used to extract the ROI matrix:

sub1_roi = load('resultsROI_Subject001_Condition003.mat');
csvwrite('sub1_roi.csv',sub1_roi.Z);

I've bolded the pieces that should be consistent across the CONN output files. You can find the 'resultsROI_Subject001_Condition003.mat' file in the '[CONN_project]/results/firstlevel/' folder.

If this is not correct, please let me know. Wouldn't want to lead you astray!

Allie