sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
096b2d8340e67b47505c6f6e838007888082fca4221d22108dcf0eb1368459f5
MATLAB
3,342
83
function L = symbchol() % L = symbchol(X) % % SYMBCHOL Symbolic block sparse Cholesky factorization. % L = symbchol(X) returns a structure L that can be used % by the efficient block sparse Cholesky solver SPARCHOL. % The fields in L have the followin...
1006051aff764268cf2ef56a2a6e253f59bbb3b6a17fa3db0b268a25c0e621f7
MATLAB
3,342
84
function ea_get_Eproj(tractset,vatlist) % Comptute E-field metrics directly on fibers (optionally in native space). % The results are stored as % patient_folder/connectomes/connnectomeName/stim_ID/E_metrics.mat (values for all fibers in the connectome!) % By Butenko and Roediger, konstantinmgtu@gmail.com arguments ...
479fbd3a5beac8b9387adc76bb4039861fff38f0e12c118a423754076900f1d0
MATLAB
3,342
48
function [prams,results]=CBIG_gwMRF_graph_cut_clustering(varargin) % This function performs MRF clustering using Graphcuts; modelling the data as VMF distributions. % Results will be stored in the results struct. The used parameters will be saved in the prams struct. % Input % % Possible parameter...
167f380e9f35534a41d576b95c5dc6729f826cce369ee2e4ad50713e898c3f4a
MATLAB
3,343
67
function [S,f,Serr]=mtspectrumc(data,params) % Multi-taper spectrum - continuous process % % Usage: % % [S,f,Serr]=mtspectrumc(data,params) % Input: % Note units have to be consistent. See chronux.m for more information. % data (in form samples x channels/trials) -- required % params: structure with fields...
b10c2567e1af471a89702d966be8249804bd21c6f97ef059f89c9453fb75c0e4
MATLAB
3,344
102
function T=BoundaryCollapse3D(V,F,T,Options) % This function performs 2D triangulation or 3D tessellation. Advantage % above delaunay is that only returns the faces inside the object % % T=boundary_collapse_3d(V,F,T,options); % V : Mx3 the vertices, with x,y,z coordinates % F : Nx3 faces with ve...
5884df7c8f3f695db7f8b145d02936b3f156d85a509144c6f3a924e0d100bd33
MATLAB
3,346
151
function [cid, alpha, mu] = circ_clust(alpha, numclust, disp) % % [cid, alpha, mu] = circClust(alpha, numclust, disp) % Performs a simple agglomerative clustering of angular data. % % Input: % alpha sample of angles % numclust number of clusters desired, default: 2 % disp show plot at each ste...
a501edc382bfc5e421de8b9667c0e2f5d8534b64fcb28effc11e0039f119384f
MATLAB
3,347
88
% pop_writeeeg - write EEGLAB dataset to disk in EDF/GDF or BDF format % % pop_writeeeg( EEG ) % pops up a window % pop_writeeeg( EEG, filename, 'key', 'val' ) % % Inputs: % EEG - EEGLAB dataset % filename - [string] filename % % Optional keys (same as writeeeg): % 'TYPE' - ['GDF'|'EDF'|'BDF'|'CFWB'...
3239fc1b98b66eaa8e23cd73a1f615dad29426877c532625768c8311b9fb2f56
MATLAB
3,348
84
function ea_get_Eproj(tractset,vatlist) % Comptute E-field metrics directly on fibers (optionally in native space). % The results are stored as % patient_folder/connectomes/connnectomeName/stim_ID/E_metrics.mat (values for all fibers in the connectome!) % By Butenko and Roediger, konstantinmgtu@gmail.com arguments ...
a0a8b6e502c223cd6a8ae50edff67a8045a7c8b333a2813c0654f14c976c5c1d
MATLAB
3,349
97
function[S,tau,tc] = staogram(data_spk,data_lfp,smp,plt,Tc,Tinc,Tw,w,D) % % staogram : calculates a moving window spike triggered ave % % Usage:[S,tau,tc] = staogram(data_spk,data_lfp,smp,plt,Tc,Tinc,Tw,w,D) % % ******** INPUT ********* % Note that all times have to be consi...
e2f612f25eaa72a47c005d57c88c8bf7cd647c7f42b9793f08fef95a47dc060e
MATLAB
3,349
94
function myPLS_plot_loadings_3D(var,var_name,signif_LC,pos_threshold,neg_threshold,save_opts) % % This function displays 3-dimensional loadings (e.g. volume) of all % significant latent components (LCs). The loadings are constrained % to a binary mask (e.g., DARTEL group template) and thresholded. % Writes loadings o...
22d83f68be0dd9417114c7453b8b76b78bdd7de31267995f68dee05b674532ee
MATLAB
3,352
91
function cell_array = CBIG_MMLDA_get_string_entry(spreadsheet, phase, rid, viscode, fieldnames, phase_match, viscode_match) % cell_array = CBIG_MMLDA_get_string_entry(spreadsheet, phase, rid, viscode, fieldnames, phase_match) % % This function get string entries from ADNI spreadsheet. % % Input: % - spreadsheet :...
34f1c9d72e5555c4a1aa5c885c200a26150d462a658fee926b3913f384d13a04
MATLAB
3,355
115
function PlotCCG(t,ccg,varargin) %PlotCCG - Plot auto/cross-correlograms of point processes. % % USAGE % % PlotCCG(t,ccg) % % t time bins obtained using <a href="matlab:help CCG">CCG</a> % ccg data obtained using <a href="matlab:help CCG">CCG</a> % <options> optional...
65091de79891aaa4269d277afe1b9b32e3affe504ea80ba0ecac1cef78e6090d
MATLAB
3,355
74
% 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...
177a9873d349513f4fed461392fb3fbec52552f7a014c7d6da25267fa3191d6b
MATLAB
3,356
103
% pop_firma() - Filter data using moving average FIR filter % % Usage: % >> [EEG, com] = pop_firma(EEG); % pop-up window mode % >> [EEG, com] = pop_firma(EEG, 'forder', order); % % Inputs: % EEG - EEGLAB EEG structure % 'forder' - scalar filter order. Mandatory even % % Outputs: % EEG - filtered ...
d48e40d8c8f589afb1e919d1fa12f99f4c8cfb9c73508cd2e4f3293febef2574
MATLAB
3,356
106
% This main file imports data (WT or IFNAGRKO datasets), % processes it (to approximate Gaussians from main body of log-normal distribution), % estimates params, simulates the system (ODE and fluctuations) with fitted params, % and plots the results for inspection %% Add all folders to path addpath(genpath(pwd)...
e4ab07e3ff725cbeecf9fe2303ce83d8e86889c775ec4bb3fe521c0b6ca0c336
MATLAB
3,356
82
function [rid_conv, rid_nonconv] = CBIG_find_conv_nonconv(rid_of_interest, years) % [rid_conv, rid_nonconv] = CBIG_find_conv_nonconv(rid_of_interest, years) % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md file_id = fopen('//share/users/imganalysis/yeolab/data/ADNI_me...
f1e30c931d6734689986f28f96d43a93ec49741f8ceaf631345031dfac5a0601
MATLAB
3,356
130
function [f,meanimt,meanim,meanref]=OIS_corr(fname,reference,section,meanim) % Usage ... f=OIS_corr(OISfname,reference,section) % % reference - reference waveform for correlation % section- sections of the timecourse to regress only in images! % sections can be the image #s to use, in that case reference should %...
4c28d6b23bcdf3d95f50586e1c57c5b5b5fd1642c66da4c85d5e0ded7585faad
MATLAB
3,357
93
function removeNSxData(timestamps, filename) % % removeNSxData(timestamps, filename) % % This function removes chunks of data given in a 2-column timestamps % variable from a NSx file and then saves it as another NSx. This is % useful when removing useless data from the file to decrease the size of % the NSx ...
10d98126206405beca2159a2b690ef654f0710b2274c9ee1757f4b19ecb5a7e6
MATLAB
3,358
105
function [Lx,Ly,corr_Lx_X,corr_Ly_Y,corr_Lx_Y,corr_Ly_X] = ... myPLS_get_PLS_scores_loadings(X,Y,V,U,grouping,pls_opts) % This function computes PLS scores & loadings. % Individual-specific PLS scores are subjects' expression of imaging and % behavior/design saliences (covariance patterns). % Component-specific P...
116730002361a0dacff136e6e0de65921debadd387bc7a21a654d494fb60cbc6
MATLAB
3,358
99
%%******************************************************************* %% HKMrhsfun: compute the right-hand side vector of the %% Schur complement equation for the HKM direction. %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%***********...
77005e15fca12dc51424af7cbfcdda511d56d7159ee1e3f29272e54a04e6f34f
MATLAB
3,358
77
function ea_predict_leave_one_out(uipatdirs,stimname,typemap,regressor,fdmri,dowhat) if size(regressor,1)<size(regressor,2) regressor=regressor'; end if ~exist('fdmri','var') fdmri.do='both'; % can be fmri, dmri or both end for pat=1:length(uipatdirs) [~, subPrefix] = fileparts([uipatdir{pt}, '_']); f...
2dadadcbb5fc256fcaa8c893eb11ee547a82dc9081f0d6f657949be36cafd649
MATLAB
3,361
106
function [ fields ] = bz_getPlaceFields1D(varargin) % USAGE % % % INPUTS % % ratemap MxNxD matrix where M is the number of cells, N is the number % of trials, and D is the number of spatial bins % minPeakRate minimum rate for peak of field [default: 1] % minFieldWidth ...
68b5eebae359c8d24535c915419f9bcf95e949a6a92e6c311dc6d1e1dba4aa89
MATLAB
3,361
91
function [allTimestamps allSnippets allIndices] = findEventTimes(NEV, Channel, Units) % Given a NEV file, an channel number, and a unit number this function % will return indices corresponding to those spikes, timestamps % corresponding to those spikes (optional), and snippets corresponding to % those spikes (opt...
a913d628768ade4ea583a35e8f967426e3348c8182981919f49f780ab7e12af4
MATLAB
3,362
122
function T_S_C_p = CBIG_gender(subInfoFile, GMICVFile, K) % T_S_C_p = CBIG_gender(subInfoFile, GMICVFile, K) % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md T_S_C_p = cell(1, 4); display('************* SEX *************'); fprintf('\n'); %------------------------...
2be78172c9e340b824886398bf6a424e49d42782138dcb68299fc3a3c17ec29e
MATLAB
3,363
84
function SmoothY=fastsmooth(Y,w,type,ends) % fastsmooth(Y,w,type,ends) smooths vector Y with smooth % of width w. Version 3.0, October 2016. % The argument "type" determines the smooth type: % If type=1, rectangular (sliding-average or boxcar) % If type=2, triangular (2 passes of sliding-average) % If type=3, ...
a1620b253172f16ce4f2fb70ace065c44572e59824d9c46736399b454314072e
MATLAB
3,363
103
function VRstatearraysNEW(animal, binsize) %Create arrays with info about running times, lick starts/ends, reward %starts/ends. The running times info is used by getruntimes to identify %running bouts. %LV analysis no longer uses this. %Inputs/requirements: Animal ID, binsize (0.1 = 0.1 second bins), matfiles ...
4b3394dff56a5d4731ad7928685ae2de936c1bb7f1719958cb699a1656870b7a
MATLAB
3,365
64
% 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...
05f74201fb75877cbf64ef55691b9e0c5c194d5e39cc98575663faf75aa5ba9d
MATLAB
3,366
110
% zica() - Z-transform of ICA activations; useful for studying component SNR % % Usage: >> [zact,basesd,maz,mazc,mazf] = zica(activations,frames,baseframes) % % Inputs: % activations - activations matrix produced by runica() % frames - frames per epoch {0|default -> length(activations)} % baseframes - vect...
0bf7596eda02f2b1e73a9273ef4140b2b5bea42842c63b881ee6a5271466aef7
MATLAB
3,370
81
function fd = fluorAnalysis(f,flydata) seconds = 30; % 40 for Exp2 slips; 67? for Exp4 real wind; 30 for everything else sigma_a = 0.5; % across rows (smoothing over time) sigma_b = 0.9; % across columns per = 0.05; frames = flydata(1).trllength; green = [flydata.fluordata]; bgcorr = green([1,3:end],:) - g...
6c6e786d2a00aec24ca450a84a55e92c1a225908c734a4c043360f90f44d9c6f
MATLAB
3,370
113
function [v]=arsim(w,A,C,n,ndisc) %ARSIM Simulation of AR process. % % v=ARSIM(w,A,C,n) simulates n time steps of the AR(p) process % % v(k,:)' = w' + A1*v(k-1,:)' +...+ Ap*v(k-p,:)' + eta(k,:)', % % where A=[A1 ... Ap] is the coefficient matrix, and w is a vector of % intercept terms that is included to allow...
e2f46458f1f6c249b4c17b12bc1f244dc4e840b50bfc9bb9f5e29d877446fdaf
MATLAB
3,370
83
% eeg_timeinterp() - perform spline interpolation of a portion % of data based on prior and post activity. See % eeg_interp() for interpolation of bad channels. % % Usage: % >> OUTEEG = eeg_timeinterp( INEEG, samples, 'key', 'val'); % % Inputs: % INEEG - input EEG structu...
f6ebe268d192ed485fd822c37e6168f2fcb60132ac7638ecac58415d80645eb9
MATLAB
3,370
99
% gradmap() - compute the gradient of an EEG spatial distribution. % % Usage: % >> [gradX, gradY ] = gradmap( map, filename, draw ) % % Inputs: % map - level of activity (size: nbelectrodes x nbChannel) % filename - filename (.loc file) countaining the coordinates % of the electrodes, or arr...
be4ce7fe6b70552db2346428023d7d40d12503c836285c5096364c6a6701ed18
MATLAB
3,371
151
function [cid, alpha, mu] = circ_clust(alpha, numclust, disp) % % [cid, alpha, mu] = circClust(alpha, numclust, disp) % Performs a simple agglomerative clustering of angular data. % % Input: % alpha sample of angles % numclust number of clusters desired, default: 2 % disp show plot at each ste...
e81cd13a31a9961e0253aafb568f28d876d014c6b968bd2979b12e800da4caee
MATLAB
3,372
106
function lc=ea_handles2lc(handles) % General settings (support both GUIDE and App Designer dropdowns) parcellations = ea_lc_getdropdownitems(handles.parcellation); parcVal = ea_lc_getdropdownvalue(handles.parcellation, parcellations); lc.general.parcellation = parcellations{parcVal}; % Graph options: lc.graph.struc_f...
ca5beb88c4ffe75a56f11e58894fee0b862bce5b1c78cdb9e1547dd96489fdcc
MATLAB
3,373
84
function headdir = fixHeaddir(headdir) plotIt = 0; shortEpochThresh = 50; bigDeviationThresh = 100; maxChunkSize2flip = 200; % larger starts flipping inappropriate data, smaller might be okay. . . if plotIt; hold off; plot(headdir(1:40000),'.b'); end %%% PHASE 1: % Drop all data points that deviate from the med...
ebecb3c58be16f7586271be03d50a4b0d7b8e21406bdb5ec1217dc9f896fb30c
MATLAB
3,374
81
function [params,paramsFilePath] = getAnalysisParams(loadParam,varargin) % getAnalysisParams loads parameters for compiling 2P data across animals % (whether TRF map or response in contrast) % % INPUT: % loadParam --> whether (1) or not (0) to load existing params % varargin...
318a8c3e1661950d817f9b5a0452e1415f947d633e0c03b294addfb50a8c6375
MATLAB
3,376
118
function cvx_optval = norm( x, p ) % Disciplined convex programming information: % NORM is convex, except when P<1, so an error will result if % these non-convex "norms" are used within CVX expressions. NORM % is nonmonotonic, so its input must be affine. % % Argument map % persistent remap1 rem...
87852c328bf1c8be2f1835a4ffe23ab0f6b0bd7783fa6f2cc744a8b18567d817
MATLAB
3,376
75
function [p, ADJ, NULL] = CBIG_ASDf_FCDiffAllSub_NBS(tThresh, id_asd_file, ... id_con_file, sub_info_file, Nperm, output_name) % [p, ADJ, NULL] = CBIG_ASDf_FCDiffAllSub_NBS(tThresh, id_asd_file, % id_con_file, sub_info_file, Nperm, output_name) % % This function compares FC difference between all ASD and all control p...
b99d9e9ac609e21e8439e1ca7ff0997b70141c1047f22f501ef2fed452b888b4
MATLAB
3,377
91
function currPosition = moveToPosition(position, stepperHandle, panelHandle, encoderHandle, axisIdx, useEncoder) % % Function: % global isMotorStop unitStep = fix(360/0.13*16);% pulses per mm tolPulseNum = 2; timeDelay = 10;%ms valPtr = libpointer('int64Ptr', 0); calllib('phidget21', 'CPhidgetStepper_getC...
f18a26ad32319f7a4b0bbbfd02a101470494d182a038e616be9b3fa2abf115e6
MATLAB
3,377
101
function normalized = NormalizeFields(fields,varargin) %NormalizeFields - Normalize one or more firing fields in space and rate. % % For each field, interpolate space in [0..1] and normalize z values % (typically, firing rates for place fields). Z values outside the fields % should be set to zero (see example below...
b75111021031825348f9add55afa7b8418be78a923bc7033b610d91cf9f68bca
MATLAB
3,378
84
ccc; AREAs = {'AC', 'PFC'}; temp = dir("..\MAT Data\cwt result\Baseline\**\cwtres_*.mat"); SINGLEPATHs = unique({temp.folder})'; RAWDATAPATHs = cellfun(@(x) strrep(x, '\cwt result\Baseline\', '\pre (granger)\'), SINGLEPATHs, "UniformOutput", false); GRANGERROOTPATHs = cellfun(@(x) strrep(x, '\cwt result\Baseline\', '\...
bb814596b8c9cf6c5ef56b9d5a14950ccf5b8957c0b5e3d932e16f2b9192b35e
MATLAB
3,380
89
clear; clc; %% Load and process experiment data % data location path_root = getenv('DECIDENET_PATH'); path_beh = fullfile(path_root, 'data/main_fmri_study/sourcedata/behavioral'); fname_beh = 'behavioral_data_clean_all.mat'; fname_meta = 'behavioral_data_clean_all.json'; % load behavioral and metadata load(fullfile(p...
033decd01d9c74d81a26c528f0c951a02524cdd88b8d85d5bdec8e05ff02f62f
MATLAB
3,381
72
function p_all = CBIG_MMLDA_characteristics_wrapper(out_dir) % p_all = CBIG_MMLDA_characteristics_wrapper(out_dir) % % Wrapper function to perform GLM (and logistic regression fro binary variables) % to compare AD subjects' characteristics (i.e., age, edu, sex, amyloid, apoe2) % across factors. % % Input: % - out_dir...
8a524766e3f69e09d91143d00aa11d2666dfd3c52aa649aed774f9a0e0275d55
MATLAB
3,381
115
function y = exp( x ) % Disciplined convex programming information: % EXP(X) is convex and nondecreasing in X. When used in CVX % expressions, X must be real. Typically, X must also be affine % or convex; X can also be concave, but this produces a log-concave % result with very limited ...
062e6c27b87a99f32dd0b1eb1e2a46dc70363ec73c138e27a1fa677096e35c8b
MATLAB
3,383
118
function cvx_optpnt = rotated_lorentz( sx, dim, iscplx ) %ROTATED_LORENTZ Rotated real second-order cone. % ROTATED_LORENTZ(N), where N is a positive integer, creates a column % variable of length N and two scalar variables, and constrains them % to lie in a rotated second-order cone. That is, given the declar...
29953c5b6af5fe15066be61de340d560b417e866517f4ea807407a8aa7987161
MATLAB
3,383
92
function [hObject, handles] = dan_edit_data_axes(hObject, handles) % This function controls what happens when the mouse is clicked on the main % gui window %% % Authors: Dan Denis % Date: 2021-07-14 %% %% Left click. Add a custom notation if strcmp(get(handles.main_window , 'SelectionType'), 'normal') c...
6a47d045467d56c5cb06dfa6695e1b7fc014fff9cc530e822ed210723fa9f5f0
MATLAB
3,384
109
%%********************************************************************* %% norm_min: matrix 2-norm minimization problem %% %% (primal) minimize || B0 + x1*B1 + ... + xm*Bm ||_2 %% %% (dual) maximize - Tr B0*Q %% subject to Tr Bk*Q = 0, k=1,...,m %% sum of singular values of Q is les...
79e56982b8ce8cead599fbf7167dec0f2c1c134ede8b44dadfb8d49c8b387a43
MATLAB
3,384
141
function [c2_idx] = dbscan2(x, varargin) % dbscan2 - Clustering by two sequential DBSCANs. The first one is applied % to the points in 'x'. The second one is applied to each cluster % recognized by the first DBSCAN. % % After the second DBSCAN, a gaussian mixture classification is applied. % The mean of each po...
c426da21e8b4e0eba6595f0cd6116fbe6a90484485af4fafb68da29e117ec313
MATLAB
3,384
90
function varargout = add(tree,uid,type,parameter) % XMLTREE/ADD Method (add childs to elements of an XML Tree) % FORMAT vararout = add(tree,uid,type,parameter) % % tree - XMLTree object % uid - array of uid's % type - 'element', 'chardata', 'cdata', 'pi' or 'comment' % parameter - property name (a char...
da7a56ee961ec9948b8d610528837dc539d4c6fbf58e521d125f39f3b61bb5b0
MATLAB
3,385
127
function [gr,gi]=cgama(x,y,kf) % [RealPartResult,ImaginaryPartResult]=cgama(RealPart,ImaginaryPart,1) % %This program is a direct conversion of the corresponding Fortran program in %S. Zhang & J. Jin "Computation of Special Functions" (Wiley, 1996). %online: http://iris-lee3.ece.uiuc.edu/~jjin/routines/routin...
278553bfc58f241e994c9b64824172821495926aa7a8d5f02c844a0dec6cc7af
MATLAB
3,387
76
function [sv,sp,fm] = spsvd(data,params,mdkp) % Space frequency SVD of input data - continuous processes % Usage: [sv,sp,fm] = spsvd(data,params,mdkp) % Inputs: % data (data matrix in timexchannels form)-required % params structure containing parameters - params has the % following fields: ...
032f2d4374abc073b2f84d906202d5da511b8950228a51d74f82ff90db7be4a8
MATLAB
3,388
69
% sleepDanalyzer montage script. % chanList. A list of channel names and (optionally) channel coordinates. % This should be an EEGLAB chanlocs struct. Alternatively you can read in a % .txt file using the readlocs function (EEGLAB). If you wish to % differentiate channel types (e.g. EEG, EOG, etc.) make sure to use t...
4021898bb4ccb3edf0e192026ae500d299fe023c428fc9598828d76a28bb8fd8
MATLAB
3,389
81
% 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...
abf50b123b5556d7c894e425505d5fef0edd6a77ff1318e562b4fd03f323bab1
MATLAB
3,390
111
function [output]= CNMF_noparpool(input, session); %% load structure foldername = input.foldername; files = input.image; listhdf5 = input.list; ROI = input.ROI.file; a = input.ROI.a; FOV = input.param.FOV; options = input.param.options; tau = input.param.tau; p = input.param.p; merge_thr =input.param.merge_thr; %Sess...
b8e1e5b1401ede35b9269b9e295d697ada38f32375558540b06407c8072a5b23
MATLAB
3,393
89
function [dtf,ctf]=SOFAhrtf2dtf(hrtf,varargin) %SOFAHRTF2DTF converts HRTFs to DTFs (and CTFs) % Usage: [dtf,ctf]=SOFAhrtf2dtf(hrtf) % [dtf,ctf]=SOFAhrtf2dtf(hrtf,f1,f2) % % Input parameters: % hrtf: SOFA object with SimpleFreeFieldHRIR convention % % Output arguments: % dt...
d42b56d391a60c61fb7e1ab19cb6913d00aea4ed7cae2f0eea481d6c269ccf13
MATLAB
3,394
88
function angles = GetAngles(varargin) %GetAngles - Get angles (from position samples). % % Angles are returned in radians (in [-pi,pi]). This function requires two % or more LEDs (only the first two are used). % % USAGE % % angles = GetAngles(<options>) % % <options> optional list of property-value pairs...
d6eb8ff56cf08439a1a1a331b94fe6cb35f0da00729047a3b40e31b689b125f1
MATLAB
3,395
77
function ea_nc_segment(options) %% neck-crop and segment MR-image directory = [options.root,options.patientname,filesep]; matlabbatch{1}.spm.tools.preproc8.channel.vols = {[directory,options.prefs.prenii_unnormalized,',1']}; matlabbatch{1}.spm.tools.preproc8.channel.biasreg = 0.0001; matlabbatch{1}.spm.tools.preproc8...
41c5cdcd4a56875b0e7b9b1be68cf5acde87262dfe1a907e10ade7beb0ef3893
MATLAB
3,397
91
function [id_keep, EB, reg] = CBIG_ASDf_CCA_genInputs(ind_scores, path_behav_scores, id_all, dx, regressors) % [id_keep, EB, reg] = CBIG_ASDf_CCA_genInputs(ind_scores, path_behav_scores, id_all, dx, regressors) % % This function gets participants' IDs, exchangeability block (for permutation test % controlling site) an...
f4005d75f76adad413bbd4787a8314ae0f09827db02134faceaff934b52aa67d
MATLAB
3,399
88
function atlases=ea_atlasmajorcomponent(atlases,toclean) % from specified component, only preserve largest component for c=toclean for side=1:2 % figure, patch(atlases.roi{c,side}.fv,'FaceColor','none') fvsplit=splitFV(atlases.roi{c,side}.fv.faces,atlases.roi{c,side}.fv.vertices); for comp=1:l...
0d0f61a5274d5adbd9bf547254de527dc9269b3f51f9102c9c7d09dce5a3af5e
MATLAB
3,400
106
function plotKinematicDists(kinematics) % Plots the mean within and between target distances at each time point % across trials, then indicates at which time points these distributions % are significantly different % Params mice = {'b8sSM5', 'b8sSM6', 'b8sSM7', 'b8sSM8', 'b8sSM9', 'b8sSM10'}; miceNames = {'mouse 1', '...
35aec751cec3c9d0d5b7e45e2b3a92bae3564f3c687c1757d31d80066cc1fc7c
MATLAB
3,401
80
% 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...
7c6278d9942a85d53bed3d4295f592b923728f3e3f8151db1c9ca048cd636af5
MATLAB
3,402
180
function trainmodel %% %scheme = evalin('base','scheme'); d1 = 0.5+(0:0.05:1)*2.5; d2 = 0+(0:0.05:1)*3; d3 = 0.15+(0:0.05:1)*2.5; v = 0:0.05:1; [D1 D2 D3 V] = ndgrid(d1,d2,d3,v); nt = 10^5; D1 = 0.5+rand(nt,1)*2.5; D2 = 0.5+rand(nt,1)*2.5; D3 = 0+sqrt(rand(nt,1))*2.5; V = rand(nt,1)*1; Vw = (1-V).*rand(nt,1)*0; %idx =...
758c021c5e8cc1177f7d26edc7d7dd40712ad984482102871f1f06b2f070755a
MATLAB
3,404
133
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % We study the Direct Switch model with generic asocial behaviour % % We consider the best-of-n case % % We vary eta and we plot the difference between the asymptotic fraction of % best option and second best option for a given eta with respect to the % case best...
7ed130339e47251f241b70654f521a0dc616bb6c420c92400582096cb15d3b94
MATLAB
3,404
92
% This script sets up directory structure for new second-level analysis and % copies in scripts from master 2nd-level script dir. % Some scripts should be copied in and modified. Others can be run % directly from the master scripts folder. % Go to your new analysis folder and run this from within it. % Note: type a_...
2d627c11f1c6a0dbd1b26b02a85001c5b0947d93c9efe0112958df1fcc758b58
MATLAB
3,406
103
% Edit these two, and possibly the 3rd, before running % ------------------------------------------------------- % Remember where the study's own setup put the results, so the call below can be % checked against it (see the guard immediately after). resultsdir_before_setup = ''; if exist('resultsdir','var'), resultsdi...
44a5a64358a6548a0e44f2408847513cf033e1433961827dd49d882e69c62c12
MATLAB
3,406
96
function scores = CBIG_MMLDA_get_num_entry(spreadsheet, phase, rid, viscode, fieldnames, phase_match, viscode_match) % scores = CBIG_MMLDA_get_num_entry(spreadsheet, phase, rid, viscode, fieldnames, phase_match) % % This function get numeric entries from ADNI spreadsheet. % % Input: % - spreadsheet : csv file fro...
4a08a4a24684a7dd058b1de455453dd5f77a85f8db4528cef9ee45988f109c03
MATLAB
3,406
84
ccc; AREAs = {'AC', 'PFC'}; temp = dir("..\MAT Data\cwt result (ext)\Baseline\**\cwtres_*.mat"); SINGLEPATHs = unique({temp.folder})'; RAWDATAPATHs = cellfun(@(x) strrep(x, '\cwt result (ext)\Baseline\', '\pre (granger ext)\'), SINGLEPATHs, "UniformOutput", false); GRANGERROOTPATHs = cellfun(@(x) strrep(x, '\cwt resul...
a1c0fda8033d46aa3d8d917c1ce0b4d1663342554cc3126b06da5b8fd4b1e2b6
MATLAB
3,406
101
function CBIG_pMFM_step6_SWSTD_state_Schaefer100() % This function is used to conduct the statistical analysis corresponding % to figure S8D and S8E in the paper. % % 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 ...
64763029f39fffd9ab85e42194e5668c81f37d0d7512283311f5e9141a5f0a9a
MATLAB
3,407
66
%% Canlab dataset basic usage % Shows how to load a sample canlab_dataset object, extract variables, and % make some plots. % Instructions to include in help files as appropriate: % ----------------------------------------------------------------------- % % Before you start, the CANlab_Core_Tools must be added to your...
10fc1494968e9daaf0fcf41fbae0cb07dca99914ff04c4bd6e574335d52c3e51
MATLAB
3,408
87
function ea_export(options, clusterfunctionname) % This function exports jobs created by the GUI of Lead-DBS. It is % distributed within Lead-DBS toolbox (www.lead-dbs.org) % __________________________________________________________________________________ % Copyright (C) 2016 Charite University Medicine Berlin, Movem...
92b5d15ca35e5eb837850d90a673fbb47a0e47a92bd7038a5f5f2f0d3089d2e1
MATLAB
3,409
96
classdef ButtonBox < uix.Box %uix.ButtonBox Button box base class % % uix.ButtonBox is a base class for containers that lay out buttons. % Copyright 2009-2015 The MathWorks, Inc. % $Revision: 1165 $ $Date: 2015-12-06 03:09:17 -0500 (Sun, 06 Dec 2015) $ properties( Access = public, ...
e542c5e610689942d21e0a0e5395e0700a46d56333f88afc412ac38577f2f3f2
MATLAB
3,410
102
function [ ] = bz_RunAnalysis(analysisfunction,datasetfolder,varargin) %bz_RunAnalysis(analysisfunction,datasetfolder) is a high level function that %takes as its input an analysis function and returns the result of the %analysis on multiple recordings % %INPUT % analysisfunction A function name. The function sh...
6eb52f77d399e211be30697f90b972f506b84b8ecd4a3616191c24c0aa77d7fe
MATLAB
3,412
92
function isom=ea_reformat_isomatrix(isom,M,options) % this function tries to put the isomatrix provided into the correct format % to be used by LEAD-DBS. The isomatrix is a matrix of values that can be % displayed either at each active contact, each contact or in the spacings % between contacts (e.g. for power-analyses...
a704e9c038046734273197a892dabff5d52f52dc80b6e08efb4ec17e36ada88a
MATLAB
3,412
93
% fir1 bandpass filter implementation for rc files % Base on firfilt2 (Hajime Hirase - 1998) % Modification Lynn Hazan dec 2004: any offset can be used instead than an hard code offset of 2048 for 12 bit recordings % (subtracts offset before filtering and adds offset before writing) % function % firfilter(inname,outna...
56c2ed8fb425dc64e87d746853632ce3d935993796174589cb9022f2f8453b5b
MATLAB
3,413
98
function [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossSpecMat(data,win,params) % % % Multi-taper cross-spectral matrix - another routine, this one allows for multiple trials and channels % but does not do confidence intervals. Also this routine always averages over trials - continuous process % % Usage: % % [Sc,Cmat,Ctot,C...
500750c3f75cc0a2fca36256687c46708fc1e94a43bba1f026b858963c89d055
MATLAB
3,414
88
function data = loadmask(fn,threshold,ref,edges) data = []; if iscell(fn), [fp fndum fext] = fileparts(fn{1}); else [fp fndum fext] = fileparts(fn); end; if strcmp(fext(1:4),'.nii') || strcmp(fext(1:4),'.hdr'), if size(...
3b5c463f152303bb93953b9cbba70137e7368b1b9f07dff11d9b304429a91067
MATLAB
3,418
83
function [p_spin, r_dist] = spin_test(map1, map2, varargin) % % Usage: % [p_spin, r_dist] = spin_test(map1, map2, varargin) % % Description: % Spin permutation (author: @saratheriver) % % Inputs: % map1 (double array) - One of two map to be correlated % map2 (double array) - The other map to be correlated % ...
ee7dff42625fcf11f28d455d51eefe3193bc5f2c4f40771b0fa6f37e9d1aa4cc
MATLAB
3,418
97
function P = paths() %FNIRSPOWER.PATHS Return centralized, project-relative paths. % % P = fnirspower.paths() % % Description % ----------- % This function defines the recommended repository and workspace layout % used by the example scripts and convenience workflows. All paths are % resolved relative to...
ca007b5948e3c4b84b94422e658d0ea8fbe9eb2e9a45918953e08a3cf082c636
MATLAB
3,419
101
% eeg_readoptions() - Read EEGLAB memory options file (eeg_options) into a % structure variable (opt). % % Usage: % [ header, opt ] = eeg_readoptions( filename, opt ); % % Input: % filename - [string] name of the option file % opt - [struct] option structure containing backup values...
8159c9781db532e6cabd54be54d57f3539bf8228a2f3d606ad6c3b8d1c318931
MATLAB
3,420
100
function [h,U2] = WatsonU2Test(group1,group2,alpha) %WatsonU2Test - Test if two samples (circular data) have different means / variances. % % This non-parametric test assumes the data comes from a continuous distribution. % % USAGE % % [h,U2] = WatsonU2Test(group1,group2,alpha) % % group1 angles in rad...
ce8279177bf2c9724e5c91edb79f6cf81426f817b714d7fb452e241e50ce811b
MATLAB
3,423
65
function plotEulerDiagram(qMetric, param, qMetricNames,figHandle) colorMtx = colors(14); % get 12 colorbling-friendly colors colorMtx = [colorMtx(1:14, :, :), repmat(0.7, 14, 1)]; % make 70% transparent colorMtx = colorMtx([1:2:end, 2:2:end], :); % shuffle colors to get more distinct pairs if param.computeDistanceMe...
29ef4379b826ee3dd8b81306a5c7c681566ef041ef593adacdd1bf2472fe8282
MATLAB
3,424
112
function [In,pl] = ClusterPointsBoundaryOutBW(Data, ECells, ICells,m,b) % function [In,pl] = ClusterPointsBoundaryOut(Data, IfPlot,nClusters) % % --This is from Anton's 'ClusterPoints.m' % The only difference is that you can also output the boundary information (pl) % % Data is two column matrix of coordinates, IfPlo...
88b6d09b729381bc39ffafd0078a3137c317607a3e231b701615cfa64d647904
MATLAB
3,424
97
%%******************************************************************* %% HSDNTrhsfun: compute the right-hand side vector of the %% Schur complement equation for the NT direction. %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%*********...
b7d4da4f6e159b6d426942f172ab6489446deab16e58c55da829b5e6fba13cdf
MATLAB
3,424
93
function ea_reconstruction2mni(options) if ~isfield(options.subj, 'coreg') options = ea_getptopts(fileparts(fileparts(options.subj.recon.recon))); end load(options.subj.recon.recon,'reco'); nii = ea_load_nii(options.subj.coreg.anat.preop.(options.subj.AnchorModality)); if ~isfield(options,'elspec') options....
1b1654bfca9e01ab44f522f555e003bb0804357604a368f64255bbe099d0548d
MATLAB
3,425
105
function data = AFOFdata_struct2_5(inputdata, filenames) % USE THIS FOR EXP2.5 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}; ...
beea2e093780867f9d70d84e7d75c5660b7431b0352ea7d8352ccff9cf62f9fc
MATLAB
3,425
80
function handles = dendrite_regmater(handles, t_points, R_points, dendriteROI_mask) handles.roimask = zeros(size(handles.im_norm)); im_norm = handles.im_norm; scrsz = handles.scrsz; pos_dend = round([scrsz(3)/6 20 scrsz(3)/3*2 scrsz(4)-100]); [d1,d2] = size(im_norm); if ~isempty(handles.size) explinelength = s...
58bf06ee01e44ced6772a6f7bbd6cae8df17081f74d8ac31a3209a00c2c69fb8
MATLAB
3,426
99
% get holdout set for SVM contrasts, balanced across groups, 2nd-level batch scripts % adapted from plugin_get_holdout_sets by @lukasvo76, March 2021 % hard-coded options % 'fivefold_leave_whole_subject_out' : 5-fold cross-validation, leaving % whole subject out (all images from subject across all conditions) % 'leave...
7d71f501fe405d79a9060696bb95f65fa9bda82fd5433aecaff63f6f32a1eb45
MATLAB
3,426
106
function val = ft_getopt(opt, key, default, emptymeaningful) % FT_GETOPT gets the value of a specified option from a configuration structure % or from a cell-array with key-value pairs. % % Use as % val = ft_getopt(s, key, default, emptymeaningful) % where the input values are % s = structure or cell...
eb2c5d9fb64863a0d543c2848f2cbb836fc8949f18b7d00e94da3a1d7b0f73b5
MATLAB
3,426
97
% [labels, start, stop, distance, speed] = CleverSys.load(filename, <sheet>) % epochs = CleverSys.load(filename, <sheet>) % Returns a list of event epochs generated by CleverSys. % % Example: % filename = 'data\sequential events - frame.xlsx'; % sheet = 1; % [labels, start, finish, distance, speed] = Clev...
13c22832efa9c2a19158ce8a13c66784a2b359cc7a1b2b491941c68e6e5e46e8
MATLAB
3,427
111
function [coords_mm,trajectory,markers,elmodel,manually_corrected,coords_acpc]=ea_load_reconstruction(varargin) % [coords_mm,trajectory,markers,elmodel,manually_corrected,coords_acpc]=ea_load_reconstruction(varargin) % __________________________________________________________________________________ % Copyright (C) ...
720dfae14f3565f3581086596b867fe0af58b10e1314a84bae5f7f3622cf73c7
MATLAB
3,427
97
%% RUN_VARIANCE_STEP % Example driver for within-subject beta-variance estimation using % fnirspower.pipeline.run_variance. % % This script: % 1) sets up fnirspower and third-party paths % 2) defines mesh / forward-model / layout inputs % 3) builds an explicit SNIRF file list for the selected subjects % ...
ed37429aff9227451464b450e2a89f946b7a2d4eba6c3ed2d3dad51e68e0fb49
MATLAB
3,427
89
function imData=read_file(path_to_file,sframe,num2read,options,im_info) % Reads uncompressed multipage .tiff, .hdf5, .avi or .raw files % Usage: my_data=read_file('path_to_data_file, start frame, num to read); % INPUTS: % path_to_file: location of file to be read % sframe: first frame to read (...
d56b3a76bc775f93904f3a594b1bae70865f7b54315d29cf237b236e17b44a62
MATLAB
3,428
109
% readelp() - read electrode locations from an .elp (electrode positions) % file as generated, for example, by a Polhemus tracking device % Usage: % >> [eloc, elocnames, X, Y, Z] = readelp(filename); % % Inputs: % filename - name of the .elp file containing cartesian (XYZ) electrode % loca...
7128612d1315ee67db20bc59207ef7dccdee9c24b2fb3c27b4ca6533fb04ee9f
MATLAB
3,429
101
function bb_moments_raincloud(region_idx, parcellation, title) % % Usage: % bb_moments_raincloud(region_idx, title) % % Description: % Stratify regional data according to BigBrain statistical moments % (authors: @caseypaquola, @saratheriver) % % Inputs: % region_idx (double array) - vector of data. % ...
9c3363aeba293d145a9addbd01afe0a89db7326ee942ebd0dcaeb35a6a0c427e
MATLAB
3,430
101
function xcell = cellK(x,K) % xcell = cellK(x,K) % % CELLK Stores SeDuMi cone K-vector in cell-array format. % % On output xcell.f and xcell.l are the free and >=0 components, % xcell.q{k}, xcell.r{k} and xcell.s{k} contain the Lorentz, % Rotated Lorentz, and PSD-components, resp. % xcell.s{k} is a K.s(k) x K.s(k) mat...
32dd4e30a11f7951818fcffda915a5c481baff68d65b480e8f37a97e91de6c0f
MATLAB
3,431
58
classdef Normalizer < uint8 enumeration LINEAR_FIT (1) % linear fit 405 to 465, norm = (465-fit405)/fit405 NO_NOISE_SCALING (2) % same as LINEAR_FIT, but only 5s movmedian of 405 gets scakaled, noise not ZSCORE_DEBLEACHED (3) % separately zscoring debleached 405 and 465 signa...
bace56ad878af320fcbe2bf979e44000f90b0fd94714738d53b48a6587a57fa0
MATLAB
3,431
143
function [fspec, fstem, fmt] = MRIfspec(fstring,checkdisk) % [fspec fstem fmt] = MRIfspec(fstring,<checkdisk>) % % Determine the file specification (fspec), stem (fstem), and format % (fmt) from the given file string. % % A specification is the name of a file as it could exist on disk. The % specification has the form ...
93de9259a0dc3a7c14a08ab7c58ce3c6538f297ba876bb45066db56bfbe6ab52
MATLAB
3,434
65
function [bz_datasets,bz_datasets_excluded] = bz_database_submit_collection(database_name,Investigator,NYU_share_path) % Submit datasets from a folder on the NYU sbare to the Buzsakilab metadata-database % scans the directory tree for new sessions to add to the database. % NYU_Share_Datasets / Investigator / Animal / ...
4db204115163e3012ebe2af2fc7dd2f66f8f009a0b6dd09a78b4060f29ee39bb
MATLAB
3,436
107
function [ind,t0,s0] = crossing(S,t,level,imeth) % CROSSING find the crossings of a given level of a signal % ind = CROSSING(S) returns an index vector ind, the signal % S crosses zero at ind or at between ind and ind+1 % [ind,t0] = CROSSING(S,t) additionally returns a time % vector t0 of the zero crossings of ...
f71fbe0afc9ae7d609e92cc1e75f297f73f8b1b1f518a0d643a915b537bcb084
MATLAB
3,436
67
function [S,f,Serr]=mtspectrumc(data,params) % Multi-taper spectrum - continuous process % % Usage: % % [S,f,Serr]=mtspectrumc(data,params) % Input: % Note units have to be consistent. See chronux.m for more information. % data (in form samples x channels/trials) -- required % params: structure wi...