And this is the full function to create a single subject design matrix. To use the function, declare the variables 'folderName' and 'FMRDocumentName' and provide them some value before running the script.
or another version, from the Single study design matrix (*.rtc) page:
function Create_design_matrix() {
// Step 1: open the FMR project
var fmrname = FileDialog.getOpenFileName();
var doc = BrainVoyagerQX.OpenDocument(fmrname);
// Step 2: remove the current link from the project to an *.rtc file
doc.ClearDesignMatrix();
// Step 3: Create empty predictors
doc.AddPredictor("LVF");
doc.AddPredictor("RVF");
doc.AddPredictor("BVF");
// Step 4: Set predictor values
doc.SetPredictorValuesFromCondition("LVF", "Objects in LVF", 1.0);
doc.SetPredictorValuesFromCondition("RVF", "Objects in RVF", 1.0);
doc.SetPredictorValuesFromCondition("BVF", "Objects in BVF", 1.0);
// Step 5: Include the HRF in the model
doc.ApplyHemodynamicResponseFunctionToPredictor("LVF");
doc.ApplyHemodynamicResponseFunctionToPredictor("RVF");
doc.ApplyHemodynamicResponseFunctionToPredictor("BVF");
// Step 6: Save the *.rtc file
var rtcname = FileDialog.getSaveFileName("*.rtc", "Please choose a name for the RTC file");
doc.SaveSingleStudyGLMDesignMatrix(rtcname);
}