sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
962cc562885aff0a40cdbcd233e97bde5de7479c9cfad399b7bd0b009902aafb
MATLAB
3,276
84
%jds_periSuppressionRippleProbREM %Peri-suppression cortical ripple probability during REM: histograms of %chain REM cortical ripple times around PFC population-suppression %troughs, compared against a 99% band from circular-shift shuffled %suppression events (from jds_detectPopulationSuppressionREM output). day = 1; ...
f91d5c09cf806b5e3d60b108d4dea12afdb3607ed63dffba0bb8b17866728514
MATLAB
3,281
98
function [R,eff] = randmio_dir_connected(R, ITER) %RANDMIO_DIR_CONNECTED Random graph with preserved in/out degree distribution % % R = randmio_dir_connected(W, ITER); % [R eff] = randmio_dir_connected(W, ITER); % % This function randomizes a directed network, while preserving the in- % and out-degree...
05ba7de32110f77d92564bfd93ee18810727c394c51f3cfd0716247db7794f23
MATLAB
3,282
92
function Parcellate(data_dir,save_dir,parcellation,n_areas) % % Parcellate the neuroimaging data according to a given parcellation. % Accepts only .nii files. % % INPUT: % data_dir directory where the .1D files with the ABIDE data are % stored % save_dir directory to save the new data % parcella...
ab7a47d71af5bd8714728a7be88ef50081c183a166ffb7da5a7e97d917fac9cc
MATLAB
3,288
89
function newData = OverlapCalculation(data,OverlapPerc,minLocs,minArea) wb = waitbar(0,['Calculating the percentage of overlap between the two channels per cluster of data set ' num2str(1) '/' num2str(length(data))]); newData = cell(1,length(data)); for i = 1:length(data) if ~isempty(data{i}) ...
a113a62d02825076492ac0daeaa995a62c4f0d1d3ea2b0dc4eae0eee38fa9956
MATLAB
3,297
80
function [R, scale]=arqr(v, p, mcor) %ARQR QR factorization for least squares estimation of AR model. % % [R, SCALE]=ARQR(v,p,mcor) computes the QR factorization needed in % the least squares estimation of parameters of an AR(p) model. If % the input flag mcor equals one, a vector of intercept terms is % being fitt...
10cd02c351c7f5e45d1431ccff8e39cc21a9a7b9e13451dcc440b2f6b28329e6
MATLAB
3,298
77
function [trial_types, valid_responses, valid_correct_responses] = tc_get_events_from_trigger_values(all_trigger_values_vec, left_values, right_values, non_odd_ball_value, response_value, all_reaction_times, sampling_rate, stim_duration) %% [trial_types, valid_responses] = tc_get_events_from_trigger_values(all_trigger_...
85098500504abfac7185e384fdd5ba56db0daf248f7629dfc5596045822d276d
MATLAB
3,301
78
function image_average_filter(data) figure() set(gcf,'name','Average Filter','NumberTitle','off','color','w','units','normalized','position',[0.25 0.15 0.4 0.6],'menubar','none','toolbar','figure') if length(data)>1 slider_step=[1/(length(data)-1),1]; slider_one = uicontrol('style','slider','units','...
e5e13264556a3238ef430774645b50488fd8378cd1e949d9e29c5c6dcb67cd46
MATLAB
3,302
87
function LEiDA_TransitionsK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % LEADING EIGENVECTOR DYNAMICS ANALYSIS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Function to compute the transition probability matrix for each sub...
731499c424230611ea68a70a652eb9e35dc7c4daf6caae5b9cc168f8058dad8a
MATLAB
3,307
82
% This function returns the path to the DL+Direct output folder % If the path doesn't exist or the folder is empty, it will create the path % and run the algorithm. % The name of the folder is always: DLdirect_output function DLdirect_path = DLdirect_subject_space_Trento(data_path,varargin) if nargin < 2 ...
fed5ec690096712bc7daf851e1aab68f86455810551a826b0a6d4034ec5ed7a5
MATLAB
3,310
88
function [atlas_out, fc_out] = removeNetworks(atlas_in, net_names, name, fc_in) %REMOVENETWORKS Remove given networks from a network atlas % atlas_in: Input network atlas % net_names: Networks to remove % name: Name of modified atlas % (Optional) fc_in: Functional connectivity to remove given networ...
82611a822f02e5b5ca961727334f65c116f1d229d4f0cfbbeb1ab2a5417a6bcc
MATLAB
3,325
160
%% MAIN clc clear format compact format longG load('waveforms_ripple_clusters_all.mat') %save('waveforms_cluster2_rgs.mat','waveforms_cluster2_bp_rgs','waveforms_cluster2_raw_rgs','-v7.3'); %save('waveforms_cluster2_rgs.mat','waveforms_cluster2_bp_rgs','waveforms_cluster2_raw_rgs','-v7.3'); %save('waveforms_cluster2_r...
cae5a904b179dc8ba0410d32ae674fcc26fb293d65ccef75dbb8ff9747b4aaae
MATLAB
3,339
80
function [I,Q,F]=motif3struct_wei(W) %MOTIF3STRUCT_WEI Intensity and coherence of structural class-3 motifs % % [I,Q,F] = motif3struct_wei(W); % % Structural motifs are patterns of local connectivity in complex % networks. Such patterns are particularly diverse in directed networks. % The motif fre...
88e4ff6631a80c46597baeab83eb4a08afcd92a6abeba28efc3e033a7464ec5c
MATLAB
3,342
121
function ri = rand_index(p1, p2, varargin) %RAND_INDEX Computes the rand index between two partitions. % RAND_INDEX(p1, p2) computes the rand index between partitions p1 and % p2. Both p1 and p2 must be specified as N-by-1 or 1-by-N vectors in % which each elements is an integer indicating which cluster the point...
3aeb28822df0023a4c9f6f5d3931d57311d504a71d83f386fbd7c321005cd05f
MATLAB
3,348
100
function Plot_K_nodes_in_cortex(data_dir,save_dir,selectedK,parcellation) % % Plot the nodes with positive values in the vectors of the centroids red % and the remaning nodes blue. Scale the size and transparency of the nodes % according to their contribution. % % INPUT: % data_dir directory where LEiDA results ar...
da1fcccf030e3baab719a57e15f2fae67d0eb018abe431133390631fb1172618
MATLAB
3,373
110
%jds_compareRippleModulationShifters %Compares NREM ripple modulation (suppression index and ripple-aligned %PSTH) of CA1 cells classified as REM theta-phase shifters vs nonshifters %(rank-sum, boxplot, PSTH overlay). clear savedir = '/Volumes/JUSTIN/SingleDay/ProcessedDataREM/'; load([savedir 'CA1nremca1allripmodsigd...
030f90ecaf53d9e9e52d7351bbdd30feafe2ca9755d0b9d31215dab7964ea630
MATLAB
3,377
112
function extract_eye_trials(sj,blk) piwd='/project/3018037.01/Experiment3.2_ERC/AnalysisFolder/rawData/'; %sj=[1 2 5:7 9:20]; % sj=9; % blk=3; pp=['S' num2str(sj)]; %if sj<21 hdrlines=43; % else % hdrlines=47; % end f=fopen([piwd pp filesep 'eyetrackerfiles' filesep pp '_B' num2str(blk) ' Samples.txt'])...
5fa78d628d4484a2aa562a95b1b6679da65a40d341fe89338db585c93fef9180
MATLAB
3,384
86
classdef DeglitchTest < matlab.unittest.TestCase properties tmp_dir end methods(TestMethodSetup) function setup(testCase) tmpd = tempname; mkdir(tmpd); testCase.tmp_dir = tmpd; utest_bst_setup(); end end methods(...
10f83a2e289b3e8825f966cbcbdc71c4a592d86573aed5a52ef73873a44755ed
MATLAB
3,385
96
function surf = SurfStatWriteSurf1( filename, surf, ab ); %Writes coordinates and triangles to a single .obj or FreeSurfer file. % % Usage: surf = SurfStatWriteSurf1( filename, surf [,ab] ); % % filename = .obj or FS file name. If extension=.obj, writes a .obj file % (ASCII or binary), else write...
ce8efb098e1b7825de24feccc051f9ec96d272a31f327662153a2ea59dbca094
MATLAB
3,400
96
%% plot_fig5 % % Reproduces all Fig. 5 panels % % Requires: shadedErrorBar.m (Mathworks File Exchange) % 'Fig5_mua_sua.mat', 'Fig5_lfp_tf.mat' % Author: moh3enparto@gmail.com % Date: 08.08.2026 clear; close all; set(groot, 'defaultAxesTickDir', 'out'); set(groot, 'defaultAxesTickDirMode', 'manual'...
392b9d9643c6354f09104c28312608b1ffddb57cefcb3810a9fac68a51dcc32e
MATLAB
3,401
107
function [On,Wr] = reorder_mod(W,M) %REORDER_MOD Reorder connectivity matrix by modular structure % % On = reorder_mod(W,M); % [On Wr] = reorder_mod(W,M); % % This function reorders the connectivity matrix by modular structure and % may consequently be useful in visualization of modular structure...
9768e6c2998facd16992f106d7a35e0022bdc7bd5c1f67c539102ccbb463f3eb
MATLAB
3,404
90
function [anat_brain, mask] = spm_brain_extraction(structural) %% STEP 3 -- Segmentation of coregistered structural image into GM, WM, CSF, etc % (with implicit warping to MNI space, saving forward and inverse transformations) [d, f, e] = fileparts(structural); if exist([d filesep f '_brain.nii'],'file') disp('...
9cba91f062aacbdc3cdc0924fe876cc3194cf20d7a0c669ff09235cd8f31c645
MATLAB
3,418
141
function newmap = bluewhitered_PD(m,x) %BLUEWHITERED Blue, white, and red color map. % BLUEWHITERED(M) returns an M-by-3 matrix containing a blue to white % to red colormap, with white corresponding to the CAXIS value closest % to zero. This colormap is most useful for images and surface plots % with positiv...
c5d7ce136659391033d6de42e7cf01d12af5f27943a18bf50bbc70942635174a
MATLAB
3,421
115
% CLIP_NII: Clip the NIfTI volume from any of the 6 sides % % Usage: nii = clip_nii(nii, [option]) % % Inputs: % % nii - NIfTI volume. % % option - struct instructing how many voxel to be cut from which side. % % option.cut_from_L = ( number of voxel ) % option.cut_from_R = ( number of voxel ) % option...
e9e22448095579ce740cdc438ecac637b2bc24e468414dc38cfd0704f7e4ef2a
MATLAB
3,428
105
%-------------------------------------------------------------------------- % Till Habersetzer, 05.07.2025 % Communication Acoustics, CvO University Oldenburg % till.habersetzer@uol.de % % Description: % Master script for running the 'complete' MEG-audio cross-correlation % analysis pipeline (without plotting). % ...
60047e95719ed845b40103b6ad47d07528e4d05d85765a76fd3555351ca7d803
MATLAB
3,430
101
% current working directory needs to be /path/to/scripts mainpath = pwd; addpath([mainpath filesep 'toolboxes' filesep 'OpenFmriAnalysis']) addpath([mainpath filesep 'toolboxes' filesep 'tc_functions']) addpath([mainpath filesep 'toolboxes' filesep 'spm12']) tvm_installOpenFmriAnalysisToolbox %% freeSurferFolder = [...
6453e3469fa2ce3d11cf6f98e3d797f00df96b34ddd20da5ef5624683e16cdce
MATLAB
3,441
83
function loc_list_clusters_data_table(data) counter = 0; for i = 1:length(data) data_to = unique(data{i}.area); if length(data_to)>1 counter = counter+1; data_to_send{counter} = data{i}; end end if exist('data_to_send','var') f = waitbar(0,'Extracting Data Table Information...'...
4e1af71c1f19454ad8148cb47e18a1a123a741501854313fc04f31d6d179059b
MATLAB
3,457
89
function LEiDA_AnalysisCentroid %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % LEADING EIGENVECTOR DYNAMICS ANALYSIS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Function to analyse one PL state from the set of K PL states c...
a2f2e7ee3d1e6c8c9105188181457d79a6255b24e9bd04146af9db2ffca0e02f
MATLAB
3,457
96
function loc_list_break_data(data) input_values = inputdlg({'X_axis Pile Size','Y_axis Pile Size'},'',1,{'10','10'}); if isempty(input_values)~=1 x_axis_pile_size = str2double(input_values{1,1}); y_axis_pile_size = str2double(input_values{2,1}); data_break = cell(1,length(data)); for i = 1:length(...
eaaa694e5e00b95e4fb92aaaae1abeed649869a8e9f5ef7c7d0185a9f4cb6b87
MATLAB
3,459
78
function varargout = nst_io_fetch_sample_data(data_label, confirm_download) % Return file names of sample data. Download them if necessary. % % [NIRS_FILES, SUBJECT_NAMES] = NST_IO_FETCH_SAMPLE_DATA('template_group_tapping', CONFIRM_DOWNLOAD) % if nargin < 2 confirm_download = 1; end switch data_label case 't...
34a6279b1401235e9a25b7035e678e536634183aa51a85b5f3bb7ebcf0af16d9
MATLAB
3,461
105
function Y_rand = spin_permutations(Y,spheres,n_rep,varargin) % SPIN_PERMUTATIONS constructs null data through spin permutations. % % Y_rand = SPIN_PERMUTATIONS(Y,spheres,n_rep,varargin) performs spin % permutations of n-by-m matrix Y, where n is number of vertices and m % number of markers to perumute. Spheres...
bd6fbe4a62f53aa4c19167d3f7f3f894cb032773d443cf0431992934526b26a4
MATLAB
3,467
88
function [C, q]=core_periphery_dir(W,gamm,C) %CORE_PERIPHERY_DIR Core/periphery structure and core-ness statistic % % C = core_periphery_dir(W) % [C,q] = core_periphery_dir(W,gamm,C0) % % The optimal core/periphery subdivision is a partition of the network % into two non-overlapping groups of nodes, a c...
ba7ac591c7df2e247f7b25c7b5a6252750d7a5a44adb56f56ca8f41c6b813e10
MATLAB
3,477
106
function Binned_y = Model_2State(parameter_guess, JumpProb, data_to_fit) %MODEL_2STATE 2-state model, fixed localization error LocError = data_to_fit.LocError; dT = data_to_fit.dT; HistVecJumps = data_to_fit.HistVecJumps; dZ = data_to_fit.dZ; HistVecJumpsCDF = data_to_fit.HistVecJumpsCDF; ModelFit = data_to_fit.ModelF...
b161c98e900b7efbbf862590e64122815b9a91ec97186894a6f5f88266539605
MATLAB
3,478
98
function LEiDA_AnalysisK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % LEADING EIGENVECTOR DYNAMICS ANALYSIS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Function to analyse the PL states chosen according to the analysis fr...
d748814d30b67455753c6c38c15cc40d2cd222d1ccf619b8030aa95176344185
MATLAB
3,484
107
function P = morlet_transform(x,t,f,fc,FWHM_tc,squared) % function P = morlet_transform(x,t,f,fc,FWHM_tc,squared) % % Applies complex Morlet wavelet transform to the timeseries stored in the % matrix x with size (ntimeseries x ntimes). It returns a wavelet coefficient map (by default % squared) % % INPUTS: % ...
3088b2740d5d04c9bec4046127d556a44a1bcf21e9716e7e55b41b1e3d0e74fb
MATLAB
3,492
103
function [b,idx,outliers] = deleteoutliers(a,alpha,rep); % [B, IDX, OUTLIERS] = DELETEOUTLIERS(A, ALPHA, REP) % % For input vector A, returns a vector B with outliers (at the significance % level alpha) removed. Also, optional output argument idx returns the % indices in A of outlier values. Optional output argum...
0c9df917f27bddc4afd49d79f69c22e4fe15483c16e4c257df04daea8339ffb9
MATLAB
3,495
87
% COMPUTEMATCHEDFANOFACTOR Compute Fano Factor for matched distributions % % [FF, FF_SE] = computeMatchedFanoFactor(meanA, meanB, varA, varB, num_resampling) % Computes the Fano Factor for two datasets with matched mean distributions % through iterative resampling. The Fano Factor represents the slope of the...
80f31e57c858bdc3a4883f72cbe075ff3d726bfd78e699f77abcc0bb3d77d839
MATLAB
3,503
84
function [ResultMap1,ResultMap2,ResultMap3,ResultMap4,res]=restgca_coefficient_XQ(AROITimeCourse, ABrain4D,Order,theCovariables) ResultMap1={};ResultMap2={};ResultMap3={};ResultMap4={}; nDim4 = size(AROITimeCourse,1); % [nDim1, nDim2, nDim3, nDim4]=size(ABrain4D); % component by QX % ...
df91fc528147c12a028bf6c17383b31aa59291068ca904b69c13e7a2b1daff6b
MATLAB
3,506
100
function Y_rand = moran_randomization(Y,MEM,n_rep,varargin) % MORAN_RANDOMIZATION Null model for spatially auto-correlated data. % y_rand = MICA_MORAN_RANDOMIZATION(y,MEM,n_rep,varargin) computes % random values x_rand with similar spatial properties as the input data % x. x is a n-by-1 vector of observations, ...
0faf43527d48fa8ae7853799e7f1735bfcb0b73f438e5c3e8fdbcf34d542b011
MATLAB
3,508
96
function source_space_full_group_pipeline_V1() % Example for the template- and surface-based full pipeline, using the % function nst_ppl_1st_level_channel_V1. % % This script downloads some sample data of 10 "dummy" subjects (27 Mb) % Total max amount of data to download: (TODO) Mb, the user is asked for download...
33e0f1f90f5df7d4eca041cb0210c85dd72ab0c5d18b334ae89ccf60bd4713c8
MATLAB
3,509
101
function FC_project = get_network(FC_project,network) old_path = pwd; switch FC_project.atlas case 1 LN = [1,2,3,4,5,6,7,8,9,10,11,12,15,16,25,26,57,58,61,62,65,66,67,68,81,82,83,84,85,86,87,88,89,90]; SN = [33,34,147:152]; DAN = [1,2,5,6,51,52,61,62]; DMN = [19,20,25,26,3...
e7801c04fdc20329eda09d80d9cffee4e7e96c5edbe0df68f83b6e84573ad6a0
MATLAB
3,510
100
function [cmat, band_indexes] = nst_math_build_basis_dct(nsamples, sampling_rate, freq_ranges, ortho) % build_basis_cosine - Build a Cosine basis within specific frequency % ranges (or bands) % % Synopsis % [cmat] = build_basis_cosine(nsamples, sampling_rate, freq_ranges) % % Description % build an orthogonal matri...
215b07a3f59611646aa240ee614cc76b4596faf0dd31c9fe887f4dd2fc925ca6
MATLAB
3,511
117
function AS_ShowGCmatrixGUI Hsize = get(0,'screensize'); MIDPOINT = [Hsize(3)/2,Hsize(4)/2]; Asize = [100*3,100+40]; MaxSIZE = [Hsize(3) Hsize(4)]*0.4; factor = MaxSIZE./Asize; factornew = min(factor); POSSIZE = Asize*factornew; SelMod.fig = figure('position',[MIDPOINT(1)-POSSIZE(1)/4,MIDPOINT(2)-POSSIZE(2)/4,P...
054d0a8e847ee152efdd890ab6be13c759c4ea2bd3ad2e61837510436a9df080
MATLAB
3,513
109
function [Rlatt,Rrp,ind_rp,eff] = latmio_und(R,ITER,D) %LATMIO_UND Lattice with preserved degree distribution % % [Rlatt,Rrp,ind_rp,eff] = latmio_und(R,ITER,D); % % This function "latticizes" an undirected network, while preserving the % degree distribution. The function does not preserve the strength % d...
ac740daa3873b74ea7aba5c842ccc0c7cba37c0245fb7214dd3f1abc99536dd9
MATLAB
3,513
134
function varargout = fdr(varargin) % Computes the FDR-threshold for a vector of p-values. % % Usage: % [pthr,pcor,padj] = fdr(pvals) % fdr(pval,q) % fdr(pval,q,cV) % % Inputs: % pvals = Vector of p-values. % q = Allowed proportion of false positives (q-value). % Defa...
a68401db411727a1a9e79b2fd21ee520dbbb764477f91dd8eba3bfdf82ff6c1a
MATLAB
3,514
44
% SCHEMABALLUNIT Unit tests for schemaball. classdef schemaballUnit < matlab.unittest.TestCase methods (Test) % Verify all errors function verifyErrorsWarnings(tc) tc.verifyError(@() schemaball([],[],[],[],[]) ,'MATLAB:TooManyInputs') tc.verifyError(@...
1f3145c7e643ec285015004c27db528aa987221f30cdbeb1c909032314555858
MATLAB
3,515
105
function Binned_y = Model_2State_fitLocError(parameter_guess, JumpProb, data_to_fit) %Model_2State_fitLocError 2-state model, fitted localization error dT = data_to_fit.dT; HistVecJumps = data_to_fit.HistVecJumps; dZ = data_to_fit.dZ; HistVecJumpsCDF = data_to_fit.HistVecJumpsCDF; ModelFit = data_to_fit.ModelFit; Z_co...
134268950e137007fc95f1ca16fde6eb8baf7265020736c65c85639068d9c645
MATLAB
3,520
112
function [sr, PL_bin, PL_wei, PL_dis, paths] = navigation_wu(L, D, max_hops) % Navigation of connectivity length matrix L guided by nodal distance D % % % Navigation % [sr, PL_bin, PL_wei] = navigation_wu(L,D); % % Binary shortest path length % sp_PL_bin = distance_bin(L); % % Weighted shortest path length % sp_PL_wei...
05bb9c1070e20c81a4850745619584f94a2d4c9a4c5964521c11807b3082bd04
MATLAB
3,524
121
function [zmap]=stats_high_spec(freq1,freq2,w) ntrials=size(freq1.powspctrm,1); %Requires converting NaNs values into zeros. no1=freq1.powspctrm; no2=freq2.powspctrm; no1(isnan(no1))=0; no2(isnan(no2))=0; %% freq1.powspctrm=no1; freq2.powspctrm=no2; %% statistics via permutation testing % p-value pval = 0.05; % con...
26b117866c070147fcacf5e438871b3be5b2aac532ceb6b59ad8e7edb844d1f9
MATLAB
3,528
102
function over_subject_results = i_make_t_stat_fmri_over_subjects(parameters, subjects, bad_subjects, models_to_use) %% over_subject_results = i_make_t_stat_fmri_over_subjects(mainpath, subjects, bad_subjects, models_to_use) %mainpath = '/project/3018037.01/Experiment3.2_ERC/AnalysisFolder/scripts/scriptTemplates/..'; t...
8d1723ad5a2ab86f290276e28ff15c02ff1bcd898b5eab2b93074f3d613b4731
MATLAB
3,532
87
function jds_chainIsolatedAssemblyStrengthREM(animalprefixlist,area,state) %JDS_CHAINISOLATEDASSEMBLYSTRENGTHREM Assembly reactivation in chain vs isolated ripples. % jds_chainIsolatedAssemblyStrengthREM(animalprefixlist,area,state) % compares peak z-scored assembly reactivation strength within chain % cortical r...
739885c2ece065222469201e076eca710015d878264d60ab1d695cf4b4d43a7e
MATLAB
3,534
97
% Demonstrate how spin rotation works with a faked dataset in FreeSurfer fsaverage5 % Requires AxelRot.m (included in this directory) from file exchange, % https://www.mathworks.com/matlabcentral/fileexchange/30864-3d-rotation-about-shifted-axis?focused=5191309&tab=function % & installation of FreeSurfer Matlab toolbo...
e9d4d83442b32adac6d0fff8d66dbbbdca7f7e96c3aaa17f156154bc7362e88d
MATLAB
3,545
92
function OUT = cluster_DTI_perm_2groups_3(S_fin) %combining original and permuted clusters %this function works in connection with the previous one % Leonardo Bonetti, Aarhus, 22/12/2020 %indexing and loading permuting clusters a = dir([S_fin.outdir '/' S_fin.analysis_name '_clust_perm*']); if ~isempty(a) %if there ...
d4a6e1653ee164d29cbd1c640ad64a57681df9ba54bef21b6fb600c392e20640
MATLAB
3,553
72
classdef DiagnosticPlot < handle properties edge_test_options network_test_options edge_test_result network_atlas networkTestResult end methods function obj = DiagnosticPlot(edge_test_options, network_test_options, edge_test_result, network_atlas, networkTes...
309b4100c36ed9fbeb9be9e81dcd9e744c3d2f4ac3269f8f3ab469851701d35d
MATLAB
3,557
121
function [SPL,hops,Pmat] = distance_wei_floyd(D,transform) % DISTANCE_WEI_FLOYD Distance matrix (Floyd-Warshall algorithm) % % [SPL,hops,Pmat] = distance_wei_floyd(D,transform) % % Computes the topological length of the shortest possible path % connecting every pair of nodes in the network. % % Inputs: %...
0608d48391400cb69f7f10d5f7abadf636c542ac4b6ce8dfd6bf9709e64ff2de
MATLAB
3,560
112
%-------------------------------------------------------------------------- % Till Habersetzer, 05.07.2025 % Communication Acoustics, CvO University Oldenburg % till.habersetzer@uol.de % % Description: % Master script for running the complete MEG-audio neural decoding % analysis pipeline (without plotting). It orc...
7436e5fed90737c3a3aad7af95634a33f55a00d1bea33d109b985781f6f6a76e
MATLAB
3,568
84
% When you load any ANALYZE or NIfTI file with 'load_nii.m', and view % it with 'view_nii.m', you may find that the image is L-R flipped. % This is because of the confusion of radiological and neurological % convention in the medical image before NIfTI format is adopted. You % can find more details from: % %...
1d73e814b3bbc0494921acced58fb16cf8e13d5ff7f0301648881eb058d4debb
MATLAB
3,579
107
function [R,eff] = randmio_und_connected(R, ITER) %RANDMIO_UND_CONNECTED Random graph with preserved degree distribution % % R = randmio_und_connected(W,ITER); % [R eff] = randmio_und_connected(W, ITER); % % This function randomizes an undirected network, while preserving the % degree distribution. T...
9465a7509d8227782bcc84f73d203f1a286fe9cf9b4f6f5c3bb14914e829fe61
MATLAB
3,583
86
function [embedding, scaled_eigval] = diffusion_mapping(data, n_components, alpha, diffusion_time, random_state) % DIFFUSION_MAPPING Diffusion mapping decomposition of input matrix. % embedding = DIFFUSION_MAPPING(data,n_components,alpha,diffusion_time) % computes the first n_components diffusion components of ma...
76060c3c9d4813ea5c97b6b41d945bb11f9c3a3de6184f3d2fb377d019392ea9
MATLAB
3,587
106
function run_permcp(tensorname,method,minF,maxF,nreps,shiftAmount) %PERMCP Computes a permuted CP decomposition for several choices % of the number of components (minF up to maxF) and a given % number of repetitions using different random initializations. % It assumes each fiber in the tensor is a flatt...
cd8b2b3ae78d065bf1b8cefaac7ad5bc2c15a522e80a60068b5b69f89914081b
MATLAB
3,588
93
% Function to generate a p-value for the spatial correlation between two parcellated cortical surface maps, % using a set of spherical permutations of regions of interest (which can be generated using the function "rotate_parcellation"). % The function performs the permutation in both directions; i.e.: by permute both...
690065c59813a2a46bf4dc8ceb2299abc1d16c9a6b990556221b41dda11a63cb
MATLAB
3,609
81
function surface_template_full_group_pipeline_V1() % Example for the template- and surface-based full pipeline, using the % function NST_PPL_SURFACE_TEMPLATE_V1. % % This script downloads some sample data of 10 "dummy" subjects (27 Mb), % as well as the Colin27_4NIRS template (19 Mb) if not available. % For the ...
b7e54804e4292454dc31c39b1d4baf94ec6263ba881f8e00161bdd96406d3906
MATLAB
3,610
73
function ROI_final_pos = drawROIsOnCortex(ax, net_atlas, ctx, mesh_alpha, ROI_radius, view_pos, surface_parcels, color_mode, color_mat) %DRAWROISONCORTEX Draw ROIs on cortex mesh % net_atlas: relevant NetworkAtlas object % ctx: MeshType object determining what mesh inflation value to use % mesh_al...
a75399d895cb83388ea21dc6b3f715642bbcde034a139302dc199e7c61b71d7d
MATLAB
3,631
115
%-------------------------------------------------------------------------- % Till Habersetzer, 20.06.2025 % Communication Acoustics, CvO University Oldenburg % till.habersetzer@uol.de % % This script serves as a visualization tool for pre-computed Auditory % Evoked Field (AEF) data, using the FieldTrip toolbox. It l...
254656cb1f278f55ec205406302940e801f7b2490d075c4b21a8cb6ce53f0273
MATLAB
3,632
100
function [B,E,K] = evaluate_generative_model(A,Atgt,D,modeltype,modelvar,params) % EVALUATE_GENERATIVE_MODEL Generation and evaluation of synthetic networks % % [B,E,K] = EVALUATE_GENERATIVE_MODEL(A,Atgt,D,m,modeltype,modelvar,params) % % Generates synthetic networks and evaluates their energy function (see % ...
372cd94f4db2d820831109b9dc33b3ef238aca12f6b914c7574ae57e9befcf24
MATLAB
3,636
105
function [Mreordered,Mindices,cost] = reorder_matrix(M1,cost,flag) % REORDER_MATRIX Matrix reordering for visualization % % [Mreordered,Mindices,cost] = reorder_matrix(M1,cost,flag) % % This function rearranges the nodes in matrix M1 such that the matrix % elements are squeezed along the main diagonal. T...
558276fc32fbe4e65567ae80c075fd1a51547990fd15999e2a44f81238ef8ccc
MATLAB
3,638
81
classdef MultiLevel < nla.edge.permutationMethods.Base %MULTILEVEL Multilevel permutation method % % multi-level strategy = multiLevel() % multi-level strategy = the object which will be doing the permutations the data. The functional % connectivity is permuted % % needed for methods: ...
2ccf011de24db8d0e7e501668391074392fff4a306b3085a57974ded49740948
MATLAB
3,639
96
function [info]=Getifh(filename) % % Program to read 4dfp image header. % % Yi Su, Jan 2011 info=[]; %Processing filename [path,name1,ext1]=fileparts(filename); [dum,name2,ext2]=fileparts(name1); if (isempty(ext1)) name=[name1 '.4dfp.ifh']; elseif (isempty(ext2)||~strcmp(ext2,'.4dfp')||~strcmp(ext1,'.ifh')) ...
ccae76b39a48dc7490906f79b2f01f3808fbc54a79e225300771bf2848fd75c9
MATLAB
3,642
140
function [Eres,prob_SPL] = resource_efficiency_bin(adj,lambda,SPL,M) % RESOURCE_EFFICIENCY_BIN Resource efficiency and shortest-path probability % % [Eres,prob_SPL] = resource_efficiency_bin(adj,lambda,SPL,M) % % The resource efficiency between nodes i and j is inversly proportional % to the amount of...
059cbc5ffe166b8946200be5e4d173fc7aedcb0ca7a818b1c443b5a0fbdc4271
MATLAB
3,648
136
function pval = computePVal(kA, muA, varA, kB, muB, varB) % Compute the p-value for rnaseqdedemo. pval = ones(size(kA)); p_A = muA ./varA; r_A = (muA.^2)./(varA-muA); p_B = muB./varB; r_B = (muB.^2)./(varB-muB); kS = kA + kB; p_obs_0 = nbinpdf(kA, r_A, p_A) .* nbinpdf(kB, r_B, p_B); nf_idx = isfinite(p_obs_0); p_ob...
e1cf20d5221c714272a4aab66d3c40595f51c48e5f5175d50d04e77e0fccaf0e
MATLAB
3,656
75
function j_check_voxel_neighborhood(mainpath, subjects, bad_subjects) %% j_check_voxel_neighborhood(mainpath, save_dir, subjects, bad_subjects) subject_counter = 0; hemispheres = {'lh', 'rh'}; visual_areas = {'V1', 'V2', 'V3'}; perc_layers = []; neighborhood = []; num_voxel = []; for subject = setdiff(subjects, bad_su...
570d07f37a70034b7e0ff6434d74bd800d8ca5abf504cb8602dc8195e52297d7
MATLAB
3,659
106
function [aligned, xfms] = procrustes_alignment(gradients,varargin) % PROCRUSTES_ALIGNMENT Performs a Procrustes alignment between gradients. % % aligned = PROCRUSTES_ALIGNMENT(gradients,varargin) performs a singular % value decomposition of the vectors in cell array gradients to align % them. Valid name-value ...
40b14954729117b9595bcb9cdeadffe8fb8f1f39c3836c54a850a832c5333df9
MATLAB
3,665
111
function cluster_performance(data_dir) % % Compute the Dunn's index, Calinski-Harabasz (CH) index and average % Silhouette coefficient for each value of K to assess clustering % performance. % % INPUT: % data_dir directory where the results from K-means are saved % % OUTPUT: % dunn_score Dunn's index computed ...
8e43c44c10831a850eda913db14e46827c6aead943af39d3aa8b7e18e0fe4794
MATLAB
3,668
176
function [beta, tstr, ha] = mipp_resQ_plot(S, xps, h, h2, opt) % function beta = resQ_plot(S, xps, h, h2, opt) error('replaced by v2') if (nargin < 3), h = gca; end if (nargin < 4), h2 = []; end if nargin < 5 opt = mdm_opt(); opt = resQ_opt(opt); end ind = ones(xps.n, 1, 'logical'); S = abs(S); if ~isfiel...
8480a4fcf39bc8f82bee478ab3b4db4454f1bbb86fa2eed5b18d4241dd7b4ce9
MATLAB
3,669
113
function data = SurfStatReadData( filenames, dirname, maxmem ) %Reads data (e.g. thickness) from an array of .txt or FreeSurfer files. % % Usage: data = SurfStatReadData( filenames [, dirname [, maxmem ]] ); % % filenames = .txt, .mgh or FS file name (n=1) or n x k cell array of file % names. If t...
dc8e77bdea3e5d7f9d8087604bc07c267ee6017a5936d5d4fd90f2cfa8f0b881
MATLAB
3,684
107
function [ MATF ] = generalCoupling_prepareplotting_LBPD_D( POS, NEG, p_thresh, label_path, pos_lab_only ) % It creates an ROIs x ROIs matrix, ordering ROIs according to labels % provided (example that I provide consists in AAL ordered like LRLRLR), % showing the sum over time of significant connections between ROIs. ...
408e018d656f0ec77a1dd37048532438c776cb106b8a465602ea352b4f56cdc4
MATLAB
3,697
72
function O = GED_SingleSubjects(S) O = []; addpath('/projects/MINDLAB2017_MEG-LearningBach/scripts/Mattia') comps2see = S.comps2see; list = S.list; shr = 0.01; % value between 0 and 1 (0 small perturbation, 1 big perturbation) - for Mattia regularisation (until 0.001 it works for restoring the full rank of th...
65347be0def1bbb2bc032d719f75f3aa08245044c7f05554103cd2b4ea80cc2f
MATLAB
3,697
70
classdef StudentTTest < handle %STUDENTTTESTs Student's t-test (t-test assuming normal distributions) properties (Constant) name = "students_t" display_name = "Student's T-test" statistics = ["t_statistic", "single_sample_t_statistic"] ranking_statistic = "t_statistic" al...
238a7c85c98253c2aa5ed41d5bfe946ec5af21f46b40522ede9053c18f7589af
MATLAB
3,698
148
% Load NIFTI header extension after its header is loaded using load_nii_hdr. % % Usage: ext = load_nii_ext(filename) % % filename - NIFTI file name. % % Returned values: % % ext - Structure of NIFTI header extension, which includes num_ext, % and all the extended header sections in the header extens...
47f90bef5f0cd499e0945f97ebf6a904dd5107033fb8fff14869a02a6cda84fc
MATLAB
3,707
105
function PlotRadarGraph_multi(Data,seednum,maxpercent,Patchcolor,markersize,sepnum) pathmfile = which('AS_WTA_GUI.m'); [pat nam ext] = fileparts(pathmfile); load(fullfile(pat,'SEEDCOLOR.mat')) load(fullfile(pat,'JETcode.mat')); Hsize = get(0,'ScreenSize'); Bsize = min(Hsize(3),Hsize(4)); BsizeUsed = floor(Bsiz...
76abef0641297cb9fbac378a110c0db6334ad301b33464e9fedd8f6557f82ac6
MATLAB
3,708
85
classdef Base < nla.TestResult %Base class of results of edge-level analysis % % :param size: The size of the Trimatrix being analyzed % :param prob_max: The threshold for the p-value properties coeff % Fisher transformed r-value prob prob_sig avg_prob_sig = NaN ...
c68127f7935c6852cb1c59425b49ca061379e9f977c5844e94a036aa870ae64c
MATLAB
3,719
97
function varargout = process_nst_snap_montage( varargin ) % @============================================================================= % This function is part of the Brainstorm software: % http://neuroimage.usc.edu/brainstorm % % Copyright (c)2000-2016 University of Southern California & McGill University % This ...
0772d4b70df2a43c2573ef9be25995f5324e9da0dc6cfe69fd0c2773eb1d1dd1
MATLAB
3,720
176
function [beta, tstr] = resQ_plot(S, xps, h, h2, opt) % function beta = resQ_plot(S, xps, h, h2, opt) if (nargin < 3), h = gca; end if (nargin < 4), h2 = []; end if nargin < 5 opt = mdm_opt(); opt = resQ_opt(opt); end ind = ones(xps.n, 1, 'logical'); ind(1:2) = 0; S = abs(S); if ~isfield...
51a8577c883aea991c0933e8e1b47473cf1edd1f5b526400c4f4d4a4e90ce2b9
MATLAB
3,726
124
%% read prot=xlsread('L:\Elite\LARS\2014\mai\transfection 3rd paralell\TransFecMCR27logBm2withFugeneandControl.xlsx'); %% check normal ratio distribution histfit(prot(prot(:,15)~=0,15)) % check for median ratios heavy normal to light normal xlim([-3 3]) hist(prot(prot(:,15)~=0,15),[100]) % check for median rat...
b874641ec395e9ce66b0fe64ac99d7acdc8f782b472c3893d04893e6137c0b23
MATLAB
3,726
90
function model = nst_glm_apply_filter(model,filter_name, varargin ) %NST_GLM_APPLY_FILTER Apply filter on the regressor of the column matrix %but only apply when it's ok to apply it (for exemple, we don't apply a %high-pass filter on the constant regressor). Condition about what filter %can be applied can be found in m...
78000171865e0b2d45d78345ee96af0c1819f8cf2a84de655729092d633704b8
MATLAB
3,729
83
% current working directory needs to be /path/to/scripts mainpath = pwd; addpath([mainpath filesep 'toolboxes' filesep 'OpenFmriAnalysis']) addpath([mainpath filesep 'toolboxes' filesep 'spm12']) tvm_installOpenFmriAnalysisToolbox; %% tic;disp('doing boundary registration...') configuration = []; configuration.i_Subje...
9ad6914fc59f0ddb572266d322dcf6242b6efecdc49ace065c408245d4512d12
MATLAB
3,729
122
function S2 = convert_surface(S,varargin) % CONVERT_SURFACE Converts surfaces to MATLAB or SurfStat format and % writes new surface files. % % S2 = CONVERT_SURFACE(S) converts surface S to SurfStat format. S can % either be a file (.gii, .mat, .obj, Freesurfer), a loaded variable (in % SurfSt...
f89aa23e4d69f2491d4a284829e183b866d1e4ced24b2839c80d7e8e73a96679
MATLAB
3,732
91
classdef RemoteDataTest < matlab.unittest.TestCase properties tmp_dir end methods(TestMethodSetup) function create_tmp_dir(testCase) tmpd = tempname; mkdir(tmpd); testCase.tmp_dir = tmpd; end end methods(TestMethodTeardown) ...
e29b2ecde4d5137a4d25532d87636c748ea93387b22455f79c65102959b7dffc
MATLAB
3,735
114
% Input an [x,y] list of localization positions and generate a mask image % enclosing the area they comprise. The image can optionally be resized to % obtain a desired pixel size % % Inputs % xy - two-column matrix with x and y coordinates of localizations in % presumed units are pixels, since this makes...
55b4147a7cf8b850e94a957607490f4b0d53f41f006f24d38ec56b4d1c3f3555
MATLAB
3,741
136
function [zmap]=stats_high_granger(g2,g,i,j) %ntrials=size(freq1.powspctrm,1); a=[i j]; ntrials=size(g2, 5); %Requires converting NaNs values into zeros. no1=squeeze(g(a(1),a(2),:,:,:)); no2=squeeze(g2(a(1), a(2),:,:,:)); no1(isnan(no1))=0; no2(isnan(no2))=0; % replicating time frequency matrix ntrials time %no1=r...
445f22f713737ff97ccebd262c406fd3791c5b0f704f16dfc8295b07f50131ea
MATLAB
3,763
109
function t = term( x, str ); %Makes a vector, matrix or structure into a term in a linear model. % % Usage: t = term( x [, str] ); % % Internally a term consists of a cell array of strings for the names of % the variables in the term, and a matrix with one column for each name, % which can be accessed by char ...
44b8e5383e52bc2332b1011cf00cc5246a55f1d3d451ab9ed59c000e578f04fc
MATLAB
3,788
116
% This script loads 7 unweighted, undirected adjacency matrices % corresponding to a clique, chain, ring, 1D lattice, star, rich-club, and % bi-modular toy networks (all graphs have 50 nodes). The following % efficiency measures are computed for each graph: % % - prob_SPL: probability of one particle traveling through...
9f39925ca2a2212667edb046abba5221e2c6b8ca075c79656383578f6ebfc54a
MATLAB
3,809
88
function [f,F]=motif4funct_bin(A) %MOTIF4FUNCT_BIN Frequency of functional class-4 motifs % % [f,F] = motif4funct_bin(A); % % *Structural motifs* are patterns of local connectivity in complex % networks. In contrast, *functional motifs* are all possible subsets of % patterns of local connectivity e...
9f2b933e0e84647b6e7acd0219310d9e0703c80182dd52ce710ee0a961da7cfb
MATLAB
3,812
76
classdef WelchTTest < handle %WELCHTTEST Welch's t-Test (t-test assuming normal distributions with unequal variances) properties (Constant) name = "welchs_t" display_name = "Welch's T-test" statistics = ["t_statistic", "single_sample_t_statistic"] ranking_statistic = "t_statisti...
77632bda4dd6c39ceb908064d7ba4a3c2f291eb37eb160aae7f20734bab0ddfd
MATLAB
3,815
112
function Plot_K_links_in_cortex(data_dir,save_dir,selectedK,parcellation) % % Plot the links between the areas with positive values in the vectors of % the centroids in a glass cortex. % % INPUT: % data_dir directory where LEiDA results are stored % save_dir directory to save results for selected optimal K % ...
90c58a6285189e68f1bf86cdf9f64476dc03ace5909a74c6f40ab40635d7917c
MATLAB
3,824
179
function dFC_project = get_roi_lobe(dFC_project) if dFC_project.atlas==1 ROI_location = { 'Frontal' 'Frontal' 'Frontal' 'Frontal' 'Frontal' 'Frontal' 'Frontal' 'Frontal' 'Frontal' 'Frontal' 'Frontal' 'Fro...
100a13bc53903e4185451a912612c2a57fd48f0e39e4741c9019b2289d58a7d7
MATLAB
3,826
103
classdef UnconstrainedBlocks < nla.helpers.stdError.AbstractSwEStdErrStrategy properties (SetAccess = protected) REQUIRES_GROUP = true; end methods function contrastStdErr = calculate(obj, sweStdErrInput) %rename variables for ...
6a3d6f317c9d2f2b7c3ba5110de6bcc7b59644d774510531846dc2a03f4f6f17
MATLAB
3,829
145
function [outpict inclass]=imcast(inpict,outclass) % [OUTPICT INCLASS]=IMCAST(INPICT,OUTCLASS) % Scale and recast image data and return class of input % This is more succinct than using getrangefromclass() % and im2double(), im2uint8(), etc. % % This is a convenience not only because it is suc...
3605f0920a76a417edcd2ee2006e32e46a7d17e5c385f486413908d3789ee2ae
MATLAB
3,833
85
function Plot_K_overlap_yeo_nets(data_dir,save_dir,selectedK,parcellation) % % Compute the overlap between each PL state (1 to selectedK) and the RSNs % defined in Yeo et al., (2011). Plot the overlap between each PL state and % each of the Yeo RSNs. % % INPUT: % data_dir directory where LEiDA results are stored %...
c01d301a8e33aecd3ff8de14222deea4c29c78bd9ef6c0f59a9674f657a31a62
MATLAB
3,838
167
clear maindir = 'D:\DATA_LOCAL\MIPCART pilot\Histology\Sorterad'; fnl = fix.findFiles(maindir, '*HE*.jpg'); % inam = {'Meningioma (Ref)', '102', '103', '105', '106', '12', '15', '3', '5', '8'}; inam = {'Ref. (meningioma)', 'Untreated (LNCaP)', ' ', ' ', ' ', 'Treated (LNCaP)', ' ', ' ', ' ', ' '}; ssf = [1 5 5 5 5 ...
1625b22dc432d7cee54aec0a9a877d8b12a98a4545246ba90ba1044db338a349
MATLAB
3,854
142
% PAD_NII: Pad the NIfTI volume from any of the 6 sides % % Usage: nii = pad_nii(nii, [option]) % % Inputs: % % nii - NIfTI volume. % % option - struct instructing how many voxel to be padded from which side. % % option.pad_from_L = ( number of voxel ) % option.pad_from_R = ( number of voxel ) % option...