sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
dc1997d0869bc6edf8cdedaf8152d1f31511cd17578ba15e0438d88700d4a27f
MATLAB
5,768
163
function varargout = SpineTurnover(varargin) % SPINETURNOVER MATLAB code for SpineTurnover.fig % SPINETURNOVER, by itself, creates a new SPINETURNOVER or raises the existing % singleton*. % % H = SPINETURNOVER returns the handle to a new SPINETURNOVER or the handle to % the existing singleton*. % % ...
2e69f79d095e90687184c4a9765be49151020eb25d54fdd341a960f173e40ec4
MATLAB
5,772
177
% plotproj() - plot projections of one or more ICA components along with % the original data (returns the data plotted) % % Usage: % >> [projdata] = plotproj(data,weights,compnums); % >> [projdata] = plotproj(data,weights,compnums, ... % title,limits,chanlist,channames,...
e012b4260d1398e19d5bc5c54f983d4c19feffbeaf9c24f5b7679b6a8f1b4374
MATLAB
5,777
111
function [score, scoreIndep, p] = compareAssignments(assigns1, assigns2, showTables) % COMPAREASSIGNMENTS Computes a quality measure of the similarity between assignments. % % [score, scoreIfIndependent] = compareAssignments(assignments1, assignments2) % The inputs, 'assignments1' and 'assignments2', must be two...
d9d4dc2f0cbedd748c65ff38ca80662a50857db528057e4137d025ce4afbe778
MATLAB
5,781
155
function bfsave(varargin) % BFSAVE Save a 5D matrix into an OME-TIFF using Bio-Formats library % % bfsave(I, outputPath) writes the input 5D matrix into a new file % specified by outputPath. % % bfsave(I, outputPath, dimensionOrder) specifies the dimension order of % the input matrix. This value will be ign...
597a865253c6221572795b6e0c58185859c7f7bab90ada7b50fd2d594f115496
MATLAB
5,797
110
%% Step 3 Tiny Dancers: ERP analyses clear all clc trial_mus=[]; trial_con=[]; trial_hpi=[]; trial_lpi=[]; % load names of all files '3m','6m','12m', group={'adults'}; for g=1:length(group) cd(['D:\MUSICOM_EEG\PROC\Step2_epochdata_mast\' group{g}]); FileNames = {dir(['*' 'EPOCHS.mat']).name}...
8cb9b0978edb6f320c14a62788f7ecce5f28bdf35fa400c506d4ea55d28d6101
MATLAB
5,801
163
function Volume=polygon2voxel(FV,VolumeSize,mode,Yxz) % This function POLYGON2VOXEL will convert a Triangulated Mesh into a % Voxel Volume which will contain the discretized mesh. Discretization of a % polygon is done by splitting/refining the face, until the longest edge % is smaller than 0.5 voxels. Followed by ...
cb643dedb1b4d1703743ee1385881ef08e8269dbe8e512424956a0f092864cb5
MATLAB
5,803
198
function [vertices, faces, facevertexcdata, renderer, tags] = u3d_pre_patch(ax) %U3D_PRE_PATCH Preprocess surface output to u3d. % % usage % [vertices, faces, facevertexcdata] = U3D_PRE_PATCH % [vertices, faces, facevertexcdata] = U3D_PRE_PATCH(h) % % optional input % ax = axes object handle % % out...
2378ffc5cec803d4633d73e9d9808d82d362a02c88a378b3eb0a3f8776f80eb6
MATLAB
5,806
166
function [M, TF] = padcat(varargin) % PADCAT - concatenate vectors with different lengths by padding with NaN % % M = PADCAT(V1, V2, V3, ..., VN) concatenates the vectors V1 through VN % into one large matrix. All vectors should have the same orientation, % that is, they are all row or column vectors. The vectors...
c294ec935d2d8f216b17fae8b5cd2061d0deea87be1a0ba5b2634c016928208a
MATLAB
5,808
148
function CBIG_MSHBM_avg_profiles(seed_mesh,targ_mesh,out_dir,num_sub,num_sess) % CBIG_MSHBM_avg_profiles(seed_mesh,targ_mesh,out_dir,num_sub,num_sess) % This function will be used to average profiles across all the subjects % and all the sessions. Please note that the profiles of sub-sessions will % not be included. ...
d64819b59ecc01acc6c2cec3cabd55923da03fa81e148d593d37a1925fb1b1a2
MATLAB
5,808
181
function [ccg,x,y] = ShortTimeCCG(times1,times2,varargin) %ShortTimeCCG - Time-varying auto/cross-correlograms of point processes. % % Determine how xcorrelograms vary in time, i.e. repeatedly compute xcorrelogram % over successive short time windows. % % USAGE % % [ccg,bins,time] = ShortTimeCCG(times1,times2,<opt...
8133f74a107c6c1552f5fa0c832ed21fa1d89114f862fcd633b82a9d9ba25f8b
MATLAB
5,809
163
function d = getdict % Dictionary of NIFTI stuff % _________________________________________________________________________ % Copyright (C) 2005-2013 Wellcome Trust Centre for Neuroimaging % % $Id: getdict.m 5759 2013-11-21 14:01:14Z guillaume $ persistent dict; if ~isempty(dict) d = dict; return; end % Da...
bf84d42cb0423dca2cd051b504abb22a6964924171ae039e178cd6299f03787a
MATLAB
5,810
161
% eeglab2fieldtrip() - do this ... % % Usage: >> data = eeglab2fieldtrip( EEG, fieldbox, transform ); % % Inputs: % EEG - [struct] EEGLAB structure % fieldbox - ['preprocessing'|'freqanalysis'|'timelockanalysis'|'companalysis'] % transform - ['none'|'dipfit'] transform channel locations for DIPFIT % ...
2f8e85b05249c4a46dc2b53657df45f0d7c90457cf2ded8a1d93064a778a5236
MATLAB
5,812
131
%% ODOR TASKS % Calculate spectrogram - concatenated 6 subs ts = lfp_odorTasks_combinedSubs; sniffonset_conds = { sniffonsets_odorTasks_combinedSubs}; para = []; para.freq = logspace( log10( 1), log10( 200), 100); % center frequencies for filtering para.bandwidth = logspace( log10( 2), log10( 30), 100); % bandwidth of...
cc6fddf363d43fa95d634f01ccce7b7d47c2a43544a323213a3f6c5e4255d39d
MATLAB
5,813
152
function cvx_global %CVX_GLOBAL Create CVX's global internal data structure, if needed. % CVX_GLOBAL creates a hidden structure CVX needs to do its work. It is % harmless for the user to call it, but it is also useless to do so. global cvx___ if isfield( cvx___, 'problems' ), return end tstart = ...
c67c4919c647938a292d8ef5651941e6917838af5058cda9a05dcd0d04ba936c
MATLAB
5,819
114
function [datac,datafit,Amps,freqs]=rmlinesmovingwinc(data,movingwin,tau,params,p,plt,f0) % fits significant sine waves to data (continuous data) using overlapping windows. % % Usage: [datac,datafit]=rmlinesmovingwinc(data,movingwin,tau,params,p,plt) % % Inputs: % Note that units of Fs, fpass have to be consistent. ...
79b5730733b170dc8d3e13b4ee7ea70c03ed60ff89dd0b7934e1377dfea16ace
MATLAB
5,820
176
% % % Format: The prep_7 script extracts signature responses and saves them. % These fields contain data tables: % DAT.SIGNATURES.(signaturename).(data scaling).(similarity metric).by_condition % DAT.SIGNATURES.(signaturename).(data scaling).(similarity metric).contrasts % % signaturenames is any of those from load_ima...
47a19c7f26f5fd7914506165006046eacbce14352308e0d36fc574dd8ca6780f
MATLAB
5,821
156
% This version was derived from the original version by Pestilli and Caiafa. % Copyright (2015), Franco Pestilli (Indiana Univ.) - Cesar F. Caiafa (CONICET) % email: pestillifranco@gmail.com and ccaiafa@gmail.com % https://github.com/francopestilli/life available under % https://github.com/francopestilli/life/blob/mast...
babc132a07207a2660ceee07ec130cf68783d3c4e3ff3c73ebc58375ef50394b
MATLAB
5,821
163
function borderResults = cvBorderClassifier(allROIs, randomBorders, nFolds) % Batch-mode cross-validated SVM decoding % % Strategy: % 1) Build per-segment, per-fold train/test datasets up front (including class balancing). % 2) parfor over segments to fit/predict using the pre-extracted fold data. % % Inputs: % a...
c7ae7ee8a876d28a5b91cb2865f668e5cfc613e35e9d9daf4f1a2440558b4865
MATLAB
5,829
145
% pop_loadeeg() - load a Neuroscan .EEG file (via a pop-up window if no % arguments). Calls loadeeg(). % % Usage: % >> EEG = pop_loadeeg; % pop-up data entry window % >> EEG = pop_loadeeg( filename, filepath, range_chan, range_trials, ... % range_typeeeg, range_response, format); %...
2f8fb91d7562e51056b366d60b75dd4667c534a346ea3fd17a800f6fe8ead1dd
MATLAB
5,838
111
function varargout = ea_normalize_schoenecker(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 r...
8d8b152cf39ab1042561fe94fd25f731cf154b9d8af84e6777a5cdd61a30cc9b
MATLAB
5,838
223
function h = slice3i(resultfig, vol, I2X, slicedim, sliceidx, controlhandles) % Display a slice from a volume in 3-D % h = slice3(vol, I2X, slicedim, sliceidx, handle) % % Vol is either a scalar or RGB volume, e.g. N x M x K or N x M x K x 3. % I2X is a transformation matrix from volume coordinates to xyz 3-D world % c...
9edfd72233a35c45d819291a8ebf622d490d4d86d99fbc70628dadfdc5f6db0f
MATLAB
5,849
149
function [ map,centers,occupancy,pos_loc,spk_loc ] = rate_map( varargin ) % RATE_MAP - Calculated the occupancy normalized rate map % % Calculates the N-dimensional occupancy normalized rate map. rate_amp % uses the pass_index_parser inputs. % % [MAP,CENTERS,OCCUPANCY,POS_LOC,SPK_LOC] = RATE_MAP(POS_TS,POS,SPK_TS) % [...
fa2019e5fbe653b6c4448f4ed3957491def5c74dd801133b2ae06c9ce41e3227
MATLAB
5,853
185
% matcorr() - Find matching rows in two matrices and their corrs. % Uses the Hungarian (default), VAM, or maxcorr assignment methods. % (Follow with matperm() to permute and sign x -> y). % % Usage: >> [corr,indx,indy,corrs] = matcorr(x,y,rmmean,method,weighting); % % Inputs: % x = first i...
ddf5d506daa2b6692295c91216c306a4c3e1128fc8a4a9cf38d8bf001611575c
MATLAB
5,856
128
% configure file for calculation of tensors % DTI Configuration file % BATCH system (Volkmar Glauche) % % File created by Susanne Schnell function mapop = dti_cfg_mapop % --------------------------------------------------------------------- % filename1 name of probabilistic map 1 % ----------------------------------...
1ef40f786c4d4b37e311fa057ad89e134ae1f204c268d2216d20da68b190aa70
MATLAB
5,860
208
%% USER OPTIONS & VARIABLE DEFINITIONS % ------------------------------------------------------------------------- % METRIC OPTION mymetric = 'dotproduct'; % 'dotproduct' or 'cosine_sim' % CONTROLLING FOR GROUP COVARIATE group = []; if isfield(DAT, 'BETWEENPERSON') && isfield(DAT.BETWEENPERSON, 'group') group...
dc6c70c42b1519648345923c5b90f51d9d2874728cc33f95a56fb3334ac0adae
MATLAB
5,864
147
function handles = dan_add_markings(handles, timeVec) % % Dump all the extra crap onto the screen such as bad epoch markings, % notations, segments blah blah blah %% % Authors: Dan Denis % Date: 2021-07-14 %% Mark bad epochs epochIdx = str2double(get(handles.current_epoch_number, 'String')); if handles.psg.ar....
e606e5d97a69a99badb45c7e0d953c0277feca09e16c80794b8804e1edda20c9
MATLAB
5,865
171
function [SecondsAfterLightCycleStart_PerFile,SecondsAfterLightCycleStart] = TimeFromLightCycleStart(basepath,lightsonhours,lightsonminutes,lightsonseconds) % Zeitgeber times of recording files... based on file names and/or metadata % files. % Inputs: % - basepath - per buzcode standard, where all files for a given...
b2bbb3c00c99cc5a7040fb7e1a514ce0d52cb97425e3aeb9d3ce26581695c286
MATLAB
5,872
109
function Volume=polygon2voxel_double(FacesA,FacesB,FacesC,VerticesX,VerticesY,VerticesZ,VolumeSize,Wrap) Vertices=[VerticesX(:) VerticesY(:) VerticesZ(:)]-1; % List with all vertices coordinates of a face FaceVertices=[Vertices(FacesA,:) Vertices(FacesB,:) Vertices(FacesC,:)]; Volume=false(VolumeSize); Volume=Dr...
c81f645bce0b997f1950689ed72176eb82fb58946a3c051f929c1d9e44465f7c
MATLAB
5,874
149
function CBIG_ArealMSHBM_avg_profiles(seed_mesh,targ_mesh,out_dir,num_sub,num_sess) % CBIG_ArealMSHBM_avg_profiles(seed_mesh,targ_mesh,out_dir,num_sub,num_sess) % This function will be used to average profiles across all the subjects % and all the sessions. Please note that the profiles of sub-sessions will % not be ...
5b1a267bdec74ec6c7513dbed75c32a363bce8d3e930d73aaf6d13514ef0715d
MATLAB
5,876
158
function roi_table = dice_statistic_image_by_roi(imgA, imgB, roi_img, varargin) % dice_statistic_image_by_roi Per-ROI Dice overlap between two statistic images. % % roi_table = dice_statistic_image_by_roi(imgA, imgB, roi_img) % roi_table = dice_statistic_image_by_roi(imgA, imgB, roi_img, 'p_threshold', 0.01) % r...
a6bdedf713d712724d479f888759f754aba4bed7fa59dbb6f492e5c33f5fbcad
MATLAB
5,876
160
function timeBefAftEvent = timeBeforeAfterEvent(seqOfEvents,segmentMerge,segmentSplit,timeMerge,segmentContinuous,timeSplit,firstFrame ) % timeBeforeAfterEvent calculates the time before and after the event for % the pairwsing of segments. % timeBefAftEvent = timeBeforeAfterEvent(seqOfEvents,timeMerge,timeSplit ) % ...
3af56f85512f98a1325b8e663186102b2e219609d6c6661e1666c58fe891ead6
MATLAB
5,877
138
function bands = CoherenceBands(coherogram,frequencies,varargin) %CoherenceBands - Determine running coherence in physiological bands. % % USAGE % % bands = CoherenceBands(coherogram,frequencies,<options>) % % coherogram coherogram obtained using <a href="matlab:help MTCoherogram">MTCoherogram</a> % freq...
903b1f4e87fe5208688264347aa6865b04b5629b75919b31ac8cd20d5ad861e1
MATLAB
5,878
231
%test function Errs = createjointLUTs(ten); dirs = load('dwidirections.mat'); dirs = dirs.dirs128; W = createWeightingScheme(ten); W = diag(W); orderMM = 8; orderMS = 4; alpha = 0; %% model model n = 25; Dmin = -0.3; Dmax = 6; D1 = [Dmin Dmax]; D2 = [Dmin Dmax]; D3 = [Dmin Dmax]; l1 = (0:(n-1))/(n-1)*(D1(2)-D1(...
e96237b26c97d9709234db4bdc87864025b65c38e3aaf5f459be259f29d671a9
MATLAB
5,879
225
%% Create schematics of multiple FNPs clear; clc; loadparam; % Number of FNPs N_array = [10, 20, 50, 100]; max_N = max(N_array); % Create tiledlayout figure fig = figure; fig.Position = [100, 100, 1400, 160]; set(gca,'Color','white') % box on; num_subcols = 9; num_subcols_gap = 7; t = tiledlayout(1, length(N_array)...
859f1150a495ed63afc8ee7c7bc5e9d5d524c0023770cc3ca5fa8a926c798f9b
MATLAB
5,885
110
function SANDIinput = SANDI_batch_analysis(ProjectMainFolder, Delta, smalldelta, SNR) % Main script to perform the SANDI analysis (on one or more datasets) using machine learning, as described in Palombo M. et al. Neuroimage 2020: https://doi.org/10.1016/j.neuroimage.2020.116835 % The code assumes that data are organ...
a312a1cb196601d3e16af3e60e86ac31d3b2eacd267d34950976a0024af7be40
MATLAB
5,886
148
function est = LaBGAScore_combat_fit(dat, batch, varargin) % Fit ComBat harmonization parameters on a TRAINING set only % % :Usage: % :: % est = LaBGAScore_combat_fit(dat, batch) % est = LaBGAScore_combat_fit(dat, batch, 'parametric', 1, 'ref', refLabel) % % :Inputs: % **dat:** p x n data matrix (feature...
cae90503235973d68c877da13cb7d034e810d717a6c44c8157515caaa3b521ae
MATLAB
5,887
117
function [g, c, tmp, m]=kMeansCluster(m,k,isRand) % kMeansCluster - Simple k means clustering algorithm % Author: Kardi Teknomo, Ph.D. % ...
77b06f63bc0633a8ed48447c0891bbc24427861b02bc65c99806a91206b79e02
MATLAB
5,888
165
% surrogdistrib - Build surrogate distribution % % surrog = surrogdistrib(data, varargin); % % Inputs: % data - [cell] data arrays for which to compute a surrogate % distribution. % % Optional inputs: % 'method' - ['bootstrap'|'perm'] use either 'bootstrap' or 'permutation' % method. Bootstr...
d3acdd32b3b6641d9101028da42922f5ce623dcddbd863965259728425640941
MATLAB
5,889
159
function ArgStruct=parseArgs(args,ArgStruct,varargin) % Helper function for parsing varargin. % % % ArgStruct=parseArgs(varargin,ArgStruct[,FlagtypeParams[,Aliases]]) % % * ArgStruct is the structure full of named arguments with default values. % * Flagtype params is params that don't require a value. (the valu...
3049682b51cec4ca74a2c5af512c4776b61f385cd0487cc553ea58c35d32f29b
MATLAB
5,894
189
function PlotBehavior(animal) exp_dir=get_exp(animal); stim_dir=[exp_dir 'stimuli\']; load([stim_dir 'position.mat']) position=downsample(position,25); load([stim_dir 'running.mat']) running=downsample(running,25); load([stim_dir 'licking.mat']) licking=downsample(licking,25); load([stim_dir 'reward.mat'...
471055c12e89c650767b97288bedb8616652e45fc5990fc88c8fb0646e9b0242
MATLAB
5,894
134
function call_stampresp_v2(handles) mainfig_pos = get(handles.mainfigure, 'Position'); clear trace_stamp_pool trace_num_all ttlabel_pool for k = 1:length(handles.datafilename) handles = loadtrace(handles, k); if handles.plotRawdff == 0 && handles.plotBAPdff == 0 && handles.plotFiltdff == 0 handles.plotR...
e0020102ca02a205959af8089a8b949f9d25933edbfe497cbb3ef91abe5eda6a
MATLAB
5,895
147
function colors = distinguishable_colors(n_colors,bg,func) % DISTINGUISHABLE_COLORS: pick colors that are maximally perceptually distinct % % When plotting a set of lines, you may want to distinguish them by color. % By default, Matlab chooses a small set of colors and cycles among them, % and so if you have more ...
2334babbcc939d81053d6ace0a77352ad467bd5389418ea379af52d680eab3c3
MATLAB
5,901
174
function list = find(varargin) % XMLTREE/FIND Find elements in a tree with specified characteristics % FORMAT list = find(varargin) % % tree - XMLTree object % xpath - string path with specific grammar (XPath) % uid - lists of root uid's % parameter/value - pair of pattern % list - list of uid's of matched elements...
47760ade3635b20b785a85e3838d30913dab46feaee0d2a1f949c347f0151a85
MATLAB
5,902
101
function tractset = ea_discfibers_compat_statmetrics2statsettings(tractset) if isnan(tractset.statmetric) return end switch tractset.statmetric case {'Two-Sample T-Tests / VTAs (Baldermann 2019) / PAM (OSS-DBS)'} tractset.statsettings.stimulationmodel = 'VTA'; tractset.statsettings.efieldmetri...
514a1dc8cbe3ab8daf3c4f70c9e6d3b2b677a17f07767145e1d630e45c5abc45
MATLAB
5,902
249
function z = max( x, y, dim ) % Disciplined convex/geometric programming information: % MAX is convex, log-log-convex, and nondecreasing in its first % two arguments. Thus when used in disciplined convex programs, % both arguments must be convex (or affine). In disciplined % geometric prog...
2f7ba1f903f5164a35ecbcc1e37a5e15961c79075dd4c5a46f03853f2b5d0213
MATLAB
5,903
114
function AssemblyTemplates = assembly_patterns(SpikeCount,opts) % Patterns = assembly_patterns(Activitymatrix,opts): extracts assembly patterns from the spike matrix. % % Description of inputs: % Activitymatrix: spike matrix. Rows represent neurons, columns represent time bins. Thus, each element of the matr...
748546b3de01d3ec31deab688ade76affd3264a4b3d8170e5f74d06359120d60
MATLAB
5,904
123
function [lh_time_mat, rh_time_mat] = CBIG_hMRF_build_time_matrix(lh_fmri_fullpath_txt, rh_fmri_fullpath_txt, ... mesh_type, lh_output_file, rh_output_file, censor_file_fullpath) % CBIG_hMRF_build_time_matrix(lh_fmri_fullpath_txt, rh_fmri_fullpath_txt, mesh_type, lh_output_file, rh_output_file) % % This function ge...
4e6196f952eb2a0ab01529f297981906de09c006ebd5417ac99b8a77f749a1da
MATLAB
5,905
173
function imData=bigread2(path_to_file,sframe,num2read) %reads tiff files in Matlab bigger than 4GB, allows reading from sframe to sframe+num2read-1 frames of the tiff - in other words, you can read page 200-300 without rading in from page 1. %based on a partial solution posted on Matlab Central (http://www.mathworks.co...
57346611b2c88b4cdaf1dbb331cb81adead4fe64da7ed2dfae218b7323465d48
MATLAB
5,908
157
function [spectrum,f,s] = MTSpectrum(lfp,varargin) %MTSpectrum - Compute LFP spectrum by multi-taper estimation. % % The spectrum is computed as the average spectrogram, using the <a href="http://www.chronux.org">chronux</a> toolbox. % % USAGE % % [spectrum,f,s] = MTSpectrum(lfp,<options>) % % lfp w...
f65540299b1f622893e449a8fad433c8ea22c3e746fb99545834e9ba5640128e
MATLAB
5,910
111
function [stat_img, fmri_dat, region_obj, region_table] = thresholded_fmri_data_from_pval_nii (fullpath_to_pval_nii, stat_vec, mask_obj, atlas_obj, p, p_type, stat_type, thr_type, k) % thresholded_fmri_data_from_pval_nii Thresholded map and region table for a % non-standard statistic, from a p-value NIfTI on disk. % %...
abca335fff2ae5b8e7eca9c02824b31dd8fdb552390456025faed9688e52abf0
MATLAB
5,917
151
function append_pdfs(varargin) %APPEND_PDFS Appends/concatenates multiple PDF files % % Example: % append_pdfs(outputFilename, inputFilename1, inputFilename2, ...) % append_pdfs(outputFilename, inputFilenames_list{:}) % append_pdfs(outputFilename, inputFilenames_cell_or_string_array) % append_pdfs output...
17936332e63734c5cc1c7229e28567aae1f17cbe1265b912e62ce950ba3c28d6
MATLAB
5,918
248
function z = min( x, y, dim ) % Disciplined convex/geometric programming information: % MAX is convex, log-log-concave, and nondecreasing in its first % two arguments. Thus when used in disciplined convex programs, % both arguments must be concave (or affine). In disciplined % geometric pro...
cd44fa1600f61389a57319905fdd422b5183387963bedf5fc74e739cd026f928
MATLAB
5,919
206
% Iterations over various initial NB-other cell size differences without % delamination. Plotting success probability for each size difference % shown in Figure 6. % To speed up comment line 71 in % SOP_multicell_LI_adapted_weighted_with_trigger_PerimSave.mat before % running this script to avoid saving simulations...
6c079c40367a1acb84470bd4273d89a251a4f3c80d904aec9333ef4f963f9382
MATLAB
5,920
145
function move_betas_to_secondlvl(firstlvl_dir, datadir, operation, varargin) % MOVE_BETAS_TO_SECONDLVL Move beta images to a second-level analysis directory. % % This function moves or creates symbolic links to beta images from a first-level % analysis directory to a second-level analysis directory. It is designed to b...
eb351e94afc741350c97f6c1ddc7e3ab193ad0273e007dedde790a78041bb635
MATLAB
5,920
194
function [vertices, faces, facevertexcdata, renderer] = u3d_pre_surface(ax) %U3D_PRE_SURFACE Preprocess surface output to u3d. % U3D_PRE generates the input for the MESH_TO_LATEX function from % Alexandre Gramfort from your surface-graphs. The surface graphs 3d-model can be % displayed in u3d - format i...
22b6c294f150a8ebceea9df6f9be2379a0727aa263d74695f7de363cb8018f67
MATLAB
5,921
189
function this = freesurfer_read(filename) % Low level reader of FreeSurfer file % FORMAT this = freesurfer_read(filename) % filename - FreeSurfer file % % Read ASCII triangle surface file and part of binary mgh file. % See https://surfer.nmr.mgh.harvard.edu/fswiki/FileFormats %_______________________________________...
5c8c2f37d8f2ab29a04e9be876f1d26da901473a5eecc191b16d009873ee636e
MATLAB
5,921
130
function [inds_of_sites_with_at_least_k_repeats min_num_repeats_all_sites num_repeats_matrix label_names_used] = find_sites_with_k_label_repetitions(the_labels, k, label_names_to_use) % This function takes in labels in binned label format, and an integer k, and returns the indices for all sites (e.g. neurons) % tha...
41f0dd6e9b103d69accfcf4b0d4fce288d5b7542b29accfb6c613ff1db8e806d
MATLAB
5,922
204
function [trajectory,trajvector,estpoint]=ea_fit_line(centerline) % This function fits a line to raw 3D data specified by centerline. It also % exports a normalized vector between the fitted datapoints and the next % expected point of the trajectory. The function uses robustmean by % Developer "Jonas" % (http://www.mat...
cf4c357525be0af8ac41d1d90b5fc3e29257313a5799b05919b5ca1c8b8b4966
MATLAB
5,924
143
function [SleepStateEpisodes] = StatesToEpisodes(SleepState,basePath) % Takes a buzcode structure of sleep state data and imposes max and % min durations and interruption criteria to make WAKE, NREM, REM Episodes, % Packets, Microarousals and Microarusals in REM, as defined in % Watson et al 2017. Returns the SleepSta...
f60b08010bfb1ebcbd49c1f22c211b6d0cb067bed002e0db18509b80e9272a3a
MATLAB
5,926
146
% Name: Robert Kim % Date: 09-01-2024 % Email: robert.f.kim@gmail.com % fnc_time_bootstrap_cluster.m % Description: Pointwise bootstrap CIs (like fnc_time_bootstrap.m) PLUS a % cluster-based permutation test to control for multiple comparisons across % time. Returns per-cluster p-values and a logical mask of timepoints...
f40fd5172a70a602c592482905ff64aa0c756a8e81e1d7f00f97c0fa8625d2cb
MATLAB
5,931
162
%% Set the working directory clear cd('C:\Users\perre\Cardin-Higley Lab Dropbox\Quentin Perrenoud\Partage-QP\Dryad'); %<--------- change to local path addpath(genpath(pwd)) chFigDir = 'Figures'; %<--------- relative path to output figure directory %% Load data db2Mat = xlsread('Input_Matrix.xlsx', 'C2:AJ25'); % ...
e71bcbd1c582fb9f9d4387901db1b0a9afa0982988a449b68864fa3292b1b590
MATLAB
5,932
114
function [datac,datafit,Amps,freqs]=rmlinesmovingwinc(data,movingwin,tau,params,p,plt,f0) % fits significant sine waves to data (continuous data) using overlapping windows. % % Usage: [datac,datafit]=rmlinesmovingwinc(data,movingwin,tau,params,p,plt) % % Inputs: % Note that units of Fs, fpass have to be consis...
49f7a0f99066bba648b31b5b0a4b333ef0d2a276b059885ee2f930d5967f45f9
MATLAB
5,933
133
% std_changroup() - Create channel groups for plotting. % % Usage: % >> STUDY = std_changroup(STUDY, ALLEEG); % >> STUDY = std_changroup(STUDY, ALLEEG, chanlocs, 'interp'); % Inputs: % ALLEEG - Top-level EEGLAB vector of loaded EEG structures for the dataset(s) % ...
f1e58eaa48e301027bb3e33534400ee2cd9c8aace5422f99dfe84331316d205f
MATLAB
5,936
131
function CBIG_visualize_factorComp_mixedAmyloid(subInfoFile, GMICVFile, K, GRP) % CBIG_visualize_factorComp_mixedAmyloid(subInfoFile, GMICVFile, K, GRP) % Colors % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md C_AP = 'r'; C_AN = 'g'; C_UK = 'b'; C_EDGE = 'k'; %-----...
eaee5502caa6f84d38a00abbcbc8c4ed77aba5a557da273d85b7cf5c950abb9c
MATLAB
5,937
115
function [specEv_struct, TFRs, X] = spectralevents(eventBand, fVec, Fs, findMethod, vis, varargin) % SPECTRALEVENTS Find and analyze transient spectral events in a % time-series dataset. Spectral events are defined as local maxima above a % power threshold of a specified band in the non-averaged time-frequency % ...
1e7072be5094f062b3a3bf15c0ef185873da1355e40bed7b5a246001c1b37341
MATLAB
5,940
211
function [vert, face] = read_ply(fn) % READ_PLY reads triangles, tetraheders or hexaheders from a Stanford *.ply file % % Use as % [vert, face, prop, face_prop] = read_ply(filename) % % Documentation is provided on % http://paulbourke.net/dataformats/ply/ % http://en.wikipedia.org/wiki/PLY_(file_format) % % See ...
d729509a5118e5105f2021bd12d414042eb6a2937d81f17ebb93cec57a90f95a
MATLAB
5,943
136
function plotfluordirections(avgfluor,redtemps,ROIs,Xpix,Ypix,framerate) %plot the data averaged for each ROI %show the ROI? fn=fieldnames(avgfluor); [numROIs,triallength]=size(avgfluor.(fn{1})); fig=figure('Position',[1 1 509 458]); hold on; subone=subplot(211); subtwo=subplot(212); fig2=figure('Position',[...
56ca4dddb718dc5cf019462bedfcde843c21ad37c414c1bdf1b68d21c0d092ad
MATLAB
5,948
193
function pars = checkpars(pars,lponly) %#ok % pars = checkpars(pars,lponly) % % CHECKPARS Fills in defaults for missing fields in "pars" structure. % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMa...
4bfe7b9a3fa4f3d8ca2363ee8e404b2944fd71981d004fc036eb8ca94f1a05c1
MATLAB
5,950
165
function bz_meta_extracted = bz_database_extract_meta(bz_datasets,j) % Submit dataset to the Buzsakilab metadata-database % v1.1 % % INPUT % bz_datasets % structure with subfields named after the mySQL columns. The subfields has % to have the right format for submitting to the database. % % % By Peter Petersen % peters...
f56e62b5f68d2b9cd33976159ce534e297fd2a533e00b8392347e8b3f9599349
MATLAB
5,956
154
function fix_lines(fname, fname2) %FIX_LINES Improves the line style of eps files generated by print % % Examples: % fix_lines fname % fix_lines fname fname2 % % This function improves the style of lines in eps files generated by % MATLAB's print function, making them more similar to those seen on % scree...
9e25c1089e82f5de800430011662b4fb0b9c618d0629ffcdb2c4cce36b4247fd
MATLAB
5,958
145
function NPS_region_vals = plugin_extract_local_nps_region_vals(second_level_DAT_object, my_region) %% Helper function to extract local NPS region values from DAT object % % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published...
e20ecd56fa5b3399fa0ead15be71f57d009239d952b1c4d2886178e0d6a3a498
MATLAB
5,968
208
function [fig] = colormap_roi(mat, sorting, label, varargin) % DESCRIPTION: % Make figure of matrix, with option to sort by community label. % * Note that if the matrix is already sorted (organized by labeled % community, the sorting option should be set to 2 so it won't re-sort % the same matrix. % * ...
de5e388d2f09653ef1d210d4f00412b48bf04f77d460cc7e8ce33c3cf467728f
MATLAB
5,970
150
%WAVELET 1D Wavelet transform with optional singificance testing % % [WAVE,PERIOD,SCALE,COI] = wavelet(Y,DT,PAD,DJ,S0,J1,MOTHER,PARAM) % % Computes the wavelet transform of the vector Y (length N), % with sampling rate DT. % % By default, the Morlet wavelet (k0=6) is used. % The wavelet basis is norm...
98227185074f5a21c146671da4df0f9dc5309fc50e6e7085cc401276628650be
MATLAB
5,980
119
% Name: Robert Kim % Date: 05-11-2023 % Email: robert.f.kim@gmail.com % generate_trials.m % Description: Generate synaptic-current trial data for a given trained % two-layer one-modality (instr) RNN, optionally with a chosen lesion % applied to the recurrent weight matrix. Saves a .mat file % under <model_dir>/trials/ ...
d80d1ca59657a4d63ddd68c8ab27e407ed35ef9c947b55052271394bbb86a14e
MATLAB
5,982
175
function bz_PreprocessSession(varargin) % bz_PreprocessSession(varargin) % Master function to run the basic pre-processing pipeline for an % individual sessions. Is based on sessionsPipeline.m but in this case % works on an individual session basis no in a folfer with multiple ones. % % INPUTS % <o...
2227bcd46a456b2787c39863dc57439cd832f1ffcd39934cd00dbeef5697966b
MATLAB
5,987
178
clc clear addpath 'C:\Users\Admin\AppData\Roaming\MathWorks\MATLAB Add-Ons\Functions\Shapiro-Wilk and Shapiro-Francia normality tests' % Select an .xlsx file [fileName, filePath] = uigetfile('*.xlsx', 'Select an .xlsx file'); if fileName == 0 error('No file selected'); end fullFilePath = fullfile(filePath, fileNam...
47334d188ebe2099c2864a00e6e5715cfb45ccbd8a72fa125209a218397b3eb7
MATLAB
5,991
167
function [beta, intercept, alphaSel, lambdaSel, tuneInfo] = ... selectENetHyperparams(XtrRaw, ytr, Ctr, cvIn, alphaGrid, lambdaGrid, rule, scaleMode) % selectENetHyperparams Fold-averaged Elastic Net hyperparameter selection. % % [beta, intercept, alphaSel, lambdaSel, tuneInfo] = selectENetHyperparams( ... % ...
d2db9e037ded6ea48f7dbcf7cce0e279cd1cfffdc34f579ab8f58800e46241f3
MATLAB
5,991
152
function output = resynthesise(x,fs,cfs,m,varargin) %RESYNTHESISE Resynthesise a target from a time-frequency mask % % OUTPUT = IOSR.BSS.RESYNTHESISE(X,FS,CFS,M) takes an input vector X, % sampled at FS Hz, and applies the time-frequency mask M. The mask M is % a matrix, with one column for each frequency channe...
9b86976a08345fb1ce96947585d94215ac0b5d01737490605867d02adef5e742
MATLAB
5,993
154
function updateContents(folder) %UPDATECONTENTS Create a Contents.m file including subdirectories % % IOSR.GENERAL.UPDATECONTENTS scans through the current directory, and % its subdirectories, and builds a Contents file similar to Matlab's % report-generated Contents.m files. Any existing Contents.m file will be...
d39bbd2013a1e4aedbdb29f57b301295652eb23435cd71bf801cb35528eb13fe
MATLAB
5,994
142
function T = mvpa_reg_cov_benchmark_algorithms(mvpa_dat, fold_labels, varargin) % mvpa_reg_cov_benchmark_algorithms Compare @predictive_model algorithms on one dataset. % % Re-runs the algorithm comparison under @predictive_model. The earlier % comparison (cv_pcr 0.73, cv_pls 0.73, cv_svr 0.68) was measured with the %...
2ed4bff3df41ca84d6479f91c6de3c29d47e29fd3a84197ecc155550b885fab4
MATLAB
5,996
166
function [R, t, iter_err, reg_pointqueary] = ... ICP_point_reg(reg_points, reg_pointqueary, ops) % This is an implementation of the Iterative Closest Point (ICP) algorithm. % Arguments: pointcloud - 3 x n matrix of the x, y and z coordinates of data set 1 % pointqueary - 3 x m matrix of the x, y and z co...
8fd2c5d9fa37f4338cc6c62f1fc8857160537b50696bdb4b60109b3099d6e2af
MATLAB
5,997
164
% written by Yiyuan Han, Essex BCI-NE Lab, 13/12/2019 % binary classification between two specific conditions function [perfMat,numberType] = binaryClassTestMix(class1,class2,blockTagsAC,features,folderpath,nameTag,featureNum) %% Extract the data in specific conditions % These two classes should be modified according t...
287c1cc1ad00f0777eb75ee27499d952e5f3fb656ca4e3abfbc39feaed493090
MATLAB
5,998
97
function explorer = ea_unifiedmapping_compat_statmetrics2statsettings(explorer) if isnan(explorer.statmetric) return end switch explorer.statmetric case {'Two-Sample T-Tests / VTAs (Baldermann 2019) / PAM (OSS-DBS)'} explorer.statsettings.stimulationmodel = 'VTA'; explorer.statsettings.efieldm...
0094be4de8d5057012631f314bee8c4100f63f482ca545db49fa74a8147b24e9
MATLAB
6,000
139
function this = subsasgn(this, subs, A) % Subscript assignment for GIfTI objects %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: subsasgn.m 6513 2015-08-05 17:52:13Z guillaume $ switch subs(1).type c...
e45f7ea24586bab51261760d24241b3d1b84b4f6d0f4f465aac57cc6f44e1040
MATLAB
6,002
155
function display_result_progress(cv, results_to_display, display_progress) % Displays the current mean and stdev when a single resample result is left out for different result types % to give an idea whether the algorithm has converged to a stable decoding accuracy % (these values could be used for stopping crite...
576b029f12bc0b6716079b6f8b6ea3daf9beaddf7a675b4261dd8f884b2c6d12
MATLAB
6,006
155
function [lat,coeff,rs,converge,yf] = latencyfit4AM(y,t,peak,fig) %Fits a double Gaussian + cumulative Gaussian to neural data. latency is %taken as the point at which the fit reaches 33% of its maximum. %Input args: %y = row vector of neural data, can be raw MUA or difference %t = row vector of time in ms (same leng...
22f2da99dd7239755f63efd9bbb407f43fa549f2c23fd4a7afd14b4b8be0bd53
MATLAB
6,007
115
function [C,phi,S12,S1,S2,f,zerosp,confC,phistd,Cerr]=coherencypt(data1,data2,params,fscorr,t) % Multi-taper coherency - point process times % % Usage: % % [C,phi,S12,S1,S2,f,zerosp,confC,phistd,Cerr]=coherencypt(data1,data2,params,fscorr,t) % Input: % data1 (structure array of spike times with dimension trials...
03f773583d803f752d5f172ff234cea8e5c13980189300d494bdd58dd30df163
MATLAB
6,010
184
% Combined wire sizing and spacing % Section 5.5, L. Vandenberghe, S. Boyd, and A. El Gamal % "Optimizing dominant time constant in RC circuits" % Original by Lieven Vandenberghe % Adapted for CVX by Joelle Skaf - 11/27/05 % Modified by Michael Grant - 3/8/06 % % The problem is to determine the optimal sizes of interc...
04d0f44b20a4ecba3e4cd8b59cdb678f1e5e8bf99c5cac15a655c535442ee1f2
MATLAB
6,011
198
%%***************************************************************** %% Examples of SQLP. %% %% this is an illustration on how to use our SQLP solvers %% coded in sqlp.m %% %% feas = 1 if want feasible initial iterate %% = 0 otherwise %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tu...
114be03fde393b687ac6a4d3639be2391a786174b77be213ed75577acdedb0a0
MATLAB
6,021
131
function [inds_of_sites_with_at_least_k_repeats min_num_repeats_all_sites num_repeats_matrix label_names_used] = find_sites_with_k_label_repetitions(the_labels, k, label_names_to_use) % This function takes in labels in binned label format, and an integer k, and returns the indices for all sites (e.g. neurons) % tha...
7446ffc0ce389c55c5113bfa670d51324c819a865f3b3a6d933a3be6fb8b5cb7
MATLAB
6,022
167
function cs_fmri_conseed_matrix_matrix(dfold,cname,sfile,outputfolder) % ROI based fMRI connectivity matrix based on matrix type of connectome tic if ~exist('dfold','var') dfold=''; % assume all data needed is stored here. else if ~strcmp(dfold(end),filesep) dfold=[dfold,filesep]; end end disp(['...
fc8c3f7b2f959274e06d3fc5589be8f7718b75a379d84bc9df19983f7e901ea1
MATLAB
6,022
132
classdef mp4_video < VideoWriter % Create mp4 video from figure window, like VideoWriter. % % Example for a moving circle: % h = rectangle('Position', [0 0 1 1], 'Curvature', 1, 'FaceColor', 'k'); % axis equal; axis off; xlim([0 10]); ylim([0 10]); % set axis range % vw = mp4_video('movingCircle.mp4', 4); ...
052d6a557ea398da83b910019a8a3093913550ded87ba9afb7c70d374ef349bc
MATLAB
6,023
211
% Detect red and blue LEDs position in a video file and creates a 'led' file % % USAGE % % Process_DetectLED(videoFile,<options>) % % videoFile path to Basler video file, including the '.avi' % extension or not % <options> optional list of property-value pairs (see table be...
b43d189824541346eff649516bf73b3243af89b29ce864ab3827b0e1b971922a
MATLAB
6,027
125
function ea_save_fibscore_model(obj, ExternalModelFile) % this function is called from the GUI % we want to define the model outside of cross-validation if ~exist('patsel','var') % patsel can be supplied directly (in this case, obj.patientselection is ignored), e.g. for cross-validations. patients...
b65fde08d05216216b5a6fedc0ee76aeba7215166080e0f74d57f29efa0c4bbe
MATLAB
6,034
140
function [GridDim,dowarn] = LeG_determine_griddim(elec) % DETERMINE_GRIDDIM uses the labels and positions of electrodes in elec to % determine the dimensions of each set of electrodes (i.e., electrodes with % the same string, but different numbers) % % use as: % GridDim = determine_griddim(elec) % where elec is a...
1a17a8d076e3ed01193aec1791d208c3c5ad2922cd684af40410a69ceedee7cc
MATLAB
6,037
132
function hemi_full_label = CBIG_hMRF_merge_singular_parcels_on_one_hemi(hemi_full_corr,... target_parcel_list, hemi_full_label, hemi_avg_mesh, hemi_mask) % hemi_full_label = CBIG_hMRF_merge_singular_parcels_on_one_hemi(hemi_full_corr,... % target_parcel_list, hemi_full_label, hemi_avg_mesh, hemi_mask) % % This func...
523ba6b428c87802020bde835157166c1b1ecb974aa2eafd7e9a98cf8004f940
MATLAB
6,040
238
function AUC = bootstrapOOB_ENet(X, Y, C, opts) % bootstrapOOB_ENet Out-of-bag bootstrap AUC for one resample. % % AUC = bootstrapOOB_ENet(X, Y, C, opts) % % Draws one bootstrap sample of subjects WITH replacement, trains on it, and % evaluates on the out-of-bag subjects. Repeated by the caller nBoot times to % ...
7d26bee7fc5a5e7e9a7d64d5a71156799c2736950f9f4c95f0d58a0a714a45d9
MATLAB
6,042
163
function ea_dbsegment(input) % Wrapper to run DBSegment pipeline % Note: the additional options described on % https://github.com/luxneuroimage/DBSegment are disabled and only the % default ones used input = GetFullPath(input); if isfolder(input) % Input is subj folder in LeadDBS BIDS dataset bids = BIDSFetcher(r...
2b66a85124268c2d64797b323fa8baa06715ce988d9befad5336fc3cc53a7cc6
MATLAB
6,062
157
%************************************************************************** % % This is a simple extension of the bar plot to include error bars. It % is called in exactly the same way as bar but with an extra input % parameter "errors" passed first. % % Parameters: % errors - the errors to be plotted (extra...
17ae4d2a5e66ca4de2a6ef50bdd311f18280f4eb199c36205ccd87c2d9578520
MATLAB
6,065
149
% 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...