Adding file to databse from script

Hello,

I was wondering what was the procedure to add file to the brainstorm database from script (not process).


    results                 = db_template('resultsmat');
    results.SurfaceFile     = surf_file;
    results.ImageGridAmp    =  data;
    results.Time            = [1];
    results.Comment         = '' ;


    OutputFile = bst_process('GetNewFilename', bst_fileparts(sStudy.FileName), 'results_avg_kmaps');
    bst_save(OutputFile, results, 'v6');

    % Update database
    db_add_data(iStudy,OutputFile, results );

works but i need to manually refresh the database or use db_reload_conditions(iSubject) to have the file appears in the database. Is there a better way to do it?

Edouard

@edelaire can you try with: db_add