Loading data in SPM format, Class 'file_array' is an unknown object class

Hello,

I wrote a script to analyze trial data saved from Brainstorm in SPM (.mat/.dat) format. The script tries to read the data with the Matlab 'load' command.

Sometimes it works, sometimes it doesn't and I get:
Warning: Class 'file_array' is an unknown object class or does not have a valid 'loadobj' method. Element(s) of this class in array 'D' have been converted to structures.

I guess it works when the class file_array from SPM has been imported by some operation in the latest Brainstorm session, but I haven't figured out the magic. Just starting Brainstorm is not sufficient. I searched the code to try to identify where it happens but I haven't figured out.

Any idea where to look (other than the SPM manual)?

Alain

Keep in mind that a .mat file is not format, it is just a container for an arbitrary set of variables.

As script if reading directly the SPM files (not through Brainstorm functions), the presence (or absence) of SPM functions is not checked. You could try to add the SPM plugin at the beginning of the script:

[isOk, errMsg, PlugDesc] = bst_plugin('Load', 'spm12');

Indeed, it works. Thanks!