Mat file naming conventions

Hello ... newbie question ..... sorry if this has been covered before .. I couldn't find anything on the forum.

I'm trying to run my own scripts on single trial scout time frequency data.

I've been loading the .mat files using various dir wildcard * calls in matlab... but this is getting harder with more analysis in Brainstorm because the filenames don't appear to change in an obvious way...

example:
trial 1 the mat file
...timefreq_morlet_170915_2015_ersd.mat
trial 2
...timefreq_morlet_170915_2213_ersd.mat
trial 3
...timefreq_morlet_170915_2246_ersd.mat

(trail 3 highlighted)

so the problem is selecting files to load (to get the TF data) i.e., 2015,2213,2246...

I'm sure this is not the most efficient way of selecting mat files (I'm new to BrainStorm)! .. is there a better way?

I've tried with the filters (search file names/comments)

Ideally, I'd like to just create a matlab structure of single trial time frequency scout data for a given source analysis, in this case a single subject

thanks

andrew

Hi Andrew,

You can also select files with the processes File > Select files. But in your case, it wouldn’t help much if you only want to get the TF files for the “sLORETA” files for example…
http://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#Starting_a_new_script

What you could have done, anticipating this sorting issue, was to add a tag to the files after computing them. Immediately after computing the time-frequency decompositions, you can add the process “File > Add tag” to be able to select easily the output files later.

You can also try to use the lower-level database calls to select the files.
For instance, you can get the source files including the comment “sLORETA” with the process “File > Select file: Sources”, then loop on the selected files to grab one by one the time-frequency files depending on this file:
bst_get(‘TimefreqForFile’, sFiles(i).FileName, sFiles(i).iStudy)

Many options are offered by bst_get(), read the header of the function for help with all these functionalities.

Francois

thanks Francois … these are great starting points!

cheers
andrew