sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
39d8f321491770d19022b82a8677f0fe836b3731c1a9f2a730bf3d59a1f2b136
MATLAB
4,066
105
function affinefile = ea_coregimages(options,moving,fixed,ofile,otherfiles,writeoutmat,masks,interp) % Generic function for image coregistration % % 1. Moving image will keep untouched unless the output points to the same % image. % 2. 'otherfiles' will always be overwritten. If you don't want them to be % overwr...
52ba7dbd4c82db8c3874cdccf643c709bcadd46f8a885c09b54504ab6dccdaa8
MATLAB
4,066
113
function [hObject, handles] = dan_plot_psg(hObject, handles) %% % Authors: Dan Denis % Date: 2021-07-14 %% % This function actually takes care of the plotting of the psg data plotParam = handles.plotParam; % Get the sample at the beginning of plot startTime = (plotParam.currSample - 1) / handles.psg.hdr.srate; ...
acbb143f597d6b96aac061f1ca04986141e3b7edd15b27684eb75109e7c458ba
MATLAB
4,066
135
function hm=plotsurf(node,face,varargin) % % hm=plotsurf(node,face,opt) % % plot 3D surface meshes (2d manifold) or polylines (1d manifold) % % author: Qianqian Fang <fangq at nmr.mgh.harvard.edu> % % input: % node: node coordinates, dimension (nn,3); if node has a % 4th column, it will be used to se...
d8fd14fc23a51daf6998375bb840bdc14c3a45aa5f5f66ff5c8ccb90130f19c3
MATLAB
4,068
96
function [bad_channels] = RFT_detect_FlatCorrNoise_electrodes(ft_struct,eeglab_template_file,steps_to_do,criteria) %%% From a fieldtrip structure (with N trials), concatenates all trials, %%% create an eeglab structure with this 'single concatenated trial', %%% Detects channels that are either 'flat-lined', 'line-no...
73cb4d0f7f49af437bd6b06cfeca0b3bf271459f63dcebcce8950f61915e8007
MATLAB
4,069
128
function handles = ea_lc2handles(lc, handles) % Apply Lead-Connectome options struct (lc) to GUI handles. % Shared by lead_connectome and lead_dbs Connectome tab (ea_init_connectome_tab). % General settings: parcellation parcellations = ea_lc_getitems(handles.parcellation); if ~isempty(parcellations) if ~isfield(l...
13a65b235494dfcf429ae0dad6fdd0b906c4e3aa7a81d5ad1e4bd5e25f043a2f
MATLAB
4,071
157
function hh = CBIG_herrorbar(x, y, l, u, symbol) % hh = CBIG_herrorbar(x, y, l, u, symbol) %HERRORBAR Horizontal Error bar plot. % HERRORBAR(X,Y,L,R) plots the graph of vector X vs. vector Y with % horizontal error bars specified by the vectors L and R. L and R contain the % left and right error ranges for ...
5eb1f29bad416ca9b0322f0d80380137076a49306f8fd4c88e7e5783310f3456
MATLAB
4,071
124
function [ redred, localred ] = DoubleRedundancyMMI(varargin) %%DOUBLEREDUNDANCYMMI Compute the PhiID double-redundancy of input data, % assuming it follows a Gaussian distribution and using the MMI PID. % % NOTE: assumes JIDT has been already added to the javaclasspath. % % R = DOUBLEREDUNDANCYMMI(X, TAU), where X i...
90b935568bb34cdaf8d00d875276d74d6f69b1ca040e257207765737921c9d22
MATLAB
4,071
100
function varargout = save_string(tree, formatting) % XMLTREE/SAVE Save an XML tree in an XML file % FORMAT varargout = save(tree,formatting) % % tree - XMLTree % formatting - 1 for indenting of tags, 0 for no formatting % varargout - XML string %_______________________________________...
6fb763040b42882045d1b9e7df7fc85b30024c8cf6e36a7e102f9b489678e9cc
MATLAB
4,073
136
% eegh() - history function. % % Usage: % >> eegh( arg ); % >> eegh( arg1, arg2 ); % % Inputs: % - With no argument, it return the command history. % - arg is a string: with a string argument it pulls the command % onto the stack. % - arg is a number>0: execute the element...
e0669626d726338cde0e093125fa66b5c5a7c23fe47fd7015f4b2c9b23d96289
MATLAB
4,073
106
function varargout = guideApp(varargin) % GUIDEAPP MATLAB code for guideApp.fig % GUIDEAPP, by itself, creates a new GUIDEAPP or raises the existing % singleton*. % % H = GUIDEAPP returns the handle to a new GUIDEAPP or the handle to % the existing singleton*. % % GUIDEAPP('CALLBACK',hObject,ev...
7be02c7f1efd6a5e4b89b718c36fa8028ce86a82cd07dd98dd6ec32201032d31
MATLAB
4,076
109
% mediation_example_script1 and 2 do the same analysis. % ...script1 is very terse, and includes the essential commands only. % ...script2 is longer and includes more checking that files are available, etc. % Go to the directory this script is stored in and run the script from % there. disp('Mediation example script...
aae5544e95fa3aacbad9609af05f36bd22ede01bc9b512bb4a7781deaafeaad6
MATLAB
4,076
111
% concatdata - concatenate data stored into a cell array into a single % array. only concatenate along the last dimension % Usage: % [dataarray len dims] = concatata(cellarraydata); % % Input: % cellarraydata - cell array containing data % % Output: % dataarray - single array containing all data %...
658f81463d47bc4edbde354a927a95226591dc8cae3def2cdb01e5a9b00f57ad
MATLAB
4,078
129
%%***************************************************************************** %% sqlpmisc: %% unscale and produce infeasibility certificates if appropriate %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004. %%******************************************...
1a10a398352197f84306ac79cd4400bc35c8c76b2da1113ec9fda43af6b53471
MATLAB
4,079
113
%WAVETEST Example Matlab script for WAVELET, using NINO3 SST dataset % % See "http://paos.colorado.edu/research/wavelets/" % Written January 1998 by C. Torrence % % Modified Oct 1999, changed Global Wavelet Spectrum (GWS) to be sideways, % changed all "log" to "log2", changed logarithmic axis on GWS to % a n...
50f89eab33db4a684731a02b98259c3159ce285f5ac1c2acea0dc417ddc4f8c6
MATLAB
4,083
109
function [rpos, rneg, results_table] = LaBGAScore_region_table_safe(fcn, r, varargin) % LaBGAScore_region_table_safe Call a region-table function and always get 3 outputs. % % [rpos, rneg, results_table] = LaBGAScore_region_table_safe(fcn, r, ...) % % Thin wrapper around CanlabCore's @region/table (or the vendored...
633bb3ba5fb7f28bd35052a2d583cda409698405def9983fc8a76aa9c08f86b7
MATLAB
4,084
96
function [relativeSpikeTimes, tx] =... getRasterFromStack(... discreteStack,... Discrete stack containing the alignment points kIdx,... Boolean array indicating which trials should be ignored koIdx,... Boolean array indicating which events should be kept. timeLapse,... 2 element array contaning the ...
c20bb26f6964a5e5f93ada3b0a96b5bfab9733ac99a5a651566a8a315115b308
MATLAB
4,085
178
function [physdata] = phys_merge(physfile, trigfile, mergedfile, secs2disp, sigfigs) %phystrigs Adds "faked" triggers to physiology file % Outputs % physdata: Input physiology data with an additional column % containing the "fake" scanner triggers. % The scanner triggers column is mostly zeros, but...
95cc77015bdce37801e63d9e5ca9fb0c3fa0c99017b91c1db08efe4de0b217b2
MATLAB
4,087
107
function [tassmOut, indxConverted] = smactinClean(tassmIn, varName, colIndxArr, thresholdArr) %SMACTINCLEAN: search for observations in either speckle or single-molecule properties in tassm that are LOWER OR EQUAL TO input threshold and replace them with NaN. % % SYNOPSIS: [tassmOut, indxConverted] = smactinClean(tassm...
cbf0173704386d80651d323f72b8e7488d7a87aa4dbcf86a821fc89a01722172
MATLAB
4,087
107
function [Y,YD,intervene_matrix_sim] = numInitGVL(tspan,C,Y0,interveneTimes,perturbation_begin_end,assumeStiff) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome time-series datasets, and % predicts biologically rel...
c875f65f047cc7bcfbb73b497cd823cd684e33a16eb173cff69decad272ec3ee
MATLAB
4,089
135
function [HbO_subj_full, HbR_subj_full, muA760_full, muA850_full, amplitude_scale] = ROImua_to_HbOchan( ... p, e, brain_nodes_idx, d_mu_a_est, hb_ratio, varargin) %FNIRSPOWER.MEASPRED.ROIMUA_TO_HBOCHAN % Convert a subject-specific ROI map to relative Hb and absorption fields. % % roi_amp_std specifies the ...
ecd2ccd76f49e4c492cbe0ee37986d10af544c5555106e2da1f2a10431fe8091
MATLAB
4,089
113
% written by Yiyuan Han, Essex BCI-NE Lab, 13/12/2019 % binary classification between two specific conditions function [fISPC,sFeatures,fWeights,perfMat] = binaryClass(class1,class2,blockTagsAC,blockDatasetAC,mode,folderpath,featureNum) %% Extract the data in specific conditions % These two classes should be modifi...
3c7a86ab3f35e73caa4fc9e8076de17e65c40042d0331b7412afa32ada0941ac
MATLAB
4,093
113
% eegfiltfft() - (high|low|band)-pass filter data using inverse fft % (without using the Matlab signal processing toolbox) % Usage: % >> [smoothdata] = eegfiltfft(data,srate,locutoff,hicutoff); % >> [smoothdata] = eegfiltfft(data,srate,locutoff,hicutoff,epochframes,filtorder,revfilt); % % Inputs: % ...
c4860f0000c0d26ad5cf2694a28a84e95a2bc9fa8d6ae8e26a91f664268892c9
MATLAB
4,094
82
function write_nifti2_hdr(filename, hdr) % WRITE_NIFTI2_HDR % % Use as % write_nifti2_hdr(filename, hdr) % where % filename = string % hdr = structure with nifti-2 header information % % See also READ_NIFTI_HDR, READ_CIFTI, WRITE_CIFTI % Copyright (C) 2013, Robert Oostenveld % % This file is part of Fi...
f90520e41d31e2c6beae0015d82f2121cee8877b42b2162e7a5df3db85ce0525
MATLAB
4,097
118
function dicm_val_rep(dcmFile, tag, val, newFile) % Replace tag value with val in dicmFile, and save as newFile. % % dicm_val_rep('myFile.dcm', 'PatientName', 'sub-002', 'newFile.dcm'); % dicm_val_rep('myFile.dcm', '0177,0011', 'sub-002'); % use hex for tag % % The first three input argument are manditory. The forth ...
967cdf49fbb79ddca4fe66f78a25498744dfa1eb6c9fd1b68ece667edd4af6a2
MATLAB
4,100
128
% jointprob() - rejection of odd columns of a data array using % joint probability of the values in that column (and % using the probability distribution of all columns). % % Usage: % >> [jp rej] = jointprob( signal ); % >> [jp rej] = jointprob( signal, threshold, jp, normalize, discre...
9e0479de435ee75faf1c875c8c987cbe3c79b1d11f5a1208981e33410c01692e
MATLAB
4,100
148
function savemsh(node,elem,fname,rname) % % savemsh(node,elem,fname,rname) % % save a tetrahedral mesh to GMSH mesh format % % author: Riccardo Scorretti (riccardo.scorretti<at> univ-lyon1.fr) % date: 2013/07/22 % % input: % node: input, node list, dimension (nn,3) % elem: input, tetrahedral mesh element list...
afa7b3a94590db96e17080521582e5f35a978d242db010940206d7c99c5081f8
MATLAB
4,100
112
function data = AFOFdata_struct2(inputdata, filenames) % USE THIS FOR EXP2 SLIPS % how it works: % fly = AFOFdata_struct(data,filenames) where data and filenames are % outputs from rotoball_importer() for e = 1:length(inputdata) for t = 1:length(inputdata{e}{1}) trial.filename = filenames{e}; ...
a0c5f67dbf3780a628d1fe2b7c7ff2a11cf6bd3b1567d2db2d80da9a07aa9917
MATLAB
4,102
101
% makeelec() - subroutine to make electrode file in eegplot() % % Usage: >> makeelec(chans) % >> [channames] = makeelec(chans) % % Inputs: % chans - number of channels % % Author: Colin Humprhies, CNL / Salk Institute, 1996 % % See also: eegplot() % Copyright (C) Colin Humphries, CNL / Salk Institute, A...
931b4d1e9d2bb772034b25c2840d87f69b7ed815526b48c76881dd308b6d5087
MATLAB
4,106
103
function [offsets, aligned] = ... alignwaveforms(template, waveforms, mx) %ALIGNWAVEFORMS Finds best alignment of waveforms to a reference. % OFFSETS = ALIGNWAVEFORMS(TEMPLATE,WAVEFORMS,MAXSHIFT), where TEMPLATE % is an 1 x T vector and WAVEFORMS is an N x T matrix, returns an N x 1 % vector ...
c4de95b4cf71cc1cf2c0770e1293a23f1a4888f2b3468c9aad95433a422c5e7d
MATLAB
4,110
100
function [m,max_card_matching]=matching(A,varargin) % MATCHING Compute a maximum cardinality matching % % m=matching(A) returns a matching between the vertices of an undirected % graph. A matching is a subset of edges where each vertex in incident on % only one edge. A maximum cardinality matching is the largest poss...
f26be53d10a73c9ab84df168b8896a687ca0ba4f3c28e4d96b20b182ed960dd1
MATLAB
4,111
116
% biosig2eeglabevent() - convert biosig events to EEGLAB event structure % % Usage: % >> eeglabevent = biosig2eeglabevent( biosigevent, interval, mode) % % Inputs: % biosigevent - BioSig event structure % interval - Period to extract events for, in frames. % Default [] is all. % mode...
2ea7b4cf1c81f021251bc080ccacdf34b2e2e7bea87ffd25e7c5b7eca1d602e0
MATLAB
4,114
103
function varargout = pickerGUI(varargin) % PICKERGUI MATLAB code for pickerGUI.fig % PICKERGUI, by itself, creates a new PICKERGUI or raises the existing % singleton*. % % H = PICKERGUI returns the handle to a new PICKERGUI or the handle to % the existing singleton*. % % PICKERGUI('CALLBACK',hO...
164b8a2072a95da9395f2a8b8d80288245d6a7604e29ad0084aa78e3ec666194
MATLAB
4,118
107
function [XtrR, XteR, nuis] = residualizeFold(Xtr, Xte, Ctr, Cte) % residualizeFold Train-only nuisance regression for one cross-validation fold. % % [XtrR, XteR, nuis] = residualizeFold(Xtr, Xte, Ctr, Cte) % % Regresses the nuisance covariates out of the feature matrix, estimating the % nuisance coefficients on...
76e55a716b09759699c21b9672b89348640715c1e6ccb500fa11fac16d6dba48
MATLAB
4,118
122
function OUT = run_variance_subject(snirf_path, nirs_model, baseline_sec, block_sec, iter_blocks, n_iter, concat_baseline_sec) %RUN_VARIANCE_SUBJECT Run subject-level block-resampling analysis for GLM beta variability. % % OUT = fnirspower.pipeline.run_variance_subject( ... % snirf_path, nirs_model, baseline_...
82348a00898d2fdf2c9cc7d52c576a30243d3f8055375de7d04cf7ec8c3079bf
MATLAB
4,118
137
function Z = palm_inormal(varargin) % Applies a rank-based inverse normal transformation. % % Usage: Z = inormal(X) % inormal(X,c) % inormal(X,method) % inormal(X,...,quanti) % % Inputs: % X : Original data. Can be a vector or an array. % c : Constant to be used in the transf...
db8aae7796089c10ca2c5b6365c4f9648e28acad9c158e1679c89cc7aa0d9447
MATLAB
4,122
122
%% RUN_ABSORPTION_ESTIMATION_STEP % Driver script: ensure μa exists, then run absorption estimation. % - Finds latest GLM outputs (Hb and ΔOD) under project paths. % - If μa recon is missing, reconstructs it from ΔOD betas. % - Calls fnirspower.pipeline.run_absorption_estimation with resolved files. %% Resolve p...
aac80721fe349ec075fdd82a847e16ccd5f89eea3d698552df25ca5a8e47289e
MATLAB
4,124
112
function [sessionArmChoice] = getSessionArmChoice(varargin) % Compute and get session arm choice over all session subfolders % % USAGE % % [tracking] = getSessionTracking(varargin) % % INPUTS % basePath (default: pwd) basePath for the recording file, % in buzc...
bcd83abc792df9a8fbc6b5d2d753e34b87ea10f94d85443015de4affac0b8581
MATLAB
4,124
143
function myOISscr1_wrap(flist,saveid,opt1,opt2,vars2load,skip1load,checkflag) % Usage ... myOISscr1_wrap(filelist,saveids,option1str,optionAllstr,loadVars,skip1load,checkflag) % % Ex. % opt1=sprintf('''do_load'',[1:6200],''do_crop'',''do_bin'',[2 2 2],''do_binfirst'',''do_motc'',''do_maskreg'',''do_intc'''); % opt2...
2034d2683cee9b4b67d4086d816ba4c05f7e00878525038747a936235e8872a9
MATLAB
4,127
122
function logAnalysisFile(AnalysisFileName, writePath) % The purpose of this utility is to provide a record of analyses run by % writing out to a log file the state of the code that was used to analyze % the data. It writes the log file into the current directory if only a % filename is provided. An absolute path is req...
64cef535b0bf939dd66a5e6b1d73c95689d0c28ec0070da253199670af7ed453
MATLAB
4,127
126
% rejkurt() - calculation of kutosis of a 1D, 2D or 3D array and % rejection of outliers values of the input data array % using the discrete kutosis of the values in that dimension. % % Usage: % >> [kurtosis rej] = rejkurt( signal, threshold, kurtosis, normalize); % % Inputs: % signal...
93f325d814e19b3988ec4db4cc5f65bfda6efbb622c0599a7c925ca1b03b13de
MATLAB
4,132
130
function [p U UC] = circ_raotest(alpha) % [p U UC] = circ_raotest(alpha) % Calculates Rao's spacing test by comparing distances between points on % a circle to those expected from a uniform distribution. % % H0: Data is distributed uniformly around the circle. % H1: Data is not uniformly distributed around th...
65f83c05cd1a1edd39b415d9469775022ffe4b8445f2d6f55a9969e48731dcef
MATLAB
4,135
114
function varargout = ea_textdisp(varargin) % EA_TEXTDISP MATLAB code for ea_textdisp.fig % EA_TEXTDISP, by itself, creates a new EA_TEXTDISP or raises the existing % singleton*. % % H = EA_TEXTDISP returns the handle to a new EA_TEXTDISP or the handle to % the existing singleton*. % % EA_TEXTDI...
aec19aedd821ea80de5f378c36788f9f727afacd204b5ef36f26f0109b16af99
MATLAB
4,136
88
function CBIG_MMLDA_view_vol_slice_with_underlay(in_vol, underlay_vol, mni_space, color_map_name, plane, min_thresh, max_thresh, out_dir, out_name) % CBIG_MMLDA_view_vol_slice_with_underlay(in_vol, underlay_vol, ... % mni_space, color_map_name, plane, min_thresh, max_thresh, out_dir, out_name) % % Overlay input volum...
ac246d51ce462b9a9a7b8c75725e576500ad3435679658296a66f2982aabb0dd
MATLAB
4,139
108
function postprocess_write_file_for_cytoscape(filename_prefix,Theta,... bayes_factors,names) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome time-series datasets, and % predicts biologically relevant behaviors of...
8f917e52bcf8596126ec8d517a651b6811133ce73de3db5d90c5a1ef15c0216d
MATLAB
4,142
132
function cvglmnetPlot(cvobject,sign_lambda,varargin) %-------------------------------------------------------------------------- % cvglmnetPlot.m: plot the cross-validation curve produced by cvglmnet %-------------------------------------------------------------------------- % % DESCRIPTION: % Plots the cross-valida...
b7e6aff0d3a6cfb14a0ccbb700f5247042c5d2bcda59537665850a53c7a78d78
MATLAB
4,143
99
%% Read Medtronic Framelink XML Configuration File % % Andreas Husch % Centre Hospitalier de Luxembourg, Dep. of Neurosurgery / % University of Luxembourg - Luxembourg Centre for Systems Biomedicine % 2014 - 2017 % mail@andreashusch.de, husch.andreas@chl.lu function config = readMedtronicXMLTrajectory(filepath) xml = x...
41734020059ac00a009e21c8564027b30e92c80c774fb046f7ecd0d1f013d63a
MATLAB
4,144
125
% FEASREAL Generates a random sparse optimization problem with % linear, quadratic and semi-definite constraints. Output % can be used by SEDUMI. All data will be real-valued. % % The following two lines are typical: % > [AT,B,C,K] = FEASREAL; % > [X,Y,INFO] = SEDUMI(AT,B,C,K); % % An extended version is: % > [...
2114135837f649972ea9d774dd5b16bc69cf206d1f496d6254e69f833a4aa04b
MATLAB
4,145
119
function [ARIs, RIs] = computeRANDIdxAllROIsGMMs(allROIs, options, areas, nSplits) % Split the dataset into nSplit 50/50 splits balanced within area, for each % split, get all ROI GMM classifications from each split, compute adjusted % RAND index between the classifications across the two splits, repeat % Get train t...
c8dbe8b4b6386bb69ada055d236354381569717ede386094149099db6a3b88df
MATLAB
4,145
185
function y = newvar( prob, name, siz, str, geo ) narginchk(2,5); % % Check problem % if ~isa( prob, 'cvxprob' ), error( 'First argument must be a cvxprob object.' ); end p = prob.index_; global cvx___ % % Check name % if isempty( name ), nstr = []; elseif ischar( name ), nstr = struct( 'type', '.', 'sub...
173373cc5042f79117167e3d4d51aa67477310fd6eeccf7dd91359b098ed20e8
MATLAB
4,148
137
% lapplot() - Compute the discrete laplacian of EEG scalp distribution(s) % % Usage: % >> laplace = lapplot(map,eloc_file,draw) % % Inputs: % map - Activity levels, size (nelectrodes,nmaps) % eloc_file - Electrode location filename (.loc file) % For format, see >> topo...
292163df128aec8f29bed36d2f7d90dc43ab487ad6c315f11baded8597003d87
MATLAB
4,148
119
classdef zscore_normalize_FP % zscore_normalize_FP is a feature preprocessing (FP) object that z-score % normalizes each feature by calculating the mean and standard % deviation using the training set data and then subtracting this mean and % dividing by this standard deviation for both the training and tes...
b57639ca82b3e1367416f988a9c4932ef261369933943a1288b117a21f369074
MATLAB
4,148
119
function ea_options2handles(options,handles) if isempty(handles.patientlist.Data.subjId) || isempty(handles.patientlist.Selection) || ~isfield(options, 'modality') arrayfun(@(x) set(x, 'Enable', 'off'), handles.registrationtab.Children); arrayfun(@(x) set(x, 'Enable', 'off'), handles.localizationtab.Children)...
861f9041ccd91035d0ea4b297217d6e933303074a1c1d2022818fa96222d3c99
MATLAB
4,149
143
function z = cvxprob( varargin ) global cvx___ cvx_global tstart = tic; if ~iscellstr( varargin ), error( 'Arguments must be strings.' ); end % % Clear out any old problems left at this depth. These will be here due to % an error while constructing a CVX model, or due to the user deciding to % start over when con...
dbcc5d186b33be3b2fc90bd8bfe2fdd57017fa785e414f7ffe197507f072528b
MATLAB
4,150
121
% ========================================================================= % Script: Simulation_study2_1_B1_B0.m % Authors: Zijian Gao,Qianxue Shan,Weitian Chen % Email: zijian.gao@link.cuhk.edu.hk % Date: 2025-12-19 % Version: 1.0 % % Copyright (c) 2025 Zijian Gao, Qianxue Shan,...
9b1c53e8990ec06cec529677f47c049cd8e4950cd273d5deb47a7313bc0fea0b
MATLAB
4,153
130
function [normdata,intmean,intstd] = NormToInt(data,normtype,int,sf,varargin) %NormToInt(data,normtype, int,sf) normalizes the data to a subset of time %(int). Has options for multiple normalization types. % %INPUTS % data [Nt x Ndim] % normtype 'mean','median' 'Z', 'max', 'percentile', 'modZ' for modified Z-s...
e2ece3c92e9348cde97de999eb21e52bd394e4ed84600df7ced38e9238fe44d8
MATLAB
4,154
106
function V = vm_minimize(V, C, KP, P0, KA, A0, max_relaxation_steps, force_tol) % VM_MINIMIZE Relax vertex positions to (local) mechanical equilibrium % using the FIRE (Fast Inertial Relaxation Engine) algorithm. % % V = VM_MINIMIZE(V, C, KP, P0, KA, A0, max_relaxation_steps, force_tol) % iteratively moves vertice...
5f5f9d73d20f0ae85a4357b5e94b5bc3f8da3f6c2ce4da357f58dd39ebe6ea91
MATLAB
4,155
122
% eeg_countepochs() Count how many epochs there are of each type % % Usage: % >> eeg_countepochs(EEG); % % Inputs: % EEG - input dataset % epochmarker - ['type'|'eventtype'] indicates which part of the % EEG.epoch structure the different trial types are stored in. Depending % on what sy...
60ce0ffcf3c65c9543611a069874868a4033547e80d288a9938af39aea38ff2e
MATLAB
4,155
114
function ConvertTwoLFPFilessToOne(datasetfolder,recordingname,varargin) % Converts previous _SWLFP.mat and ThetaLFP.mat files to a single % StateScoreLFP.mat file. %INPUT (optional) If no inputs included, select folder containing .lfp % and .xml file in prompt. % % datasetfold...
37bf0134274bf902fa2725d85eb37bd05ab1ede43908e523fe6a4e96bc2ae42e
MATLAB
4,157
106
function [diffRadOut, detectPairOfMpd, mpdOriginal] = getTrackMpd(tracksIn) %GETTRACKMPD: calculate maximum pairwise distance of each detections in single-molecule tracks % %SYNOPSIS: [diffRadOut, detectPairOfMpd, mpdOriginal] = getTrackMpd(tracksIn) % %INPUT: tracksIn : (struct) input tracks, has at least follow...
1b17cfe65274584edffda7dda9fae1c8bfb2fb9d514132ecf586a3947995620e
MATLAB
4,159
130
function [p U UC] = circ_raotest(alpha) % [p U UC] = circ_raotest(alpha) % Calculates Rao's spacing test by comparing distances between points on % a circle to those expected from a uniform distribution. % % H0: Data is distributed uniformly around the circle. % H1: Data is not uniformly distributed around th...
682109be0e17f5b0821f270b0a1f7fccea7f1bf9dc622b44199ec2874e20da09
MATLAB
4,159
112
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Assign Shirer Network to Brainnetome ROI % Author: Yuan Zhang % Date: 2025-07-25 % % Description: % This script maps each Brainnetome atlas ROI (BN_ROI) to a Shirer % 14-network parcellation based on the overlap of voxel locations. % For...
c584dff2a58bf8f20dafbbece3cd94b2965893dabdb187bf9d7bbf421e5c85de
MATLAB
4,160
115
function [R,Rperm,Rnaned,Rpermnaned,h]=ea_Rmap(varargin) % creates a correlation nifti file given a set of images and a % regressor ("R map" in Horn 2017 AoN) % ea_Rmap(fis,regressor,outputname,mask,sk,corrtype) % sk can be 'k','s','sk' % for smoothing and normalization options. Mask only necessary if % choosing 'k' o...
caac326f69ca664954a95e00aed984e32722bdc19e2b38c9b65593899c559f60
MATLAB
4,162
78
function [S,t,f,R,Serr]=mtspecgramtrigpt(data,E,win,movingwin,params,fscorr) % Multi-taper event triggered time-frequency spectrum - point process times % % Usage: % % [S,t,f,R,Serr]=mtspecgramtrigpt(data,E,win,movingwin,params,fscorr) % Input: % data (univariate spike data -1d structure array of spike ti...
0c765d03d1c2cec89944258dc5fb6a72459cf106003760f1fd6ae45d260d24ef
MATLAB
4,163
126
% eeg_rejsuperpose() - superpose rejections of a EEG dataset. % % Usage: % >> EEGOUT = eeg_rejsuperpose( EEGIN, typerej, Rmanual, Rthres, ... % Rconst, Rent, Rkurt, Rfreq, Rothertype); % % Inputs: % EEGIN - input dataset % typerej - type of rejection (1=raw data; 0=ica). % Rmanual ...
3015d45758db678a97174d6b38922ba0852bf87325e1a69a3e2a3d69aeaa94f7
MATLAB
4,164
108
function [out, azi, ele, idx] = SOFAspat(in,Obj,azi,ele,flag) % SOFAspat % [out, azi, ele, idx] = SOFAspat(in,Obj,azi,ele) spatializes the sound IN using % the HRTFs from OBJ according to the trajectory given in AZI and ELE. % Input: % in: vector with the sound % Obj: SOFA object containing the HRTFs % azi, ...
f9f2dec2ab14c1199594a06d259571648bac1c3d8e724c54ae6765a4db715a7c
MATLAB
4,167
120
clc; clear; addpath("E:\Data Analysis\2P Imaging\Programs\Fiji.app\scripts"); addpath('D:\Git\FindUSN\CalciumDataProcessing\Preprocessing\MotionCorrection'); % Select the root folder to process rootFolder = uigetdir(pwd, 'Select Root Folder to Process'); if rootFolder == 0 error('Folder selection canceled.'); end...
986de0fac00e3d159dce845095edf94f6b8123ef1988af27d5deed17a23b5659
MATLAB
4,169
86
function [C,phi,S12,f,zerosp,confC,phistd,Cerr]=cohmatrixpb(data,params,fscorr) % Multi-taper coherency matrix - binned point process % % Usage: % % [C,phi,S12,f,zerosp,confC,phistd,Cerr]=cohmatrixpb(data,params,fscorr) % Input: % data (in form samples x channels) -- required % params: structure with field...
85a728a56babc9cbce051a75b3593dd158dffaa56ed2275272a88fcfcdb510da
MATLAB
4,171
109
%function [xml, rxml] = LoadXml(FileBase) %loads the xml file using xmltools (have to have it in the path) % rxml returns it's original layout - very messy structure but contains all % the xml file contents. % xml - is the ouput structure which is backwards compatible to LoadPar % output, so you can use it instead ..al...
e525567c554f8ae66d4d8466fa0c81f2d60883d84e36a782b9175f01b751a515
MATLAB
4,171
84
function [correct_class_decision_values normalized_rank_results rank_confusion_matrix] = get_rank_and_decision_value_results(cv, YTe, classifier_labels, decision_values, create_rank_confusion_matrix) % This helper method calculates the normalized rank results, the decision values for the correct class, and the rank con...
799010cdfb9be3914b33b9b34ddb0b8deef52a8c5110c7cd34de5667ea97c638
MATLAB
4,172
107
function ea_gencheckregfigs(options, type) if ~exist('type', 'var') type = {'coreg', 'norm'}; elseif ischar(type) type = {type}; end if ismember('coreg', type) fprintf('\nExporting coregistration check images to %scheckreg...\n', [options.subj.coregDir,filesep]); % Make dir ea_mkdir(fullfile(optio...
c7d621e09c101e772160538d8ea5cb3676b6b42e7228bf9b0c1895d7c677b2f6
MATLAB
4,172
147
% Iterations over different delamination durations % To speed up comment line 71 in % SOP_multicell_LI_adapted_weighted_with_trigger_PerimSave.mat before % running this script to avoid saving simulations movies for each % iteration clear all; close all; clc; model.ratio = 'rho'; model.zone = 'Gaussian-like prone...
02050fff7d97f43045949f33bae630fef37718a52cc024c0303c4df2ab9dd420
MATLAB
4,173
111
function [ viewinfo ] = EventVewPlot %UNTITLED Summary of this function goes here % Detailed explanation goes here obj = findobj('tag','EventExplorerMaster'); FO = guidata(obj); %Two options of current timepoint: Event Number, arbitraty timepoint %FA/misses for DetectionReview switch FO.viewmode case 'timepoin...
dfffca02f3731572c14d147cc672c7614babf7dff8bb377e7900864fc387ec98
MATLAB
4,173
128
function lab = eigK(x,K) % [lab,q,f] = eigK(x,K) % % EIGK Computes the spectral values ("eigenvalues") or even the complete % spectral decomposition of a vector x with respect to a self-dual % homogeneous cone K. % % > LAB = EIGK(x,K) This yield the spectral values of x with respect to % the self-d...
90a966c1e7ccb3decf8f8935a4ad2b98af5b38f768f9787c53c367b138ec3a52
MATLAB
4,174
103
function [tau, curve, info] = ami(x, L, opts) %AMI Average mutual information versus lag. % TAU = AMI(X,L) returns the lag of the first local minimum of the average % mutual information of X with itself, computed over lags 0:L. TAU is the % embedding delay for phase space reconstruction. % % [TAU,CURVE] = AMI(X...
8ce7250a5d62bc96cd5013169b8be0609be818e8fec4ffc33feeb7436533e0dc
MATLAB
4,175
162
function x = sparsify( x, mode ) global cvx___ narginchk(2,2); persistent remap % % Check mode argument % if ~ischar( mode ) || size( mode, 1 ) ~= 1, error( 'Second arugment must be a string.' ); end isobj = strcmp( mode, 'objective' ); pr = cvx___.problems( end ); touch( pr.self, x ); bz = x.b...
ca7d00b51bdd5b339e5aca716304f0711a2fb8e073439fab6275c9cfecaa6a79
MATLAB
4,176
88
function CFA_ReOrientDataForAna answ = inputdlg('1:T1,2:T2,3:EPI,4:withT1,5:CT','which conditions?',1,{'1'}); modality = str2num(answ{1}); if modality==4 answ2 = inputdlg('1:T2,2:EPI,3:CT','which modality for OtherMode image',1,{'1'}); modother = str2num(answ2{1}); end PG = uigetdir(pwd,'Need Reorient directory...
1a8e0be6dc937c43e8279f9c4fa52197daf6837c4be33d1f25143d5a124c0e67
MATLAB
4,177
170
function fit = lognet(x,is_sparse,irs,pcs,y,weights,offset,parm,nobs,nvars,... jd,vp,cl,ne,nx,nlam,flmin,ulam,thresh,isd,intr,maxit,kopt,family) [noo,nc] = size(y); if noo ~= nobs error('x and y have different number of rows in call to glmnet'); end if nc == 1 [classes,~,sy] = unique(y); nc = length(cl...
6da2cdde400a4c62463d4acd7632c13e3fd626e305cd3d796e4e49397b7571cf
MATLAB
4,178
127
datafolder = '/Users/dlevenstein/Dropbox/Research/Datasets/BWData/'; %Make List of all Recordings in data folder recordings = dir(datafolder); recordings(strncmpi('.',{recordings.name},1)) = []; %Remove entries starting with .,~ recordings(strncmpi('~',{recordings.name},1)) = []; numrecs = length(recordings); %% au...
9fa4cccbadce61f7cbc2abed7b47315e0a7ee6396ec42c975feea30db98b4e51
MATLAB
4,178
113
classdef ea_slicer_for_lead properties install_path executable_path installed_version upstream_version download_url end properties (Access = private) release_tag = 'v231122-beta' release_version = struct('linux', '0.1.0-2023-11-22', 'mac', '0.1.0-202...
daeee4192a18c8e196d47dea14a80ed4929879ead8c3d0733c493200f17bd376
MATLAB
4,180
103
% pop_chancenter() - recenter cartesian X,Y,Z channel coordinates % % Usage: % >> chanlocs = pop_chancenter(chanlocs); % pop up interactive window % >> [chanlocs centerloc] = pop_chancenter(chanlocs, center, omitchan); % % Inputs: % chanlocs = eeglab channel location structure (see readlocs()) % center ...
08962877ca49cdc63c04f8525679f90d8a3b616fa0a88bc10e9dd149f2fa34cd
MATLAB
4,183
117
function [string, file_name] = user_string(string_name, string) %USER_STRING Get/set a user specific string % % Examples: % string = user_string(string_name) % isSaved = user_string(string_name, new_string) % [value, file_name] = user_string(...) % % Function to get and set a string in a system or user specific...
b911f51967aaf1cb0e7a993ce458f6f9d1bf6effdaa1bd4fcd176c002aeab239
MATLAB
4,184
148
function result = cvlognet(object, lambda, x, y, weights, offset, foldid, ... type, grouped, keep) if nargin < 10 || isempty(keep) keep = false; end typenames = struct('mse','Mean-Squared Error','mae','Mean Absolute Error',... 'deviance','Binomial Deviance','auc','AUC','class','Misclassification Error'); ...
50f994512db190de4179d297619111776e8884461eb8bde99e4a79ac3e6e1207
MATLAB
4,186
132
function plot_spectogram(psd, freqs, lims, stages, plotType, varargin) % Plot a spectogram. Will either plot a heatmap depicting power in all % frequeny bands, or as lines depicting band-averaged power % % Required input: % % psd = freqs x epoch array % freqs = vector indicating frequency at each row % lims = [lo hi] f...
740f4e048d3662d76044ee49eb6aef29ece0560a94e1da403366ca2d74aeb946
MATLAB
4,186
90
% 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...
f05f387c3ab69c022c7d783cc4a7f108afcc634f99cdf74dd7155d51c1b673b2
MATLAB
4,188
114
function ref = ea_create_threshold_union_ref_nii(outPath, inFiles, thr, voxSize) % CREATE_THRESHOLD_UNION_REF_NII % Make a zero-filled reference NIfTI whose FOV is the union bounding box % of all *thresholded* regions (V > thr) across input images. % % outPath : '.nii' or '.nii.gz' % inFiles : char or cellstr of NIfTI ...
422e31d7175ba227b35456bbf7fcc3bf40fa6ec8b9e678cc840656593ea9e6f5
MATLAB
4,190
122
function displayGUIplots(handles, ifspine, ifdendrite) if nargin == 1 if ~isempty(handles.roi) ifspine = 1; else ifspine = 0; end if ~isempty(handles.dendrite) ifdendrite = 2; else ifdendrite = 0; end end if ifspine == 0 && ifdendrite == 0 roimap = ze...
9580d73a98516c6cba5586168cf7fff6073d6d52d1a6ef7cb9957b40093386e4
MATLAB
4,191
106
function [rotcorr, rrcorr] = fast_cross_correlation(rois, rrois, dim,forty) angles=rotation_xyz(dim,forty); corr=zeros(size(rois,2),'single'); %rot_angle=zeros(size(rois,2),'single'); rcorr=zeros(size(rrois,2),'single'); %rot_rangle=zeros(size(rrois,2),'single'); % Construct numerator and denumerator tables, that c...
5c548d79338cc84403be4fe3b3a2aeb28bdbff9bdb7e9a28adca33924dee08a1
MATLAB
4,192
106
function [rotcorr, rrcorr] = fast_cross_correlation(rois, rrois, dim,forty) angles=rotation_xyz(dim,forty); corr=zeros(size(rois,2),'single'); %rot_angle=zeros(size(rois,2),'single'); rcorr=zeros(size(rrois,2),'single'); %rot_rangle=zeros(size(rrois,2),'single'); % Construct numerator and denumerator tables, that c...
3c4368710bb4e80faaf21308e02019fbcc48bbf695c71e003c920a7f269c4003
MATLAB
4,193
114
% 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...
0505ed20c59ad99ecc26bfe13ce3c823545e654b4c862a3a3a29ac4215e64b2d
MATLAB
4,196
121
function g = loudWeight(f,phon) %LOUDWEIGHT Calculate loudness weighting coefficients % % G = IOSR.AUDITORY.LOUDWEIGHT(F) returns loudness-weighting linear- % magnitude coefficients for frequencies F (Hz). The function is based on % the loudness at 65 phons defined in ISO 226:2003. The coefficients are % scale...
491f7eb47ca2c5f6b88aafbe90e006c751356bf012eaaca1976a405945c9f564
MATLAB
4,197
114
function [delta,h,alpha] = iswnbr(w,thetaSQR) % [delta,h,alpha] = iswnbr(vSQR,thetaSQR) % % ISWNBR Checks feasibility w.r.t. wide region/neighborhood of Sturm-Zhang. % vTAR:= (1-alpha)*max(h,v) projection v onto theta-central region % delta = (sqrt(n)/theta) * norm(vTAR - v) / norm(v) % % ********** INTERNAL FUNC...
86227b6c31b935b1f7c2bc0ad58d0e21af74d028301c425c63784630b1d119bf
MATLAB
4,198
147
function obj=geom_bar(obj,varargin) % geom_point Display data as bars % % Example syntax (default arguments): gramm_object.geom_bar(0.8) % This will add a layer that will display data as bars. When % data in several colors has to be displayed, the bars of % different colors are dodged. The function can receive an % opt...
a673007ac67ba0f700bee4fbbd2fb76416c69d42e3ed9921b498f3238b301948
MATLAB
4,199
110
function [SleepState] = bz_ThetaStates(basePath,makePlot) % [SleepState] = bz_ThetaStates(basePath) % Takes the output of SleepScoreMaster and separtes WAKEstate into % WAKEtheta and WAKEnontheta by applying the same threshold calculated form % REM sleep. This is not an ideal way and needs to be improved. % F.Sha...
a9fc0ee7e4d8f8d2387ceb01639ffc42422bc36db5ce294c5c496cb60eb3bca7
MATLAB
4,199
109
%function [xml, rxml] = LoadXml_SleepScore(FileBase) %loads the xml file using xmltools_ss (have to have it in the path) % rxml returns it's original layout - very messy structure but contains all % the xml file contents. % xml - is the ouput structure which is backwards compatible to LoadPar % output, so you can use i...
1b7f3aeb8c46bf4ebf8e7529453835da263f064d86bbef91d2dfc850b174de9c
MATLAB
4,200
153
function p = PlotTicks(xy,varargin) %PlotTicks - Plot ticks. % % USAGE % % p = PlotTicks(x,y,<options>,<options2>) % % x list of tick abscissae % y list of tick ordinates % <options> optional list of property-value pairs (see table below) % <options2> options for func...
0b7f98de1a1741456999b5d1cc9b04a8b17467b8ae74ce02245e352300870921
MATLAB
4,202
85
%Baseline %load 'StimSM', stimAllTrials'; tstart_i=-2; tstop_i=0; % (StimCombined.m, stimAllTrials.mat) rr1a_percentmeansBase=nanmean(all_rr1a_percent(tt>=tstart_i&tt<tstop_i,:)); rr1a_percentsemBase=nanstd(rr1a_percentmeansBase)/sqrt(size(rr1a_percentmeansBase,2)); yproj2max_percentmeansBase=nanmean(all_yproj2...
2426c44fd591a43dd6abeee4626c12c8e60912a24f111bf74274ed868057f25d
MATLAB
4,203
120
function CBIG_ASDf_computeBootstrapZScores_wrapper(in_dir, out_dir) % CBIG_ASDf_computeBootstrapZScores_wrapper(in_dir, out_dir) % % Wrapper function to compute bootstrapped z-scores and p-values % % Input: % - in_dir: % Absolute path to directory where bootstrapped factor estimates % are saved...
1eb4a276015e6541ffead4ebb838b15b67a8f9ab4a6a5177aca97c67960bff9e
MATLAB
4,206
170
function [ftr lens] = saveFTR(finame,datastruct,I,vox,info,saveit) if nargin == 5, saveit = true; end; cc = {}; csc = {}; cD = {}; lens = []; if isempty(vox), warning('Empty field vox: guessing'); vox = [2 2 2]; end; reparam_step = 0.9*min(vox); %mm P = datastruct.state; labels = zeros(length(I),1);...
45a8c21f8dddad288d4463c37fd8c4a25603ac7811baf034af569296ae61c6fa
MATLAB
4,207
135
% Elmore delay sizing for an interconnect network. % Boyd, Kim, Vandenberghe, and Hassibi, "A Tutorial on Geometric Programming" % Boyd, Kim, Patil, and Horowitz, "Digital circuit optimization via geometric programming" % Written for CVX by Almir Mutapcic 02/08/06 % (a figure is generated) % % We consider the problem o...
5912afdac2a8c809136de6b0e135eda96b8272dba7df5c8028ee2e679f2f05fd
MATLAB
4,210
109
function [svn_profile,svn_str] = buildSvnProfile(folders,keywords,strs,rec) %BUILDSVNPROFILE Read data from files tagged with SVN keywords % % This function extracts SVN keyword data from specified files, and % returns the filename, path and keyword data to a cell array (and % optional char array). % % Keyw...