sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
b2ce38656fd1b4a2f32728025a7e2ddc51c49fd509fa464a25a538be94b6841c
MATLAB
9,136
250
function [lfp, events, group, sex, age, channels_by_layer_csd, remove_chans_csd] = pre_CSD_by_speed(animal,filter, region, mins, maxs) %make data for CSD %get lfp for best row of 21 channels %find channel assignments for each layer, bad channels %to be removed for group analysis %events = theta trough times ...
363340851d2f2bff5eda5caeefdc5e808394f45b2bc1bd22254e1f367a342f7b
MATLAB
9,167
320
clc clear all close all set(0,'defaultfigurecolor',[1 1 1]);% set figure background color if ~contains(path, '/Users/guofanhua/Desktop/gfh/tools/MatlabTools/BrainSpace-latest/matlab') addpath(genpath('/Users/guofanhua/Desktop/gfh/tools/MatlabTools/BrainSpace-latest/matlab')); end %% ======================= compare...
918df83d74aae62f71a8cf498846d068ec0883d5757f1c8b63920902250a946c
MATLAB
9,167
242
% std_detachplots() - Given a figure with subplots and several lines per axis, will add a callback to % each axis specified in the 'figtitles' input. The callback consist in a figure with all the detached % individuals lines. % % Usage: % >> std_detachplots('','','data',data 'figtitles', alltitlestmp,'sbtitles',sb...
10474955f2eee9b29557d6afc5527710f67f7251a7b44d58e1b59beb10bc0e43
MATLAB
9,169
223
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% demo_wave_model_simulation.m %%% %%% MATLAB script to demonstrate how to simulate the wave model on a %%% cortical surface. In particular, the script demonstrates how to %%% (1) simulate resting-state activity and %%% (2) simulate evoked ac...
9cc425c60f865c2120a7d65c80ce986271199466476220e15ff366c0cb31b206
MATLAB
9,176
146
%% ETLAS2 Dual-Echo pCASL Summary Statistics % Aggregate calibrated-BOLD metrics (CBF, BOLD, CMRO2, n) per subject in visual ROI p = "/mnt/projects/ETLAS2/data/derivatives/dual_echo_pcasl/"; overview = readtable('/mnt/projects/ETLAS2/data/subjects_overview_dual_echo_pcasl.xlsx', "TextType", "string", "EmptyFieldRule"...
502a5b1f068c5538a0bbcae5fd136a71dff7d524eee98862e639b4ea625e94d5
MATLAB
9,179
261
%% LaBGAScore_atlas_binary_mask_from_atlas.m % % % *USAGE* % % This script creates a binary mask by combining regions from one or more % atlases, and automatically saves the fmri_mask_image, and .nii versions % of it in maskdir of your dataset % % There are options to save the original atlas object created by % select_...
0993015f6ffc63f9a5849d844f52b78d15b8b16716f5e239f129573e9dd30318
MATLAB
9,186
129
% Step 1: Create a main analysis folder <basedir> and navigate there % ------------------------------------------------------------------------- % Run: a_set_up_new_analysis_folder_and_scripts % Creates local folders and copies in relevant scripts % Step 2: Edit these files in you local analysis folder an...
52d432f673d561c2e12dda8426913c1dddf396e63cf8a1e314aae7a6ab0b8fb6
MATLAB
9,187
268
function varargout=ami_thomas(varargin) % [tau,ami]=AMI_Thomas(x,L) % inputs: x - time series, vertically orientedtrc files selected by user % L - Maximum lag to calculate AMI until % outputs: tau - first true minimum of the AMI vs lag plot % AMI - a vertically oriented vector containing valu...
2b5fde60540ce21258dc48573d52ad7696cc389bb64dcf84943397acd526a808
MATLAB
9,188
235
function varargout = segment_ar_gui(varargin) % SEGMENT_AR_GUI MATLAB code for segment_ar_gui.fig % SEGMENT_AR_GUI, by itself, creates a new SEGMENT_AR_GUI or raises the existing % singleton*. % % H = SEGMENT_AR_GUI returns the handle to a new SEGMENT_AR_GUI or the handle to % the existing singleton...
5dc3623515d66f4608dcbfa190d6763e4021c4cddf675243a8d965c75f102c46
MATLAB
9,196
218
function [positionDecodingGLM_gaussian] = bz_positionDecodingGLM_gauss(varargin) % USAGE % [] = bz_positionDecodingGLM_gauss() % % INPUTS % % spikes % % behavior % % lfp % % smoothingRange % % plotting - cell UID to plot % % saveMat % % OUTPUTS % % positionDecodingGLM_gaussian cellinfo stru...
3373d006e7474a4448cc30659a1b0a23316ef49890c454e5d3db2f289bbffda8
MATLAB
9,201
285
function [ixes,R,p]=ea_leoo_significance(XYZV) % clear NAN vars: XYZV(isnan(XYZV(:,4)),:)=[]; % setup randomization: maxiter=1001; csize=nan(maxiter,size(XYZV,1)); dimen=length(XYZV); for iter=1:maxiter dat=XYZV; if iter>1 dat(:,4)=dat(randperm(length(dat)),4); end % generate predicted co...
2987f24c4c2d7196669755ebc654558c9fc30e0c602fb2c7cdc7cb7b72eecc0f
MATLAB
9,207
283
function [ixes,R,p]=ea_leoo_significance(XYZV) % clear NAN vars: XYZV(isnan(XYZV(:,4)),:)=[]; % setup randomization: maxiter=1001; csize=nan(maxiter,size(XYZV,1)); dimen=length(XYZV); for iter=1:maxiter dat=XYZV; if iter>1 dat(:,4)=dat(randperm(length(dat)),4); end % generate predicted co...
1768c2d235920e9493e75b935a011d04158719129be2ea044e495ba2a2617ecb
MATLAB
9,208
247
function [n_cnt,con_mat,pval]=ea_NBSstats(varargin) %NBSstats Computes network components among edges that survive a primary %test statistic threshold. Assigns a corrected p-value to each component %using permuted data that has been supplied as part of the structure STATS. % % [N_CNT,CON_MAT,PVAL]=NBSstats(ST...
5e718a1ad01f5a9422734fff95c9a5c6828c17169264cb9f87d1aef7caa04948
MATLAB
9,208
226
% pop_newcrossf() - Return estimates and plots of event-related spectral coherence % % Usage: % >> pop_newcrossf(EEG, typeproc, num1, num2, tlimits,cycles, % 'key1',value1,'key2',value2, ... ); % Inputs: % INEEG - Input EEG dataset % typeproc - Type of proces...
44845b3facd16e23917719f320ffcce5b732df8823fb4919d9866a9065a91655
MATLAB
9,213
201
% icadefs() - function to read in a set of EEGLAB system-wide (i.e. lab-wide) % or working directory-wide constants and preferences. Change the % way these are defined in the master icadefs.m file (usually % in dir eeglab/functions/sigprocfunc) or make a custom copy of % ...
0ce42cd577bb397c331bb94bbe6bbec7300ddf01751d1b55e4a0d6a8ba4ade84
MATLAB
9,218
210
function ea_convert_ossdbs_axons(options,settings,side,prob_PAM,resultfig,outputPaths,source_i) % Prepare Lead-DBS BIDS format fiber activations. % By Butenko and Li, konstantinmgtu@gmail.com arguments options % Lead-DBS options for electrode reconstruction and stimulation settings % par...
efffe663609f7d9fe3a07f9f5e72c21304fd5d001526f3ff6357564aecf0db82
MATLAB
9,219
300
%% Description errorb(x,y,varargin) % errorb(Y,E) plots Y and draws an error bar at each element of Y. The % error bar is a distance of E(i) above and below the curve so that each % bar is symmetric and 2*E(i) long. % If Y and E are a matrices, errob groups the bars produced by the elements % in each row and plots the ...
c20fe2adc81d74f843b13657c899e69be9a279d2ffbafaf3ca8196df9dafbbe1
MATLAB
9,223
260
function [Y, Z] = FilterM(b, a, X, Z, Dim, Reverse) % FilterM - Fast C-Mex filter % [Y, Z] = FilterM(b, a, X, Z, Dim, Reverse) % INPUT: % b, a: Filter parameters as DOUBLE vectors. If the vectors have different % lengths, the shorter one is padded with zeros. % X: Signal as DOUBLE or SINGLE vector or array. % ...
b7b58a5d6b21fefac2b90e79dbdcde694ce11677de4333ae42f7ae217ea17059
MATLAB
9,228
261
% Version 26/06/2026 % Authors: Alessandro Petrini and Davide Pierangeli % ------------------------------------------------------------------------- % This script is provided as a reference implementation of the experimental % procedure described in the manuscript. It documents the acquisition logic % and computationa...
1dbbaade19d4bdbda1c3ece9013a2909c527f118d24a061c9f4c135c11622b5c
MATLAB
9,232
296
function cs_fmri_conseed_seed_matrix(dfold,cname,sfile,cmd,writeoutsinglefiles,outputfolder,outputmask) tic % if ~isdeployed % addpath(genpath('/autofs/cluster/nimlab/connectomes/software/lead_dbs')); % addpath('/autofs/cluster/nimlab/connectomes/software/spm12'); % end if ~exist('writeoutsinglefiles','var')...
8ef5a89efcfe611598a946d119ec2cabc88725c93b367038758d103d12d85e72
MATLAB
9,240
222
%% Perform a voxel-wise t-test % % In this example we perform a second level analysis on first level % statistical parametric maps. Specifically we use a t-test to obtain an % ordinary least squares estimate for the group level parameter. % % The example uses the emotion regulation data provided with % CANlab_Core_Too...
24f16193758d50332a247de9b2b5f45613f807bf1fafff06a69d4c30bc3dd1aa
MATLAB
9,244
292
function layout = prepare_layout_NIRx(probe_file, montage_name, varargin) %FNIRSPOWER.HELPERS.PREPARE_LAYOUT_NIRX % Prepare and optionally save a 2D FieldTrip layout from NIRx probe data. % % Usage: % layout_dense = fnirspower.helpers.prepare_layout_NIRx( ... % probe_file, 'dense'); % % Required inputs:...
98d4d2a2d320b115a82944604af39de761b0a50010d1bfda072c8db599d17328
MATLAB
9,251
288
function varargout = ea_spm_preproc_run(job) % Segment a bunch of images % FORMAT spm_preproc(job) % job.channel(n).vols{m} % job.channel(n).biasreg % job.channel(n).biasfwhm % job.channel(n).write % job.tissue(k).tpm % job.tissue(k).ngaus % job.tissue(k).native % job.tissue(k).warped % job.warp.affreg % job.warp.reg %...
5c5b2b6524cb4260e3ae39bf9883e86e71f5aee467e49e5a17ceed2aa372c364
MATLAB
9,256
276
% Version 26/06/2026 % Authors: Alessandro Petrini and Davide Pierangeli % ------------------------------------------------------------------------- % This script is provided as a reference implementation of the experimental % procedure described in the manuscript. It documents the acquisition logic % and comp...
80c6b63b0b1f24e996f7542ae4a49d655de71292f0aa7094850b9542097ac31e
MATLAB
9,264
304
function turnDistribution = RadialMazeTurns(data,mode) %RadialMazeTurns - Compute distribution of successive turn angles in radial maze. % % In order to detect stereotypic egocentric strategies that a rat could employ to % solve a radial maze task, this function determines the distribution (over trials) % of success...
f9f9914196d80546a35cd2b39d08ddea9671ad5c88d039e6c9da45592f215ad2
MATLAB
9,269
223
%% modeltype1 - simple stimulation of Izhikevich RS neuron % Generates data for a simple Izhikevich regular spiking neuron. The neuron % is stimulated with one of four types of stimuli. % % Syntax: [mV,spkTimes,memNoise,stim,modelParams] = modeltype1(varargin) % % Optional Input: % modeltype1(..., 'ONvsOff', pulseSiz...
1e485a684b001401c7807cccbab24bb5a3ba45ec28da833e360c686e1db0f005
MATLAB
9,274
216
function [trl_dirs_corr, FOV, nodata] = NDK_Motion_Correction5D_savecat(fileexpnum, trialcat, zsplit) % clear all % zsplit = 0; % trialcat = 1; % % fileexpnum = SS02255_mar172023_f3e3 %thor expt # %set headpath (and reset if in "extracted" output folder) tic headpath = pwd; %'/Volumes/Samsung_T5/2p rotaball/21D07/2107...
6b5b50f26ff16a090f7f88c9fe09ca57fce99ee881cf2e7d0d6cbcbb8bf71eba
MATLAB
9,279
209
%%OLD COPY JUST IN CASE function index=singleflyeventdetection(headpath,fileexpnum,version,saveex,picknew,savefigs) %This is for doing every trial, plotting the colour, and the sum of %detected events %make another version that does the mean if ~picknew load('paperexample') end if version==2 cd('extracted2'...
18d43ea8b6310c8c1cace46370d6c0010ca52d3c92f6cc2da7cd5c74f8728115
MATLAB
9,297
270
function [cuts,allcontour]=ea_add_overlay(boundboxmm,cuts,tracor,options) % This function overlays atlas data over 2d-slice views to be exported by % LEAD-DBS. The function is called from ea_writeplanes.m % __________________________________________________________________________________ % Copyright (C) 2014 Charite U...
aef9f6d9b6169d5d24d59badcfd07260aa1b157f3a531d268b6c04afc0bcce2b
MATLAB
9,297
231
% F03_B.m % Manuscript Fig 3b: spatial correspondence by ROI. % Input tables are read from manuscript_figure_source_data/data/main_text_source_data.xlsx. clear all ROI={"Dorsal", "Lateral","Ventral"} %% read dataTables Fig3b=read_main_text_source_table("fig3b_points"); % includes all 5 seeds, averaged Fig3b_noiseCeili...
440ac7740886728a5613a3566e7ed92510388cf838a30d1dd72774a324856f28
MATLAB
9,328
280
function [Matching,Cost] = Hungarian(Perf) % % [MATCHING,COST] = Hungarian_New(WEIGHTS) % % A function for finding a minimum edge weight matching given a MxN Edge % weight matrix WEIGHTS using the Hungarian Algorithm. % % An edge weight of Inf indicates that the pair of vertices given by its % position have no...
27938187456f106b947a4fdd41ae142408ea380ca0693354369642a7f52449ca
MATLAB
9,333
231
function avm_viscous(nsteps, interval, seed, Npts, P0_value, KA_value, dt, tau_T1, L_thresh, v0_value, Dr_value, B) % AVM_VISCOUS Run an Active Vertex Model (AVM) simulation of a confluent % epithelial tissue with cell-cell viscous adhesion, on a flat (non- % sheared) periodic box, and save the results to a .mat file....
15f8b7e14950816bd3e078acbe7f12e301276d53c05cb8a5389bd6453bbf4e71
MATLAB
9,345
221
function [spindles, segments] = fun_spindle_features(segments, srate, freqs, doPlot) % Calculate spindle features. % % Inputs: % % segments : cell matrix with EEG segments to analyze % % srate: The sampling rate of the data (in Hz) % % freqs: [low high] frequency boundaries for spindle characterization % % doPlot: Plot...
b8b72b891279b857d69d6f050f143ca205180c0dd792873696ff2da257ecb6a2
MATLAB
9,351
321
function varargout=sigstar(groups,stats,nosort) % sigstar - Add significance stars to bar charts, boxplots, line charts, etc, % % H = sigstar(groups,stats,nsort) % % Purpose % Add stars and lines highlighting significant differences between pairs of groups. % The user specifies the groups a...
789b7fe7a1cd1a8c829447251de4bd03c5ab602f51d1c87c1dc7578ebe5649de
MATLAB
9,360
243
% pop_eegfilt() - interactively filter EEG dataset data using eegfilt() % % Usage: % >> EEGOUT = pop_eegfilt( EEG, locutoff, hicutoff, filtorder); % % Graphical interface: % "Lower edge ..." - [edit box] Lower edge of the frequency pass band (Hz) % Same as the 'locutoff' command line input. % "Hi...
376ea48eb3a194fba6f7dfaa9d5d27da6537aee7f31e4378abdb118d732cfdc7
MATLAB
9,362
215
% pop_rejtrend() - Measure linear trends in EEG data; reject data epochs % containing strong trends. % Usage: % >> pop_rejtrend( INEEG, typerej); % pop up an interactive window % >> OUTEEG = pop_rejtrend( INEEG, typerej, elec_comp, ... % winsize, maxslope, minR, superpose, reject,ca...
ed04921ecf49b09f4d5a618b19036a4d7d8f6a952681bfb67e78771f36ad78ff
MATLAB
9,364
258
%% Load stats savefilenamedata = fullfile(resultsdir, 'svm_stats_results_contrasts.mat'); if ~exist(savefilenamedata, 'file') disp('Run prep_3b_run_SVMs_on_contrasts_and_save with dosavesvmstats = true option to get SVM results.'); disp('No saved results file. Skipping this analysis.') return end fprin...
6b208cb27b71a8ed53e6d2b20affc3de310e3e8626e050a3dbfd3f7edaba898d
MATLAB
9,383
289
function [t,y]=chaos_library(S,t,IC,p) % function chaos_library(S,t,IC,p) % inputs - S, string name of chaotic attractor % - t, time, either of the form [to,tf] or [to:f:tf] % - IC, initial conditions % - p, coefficients of the system of differential equations used. % outputs - t, time % ...
8c6cb1f1f1d09572229e895e187e804e57060f9f7232fc421e1f85dfb46e35eb
MATLAB
9,389
286
%% Reweighted graphs in MatlabBGL % Matlab sparse matrices only support non-zero values. Because the % structure of the sparse matrix is used to infer the edges of an % underlying graph this limitation prevents MatlabBGL from trivially % addressing graphs with 0-weight edges. % % To fix this problem, codes that accept...
f71a99c11736541dbe56b0361592a5ddbe7769571b116675922982a83a19305e
MATLAB
9,390
236
function affinefile = ea_ants_linear(varargin) % Wrapper for ANTs linear registration fixedimage = varargin{1}; movingimage = varargin{2}; outputimage = varargin{3}; if nargin >= 4 writeoutmat = varargin{4}; else writeoutmat = 1; end if nargin >= 5 if isempty(varargin{5}) % [] or {} or '' otherfi...
3a45be8c8e85b6aa2b48d9cf5ec8006e872a6f71e9b1d54a57c8486813e3c081
MATLAB
9,395
195
% pop_eegplot() - Visually inspect EEG data using a scrolling display. % Perform rejection or marking for rejection of visually % (and/or previously) selected data portions (i.e., stretches % of continuous data or whole data epochs). % Usage: % >> pop_eegplot( EEG ) %...
630b0ab1eabd51b3098ddffb894826f14f166a41b36ad84b0cc4a1ad93592f97
MATLAB
9,405
232
%% ========================================================================= % 4. Plotting Configuration % ========================================================================= % --- Selection Parameters (Adjust these values to slice the data) --- % 1. Reference TSL for frequency sweeps (ms) TSL_ref_value = ...
9dea74396df240ce2b3b103d7bc4d751ed9eed16d5e672a126e6cd1d09b60553
MATLAB
9,407
286
% Save NIFTI dataset. Support both *.nii and *.hdr/*.img file extension. % If file extension is not provided, *.hdr/*.img will be used as default. % % Usage: save_nii(nii, filename, [old_RGB]) % % nii.hdr - struct with NIFTI header fields (from load_nii.m or make_nii.m) % % nii.img - 3D (or 4D) matrix of NIFTI...
2d34dfa3e2ab2aea8fce6e0e8c8fe4349271d147447ace6dbf9200f86dadafe3
MATLAB
9,410
261
function data = TDTthresh(data, STREAM, varargin) %TDTTHRESH TDT snippet extractor. % data = TDTthresh(DATA, STREAM, 'parameter', value, ...), where DATA is % the output of TDTbin2mat, STREAM is the name of the stream store to % convert to snippets, and parameter value pairs define the snippet % extracti...
94ee901b1ba6444045fac9117c8f1e528de4ceeadf3a1f296ed5bc4379d8062d
MATLAB
9,423
260
function data = LoadBinary(filename,varargin) %LoadBinary - Load data from a multiplexed binary file. % % Reading a subset of the data can be done in two different manners: either % by specifying start time and duration (more intuitive), or by indicating % the position and size of the subset in terms of number of s...
27a9e8a2c34d4a27a4558e68ccbb60cef1118e40276fc9ee5461fb7a7b4a5bd7
MATLAB
9,432
301
% gethelpvar() - convert a Matlab m-file help-message header % into out variables % Usage: % >> [vartext, varnames] = gethelpvar( filein, varlist); % % Inputs: % filein - input filename (with .m extension) % varlist - optional list of variable to return. If absent % retrun al...
75d8e23e01b503713e732bf60dc827b92d413e8d56bab6bbc172dd3c0deb1b24
MATLAB
9,438
238
function varargout = segment_property_viewer(varargin) % SEGMENT_PROPERTY_VIEWER MATLAB code for segment_property_viewer.fig % SEGMENT_PROPERTY_VIEWER, by itself, creates a new SEGMENT_PROPERTY_VIEWER or raises the existing % singleton*. % % H = SEGMENT_PROPERTY_VIEWER returns the handle to a new SEGMENT...
128c2d9778c4182c36f5d7acd91e711f150a7a22a9c78381efc9081b1f921e13
MATLAB
9,441
232
function ea_preprocess_fmri(options) directory=[options.root,options.patientname,filesep]; V=spm_vol([directory,options.prefs.rest]); signallength=length(V); %% run sequence of proxyfunctions (below): ea_realign_fmri(signallength,options); % realign fMRI % BIDS FIX: Check if segmentation already exists before runni...
17ed297b5f8b5bbbd4c7cbbaa1de43a4e55fa3c46c5b36362e561442ac8cc12a
MATLAB
9,442
298
% Check for required DAT fields. Skip analysis and print warnings if missing. % --------------------------------------------------------------------- % List required fields in DAT, in cell array: required_fields = {'conditions', 'colors', 'SIG_conditions'}; ok_to_run = plugin_check_required_fields(DAT, required_fields...
556125d5c14748ed9ad5d03a6bd8da0258ac1dc9a316ad6c0edc5db8a5f68b32
MATLAB
9,443
297
classdef Container < handle %uix.mixin.Container Container mixin % % uix.mixin.Container is a mixin class used by containers to provide % various properties and template methods. % Copyright 2009-2016 The MathWorks, Inc. % $Revision: 1358 $ $Date: 2016-09-14 11:34:17 +0100 (Wed, 14 Sep...
39fe940bf240ad1c25b1edf84c69121fc22259b2811625373bc86ea36e2e760c
MATLAB
9,446
220
%% Step 4 Tiny Dancers: Group analyses for frequencies clear clc % load all frequency data cd('D:\TinyDancers_Movement\fieldtrip_velo\PM_PROC\Step2c_timefrequency\3m'); FileNames = {dir(['*_freq' '.mat']).name} ; for k=1:1:length(FileNames) load(FileNames{k}) avg_baseline_3m{k} = freq_baseline; ...
f17d0f4d43156b5ed9b6a46040382ccfe9dac9aa4efd45a50bc71741f3af77d9
MATLAB
9,452
271
function varargout=xwt(x,y,varargin) %% Cross wavelet transform % Creates a figure of cross wavelet power in units of % normalized variance. % % USAGE: [Wxy,period,scale,coi,sig95]=xwt(x,y,[,settings]) % % x & y: two time series % Wxy: the cross wavelet transform of x against y % period: a vector of "Fourier" ...
d5620bce0f87a35a49e039c3da67f044a3f2e7589e95f445d86b4808cbf19a5a
MATLAB
9,460
266
% This is a standard data format spike times class for the CMB classdef Spike properties i % index in root.b_ts aligned from more accurate spike times 'ts' below. not directly used by end user i_lfp % cell array of indices in root.b_lfp(i).ts aligned from higher sampled spike t...
9dbd19327e72e2d971c3a1774955d894d94b87939643792307d8e80e4e3cbd1e
MATLAB
9,477
261
function varargout = RegistrationWin(varargin) % developed by Yiyi Yu, 2021 July % Last Modified by GUIDE v2.5 27-Feb-2022 17:09:07 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... ...
f46ab27e9d4f612c0b7dd15d85da989c8e54dd256fb4a052b75cb4e98425f1c3
MATLAB
9,484
246
function CFA_RunAllJob(SetUpPara,Template,Para) Indir = SetUpPara.Indir; Outdir = SetUpPara.Outdir; filp = which('CFA_RunAllJob.m'); [pth,nam,ext] = fileparts(filp); spmjobdir = [pth,filesep,'NormJobmat',filesep]; Atlasdir = [pth,filesep,'TemplateUsed',filesep]; voxelsize = SetUpPara.OutVsize; BrainMaskdir = [pth,files...
3716d219b03025e9eddaebe0297c816e3d04375799af5ce1ce4dfac7ed2588e9
MATLAB
9,486
244
function clWaveforms = getClusterWaveform(clusterID, dataDir, baseName) %GETCLUSTERWAVEFORM reads the raw binary file and compiles the voltage %traces for the given cluster (the cluster number should be the one %assigned by Kilosort/Phy). The output is a cell (or a structure) %containing the mean waveform and its stand...
02055714310089c2b197ee27c2820a830587b7359ba340a83e30970566064633
MATLAB
9,488
218
% ==================================== %% Help % ==================================== % % CBIG_train_MSHBM_Epilepsy % % This script trains the MS-HBM model on 34 drug-resistant epilepsy subjects % from the National Institutes of Health (NIH) dataset. % It generates individual FC profiles, estimates group % priors, and ...
ce3cf7232286b2f40d68d09745fcbd0de07895d96c73826932859d6fa3e3f74e
MATLAB
9,503
289
%%% Supplementary Figure 11 % Passive prediction-error GC cross-ratio temporal correlation matrices. % % Structure: % 1) Load passive differential PE-GC results % 2) Compute band/time-window averaged topographies % 3) Compute cross-ratio Spearman correlation matrices % 4) Plot SFigure 11A-B % 5) Save one inde...
43ad5fc8070187208e76d5fcfab34748c4f21c66cc810bdd2277dd338fc654a5
MATLAB
9,504
313
% This functions computes the SNR based on adjacent frequency bins % % INPUTS % PS input data (channels, frequecies, trials) % freq second dimention values for the data (frequecies) % OPTIONAL INPUTS: % fband range of frequecies to use for the normalization (SNR) % If not prove...
ff216248f27eee11e8133058554d6e4ee3abb0dbd842d90e0a297434198e9103
MATLAB
9,507
226
function [output, Greg] = dftregistration(buf1ft,buf2ft,usfac) % function [output Greg] = dftregistration(buf1ft,buf2ft,usfac); % Efficient subpixel image registration by crosscorrelation. This code % gives the same precision as the FFT upsampled cross correlation in a % small fraction of the computation time a...
958130100f386407acae909f499a2651474d9a6a1adbd08396031039a0090f8f
MATLAB
9,520
353
function test_examples %% Code examples msgid='matlab_bgl:test_examples'; % all_shortest_paths load('../graphs/clr-26-1.mat'); all_shortest_paths(A); all_shortest_paths(A,struct('algname','johnson')); [D P]=all_shortest_paths(A,struct('algname','floyd_warshall')); i=4; j=1; p=[]; while j~=0, p(end+1)=j; j=P(i,j); en...
27e1660846d0ec207b04064736b2103527e6143109948d4f95f9a2d8f6e2a341
MATLAB
9,525
289
function obj=stat_cornerhist(obj,varargin) p=inputParser; my_addParameter(p,'nbins',30); my_addParameter(p,'edges',[]); my_addParameter(p,'geom','overlaid_bar'); %line, bar, overlaid_bar, stacked_bar,stairs, point my_addParameter(p,'normalization','count'); my_addParameter(p,'fill',[]); %edge,face,all,transparent my_...
93f5503285ee6fb6a2dd3e9f3c219f9e77adc4a77980e256659ebd456d74f8a2
MATLAB
9,529
108
function risk_genes = risk_genes(disorder) % % Usage: risk_genes = risk_genes(disorder) % % Description % Outputs names of GWAS-derived risk genes for a given disorder (author: % @saratheriver) % % Inputs: % disorder ({'adhd', 'asd', 'bipolar', 'depression', 'epilepsy', % 'hippocampal_volume', 'ocd', 'schizop...
54dbd15f68e54ae46a1481df0bd441c475696c0b7ad01b8de76c9bc0b5890677
MATLAB
9,533
221
%% LaBGAScore_pet_preprocess_data.m % % % *USAGE* % % Assumptions: % % Data organization: % Data are transformed to nifti format and organized according to BIDS. % You have to specify a main directory where al the folders of the % subjects can be found. % In the folder of each subject, there mig...
51ed1e6ac634f6d0a3ea1deaad242aad3162055a7eca5034c322871bf179fef5
MATLAB
9,535
260
function data = bz_LoadBinary(filename,varargin) %bz_LoadBinary - Load data from a multiplexed binary file. % % Reading a subset of the data can be done in two different manners: either % by specifying start time and duration (more intuitive), or by indicating % the position and size of the subset in terms of numbe...
f329781cc90eb10bdd33eb9503649e42e719b2adc9d931cf41a33fdb46012ad7
MATLAB
9,548
253
function save(this,filename,encoding) % Save GIfTI object in a GIfTI format file % FORMAT save(this,filename,encoding) % this - GIfTI object % filename - name of GIfTI file to be created [Default: 'untitled.gii'] % encoding - optional argument to specify encoding format, among % ASCII, Base64Binary, ...
95a333b285fe2064260bfd375ee09363f6afcaff352ab75f63faf6bad4e9643d
MATLAB
9,552
232
function [scoreTot, frameIndexTot, meanScoreByFrmMat] = speckleFrameAnalyse(actinPropPerTimeInt, outPath, fieldName, plotType, splitNum, figName) %SPECKLEFRAMEANALYSE plots speckle properties for each frame of all movie (i.e. kinetic scores, speckle speed, etc) in an actinPropPerTimeInt structure % %SYNOPSIS [scoreT...
ccd62fc0b36df618408f2143655f32d40abac14af59676e9c9c42d09103d7466
MATLAB
9,554
277
% eeg_pvaf() - Compute EEG.data 'percent variance accounted for' (pvaf) by specified components. % Can omit specified components and channels from the computation. Can draw a plot % of the scalp distribution of pvaf, or progressively compute the pvaf for comps % 1:k, where k = 1...
68c3797b701cb333ab4e328800e6d1ef23287b95850ee638db7e8f758de9378d
MATLAB
9,578
243
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
6e6de93b83be01c8748b76eccb666059fb33224c2871f0576f1926f9e224cfdb
MATLAB
9,585
244
function trackSEL = getTrackSEL(trackedFeatureInfo,segmentSEL) %GETTRACKSEL outputs track start times, end times and lifetimes % %SYNOPSIS trackSEL = getTrackSEL(trackedFeatureInfo); % %INPUT trackedFeatureInfo: -- EITHER -- % Output of trackWithGapClosing: % Matrix...
5861213d0f78f8321bbe46a6590eafe6cf1f25b70ad8111ce9bf6bdac4ff52cb
MATLAB
9,588
238
% reref() - convert common reference EEG data to some other common reference % or to average reference % Usage: % >> Dataout = reref(data); % convert all channels to average reference % >> [Dataout Chanlocs] = reref(data, refchan, 'key', 'val'); % % convert data to new refere...
8fdab057d3d7f29fe2c266c7a98a94eb8aec84689b34c2e29b8aaead6a6103b6
MATLAB
9,589
301
function [x y pos trials map mapping] = getBehavEvents_linearTrack(pos,bins) dbstop if error scatter(pos(:,8),pos(:,10),'.') % axis([-1 1 -1 1]) [x y]=ginput(); cx = x(end-1:end); y = y(end-1:end); dist(:,1)=fastrms(abs(pos(:,8)-x(1))+abs(pos(:,10)-y(1)),120); dist(:,2)=fastrms(abs(pos(:,8)-x(2))+abs(pos(:,10)...
7723fa1b89444015f188663be62dc277fc631d48c807ac7f3dbcca13f2e07686
MATLAB
9,611
239
function varargout = ea_normsettings_spmnewseg(varargin) % EA_NORMSETTINGS_SPMNEWSEG MATLAB code for ea_normsettings_spmnewseg.fig % EA_NORMSETTINGS_SPMNEWSEG, by itself, creates a new EA_NORMSETTINGS_SPMNEWSEG or raises the existing % singleton*. % % H = EA_NORMSETTINGS_SPMNEWSEG returns the handle to a...
b95d712bd924d2aa493feced16a5ee6a661fc5766a0a0577cd0e1796bfb2d126
MATLAB
9,621
225
% convertlocs() - Convert electrode locations between coordinate systems % using the EEG.chanlocs structure. % % Usage: >> newchans = convertlocs( EEG, 'command'); % % Input: % chanlocs - An EEGLAB EEG dataset OR a EEG.chanlocs channel locations structure % 'command' - ['cart2topo'|'sph2topo'|'sphb...
56c4744c6eaae2ccec9751bffbd1ce2824db4e1c334d2f8efecd03c81bf5bb89
MATLAB
9,639
164
function varargout=ea_normalize_spmdartel(options) % This is a function that normalizes both a copy of transversal and coronal % images into MNI-space. The goal was to make the procedure both robust and % automatic, but still, it must be said that normalization results should % be taken with much care because all recon...
b8f1161db284e6b969d1005f7c57605658d7b0f8aa8e1f04cfd216762abe8f93
MATLAB
9,641
272
function CFA_MakeRes_Clustercorrected_vlsm(C05,C05P,C05N,PmapDir,TmapDir,ZmapDir,THRESHOLD,VQ,Voxdir2out05) [VP DP] = Dynamic_read_dir_NIFTI(PmapDir); [VT DT] = Dynamic_read_dir_NIFTI(TmapDir); [VZ DZ] = Dynamic_read_dir_NIFTI(ZmapDir); [pth nam ext] = fileparts(TmapDir); [pth znam ext] = fileparts(ZmapDir); THR1P = ...
b7da5de9143516f99ef3cdaef8a41e06d113469d18c6317997afe84a4796cbc3
MATLAB
9,649
260
function [PhaseLockingData] = bz_PhaseModulation(varargin) % USAGE %[PhaseLockingData] = bz_PhaseModulation(varargin) % % INPUTS % spikes -spike time cellinfo struct % % lfp -lfp struct with a single channel from bz_GetLFP() % % passband -frequency range for phase modulation [lowHz highHz] form % ...
13f3d4e8c31ae4ed73cde2fe53cdf17f2e7c71ecf19801bec4b4d1159ae61658
MATLAB
9,652
254
% std_chantopo() - plot ERP/spectral/ERSP topoplot at a specific % latency/frequency. % Usage: % >> std_chantopo( data, 'key', 'val', ...) % Inputs: % data - [cell array] mean data for each subject group and/or data % condition. These arrays are usually returned by function % ...
7d095dff48b5ed4172fef16c2bf409a0093b0cbed3f2d597ba7775f67091f182
MATLAB
9,664
208
% std_readpac() - read phase-amplitude correlation % % Usage: % >> [STUDY, clustinfo] = std_readpac(STUDY, ALLEEG); % >> [STUDY, clustinfo] = std_readpac(STUDY, ALLEEG, ... % 'key', 'val'); % Inputs: % STUDY - studyset structure containing some or all...
83caf9d6d9ee2789df6bf247f43ddc14f9445e4186827773e39f1cc334cc2f94
MATLAB
9,670
207
function homo_with_weight = CBIG_ArealMSHBM_parameters_validation(project_dir, ... mesh, num_sess, num_clusters, subid, w, c, beta, method) % homo_with_weight = CBIG_ArealMSHBM_parameters_validation(project_dir, ... % mesh, num_sess, num_clusters, subid, w, c, beta, method) % % This script will estimate the indivi...
72ace0a0825a7423269c5016cf5b24e7de89321f1838d4a35579924c7a1b7c61
MATLAB
9,681
222
function [Conditions, Triggers] = getConditions(sessionDir, varargin) % Supplement the Highspeed Table with the individual on- and offset times % of each trigger class, i.e. reward, punishment, drumcontact % Default option values: options = inputParser; addRequired(options,'sessionDir',@ischar); addParameter(options,...
45ca9c2bb6509b675ea31a0f081df92d906920c502d96a071b89bd2e10c0019d
MATLAB
9,683
221
function [out,motionInfo] = gbvs(img,param,prevMotionInfo) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % This computes the ...
7647f7971fac3f315fca1f63817a39fabc486055b996c9680890ec3b3779c9f4
MATLAB
9,686
199
% make_timewarp() - Select a subset of epochs containing a given event sequence, and return % a matrix of latencies for time warping the selected epochs to a common % timebase in newtimef(). Events in the given sequence may be further % restricted to those with s...
50d5d1731596df3da7c986b114db7458369f4bafdffa740df158fed11a2c7947
MATLAB
9,693
344
% Example script that extracts apical areas, contact lengths and % ms2 intensities for each cluster close all clear all %% Set Parameters and Select Window Folder cluster_name = 'Window1Cluster4'; WindowFolder = uigetdir; cd(WindowFolder) res = 3.3453; Interval = 24.36223; % seconds mkdir([cluster_name,'/Absolute']...
f2c801f483eae126d754296cf164da704ad8a68168174f59f730bd146be896ee
MATLAB
9,697
276
function CBIG_ASDf_Plot400Schaefer19Subcor17Networks_419by419Input(corr_mat, scalelim, filename_prefix) % CBIG_ASDf_Plot400Schaefer19Subcor17Networks_419by419Input(corr_mat, scalelim, filename_prefix) % % This function draws the 419x419 correlation matrix (400 cortical ROIs + % 19 subcortical ROIs). % Major networks ar...
5ab022d066707d66cb8b843bebac2b6eda6c316ce6d59229e3bdb4765493bc97
MATLAB
9,700
312
function dkl = rgb2dkl(rgb) sz = size(rgb); im = shiftdim(rgb,2); im = reshape(im,[3 prod(sz(1:2))]); im = im'; im = rgb2dkl_v(im); im = im'; im = reshape(im,[3 sz(1:2)]); dkl = shiftdim(im,1); function dkl = rgb2dkl_v(rgb) % bunch of constants used for RGB -> DKL conversion: lut_rgb = [ 0.024935, 0.0076954,...
f59ac043f2d70248b44ed0571824b733b8ca67d533854e01d9eeafd561088657
MATLAB
9,701
244
function varargout = ea_nbs_advanced(varargin) % EA_NBS_ADVANCED MATLAB code for ea_nbs_advanced.fig % EA_NBS_ADVANCED, by itself, creates a new EA_NBS_ADVANCED or raises the existing % singleton*. % % H = EA_NBS_ADVANCED returns the handle to a new EA_NBS_ADVANCED or the handle to % the existing si...
19d1282d11d038696164968924ee5f9ba6b60ecc2cc3279d257a26143c577c4c
MATLAB
9,713
237
function CBIG_pMFM_step8_gene_expression_analysis_desikan() % This function is the wrapper to perform all the genetic analysis % % There is no input for this function as it can automatically get the % output file from previous step. % There is no output for this function as it will generate the output files % % Writte...
7cc824c755dffc66ca71f56c62edcdab5d0fd1444686a028dd81ae7bbe9474ba
MATLAB
9,718
281
%%% Supplementary Figure 7A-D ccc; %% Settings run("private\plotConfig.m"); monkeys = ["XX", "CC"]; alphaVal = 0.05; windowStat = [0, 350]; % ms T = 10e3; % ms exampleCh.XX.AC = 38; exampleCh.XX.PFC = 47; colors.XX = {[35 71 153], [244 179 179], [240 133 25], [233 90 111], [230 33 41]}; colors.XX = cellfun(@(x) x ...
dbb423a4b3cfb8c7f05aca77e17ec6076a145413abd538a4c69e4d90b4a5b254
MATLAB
9,742
292
function smoothed = Smooth(data,smooth,varargin) %Smooth - Smooth using a Gaussian kernel. % % USAGE % % smoothed = Smooth(data,smooth,<options>) % % data data to smooth % smooth vertical and horizontal kernel sizes: % - gaussian: standard deviations [Sv Sh] (optionally, ...
729e1dd8d2be3887803f1458b560e26e7f88e331e20b81e0df9b4964bcb5c814
MATLAB
9,745
273
function ellipse_t = fit_ellipse( x,y,plot_opt ) % % fit_ellipse - finds the best fit to an ellipse for the given set of points. % % Format: ellipse_t = fit_ellipse( x,y,axis_handle ) % % Input: x,y - a set of points in 2 column vectors. AT LEAST 5 points are needed ! % axis_handle - optional. a ...
fe213fd79db7924e6b683f2cbbf9baf945d8687a459fb9e186d636f4cf4f2295
MATLAB
9,753
209
function CBIG_MMLDA_mean_correlation_map_wrapper(out_dir) % CBIG_MMLDA_mean_correlation_map_wrapper(out_dir) % % Wrapper function to get mean correlation map between mean top5 behavioral zscores and atrophy zscores. % % Input: % - out_dir : output directory % % Example: % CBIG_MMLDA_mean_correlation_map_wrapper(...
f82ff7ef1eba79934959906c42704812777a5de2144619363861501ee3960dc6
MATLAB
9,754
237
function CBIG_pMFM_step8_gene_expression_analysis_schaefer() % This function is the wrapper to perform all the genetic analysis for % Schaefer 100 parcellation % % There is no input for this function as it can automatically get the % output file from previous step. % There is no output for this function as it will gen...
018126ae473b8e0feb64fcc15fb4476c4c257f59753bc3fc3e36439d54e743a2
MATLAB
9,782
266
%This function is called within the CSD_bygroup function %Loads and formats an animal's data for CSD analysis %Determines best column of 21 linear channels on the 64 channel silicon %probe (by finding which column has the fewest bad channels). %Loads in LFP data + creates a time x channels matrix %Loads c...
e1c745320e3b357faf9ce84adabfff6bd002fc99f9827efad19a15660231334a
MATLAB
9,784
214
function settings = ea_segment_MRI(options, settings, outputPaths) % Create segmentation into GM, WM, CSF either based on T1 or Atlas or just % copy for templates/ when computing in Template space. % By Butenko and Li, konstantinmgtu@gmail.com arguments options % Lead-DBS options for electrode reconstruction a...
2ff34710020bb92dc634910b4849f20bc73fe40c12cc571dd714296834840141
MATLAB
9,801
253
function save(this,filename,encoding) % Save GIfTI object in a GIfTI format file % FORMAT save(this,filename,encoding) % this - GIfTI object % filename - name of GIfTI file to be created [Default: 'untitled.gii'] % encoding - optional argument to specify encoding format, among % ASCII, Base64Bi...
1d8f61f7200b10adff93fcbddb0b1d9bc66e641ac2e19422bfd1d76d598e7345
MATLAB
9,802
275
% subsasgn() - define index assignment for eegdata objects % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008 % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Fr...
f40be3617d5fdfa1bd47ce5d532aa5a9d35d3a0cd11846ec79ddc28936ca5670
MATLAB
9,813
267
function [obj] = ft_convert_units(obj, target, varargin) % FT_CONVERT_UNITS changes the geometrical dimension to the specified SI unit. % The units of the input object is determined from the structure field % object.unit, or is estimated based on the spatial extend of the structure, % e.g. a volume conduction model of...
0ebdb5078fe58073e95bf91949233e6e7acdad594bf60baedc0ffd1a01da1b0f
MATLAB
9,815
275
function freezeColors(varargin) % freezeColors Lock colors of plot, enabling multiple colormaps per figure. (v2.3) % % Problem: There is only one colormap per figure. This function provides % an easy solution when plots using different colomaps are desired % in the same figure. % % freezeColors freeze...
05a3ef8d157195684f5eee626228329577027fec6d9fe5e1732a2d539403f7cf
MATLAB
9,816
275
function [PVAL,ADJ,NULL] = CBIG_ASDf_NBS_permSetInput(X,Y,THRESH,permSet,TAIL) % [PVAL,ADJ,NULL]=CBIG_ASDf_NBS_permSetInput(X,Y,THRESH,permSet,TAIL) % % Modified from original NBS code from Andrew Zalesky. % This function computes the network-based statistic (NBS) as described in [1]. % % Input: % - X: % ...