sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
2776a50d5e961ecd394634077ce618ad32401438d3631a1907c5edfd3730ae4e
MATLAB
4,512
166
function hdr = load_nifti(niftifile,hdronly) % hdr = load_nifti(niftifile,hdronly) % % Loads nifti header and volume. The volume is stored % in hdr.vol. Columns and rows are not swapped. % % Handles compressed nifti (nii.gz) by issuing a unix command to % uncompress the file to a temporary file, which is then deleted. ...
62483eae3b2b58a1000f041fe30cd2c59e791981f213d1d544172283b1fed395
MATLAB
4,512
110
% Enter the values for the variables required for the ICA analysis. % Variables are on the left and the values are on the right. % Characters must be enterd in single quotes % % After entering the parameters, use icatb_batch_file_run(inputFile); %% Modality. Options are fMRI and EEG modalityType = 'fMRI'; %% Output ...
edb6f06c40ae7c68eabb834f5fbb64c92d5135f5dfbe91042010c705a8e95419
MATLAB
4,512
175
function options=ea_defaultoptions(varargin) try options=varargin{1}; catch options=struct; end if ~isfield(options,'normalize') options.normalize=0; end if ~isfield(options,'endtolerance') options.endtolerance=10; % how many slices to use with zero signal until end of electrode estimate. end if ~is...
967247704f49b87fe72c38cba61745390a0101aa01dd4ec15c02549e1504d6e9
MATLAB
4,519
115
% dipfit_gridsearch() - do initial batch-like dipole scan and fit to all % data components and return a dipole model with a % single dipole for each component. % % Usage: % >> EEGOUT = dipfit_gridsearch( EEGIN, varargin) % % Inputs: % ... % % Optional inputs: % 'com...
8076bedff60dce460f4baf7063b8ca1f0ea7be5fac5eeec4b6fc932ef1b855fb
MATLAB
4,523
127
function [t,wr,w] = widelen(xc,zc,y0, dx,dz,dy0,d2y0, maxt,pars,K) % [t,wr,w] = widelen(xc,zc,y0, dx,dz,dy0,d2y0, maxt,pars,K) % % WIDELEN Computes approximate wide-region neighborhood step length. % Does extensive line search only if it pays, that is the resulting % rate will be at most twice the best possible rate, ...
b308af717f9a48bc03ac1487831c68ba2bddf3ae79b1bb091955240d843e2ae4
MATLAB
4,526
120
function [t,peaks] = SineWavePeaks(sineWave,varargin) %SineWavePeaks - Find peaks (or troughs) in a sine wave. % % Find the peaks (or troughs) in a sine wave. The algorithm can either determine % the mid-points between the zero-crossings, or the zeros of the derivative of % the signal. This assumes a minimum of 10 sam...
7d244117fada91b47711f1033dcaa1b443db53bf84a061b5989a8c9fd7ed6d7c
MATLAB
4,527
121
%% Left Turns % TO DO THIS, YOU NEED TO RUN THE CONTENT OF COMPUTETURNBOUTS2.M Lturns = {}; leftPB = []; rightPB = []; turnLdata = []; PBcols = []; trials = []; flies = []; count = 1; for k = [1,2] % for these trial types A = allflies([allflies.trtype]==k); for n = 1:length(A) if length(A(n).t...
2416d6746f113e6b4b4a636228cd7bf9fe53554d268bce136e4b21f40596d859
MATLAB
4,529
112
% Name: Robert Kim % Date: 05-14-2023 % Email: robert.f.kim@gmail.com % fnc_task_neus_two_layers.m % Description: Identify selectivity classes for the two-layer instruction-DMS % RNNs. Crosses task selectivity (anti vs. pro) with stimulus selectivity % (stim1 = +1 vs. stim1 = -1) using Wilcoxon rank-sum tests, then sor...
3a8fe8430588b8ce63fdad7c9f38e150df9462cb05c4a184ba2e5f0c6d8abf44
MATLAB
4,534
133
function [str, sts] = ea_gencode_rvalue(item) % GENCODE_RVALUE Code for right hand side of MATLAB assignment % Generate the right hand side for a valid MATLAB variable % assignment. This function is a helper to GENCODE, but can be used on % its own to generate code for the following types of variables: % * scalar, 1D...
2b365a8d1c32be1ff7e55bb591e662ad9f6969bffc375e08cc07672c6a82ad88
MATLAB
4,540
119
function call_stampresp(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); framestamp = handles.framestamp{1}; stampinfo = handles.stampinfo{1}; if handles.plotRawdff == 0 &...
d10a6286c42109b232d94fd642e26f97a4f3a82f117c7c389b5cc35f096b028a
MATLAB
4,541
106
%% Replay estimation using place field (Bayesian decoding) x_bin_pf_include = (sum(x2_rate_map,2) > 0); x_tb_include = (sum(x2_sync_e_tb) > 0); x2_p_sp_bin = zeros(n_bin_maze,n_tb); for i_tb = 1:n_tb if x_tb_include(i_tb) x_sce_tb = x2_sync_e_tb(:,i_tb); for i_bin_maze = 1:n_bin_maze ...
fb89da1f826017ff284296c90bd57320c2f6d0aff812dc4fe889267d6a20babc
MATLAB
4,541
104
function plotSubpopTroughs(allROIs, subpopGMMs, method, names) % Compute the vector connecting the multivariate Gaussians from each % subpopulation of the clustered area-specific GMMs, project all % hard-clustered cells onto the vector and plot their smoothed % distributions if nargin < 3 method = 'logistic'; end ...
1a95abfa6ea1a38b49d8fb9a7ea1116e1346c8d287f93a4fca42a3c2406259fa
MATLAB
4,543
84
% SBM Matlab utilities % Last updated: 10-07-2006 % % % DATATOOLS [Matrix manipulation, signal processing and statistics] % alignwaveforms - Finds best alignment of waveforms to a reference % buttersimple - Fixed order Butterworth digital filter design % cmtm - Coherence function est...
1d78680e8e56d088d753afc0c6addefcfbcacec1547f2f0dc94d437502d84f0a
MATLAB
4,549
130
%%******************************************************************* %% schurmat_sblk: compute Schur complement matrix corresponding to %% SDP blocks. %% %% symm = 0, HKM %% = 1, NT %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 ...
3a0da1ecc3988ec0f4eb7e1cbb01641f789539f030032acff36b81b377747fde
MATLAB
4,549
111
function [evf, how] = LaBGAScore_firstlevel_find_events(BIDSdir, sub, stem) % LaBGAScore_firstlevel_find_events Resolve one run's events.tsv by BIDS inheritance. % % evf = LaBGAScore_firstlevel_find_events(BIDSdir, sub, stem) % [evf, how] = LaBGAScore_firstlevel_find_events(BIDSdir, sub, stem) % % Returns the fu...
f809d81f6805798ff3e6680bcd1af1f6135d27c4edbc180be6382fab3de03e4a
MATLAB
4,549
160
% eeg_eventhist() - return or plot histogram of event or urevent field values. % If NO output args, plots the histogram. If the field values % are not numbers or strings, no histogram is computed. % Usage: % >> figure; eeg_eventhist(EEG.event,'field',bins); % plot histogram...
dbc9c1e0f9b606f94df9272f71297d02650c3752332ae0cf98913ba823d4a013
MATLAB
4,551
98
function CBIG_hMRF_generate_premultiplied_matrix(output_dir, lh_fmri_fullpath_txt, rh_fmri_fullpath_txt, mesh_type,... censor_file_fullpath) % CBIG_hMRF_generate_premultiplied_matrix(output_dir, lh_fmri_fullpath_txt, rh_fmri_fullpath_txt, mesh_type,... % censor_file_fullpath) % This function generates the premulti...
2fd199881e78fc05b2bb2fc59dc1c6d802c4a42796108e0aac24f5d02fb21c9d
MATLAB
4,553
153
function pop( depth, clearmode ) % % Determine the index of the problem to be cleaned up % global cvx___ if nargin < 2, clearmode = 'clear'; end if isempty( cvx___ ), cvx_global return end p = depth.index_; if p > length( cvx___.problems ), return end % % Determine the indices of the variables, constraints, et...
5063fa1b3b0bd9f444b618af36c96a568d4c9fb6acb6d90e6d6b80a5f1abff17
MATLAB
4,553
69
function matlabbatch = batch_job_3T_dual(b) %----------------------------------------------------------------------- % Job saved on 15-Jan-2022 18:39:57 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- %% Re...
5745e28688ee9e2f1e821cbbb43186afcb281ca52f73d7962b32898fb7151705
MATLAB
4,553
149
%% Example 1 of applying topic models to images % Illustrates the "bars" example as discussed in Griffiths, T., & Steyvers, % M. (2004). Finding Scientific Topics. Proceedings of the National Academy of Sciences, 101 (suppl. 1), 5228-5235. % % This program creates a dataset of 500 images, each containing 25 pixe...
2d4140a5e1e680a1512204e54d710c6c44aa441b79f3a71a003278ac6f6794bc
MATLAB
4,558
88
% 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...
2a5fcb3b03c363710c468e48af6a4d33f2f202e7db1e743ff318ca37c11cb00a
MATLAB
4,560
100
% Graph Algorithms % % Searching through a graph % bfs - Breadth first search % dfs - Depth first search % astar_search - Heuristic astar graph search % breadth_first_search - Breadth first search with visitors % depth_first_search - Depth first searc...
96a07a53cb5a6e87947dac1c4de527a5eb2f5d3ff89c5264be8fb13c09bb4226
MATLAB
4,562
124
function [asymParam,asymFlag] = asymDeterm2D3D(positions,alpha) %ASYMDETERM2D3D estimates the asymmetry in a scatter of positions % %SYNPOSIS [asymParam,asymFlag] = asymDeterm2D3D(positions,alpha) % %INPUT positions: n-by-2/3 array of positions (x,y,[z]). % alpha : Alpha-value for determining the thresh...
2ddbafcc14698893053ef9f24b7c43b00d8d8d322a99094eb70920c974896bcb
MATLAB
4,567
172
function [] = view2vws(ax, filename, part_renderers, fix_daspect, part_tags) %VIE2VWS Saves current view in a views file for LaTeX media9 package. % % See also FIG2U3D. % % File: view2vws.m % Author: Ioannis Filippidis, jfilippidis@gmail.com % Date: 2012.06.10 - 2012.07.16 % Language: MATLAB R2...
1cdcaf77750cc1d8841511a0ee8d4268ac9cf34ebcdedf620c66760af0f5055d
MATLAB
4,568
147
%% A02_Read_decoding_outcome.m % Need to run "DCNdecodingsSVM.py" on python first! % % Liang-Yin clear all; close all; %% Load data path2decodeResult = fullfile(pwd,'DCN_decoding_result'); path2save = fullfile(path2decodeResult,'Outcome'); mkdir(path2save); cd(path2decodeResult); fstruct = dir('data_DCN_unit*....
e6d973db6045b3e020ab5dd290be36d55ba030c0894ddd222286a42957496e4f
MATLAB
4,570
151
function [count, edges, mid, loc] = histcn(X, varargin) % Purpose: compute n-dimensional histogram % function [count edges mid loc] = histcn(X, edge1, edge2, ..., edgeN) % % % INPUT % - X: is (M x N) array, represents M data points in R^N % - edgek: are the bin vectors on dimension k, k=1...N. % If it is a scal...
3854473b6e50dae096ddc04e6abe7cc6c4ba30ddcb7891915d61731383bd6cb8
MATLAB
4,571
89
function [S,f,varS,C,Serr]=mtspectrumsegc(data,win,params,segave) % Multi-taper segmented spectrum for a univariate continuous process % % Usage: % % [S,f,varS,C,Serr]=mtspectrumsegc(data,win,params,segave) % Input: % Note units have to be consistent. See chronux.m for more information. % data (single channel) -...
19f02a4819f84ce514be437b4ac64e234e6ee41220c99fdb7f127e570291d9e4
MATLAB
4,574
143
% Elmore delay sizing for a straight wire (GP) % Boyd, "Problems in VLSI design" (Lecture) % Written for CVX by Almir Mutapcic 02/08/06 % % We consider the problem of finding optimal width profile % for a straight wire segmented into N parts. We want to % minimize the Elmore delay, subject to limits on wire width % and...
630471edd214a89101390790bfacf7edb1b208a21c22028bbfacf43776bb85ac
MATLAB
4,578
93
function [C,phi,S12,f,zerosp,confC,phistd,Cerr]=cohmatrixpt(data,params,fscorr) % Multi-taper coherency matrix - point process times % % Usage: % % [C,phi,S12,f,zerosp,confC,phistd,Cerr]=cohmatrixpt(data,params,fscorr) % Input: % data (structure array of spike times with dimension channels) - required % ...
cacef17ec66a0c21a84c203928a04d00b828ed947bd65d44dde54045633f9789
MATLAB
4,580
111
% Enter the values for the variables required for the ICA analysis. % Variables are on the left and the values are on the right. % Characters must be enterd in single quotes % % After entering the parameters, use icatb_batch_file_run(inputFile); %% Modality. Options are fMRI and EEG modalityType = 'fMRI'; %...
ca3a772cac10759c9cbe7e1e18c52d2d3699191e4a139fa2e1984da931f9aa23
MATLAB
4,581
114
% %function [xml, rxml] = LoadXml_old(FileBase) % %loads the xml file using xmltools_olds (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 ca...
40010e818cf089cc85190ac9ce4493a50969160019382ea9e58e9d9e755064ca
MATLAB
4,584
151
function [varargout] = rdir(rootdir,varargin) % Lists the files in a directory and its sub directories. % % function [D] = rdir(ROOT,TEST) % % Recursive directory listing. % % ROOT is the directory starting point and includes the % wildcard specification. % The function returns a structure D similar to the ...
9df098e9728ee6382277e42188fdd0d947d81ecef038ca95348d161bc11c9f20
MATLAB
4,584
108
function [d,vfrm] = updtransfo(x,z,w, dIN,K) % [d,vfrm] = updtransfo(x,z,w, dIN,K) % % UPDTRANSFO Updated the Nesterov-Todd transformation using a % numerically stable method. % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Rom...
2ed81a7e8d44a3b1506bc3cf06c0163470100fc10efb67c2fe010bfde1c74645
MATLAB
4,585
132
function x = DBGetVariables(query,varargin) %DBGetVariables - Get all variables that match given criteria. % % Get variables and related information such as code used to generate them. % % This is mostly useful to get information about the variables (who stored % them, when, which code was used, with what parameters, ...
315b260740431156eb3098768e82de174a9ffbd1b19b87f58a88539330275bc7
MATLAB
4,585
122
function PlotIntervals(intervals,varargin) %PlotIntervals - Plot vertical bars or rectangles to show interval limits. % % Given a list of intervals [start stop], draw a green vertical bar at % the beginning of each interval, and a red vertical bar at the end of % each interval or a grey rectangle representing the inte...
ffbb9ce37f285c02ac325d46d0da00ec955eb5a3f7a865972b756faee5293681
MATLAB
4,585
117
function p_tau = CBIG_MMLDA_association_factor_tau_wrapper(out_dir) % CBIG_MMLDA_association_factor_tau_wrapper(out_dir) % % Investigate association between factor loadings and tau loadings. % % Input: % - out_dir : output directory. The output will be some forest plots. % % Example: % CBIG_MMLDA_association_fact...
c54605101ab900c0c9a74ea7ba967fd483f8ffbb1c1030e001e6f3b71287aeda
MATLAB
4,588
181
function [shaders, materials, modifiers] = shaders_materials_modifiers(v, f, c, t) % File: shaders_materials_modifiers.m % Author: Ioannis Filippidis, jfilippidis@gmail.com % Date: 2012.06.24 % Language: MATLAB R2012a % Purpose: mesh shaders, materials and modifiers % Copyright: Ioannis Filippidis...
8c6f6ad43d8f74fd5e21b364d09ace5915e9eb790e80e1fe8b019bfe70f45aa2
MATLAB
4,591
140
% Digital circuit sizing for an inverter chain (GP) % Boyd, Kim, Patil, and Horowitz, "Digital circuit optimization % via geometric programming" % Written for CVX by Almir Mutapcic 02/08/06 % % We consider a chain of N inverters driving a load capacitance CL. % The problem is to find optimal scale factors for the inver...
d2209a3dbb301abb0f8479040c94048618e8185d67fa5d84912bf57c6c803911
MATLAB
4,592
148
%%******************************************************************* %% randsdp.m : creates random feasible SDP problems with various block %% diagonal structures. %% %% [blk,Avec,C,b,X0,y0,Z0] = randsdp(dense_blk,sparse_blk,diag_blk,m,feas,solve); %% %% E.g. %% randsdp([32 20],[10 5],100,10,feas,sol...
22ddc9d677ccd3aaf3b510021976d63bec987fc8605c743f600714cb0b874140
MATLAB
4,594
125
%LoadBinaryChunk - Load data chunck from an open binary file. % % USAGE % % data = LoadBinaryChunk(fid,<options>) % % fid file id (obtained via fopen) % <options> optional list of property-value pairs (see table below) % % ====================================================================...
a7332416d83b0eb320f3fc83fb6005ad485aab9050b165cef7098cc758b8b9aa
MATLAB
4,596
109
function [Y, carry] = filterm(B, A, X, carry) %FILTERM One-dimensional digital filter (memory efficient). % Y = FILTERM(B,A,X) filters the data in vector X with the filter % described by vectors A and B to create the filtered data Y. The % filter is a "Direct Form II Transposed" implementation of the s...
aacb5c1af72e26ee9319754415692bac2177fdb083abcf7c488ce4c97c163f1c
MATLAB
4,596
142
function [status,interval,index] = InIntervals(values,intervals,varargin) %InIntervals - Test which values fall in a list of intervals. % % USAGE % % [status,interval,index] = InIntervals(values,intervals,<options>) % % values values to test (these need not be ordered) % intervals list of (start...
976c021d7c3cf425b651739ed6c58c79add4c53a916e1bd0d7854148330a502c
MATLAB
4,597
114
function postprocess_write_files_for_stability_analysis_output(... filename_prefix, N, outname_format, species_names, cutoff, doKeystone, ... num_perturbations) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome...
de979031cb620e71165271d4ea5d9b55f4214c212110cc51b6b844e37136e04b
MATLAB
4,598
62
addpath bva-io-master/ addpath (genpath('eeglab2022.1/')); eeglab datasetName = './ds005284/'; behav_data = tdfread([datasetName, 'participants.tsv']); sub = behav_data.participant_id; data = cell(1,size(sub, 1)); for subi = 1:size(sub, 1) subjectName = sub(subi,:); disp (subjectName) input_folder = [dat...
09e27aa78cb85457e941678b13da618a48892427949ec4d556efc88fdd6b83b3
MATLAB
4,599
101
function spikes = ss_energy(spikes) % SS_ENERGY Interface energy based cluster similarity computation. % SPIKES = SS_ENERGY(SPIKES) adds an interface energy matrix to a % spike-sorting object in SPIKES.HIERARCHY.INTERFACE_ENERGY. % % The energy similarity matrix is calculated by applying an exponential % ...
3e7775b83e924b06c6c873e194e7ba06a09e38446fa80a51127eeeb458d86add
MATLAB
4,599
125
typeArray = [allflies.trtype]; for i = 1:16 inds{i} = find(typeArray==i); end %% for flight bout onsets and also correlating flight intensity with neural boutlengthsecs = 4; fbl = boutlengthsecs * 100; allbouts = {}; leftPB = []; rightPB = []; leftmickey = []; rightmickey = []; trials = []; fliesinclu...
d411395131d7af06adc0d5518553ffcc8e15bcb749ca7e78d3015601b3f24e30
MATLAB
4,602
111
function [events,trigger] = triggerevents(trace, trigger, pre, post, gap) %TRIGGEREVENTS Extracts data samples before/after a trigger signal. % E = TRIGGEREVENTS(X, TRIGGER, PRE, POST), where X is an M x 1 vector % and TRIGGER is a length M vector with P 0->~0 transitions, returns a % P x (PRE+1+POST) matrix ...
b4f67024555e0c7adff947aa9de4e3b8fa1d5135417ff6ddd26c8b74023f082b
MATLAB
4,603
133
function splitNSxPauses(fileName) % splitNSxPauses % % Opens and splits an NSx file in smaller pieces, timewise. % % Use splitNSx(fileName) % % All input arguments are optional. Input arguments can be in any order. % % fileName: File name of the file that needs to be split. % DEFAULT: The user will...
6d250f8c8058c9cf476f0bf00d7c8a0fa799cfe2f067a3b517756acf09c6fe5b
MATLAB
4,605
185
% qrtimax() - perform Quartimax rotation of rows of a data matrix. % % Usage: >> [Q,B] = qrtimax(data); % >> [Q,B] = qrtimax(data,tol,'[no]reorder'); % % Inputs: % data - input matrix % tol - the termination tolerance {default: 1e-4} % noreorder - rotate without negation/reord...
3a146631e898452a112b2e761a10566a3861f90a460284822c400f68b1049f72
MATLAB
4,606
134
%% LaBGAScore_prep_s2_smooth.m % % % *USAGE* % % This script unzips fMRIprep output images, smooths them, zips the % smoothed images, and deletes all the unzipped images again. % % Script should be run from the root directory of the superdataset, e.g. % /data/proj_discoverie % The script is generic, i.e. it does not re...
7c9cbe012ce8ec0180e5700dd0da2205dc4e5c73a6c24585e968921b2f921b01
MATLAB
4,606
182
% This script just gives some examples of how the code can be used load('surface_data.mat') load('example_data.mat') %% Accentuate plotted data surface.vertices = lh_inflated_verts; surface.faces = lh_faces; vertex_id = lh_HCPMMP1; data = zscore(lh_HCPMMP1_gene_pc1); cmap = turbo(256); data_label = 'Gene PC1'; ...
0b96b90a076e168d2f70b8afe1b054151794a6e6499e10f1f0824ba5916b7f12
MATLAB
4,607
110
function S = GetMD5_helper(V) % GetMD5_helper: Convert non-elementary array types for GetMD5 % The C-Mex function GetMD5 calls this function to obtain meaningful unique data % for function handles, java or user-defined objects and sparse arrays. The % applied processing can depend on the needs of the users, therefore i...
c0e450fb9ce3972c1fdb9324fe4d411742fdfb28f13a9a90177761e3619760d6
MATLAB
4,607
95
function [dS,t,f]=mtdspecgrampb(data,movingwin,phi,params) % Multi-taper derivatives of time-frequency spectrum - binned point process % % Usage: % % [dS,t,f]=mtdspecgrampb(data,movingwin,phi,params) % Input: % Note that all times can be in arbitrary units. But the units have to be % consistent. So, if E is in sec...
cacaefffd6a327bc615ec90fe69a7a03ec98234eb72b8a2568c236f685555250
MATLAB
4,608
128
function bad_frames = LCN12_analyze_headmovement_PET(rp_file,threshold_translation,threshold_rotation) % bad_frames = LCN12_analyze_headmovement_PET(rp_file,threshold_translation,threshold_rotation) % % This routine displays overall displacements as % function of scan (time). % A log file is created with all results. ...
ab04db61b33b4e8b15990ca99f4669057522e7a592ce93819358852ed82d2086
MATLAB
4,610
94
function [dS,t,f]=mtdspecgramc(data,movingwin,phi,params) % Multi-taper derivative of the time-frequency spectrum - continuous process % % Usage: % % [dS,t,f]=mtdspecgramc(data,movingwin,phi,params) % Input: % Note that all times can be in arbitrary units. But the units have to be % consistent. So, if E is in secs...
10842c58c27d2206a4a35c5f2bf7c50e5a179f534f56b1abcae4d79055b3bdc7
MATLAB
4,612
105
%% Extracts the convex hull of the brain out of a CT image % % Andreas Husch % Centre Hospitalier de Luxembourg, Dept. of Neurosurgery / % University of Luxembourg - Luxembourg Centre for Systems Biomedicne % 2015 - 2017 % mail@andreashusch.de, husch.andreas@chl.lu function [convHullBrainMask, roughBrainMask] = extract...
e79bdff998b8fb3cc0eb3a7cfb2486e7c6e932001ad759dbcc81d75dc0c2ca36
MATLAB
4,612
135
% sbplot() - create axes in arbitrary subplot grid positions and sizes % % Usage: >> axis_handle = sbplot(v,h,index) % >> axis_handle = sbplot(v,h,[index1 index2]) % >> axis_handle = sbplot(v,h,[index1 index2],axprop,..) % >> axis_handle = sbplot(v,h,[index1 index2],'ax',handle,axprop,..) % %...
5d7c74afd5afaf137a52cefcf58bee4b1adfc2f90519632d8bc06607e10005e5
MATLAB
4,613
127
function ea_get_PCA_graphs(data, var_names, pcapath) % Plots diagnostic graphs that help to interpret the PCs and to choose % how many of them to retain for the fiberfiltering analysis % % data : a matrix with the data used, one variable per column, one % line per observation ...
1c4b436536114d540c90380ccaa72c90989113d92dbf2af6074d39a13d1880a1
MATLAB
4,614
134
function [ints, idx, MinTimeWindowParms] = ClusterStates_DetermineStates(... SleepScoreMetrics,MinTimeWindowParms,histsandthreshs) % can input histsandthreshs from externally if needed... ie via manual % selection in stateeditor %% Basic parameters % Min Win Parameters (s) if exist('MinTimeWindowParms','var') && ~...
935bfa7cfaecca635f79a50297f5b82defa73114a9e5f9544f14d35a3fc08fcc
MATLAB
4,615
125
function trainedML = train_MLP_matlab(database_train, params_train, n_layers, n_neurons, n_MLPs, SANDIinput) % Train a Multi Layer Perceptron regressor for SANDI fitting % % Author: % Dr. Marco Palombo % Cardiff University Brain Research Imaging Centre (CUBRIC) % Cardiff University, UK % 4th August 2022 % Email: palom...
ac201bb677bab75e12a7851ded1e0dd966fdd88de5266799e7bfeadfe45616f1
MATLAB
4,618
159
function [R, dR, field, rm, peaks] = DistanceFromField(self, cel, strict, plot, peaks) % returns the minimum distance from field centers. % corresponds to root.x and root.y. % % may program this so dR is derived from the root.vel vector in case the % kalman is there. for now, I will convolve with a gaussain of std 2bi...
c3756703c8e333dd1cafef3402692593e7801dea52bb1625a5779d012941f7e6
MATLAB
4,618
134
function [d pred] = shortest_paths(A,u,varargin) % SHORTEST_PATHS Compute the weighted single source shortest path problem. % % [d pred] = shortest_paths(A,u) returns the distance (d) and the predecessor % (pred) for each of the vertices along the shortest path from u to every % other vertex in the graph. % % ... = ...
83d7fa709c7d5eecb53d310a1215f3e9dfc4d3101688ec6830a2e2a6fec4415b
MATLAB
4,621
142
function [vatFibScoreBin, vatFibScoreSum, vatFibScoreMean, vatFibScorePeak, vatFibScore5Peak] = ea_discfibers_vtascore(vatlist, atlas, side, posneg, threshold) % Calculate VAT fiber connection scores based on the discfiber atlas if ischar(vatlist) vatlist = {vatlist}; end disp('Load discfiber atlas...'); load(atl...
39903a2b3b7c44737e4103c9574830ce54d199e7ab8a2189660f9b671fe37710
MATLAB
4,622
120
% subsref() - index eegdata class % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008 % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; e...
e35279ac5bbcaf6e664330ff547fd58e1a4f21114275f7787ff0ee368789606a
MATLAB
4,622
151
function palm_hemisplit(varargin) % Split back bh into lh and rh for files that have previously % been merged with palm_hemimerge. % Output file names have prefix "lh" and "rh". % % palm_hemisplit [-v #vtx] [-f #fac] <files> % % Wildcards are accepted. % % -v <nV> : Specify the number of vertices for the left hemispher...
e3abbf53bf9f216b21f69c6fb439409dd1647bb1075c5780bcbac68282bf3fb5
MATLAB
4,624
98
% 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...
219100f0633bb8326464585c3c0fc8ee1c1eb0be32e15dea72bafbbfc6ab9acd
MATLAB
4,626
167
function [vertices, edges, line_colors] = create_marker_lines(h, type) % File: create_marker_lines.m % Author: Ioannis Filippidis, jfilippidis@gmail.com % Date: 2012.06.14 % Language: MATLAB R2012a % Purpose: create linesets for markers which are not points % Copyright: Ioannis Filippidis, 2012- ...
6bf777c14e9868096692203f24cb6a83af290042085e8ccf5c897562c6a9005b
MATLAB
4,630
175
function plotexample_LFPs(animal) load('W:\bad_chans_table.mat'); bad_chans = table2cell(bad_chans_table); if strcmp(animal,'3xTg1-2')==1 load('F:\Ephys Analysis\VLSE neuro 4-4 - HPC2\probe_data\ECHIP512_3xTg1-2.mat') else load('F:\Ephys Analysis\VLSE neuro 4-4 - HPC2\probe_data\ECHIP512.mat') ...
ed6afd8965a7e6e9e91448f9555942bf84554cc117d285242aa3dc32b092eff7
MATLAB
4,631
122
function [spectrum,f,s] = MTPointSpectrum(times,varargin) %MTPointSpectrum - Compute point process spectrum by multi-taper estimation. % % The spectrum is computed using the <a href="http://www.chronux.org">chronux</a> toolbox. % % USAGE % % [spectrum,f,s] = MTPointSpectrum(times,<options>) % % times ...
80021ccbea30888d0287963005dfe851f3e1ff389e9a2d8b419d9236b245a4aa
MATLAB
4,632
135
function trackMoments = calcTrackMoments(coordinates,standardDevs,... momentOrders,maxLag) %CALCTRACKMOMENTS calculates the order^th moments of a track (MSD when order = 2) % %SYNPOSIS: trackMoments = calcTrackMoments(coordinates,standardDevs,... % momentOrders,maxLag) % %INPUT coordinates : nTP-by-nD array of ...
726adb7216dc2ee9404e30faefdd109c8fde2e37af1f724a40eb8e2d038dcf43
MATLAB
4,634
139
% ttest2_cell() - compute unpaired t-test. Allow fast computation of % multiple t-test using matrix manipulation. % % Usage: % >> [F df] = ttest2_cell( { a b } ); % >> [F df] = ttest2_cell(a, b); % >> [F df] = ttest2_cell(a, b, 'inhomogenous'); % % Inputs: % a,b = data consisting of UN...
98aa5cb4d2a32da1ae10b841c4136bede4ec5e290c52af63b42b67b52d5911f1
MATLAB
4,635
133
function [f, pp] = make_plot2_swarm2(plot_an, plot_aw, colL, colR, markerSize, markerAlpha, jitterWidth, null99_an, null99_aw) % make_box_plot2 : swarmchartを使った簡易ヒゲなし箱ひげ図 % MATLABのswarmchart関数でデータをプロットし、Q1-Q3を太い線で表示、中央値を〇で表示します。 % null distributionの99%ラインを点線で表示します。 % ※ MATLAB R2020b以降が必要です % % 入力: % plot_an...
49759f41b877a448e40a1cb1e9bbcc6728664786473388ddda570be8f7f57e3d
MATLAB
4,636
174
figtitlebase = 'BucknerLab rsFMRI Cosine Similarity'; image_set_name = 'bucknerlab'; % keyword for named set to pass into load_image_set [mapset, netnames] = load_image_set(image_set_name); mycolors = seaborn_colors(length(netnames)); k = length(DAT.conditions); myfontsize = get_font_size(k); % This is a function...
7fc9bb8b8678a097c3aa2fe2eccb5e5f0c657d4017bbc7fb42b03a8339cde86e
MATLAB
4,637
171
% Version 26/06/2026 % Authors: Alessandro Petrini and Davide Pierangeli % ------------------------------------------------------------------------- % This script is provided as a reference implementation of the digital % backend used in the high-dimensional photonic neural network implemented % in the manuscr...
f6654a3838313014ac8da2f81c6bebc8707b193f0547576be7b89c57717fca78
MATLAB
4,637
116
function [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossSpecMatpb(data,win,params) % % % Multi-taper cross-spectral matrix - another routine, this one allows for multiple trials and channels % Does not do confidence intervals. % Also this routine always averages over trials - binned point process % % Usage: % % [Sc,Cmat,Ct...
aae4a0c3e5e0abbe3852767b6177ecaf901b2e8ce97c741105eb685b11959a1a
MATLAB
4,641
159
function CutDatFragment(fname,timeperiod,RenameOriginalsAsOrig) % Creating a new dat file from a fragment of an original dat file % INPUTs % fname: filepath/name of original dat % timeperiod: start and stop of file fragment to keep, in seconds % RenameOriginalsAsOrig: [optional] - specifies naming convention for new vs...
d20b59284e13439c1efdbb4bea47a9db22d57ad2052d3765dfe2572a6a07e58d
MATLAB
4,647
177
% Script that runs dynamic perimeter model shown in Figure S4 for a % specific parameter choice % Adapted from Troost et al., 2023 %% RUN SCRIPT for SOP Weighted Lateral Inhibition Model %% Dynamic perimeter driven by Activated Delta clear; close all; clc; %% Model setup model.ratio = 'rho'; model.zone = 'Gaussia...
f0cb722acce129355da9ea483dc40565bfb3f75f16882dc7769b9d0c6b330da9
MATLAB
4,647
154
%% Draw neural field model clear; clc; loadparam; % Create function for surface f = @(x, y) 1-2*(x.^2+y.^2); % Create surface mesh Nx = 41; % 41 x 41 grid x_coord = linspace(-0.5,0.5,Nx); y_coord = linspace(-0.5,0.5,Nx); [X, Y] = meshgrid(x_coord, y_coord); % Generate grid data Z = f(X,Y); % Calculate Z values % C...
0b0f132a4965f25ffeb35d968ab89a68881416377e91f23a1c328db15b44ce93
MATLAB
4,649
127
% this script reads all the spike timestamp and a/d info from a plx file into matlab % variables. % Open a plx file % this will bring up the file-open dialog StartingFileName = ''; %StartingFileName = 'c:\plexondata\NSSample.plx'; %StartingFileName = 'c:\plexondata\au101602a.plx'; [OpenedFileName, Version, Fre...
9dea56d430c33bb9a31177cc78a276efdac8e582e7e92e8372857f4df8ab62b4
MATLAB
4,650
143
classdef Grid < uix.Grid %uiextras.Grid Container with contents arranged in a grid % % obj = uiextras.Grid() creates a new new grid layout with all % properties set to defaults. The number of rows and columns to use % is determined from the number of elements in the RowSizes and % Colum...
dd531f413138424f80e8932ba1233ec63f1492e0fabdb79f9233918bd6762e98
MATLAB
4,654
122
function [curve,stats] = FiringCurve(samples,spikes,varargin) %FiringCurve - Compute firing curve (e.g. for a head direction cell). % % Compute firing curve (e.g. for a head direction cell, or a place or grid cell % on a linear track), as well as occupancy and spike count curves. Optionnally, % curve statistics can...
e8ea3d61c0ad39025aa311021be489db53fadbbcac430032e2e19cc5786a08aa
MATLAB
4,655
130
function [y,dx,k, r] = wrapPcg(L,Lden,At,dense,d, DAt,K, rb,rv,cgpars, y0) % [y,r,k, DAy] = normeqPcg(L,Lden,At,dense,d, DAt,K, b, cgpars, y0,rhs) % % WRAPPCG Solve y from AP(d)A' * y = b % using PCG-method and Cholesky L as conditioner. % If L is sufficiently accurate, then only 1 CG-step is needed. % In general, pro...
1a6cd183fd8642f3d9eae813d79238b0d45b629c2ae009a353afeabfbe2c7720
MATLAB
4,659
147
function wtcsig=wtcsignif(mccount,ar1,dt,n,pad,dj,s0,j1,mother,cutoff) % Wavelet Coherence Significance Calculation (Monte Carlo) % % wtcsig=wtcsignif(mccount,ar1,dt,n,pad,dj,s0,j1,mother,cutoff) % % mccount: number of time series generations in the monte carlo run (the greater the better) % ar1: a vector contain...
9033fd01cb20f4ab3748d20b43f7808e569e7507bbf7720f1d471c59fd752c04
MATLAB
4,660
89
function [S,f,varS,C,Serr]=mtspectrumsegc(data,win,params,segave) % Multi-taper segmented spectrum for a univariate continuous process % % Usage: % % [S,f,varS,C,Serr]=mtspectrumsegc(data,win,params,segave) % Input: % Note units have to be consistent. See chronux.m for more information. % data (single ch...
df01a9a8e8eb9ab1888948e9ab2c4fdd8496f5510b3cb2b2fefe449bc30959fd
MATLAB
4,665
135
function [rate_map, xs, ys, xdim, ydim, no_occupancy] = plot_rate_map(self, cel, suppress_plot, xdim, ydim, clims, mergeepochs) % [rate_map, xs, ys] = root.plot_rate_map(cel, suppress_plot, clims) % % Plots spatial rate map for cell cel = [ tetrode, cell ] for all root.epoch % (multiple epochs concatinated). % % Return...
da121097e12380fea15be0b865ce7b2b4d73ad730985e162ab7ee546b8de1f6e
MATLAB
4,666
125
function [trackedFeatureInfo,trackedFeatureIndx,trackStartRow,numSegments,aggregStateMat] = ... convStruct2MatIgnoreMS(tracksFinal,startFirstFrame) %CONVSTRUCT2MATIGNOREMS converts tracks from structure format to matrix format, ignoring merges/splits. % %SYNPOSIS [trackedFeatureInfo,trackedFeatureIndx,trackStar...
38e63a3ae9629df6c485320024182672c0fa865c659fc973a693ef3512550ae8
MATLAB
4,669
158
function [pval table] = circ_wwtest(varargin) % [pval, table] = circ_wwtest(alpha, idx, [w]) % [pval, table] = circ_wwtest(alpha1, alpha2, [w1, w2]) % Parametric Watson-Williams multi-sample test for equal means. Can be % used as a one-way ANOVA test for circular data. % % H0: the s populations have equal m...
ae57adefe3bc8bdc4e02158011673bddbf842c59682eeb4b49359e9f5b185d0e
MATLAB
4,669
133
function [total_count_norm,biomass_norm,scaleFactor,med_counts,med_biomass] = calcNorms(keep_species,data_counts,intervene_matrix_filtered,biomass,experimentBlocks) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome t...
00e218e26d714d9bbdcd99803ab61e3449a0d6711c5eadd71d2e4dd8bf96a7eb
MATLAB
4,671
93
function [C,phi,S12,f,zerosp,confC,phistd,Cerr]=cohmatrixpt(data,params,fscorr) % Multi-taper coherency matrix - point process times % % Usage: % % [C,phi,S12,f,zerosp,confC,phistd,Cerr]=cohmatrixpt(data,params,fscorr) % Input: % data (structure array of spike times with dimension channels) - required ...
6bca4045cd14e8ffa3bf5f4e224287ec28a1a5fab639aebe709d88cd4e5cb1b5
MATLAB
4,676
127
function [synchronized,indices] = Sync(samples,sync,varargin) %Sync - Make sample timestamps relative to synchronizing events. % % Select samples that fall around synchronizing events, and make their % timestamps relative to the synchronizing events. This can be used to % build e.g. spike raster plots or successive ev...
1513228c5d5ac24fce0551f663bb78bcf6cf2da19529e78cc9e35b1b8c5b5eec
MATLAB
4,677
114
function res = summarizeSlopeReduction(slopeA, slopeP, areaName) %SUMMARIZESLOPEREDUCTION Quantify passive reduction of repetition-rate slope. % % slopeA: behavioral/active slope % slopeP: passive slope % % Output includes: % allChannels: % mean slopes across all included paired channels % activeEnhancementCh...
83e74094853b64c2591a99620150da9b34369e7fb905545b7e01955cbce1ff1a
MATLAB
4,683
139
% angtimewarp() - Given two event marker vectors, computes a % warping of the input angular time series so that its % evlatencies match newlatencies. Values of the warped % timeserie that falls between two frames in the original % timeserie will be linearl...
6fc1d3cde87b0f0689b25b9cd18893671aaee1fc108a74f0056852dc72bd1642
MATLAB
4,684
142
%%% normalize & average MUA - THINGS dataset % 2022 P. Papale fecit clear all addpath(genpath('\_code\code_utils_v2\')); % constants monkey = 'monkeyN'; datadir_gen = '\'; % chns to region if monkey == 'monkeyN' rois = ones([1 1024]); % V1 rois(513:768) = 2; % V4 rois(769:end) = 3; % IT else rois = on...
acbed3a9eacca9bdee82fa8f0e4e72a3ec362425f6b49d32940abaacef143f74
MATLAB
4,685
87
addpath('/dartfs-hpc/rc/home/m/f0042vm/software/spm12'); addpath(genpath('/dartfs-hpc/rc/home/m/f0042vm/software/canlab/CanlabCore/CanlabCore/')) addpath(genpath('/dartfs-hpc/rc/home/m/f0042vm/software/canlab/Neuroimaging_Pattern_Masks/')); %% Plotting Parcellations % There are two ways to plot parcellations. One is b...
a4645ed1f41e6c42d4b3eb9bd62de56f48ffc00796a2f6aeafa423ee81557972
MATLAB
4,688
122
function [coord_snapped] = LeG_warp_hermes2010(~, elec, surf, GridDim) % WARP_HERMES2010 projects the ECoG grid / strip onto a cortex hull % using the algorithm described in Hermes et al. (2010, % J Neurosci methods) in which electrodes are projected onto the pial % surface using the orthogonal local norm vector to th...
2dd86db618b10eb409be8b3f423421f6c60956069ea04f57f610183d2b958925
MATLAB
4,689
117
function [interpolated,discarded] = Interpolate(samples,timestamps,varargin) %Interpolate - Interpolate samples (positions, spikes, LFP, etc.) at given timestamps. % % Interpolate samples (positions, spikes, LFP, etc.) at given timestamps. As a special % case, a point process can also be 'interpolated' by changing eac...
1d75553d07ec62ae3c036b1e087d2da66836e3311cf11863eaecbfce4e88e60e
MATLAB
4,690
142
function [res, errStr]= morph_data(mask, kernelAy, kernelPos, OPStr, noVoxInKernel, forceKPos) %function [res, errStr]= morph_data(mask, kernelAy, kernelPos, OPStr, noVoxInKernel, forceKPos) % % Funktion to apply any binary morphology kernel an binary images or 3D datasets. % % Input: % -mask: mrStruct and schou...
c76b93c74ece74054786735317757e7dd9bca9e28e70db7b54df44229f49820b
MATLAB
4,692
115
function ydata = tsne_p(P, labels, no_dims, max_iter) %TSNE_P Performs symmetric t-SNE on affinity matrix P % % mappedX = tsne_p(P, labels, no_dims, max_iter) % % The function performs symmetric t-SNE on pairwise similarity matrix P % to create a low-dimensional map of no_dims dimensions (default = 2). % The matrix ...
adb48a5b66dc3a7fcb3832ec753cc1e4d16fcc7646ece6a43e62e18b74295c44
MATLAB
4,693
116
% vectdata() - vector data interpolation with optional moving % average. % % Usage: % >> [interparray timesout] = vectdata( array, timesin, 'key', 'val', ... ); % % Inputs: % array - 1-D or 2-D float array. If 2-D, the second dimension % only is interpolated. % timesin - [floa...
e3af92ccb611f6565e5d5ce21fed8a33d6fb0816bf0f71818056d6926a11520f
MATLAB
4,695
108
% Name: Robert Kim % Date: 05-14-2023 % Email: robert.f.kim@gmail.com % one_modality_cebra.m % Description: Plot example CEBRA trajectories for the one-layer, % one-modality instruction-DMS (instr) RNN. This script loads a CEBRA % embedding produced by cebra_for_matlab.ipynb and renders trajectories % during the instru...