Creating matlab raw data file

dear all,
We are currently try to load our data acquired with our house made system. We create matlab file and import the data by using the function "import EEG matlab matrix". If the file only contains the data matrix, it well works but we don't have channels names (only E01, E02....).
To avoid this, we tried to include in the first lines of the matlab file the channels names but we get an error message from brainstorm "no valid recording file" and when I click "oK", I get more details :


I found a previous discussion about "creating .raw data file" but unfortunately, I didn't find my response.
Thanks for help !

The file format "EEG: Matlab matrix (.mat)" is designed to import a plain matrix of data, with no metadata.

If you want to store data+metadata, then you need to use another file format.
You have quite a few options:
https://neuroimage.usc.edu/brainstorm/Introduction#Supported_file_formats

If you want something really portable that all MEG/EEG processing software can read and write, use one of the formats available in the EEG-BIDS specification:
https://bids-specification.readthedocs.io/en/bep-009/04-modality-specific-files/03-electroencephalography.html
I'd recommend the BrainVision format, simpler, easier to read/write and more versatile than all the others.

If you want something tailored for Brainstorm, save directly Brainstorm data structures:
https://neuroimage.usc.edu/brainstorm/Tutorials/Epoching#On_the_hard_drive

Thanks François ! Is it possible to use this Brainvision format for saving MEG OPM data ?

Check the documentation the documentation of the BrainVision file format and see if you can store all the metadata you need in there.
Since the the .vhdr are text files with sections, nothing prevents your from adding more sections if you need to store more information. The extra fields would be ignored by other programs, but at least the signals, channel names and markers would be readable by any BIDS-compatible program.