HCP has developed 2 ways to get read and write CIFTI files into in MATLAB:
FOR MEG USERS (This tool pads the matrix with NaNs):
A. PLEASE DON'T USE THIS OPTION WITH HCP MRI DATA AT THIS TIME. Using the code developed for the HCP megconnectome data analysis pipelines that are implemented using the FieldTrip toolbox. The code is available in stand-alone format from https://github.com/Washington-University/cifti-matlab, in the ft_cifti folder. This approach loads the complete CIFTI XML header information into a MATLAB structure, including information on what each CIFTI index represents. Where possible it will also represent the anatomical models. Furthermore, it allows you to write data from MATLAB to CIFTI format. This code is relatively new and not yet fully tested. If you test this code, we would appreciate your user feedback. load gifti surface files.
FOR MRI USERS (This tool does not introduce NaNs):
B. Using Workbench v1.0 or newer + GIFTI toolbox code (descriptions below). This method has the limitation of not telling you what the CIFTI indices represent (what vertex or voxel, etc) and it creates intermediate files (that are deleted as part of the provided code). For this approach you need a couple of prerequisites:
1) Connectome Workbench v1.0 (available here) needs to be installed on the system.
ALPHA TESTING, FOR MRI USERS (This tool is not yet ready for production use):
C. A new cifti library has been written for matlab, which is intended to be backwards compatible with ciftiopen, etc from option B, but provides the information of what each CIFTI index represents. Unless you are reading CIFTI-1 files (the currently released HCP files should be exclusively CIFTI-2), there are no external dependencies (to read CIFTI-1 files, install Connectome Workbench v1.0 or newer, available here). If you can accept the risk of a very new library generating incorrect output files, the library is available at https://github.com/Washington-University/cifti-matlab.
3. I see that HCP distributes group average dense connectome files. Do you also provide connectivity matrices for individual subjects?