How to edit a .dat file exported from Brainstorm

Hello, I'm relatively new to Brainstorm and am working on helping a colleague with something. Specifically, I'm trying to go in to .dat files exported from Brainstorm and edit them in MATLAB with a custom function, in order to do things like subtraction automatically in a loop. However, when I try to open a .dat file, it has odd characters that I think are ANSI. Is there a way to either export these .dats such that they are interpretable, or to import these in MATLAB so they are interpretable (not just binary or hexadecimal, but actual text)?

Appreciate the help!

All files in Brainstorm are saved as .mat that can be read in Matlab without any further trouble.
However, .mat is not a format, but a container, the way data is arranged inside the .mat file depends on the data type:

https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#File_structures

I'm not sure to which .dat files you refer to.

Hi Raymundo,

Thank you for the quick reply! These are .dat surface files exported for SPM12 as discussed here: https://neuroimage.usc.edu/brainstorm/ExportSpm12

I am hoping to edit the .dat files directly if that is possible.

For reading the resulting [.gii, .dat] pair of files you can use, the following function that is in Brainstorm:

in_gii(GiiFile)

FYI, this [.gii, .dat] pair of files is created in out_spm_gii.m (also in Brainstorm)

To clarify, I'm looking to read the .dat files exported from Brainstorm for SPM12 into MATLAB, not Brainstorm. Is this possible?

The [.gii, .dat] is a normal GIfTI file, I pointed you to a Matlab script in_gii.m that we have developed to read this kind of data:

brainstorm3/toolbox/io/in_gii.m at master · brainstorm-tools/brainstorm3 · GitHub

OH, got it, thank you this did work!