help > RE: Running NBS from script rather than GUI
Feb 23, 2026  11:02 PM | Andrew Zalesky
RE: Running NBS from script rather than GUI

Check out the example in the header of the script NBSglm.m


It is possible to run as a script to facilitate batch processing with the GUI. 


Originally posted by jtanne98:



All, 

Apologies if this is obvious, but I have checked the documentation and forum but have not found a clear answer.

I would appreciate being able to run this using script in order to batch different analyses. This is the only one i can get to run, but still produces errors on the size of C not being 2D. 


If there is example script code to run a glm comparing two unpaired groups while adjusting for covariates, that would be very welcome. 


%% 
n_perm=1000;
age = %continuous but demeaned
sex   %coded 0 and 1
group = % 1 = Group, 0 = Control
X = [ones(size(group)) group  age sex ];


C1= [0  1 0 0]; % Group over Control
C2= [0  1 0 0]; % Control over Group



%%
global NBS
NBS=struct()
NBS.GLM.perms=n_perm;
NBS.GLM.X=X_w120;
NBS.GLM.y=C_w120;
NBS.GLM.contrast=C1;
NBS.GLM.test='ttest';



NBSglm(NBS.GLM)


NBS_1=NBS %stores NBS result 



 

Threaded View

TitleAuthorDate
jtanne98 Feb 23, 2026
jtanne98 Feb 26, 2026
RE: Running NBS from script rather than GUI
Andrew Zalesky Feb 23, 2026
jtanne98 Feb 23, 2026
Andrew Zalesky Feb 24, 2026