sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
1d2acc106804d2db92b11b382348a3dbdb29465c68a87058428fa065c535b7bc
MATLAB
10,548
286
function varargout = multiwaveplot(varargin) %MULTIWAVEPLOT Stacked line plots from a matrix or vectors % % Multiwaveplot draws a series of stacked lines (one on top of the other) % contained in the rows of an input 2-D matrix. Each line has a % designated row on the plot; the first row is plotted at the bottom ...
e3063513bcfb6d80b57f1c2190e92bf6f3ce6eafde7ebc41ef82515eab498b93
MATLAB
10,557
306
function [FaceVertexCData,new_cmap,new_climits,orig_data_climits] = makeFaceVertexCData_old(vertices,faces,vertex_id,data,cmap,colorFaceBoundaries,colorUnknownGrey,climits) % This script will plot the boundaries defined by some parcellation/ROIS on % a surface projection. It can also alter the colormap so regions that...
2c060a1244103e26a4fd215e60314b4749b3cf8b9475d14aca5b6c9ed33bd692
MATLAB
10,558
232
classdef (Abstract, CaseInsensitiveProperties = true) statsPlot < ... matlab.mixin.SetGet %STATSPLOT An abstract superclass for classes that plot statistics % % As an abstract class, this class cannot be instantiated. It provides no % public methods. The class is a super class for: % - iosr.statistic...
0e1a30032a18467eba047a40999dc2ecb208e14d81f88fe2637193d1950f7b11
MATLAB
10,571
263
function dat=plotstrongestdir_save(avgfluor,redtemps,ROIs,Xpix,Ypix,framerate,maxvec) %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...
fbd87fbb71e50a2e3eafb8f69197c598400121526fb35409f4aabbeac6dd9461
MATLAB
10,574
234
function cmap=get_colormap(nc,nl,opts) [temp_c , temp_l] = meshgrid(1:nc,1:nl); color_ind = temp_c(:); lightness_ind = temp_l(:); if ischar(opts.map) %Brewer colormaps from http://colorbrewer2.org switch opts.map case 'matlab' cmap=lines(); cmap_nc = 8; cmap_nl = 1...
4bef8e3833d5c86665dfec6d07314c9e8e9628b5522a3c0827716617e07a13f4
MATLAB
10,575
227
function [I,Ihat,cvs,val_struct]=ea_explorer_crossval(viz,tractset,strategy,iterations,posthoccorrect,customconfig) if ~exist('customconfig','var') customconfig=[]; end switch tractset.multitractmode case 'Split & Color By Group' if ismember(strategy(1:6),{'Custom','Import'}) ea_error('Mul...
c75b8cb6b4b8a3b56a26f070e20d9505024e10498f40dd0b8b116cdafa017020
MATLAB
10,576
227
function [I,Ihat,cvs,val_struct]=ea_disctract_crossval(viz,tractset,strategy,iterations,posthoccorrect,customconfig) if ~exist('customconfig','var') customconfig=[]; end switch tractset.multitractmode case 'Split & Color By Group' if ismember(strategy(1:6),{'Custom','Import'}) ea_error('Mu...
96668611fc64b181d6727e157f47e44efa5bf67cebee8f657cbe33f62d3da497
MATLAB
10,587
322
function stackview(hr,ftr,showfun) if nargin == 2, showfun = @imagesc; end; ds.maps = computeParameterMaps(ftr,1); ds.img = ds.maps.vf; ds.hr = hr; ds.ftr = ftr; set(datacursormode,'UpdateFcn',{@(x,y) labeldtips(x,y,ds)}) datacursormode on %f = figure('Position',[360,500,750,585]); f = gcf; clf; h =...
1e07c634720e7df68b51a53d6d18969709cf817ca9c7a6a7cdb5303532eac3d9
MATLAB
10,593
271
% pop_biosig() - import data files into EEGLAB using BIOSIG toolbox % % Usage: % >> OUTEEG = pop_biosig; % pop up window % >> OUTEEG = pop_biosig( filename, channels, type); % % Inputs: % filename - [string] file name % % Optional inputs: % 'channels' - [integer array] list of channel indices % 'blockrange'...
aa190a3f5f22fb0e6ae2c7369c56ae7e9873b668ea6a630054762cb82f6ebc61
MATLAB
10,607
357
function baseline = CBIG_hypoTest_4t(betas, stats) % baseline = CBIG_hypoTest_4t(betas, stats) % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md baseline = zeros(18, 3); %% AD fprintf('\n----------------------------- AD -----------------------------\n'); fprintf('\...
e14a42daf0dbf9418773786f288ef20aad9a6ebc0974a358316a8fe19cf2fc19
MATLAB
10,609
338
%% a3_state_dependent_BGA_dynamics.m % % Goal: % Characterize state-dependent BGA dynamics (UP vs DOWN) % - Timecourses (onset-locked & response-locked) % - Pre vs Post reversal (State × Period) % % Figures: % Fig 2d : aIns timecourse (onset) % Fig 2e : aIns State × Period % Fig S3 : response-locked ...
7649245d02c03438c33526364ed5202db497ef26187134e1e9de1e04afa02b39
MATLAB
10,613
336
%% =============================================================== % 03_state_dependent_BGA_dynamics.m % % Goal: % Characterize state-dependent BGA dynamics (UP vs DOWN) % - Timecourses (onset-locked & response-locked) % - Pre vs Post reversal (State × Period) % % Figures: % Fig 2d : aIns timecourse (onset)...
a8992eb40b3d58fdec865d95846cdc5e152dda0f13ee45e801bde29d0af78a18
MATLAB
10,622
262
clear; load("data_folder/Egestive_priming_data.mat"); load("data_folder/btype.mat") % Skip experiments 5, 6, 9 % Remove channel 141 for experiment 4 ch{4, 1}(141) = []; ch{4, 2}(141) = []; % Data processing code animal = 1; sigma = 0.05; downsample_factor = 150; % 10 ms spike_threshold = 0; % no threshold protractio...
ffa3673f59201b17eb5fad32f9ec2d9006c23bd2c2882ad82075b1ffed4c8cf7
MATLAB
10,622
327
function [] = fig2u3d(ax, fname, imgtype, addaxes, varargin) %FIG2U3D Convert figure to U3D file. % FIG2U3D saves the current axes as a U3D file for inclusion as an % interactive 3-dimensional figure within a PDF. Either LaTeX or Adobe % Acrobat can be used to embed the U3D file in the PDF. % % A VWS fi...
d9ed4c689e4b443714d8ffa982647a293a079ef1e96017eafcf8fcac366d3cff
MATLAB
10,634
234
% pop_firws() - Filter data using windowed sinc FIR filter % % Usage: % >> [EEG, com, b] = pop_firws(EEG); % pop-up window mode % >> [EEG, com, b] = pop_firws(EEG, 'key1', value1, 'key2', ... % value2, 'keyn', valuen); % % Inputs: % EEG - EEGLAB EEG structure % 'fcutoff' - v...
635bdf072b0c7911d69f591a0ce8e0f6feee65a816d821b391e09c7682e65adb
MATLAB
10,637
297
function cm = magma(n, opt_interp) % Colormap: magma %-- Parse inputs ---------------------------------------------------------% if ~exist('n', 'var'); n = []; end if isempty(n) f = get(groot,'CurrentFigure'); if isempty(f) n = size(get(groot,'DefaultFigureColormap'),1); else n = size(f.Colormap,...
a8d104264b2816ce6810b7c8f636ed3cfc006809bf77ea084d28470d89cf21c8
MATLAB
10,641
319
function IDX = LaBGAScore_dep_build_index(varargin) % % % *USAGE* % % Builds an index of every callable file (.m, .mex*, .p) under the given % dependency roots, mapping each callable NAME to ALL of its candidate % definitions. LaBGAScore_dep_map resolves identifiers against this index. % % The index exists because whic...
f69ad886e28e5bea9fa64076f9f052cae6d845d6816b391cf0f6ed35abe7a8d5
MATLAB
10,649
282
function self = LoadLFP(self, ind, varargin) % Loads LFP data file into root.b_lfp property % % (1) Loads root.path_lfp(root.active_lfp) % (2) Loads all root.path_lfp(indices) to current object % % So far, .mat files with lfp, lfp_ts fields can be imported. .ncs % files can be imported. other methods % can be added % %...
6f282cde61581b85ef351de96f003826bd66572825122fe0881fb884cb58b204
MATLAB
10,655
280
% subsasgn() - define index assignment for eegdata objects % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008 % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Fr...
a7b45e7e2a8dd59ccf64f25da0e82e407c48b2905da574885f5c4f9658155482
MATLAB
10,661
357
function baseline = CBIG_hypoTest_4t(betas, stats) % baseline = CBIG_hypoTest_4t(betas, stats) % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md baseline = zeros(18, 3); %% AD fprintf('\n----------------------------- AD -----------------------------\n'); fprintf('\...
af69fd8fc53adce27ae38508b28fa0ad8c4638585ddae4f2b34f375914183bfa
MATLAB
10,674
293
%% Step 4 Tiny Dancers: Group analyses for autocorrelation %% Load data clear clc cd('D:\TinyDancers_Movement\fieldtrip_velo\AE_PROC\SD5\Step3_autocor\3m\'); respdata_mus=[]; respdata_freq=[]; FileNames = {dir(['*' '.mat']).name} ; for k = 1:1:length(FileNames) load(FileNames{k}) avg_baseline_3m{k...
c7b9fbf9a0cea64f5c7bb2009391bd95b5bd07ac4353547f32039412c0a788b7
MATLAB
10,676
320
% Find boundary of a cell layer in an image. % % This follows some of the recommendations by Treloar & Simpson, Plos One % e67389, 2013 % % The script first turns the image into a binary by finding locations in % the image having gradients larger than a threshold value. Those locations % are then dilated. Various oper...
dc26077694c3ba78c26e7fe1c98754120e7e1406ee8e9723032fe50a10354b2d
MATLAB
10,684
340
function [ixes]=ea_centrality_significance(XYZV) % clear NAN vars: XYZV(isnan(XYZV(:,4)),:)=[]; % setup randomization: ea_dispercent(0,'Permutation based statistics on strength centrality'); maxiter=5001; csize=zeros(maxiter,size(XYZV,1)); for iter=1:maxiter dat=XYZV; if iter>1 dat(:,4)=dat(randpe...
df688749e24078f109d21199ac4b5297ef69a5433f017152a9bb03f53efe5667
MATLAB
10,691
242
% pop_rejchanspec() - reject artifacts channels in an EEG dataset using % channel spectrum. The average spectrum for all selected % is computed and a threshold is applied. % % Usage: % >> pop_rejchanspec( INEEG ) % pop-up interative window mode % >> [OUTEEG, indelec] = pop_rejchan...
229901b6cad03975082b14828a148c6a5bfcf984e18b85ebf91952a0cf1279a5
MATLAB
10,715
179
% pop_specparams() - Set plotting and statistics parameters for computing % STUDY component spectra. % Usage: % >> STUDY = pop_specparams(STUDY, 'key', 'val'); % % Inputs: % STUDY - EEGLAB STUDY set % % Plot options: % 'topofreq' - [real] Plot Spectrum scalp maps at one spec...
7bd3aced4934d4b0a2b060968d51c88434245d674e597e526eb0be8e26b1fd8f
MATLAB
10,732
248
close all % addpath ~/Documents/MATLAB/xml_io_tools/ (may need to add path to files) my2Pscr1('TSeries-06132019-1507-4883/','do_load',{[1:1700],[1:2],[1]},'do_motc',[4 100 1 1 0],'do_motcref',[1 1],'do_keepraw'); %my2Pscr1('TSeries-05302019-1228-4772/','do_loadall','do_motc',[4 100 1 1 0],'do_motcref',[1 1],'do_keepr...
d3cc26a10f76d54e78d12a1cc3dffafa0a6e482110fae8478e7045aa7744fe18
MATLAB
10,737
413
function saveNSx(NSx,varargin) %% % Save an .NSx file from an NSx structure (gained by using openNSx) % Works with file spec 2.3 and 3.0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Use: saveNSx(NSx,optionalinputarguments) % NSx: The NSx data structure. % All arguments belo...
4d40ac7666cf4ecb7d850ba2998c654b18e607cad8a73a0aac2fff4332363f48
MATLAB
10,740
300
function shim = cvx_sedumi( shim ) % CVX_SOLVER_SHIM SeDuMi interface for CVX. % This procedure returns a 'shim': a structure containing the necessary % information CVX needs to use this solver in its modeling framework. global cvx___ if ~isempty( shim.solve ), return end if isempty( shim.name ), fname = ...
46ecdd790da6a30a30f57ba4a303efe20cf526f6da102d2913072c3c9bbafe79
MATLAB
10,748
439
% Main script with ODEs and solvers for dynamic perimeter model % Adapted from Troost et al., 2023 function [yout,tout,params] = SOP_multicell_LI_adapted_DYNAMIC_perimeter_HillsNoRecovery(model,params,y0) %% prepare pp = genpath('functions'); addpath(pp) % load defaults if absent if(nargin < 2) switch model.rat...
5a97d9d4a885492d402e51aaf4cb8c61006ee58a36479eefc9a16d8e4f5745f9
MATLAB
10,759
361
% The basic application of the 'reslice_nii.m' program is to perform % any 3D affine transform defined by a NIfTI format image. % % In addition, the 'reslice_nii.m' program can also be applied to % generate an isotropic image from either a NIfTI format image or % an ANALYZE format image. % % The resliced NIfTI fi...
71745730f29fbb65db30a65a83dd012de64e4e77baa51e810a1f342131ad7a3d
MATLAB
10,775
273
function [hObject, handles] = dan_plot_hypno(hObject, handles) %% % Authors: Dan Denis % Date: 2021-07-14 %% % How many stage files are loaded f = fieldnames(handles.psg.stages); f(cellfun(@isempty, regexp(f, 's\d', 'match'))) = []; hypnoX = 1:1:length(handles.psg.stages.s1.stages); %% Add lights out and light...
ffa491b75898bece2fe99a2e76e12a843c21f1afa085baff8ea9ca18d876d60d
MATLAB
10,777
372
roimask_imagename = 'v4-topics-100_25_inhibition_response_control_pFgA_z_FDR_0.01.nii'; if ~exist(which(roimask_imagename), 'file') try roimask = gunzip([roimask_imagename '.gz']); roimask_imagename = roimask{1}; catch end end % this map is similar but with fewer unique regions: %roimask_imagename...
b1a47f78b30b66647a9ee86f7b0ff7431c54ec274e3fe0f68b8311d940678a8d
MATLAB
10,784
254
%% LaBGAScore_firstlevel_s3b_phMRI_signature_responses.m % % % *USAGE* % % This scripts calculates signature response on every first-level condition % (one per timebin per condition) and writes a summary table in long format % for mixed model analysis in a statistical program of your choice. % % It also contains an op...
ba2db574ce12a4cd629f75f982d9d36d64408e31ae7a3c666ebaad2efe55ffb2
MATLAB
10,806
130
%----------------------------------------------------------------------- % Job configuration created by cfg_util (rev $Rev: 313 $) %----------------------------------------------------------------------- matlabbatch{1}.menu_cfg{1}.menu_entry{1}.conf_files.type = 'cfg_files'; matlabbatch{1}.menu_cfg{1}.menu_entry{1}.con...
0e48d8d51f6053fbe26f65869df36568b18237463bc7c0de7e62a99ee069b033
MATLAB
10,810
253
%% NiftiyMod - Base class for all Nifti Objects. Wrapping the nifti Toolbox, % rewritten no frills version of the more powerful NiftiModality Class % % Andreas Husch % Centre Hospitalier de Luxembourg, Dep. of Neurosurgery / % University of Luxembourg - Luxembourg Centre for Systems Biomedicne % 2016 - 2018 % mail@and...
e931bf381ddb260d7a5120deed96d00122854967a5bc4c7a0993a9a89bc969bc
MATLAB
10,812
309
function [phasedistros,phasebins,phasestats,h] = PhaseModulation(spikes,lfp,passband,intervals,lfpfreq,method,plotting) % USAGE %[phasedistros,phasebins,phasestats,h] = bz_PhaseModulation(spikes,lfp,passband,intervals,lfpfreq,method,plotting) % % % INPUTS % spikes - spike train, in seconds, a population or a si...
ffdb6424bec7e1445f21018b77ca80930698ea109b7405ed67f153617cf33e59
MATLAB
10,820
290
% NOTE: the use of this script is being deprecated, as the option to run % robust parcelwise second-level regression on conditions is now built into % prep_3a_run_second_level_regression_and_save.m; please use that script % instead of this one % @lukasvo76, May 2022 % THIS SCRIPT RUNS BETWEEN-PERSON (2nd-level) Robust...
af8f099affeca62197241a4b00630dd9dbea4f260d81da9e28b758cea597c913
MATLAB
10,823
316
function CBIG_MMLDA_add_text_to_forest_plot(forest_plot, file_pvalue, out_dir, p_thresh, k, compare_factor_names) % This function takes in the raw forest plot and p values, and add text to % the forest plot, such as 'F2 - F1', 'Latter is worse'. % The final figure will be saved in the same directory as out_dir, with a...
500638d92b6daa3aed749d46d49215ea0f1da7c961971e9dcbc94dbcbf1a91a5
MATLAB
10,833
361
function [subj_prob, avg_prob, roi_info] = compute_subject_ROI( ... p, roi_def, varargin) %FNIRSPOWER.MEASPRED.COMPUTE_SUBJECT_ROI % Generate subject-specific spherical ROI maps on a brain mesh. % % For each subject and ROI: % 1) Translate the nominal ROI center independently along x, y, and z. % 2) Limi...
eb352c2a0dc379f3b6e1aac61c3a6d34d8253e42ba51030d23ff5439a5acaad4
MATLAB
10,839
288
% function run_reg_fourier_TFM %RUN_REGULAR_FOURIER_TFM.M % % Compute tractions from substrate displacements. % % This script calls reg_fourier_TFM.m written by Yunfei Huang and Benedikt % Sabass, and published as Sci. Rep., 2019, vol. 9, pp. 1?16. % https://www.nature.com/articles/s41598-018-36896-x % Optional: I...
72b1b6e78a3b4dc2078865ec891b1bd86be77eaa3d00efe5bb393ac8fbf0355b
MATLAB
10,856
333
function AUC = quickCV_ENet(X,Y,C,opts) % quickCV_ENet Leakage-free quick CV AUC estimate for Elastic Net. % % This helper function provides a *quick* (non-nested) cross-validated AUC % estimate for Elastic Net models, intended specifically for high-repeat % diagnostics inside: % - permutation testing % - bootstr...
80212935588ef55546654d1cd7fcdfcb310981423ceb556d06f63a1347c96870
MATLAB
10,879
197
% EEGLAB cross-platform compiling script % should be run on a newly checked out EEGLAB version as % some folder are temporarily modified % % Arnaud Delorme - August 3rd, 2009 % Copyright (C) 2009 Arnaud Delorme % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU Ge...
943fc978102a18c92f3bc3c1463f1726599c0616dcd30771eac44c591b2b1015
MATLAB
10,887
262
function [cpAll, cpMean] = fun_so_spindle_coupling(soData, ssData, chans, srate, soEvents, ssEvents, varargin) % Slow oscillation-spindle coupling. Automatically detects coupling % events on multi-channel data and returns index of coupled and uncoupled % spindles as well as coupling parameters. Requires the circStats t...
94eb4e366bb35e73230a4055b814ff436f09e0e800f580a5e4418fc2857cfbdd
MATLAB
10,898
255
%% Multi-level kernel density (MKDA) meta-analysis example: Agency database % The starting point for coordinate-based meta-analysis (CBMA) is a text file % with the information entered from published studies. In this example, the % information is contained in the file "Agency_meta_analysis_database.txt" % It is in th...
8ab9ac006cb7d12dae94aed9b5a815cd647b07c194f9b543a8dbf5de6b2d39c3
MATLAB
10,905
396
%% figure 5 load('figure5_data') %% an_col = [30 58 205]/255; aw_col = [229 32 21]/255; awake_color1_5 = [0.8272 0.3489 0.2865]; anes_color1_5 = [0.1792 0.4769 0.7191]; %% Figure 5B % Define parameters norm_lim = [2.5*10^-3 3.17*10^-3]; null_coloar = [0.5 0.5 0.5]; % Set de...
4a8e2e4b642f1d6d01b8beae386ff4719ed1dbb9530c00745e8738e3f456ab48
MATLAB
10,907
332
function [maskBlobs,labels,maskBlobsVis] = segmentBlobs_locmax(image,... thresholdMethod,methodValue,filterNoise,filterBackground,minSize,locMax,plotRes,mask) %segmentBlobs_locmax segments blobs in 2Detection_IdxD images via various %thresholding methods and use local maxima to catch the dim objects % %SYNOPSIS ...
258a3bb94923c6ed344827b798bfb36be0096e3791ca415f48d22847c7f7528a
MATLAB
10,916
326
function varargout=ea_plot3t(varargin) % PLOT3T Plots a (cylindrical) 3D line with a certain thickness. % % h = plot3t(x,y,z,r,'color',n); % % PLOT3T(x,y,z), where x, y and z are three vectors of the same length, % plots a line in 3-space through the points whose coordinates are the % elements of x, y and z. Wi...
78bc208700f85b5f286e4732e05e608c288e45fb038b7805888b3a700273e7f2
MATLAB
10,919
243
% pop_eegthresh() - reject artifacts by detecting outlier values. This has % long been a standard method for selecting data to reject. % Applied either for electrode data or component activations. % Usage: % >> pop_eegthresh( INEEG, typerej); % pop-up interactive window % >> [E...
9e1600330a73a2e8b6c44c8547000a9551c682b5a5644dd5757a7571431e811d
MATLAB
10,924
334
function AUC = quickCV_ENet_PR(X,Y,C,opts) % quickCV_ENet_PR Leakage-free quick CV precision-recall AUC estimate for Elastic Net. % % This helper function provides a *quick* (non-nested) cross-validated AUC % estimate for Elastic Net models, intended specifically for high-repeat % diagnostics inside: % - permutatio...
6b885e447eb1cc6a5a17293f957e0dedd043641009e49fa1bb11d01ec4478f86
MATLAB
10,925
344
classdef Divider < matlab.mixin.SetGet %uix.Divider Draggable divider % % d = uix.Divider() creates a divider. % % d = uix.Divider(p1,v1,p2,v2,...) creates a divider and sets % specified property p1 to value v1, etc. % Copyright 2009-2016 The MathWorks, Inc. % $Revision: 1436 ...
1060a353f9abfff178eeae19b404648e1b6ea170d1966cd8a6962ce80f99d004
MATLAB
10,957
285
% configure file for reading DWI data (Dicom, Bruker or other formats) % DTI Configuration file % BATCH system (Volkmar Glauche) % % File created by Susanne Schnell function read_data = dti_cfg_read % --------------------------------------------------------------------- % dicom Input dicom file names % --------------...
6d81cd97e05b5f3035ef335deb94979f2a86b6857c4550a81a13b6fbd1e5bd49
MATLAB
10,964
319
function [F,time,ID,U,taxa_data,time_data,ID_data,U_data,F_prime,X,magnitude]=... import_data_and_construct_matrices(densities,total_biomass,perturbations,time,o_rescale_to_one,... o_differentiation,specific_density,sample_indeces_to_remove); % This file is a part of the MDSINE program. % % MDSINE: Microbial Dy...
7afb566d44da22304c878732e79f8010ce017ff088112b1d1f90cb43eaa3ec52
MATLAB
10,977
307
% loadavg() - loading eeg average data file from Neuroscan into % matlab. % Usage: % >> [signal, variance, chan_names, ... % pnts, rate, xmin, xmax] = loadavg( filename, version ); % Input: % filename - input Neuroscan .avg file % version - [1 or 2] function version. Default...
a791294a817051760e5b788118443d6c3b98a9f59c2d2a2db25ef117346388cb
MATLAB
10,978
294
function bz_fitPoissPlasticity(basepath, preID,postID,varargin) % This function takes a pair of neurons and fits a Poisson GLM to account % for long term monosynaptic coupling. This framework exploits a bin-by-bin baseline % offset that reflects the postsynaptic spiking binned at a timescale % slower than the fine time...
988f6eb20777e16802926093192caedd89295d269c4b9d141ce2df6da9acd737
MATLAB
10,993
266
function [A, bcol] = print2array(fig, res, renderer, gs_options) %PRINT2ARRAY Exports a figure to an image array % % Examples: % A = print2array % A = print2array(figure_handle) % A = print2array(figure_handle, resolution) % A = print2array(figure_handle, resolution, renderer) % A = print2array(figur...
3c09f020508b9b30c875debb8e02ca3556c5cc3b3d1813de306b25313eb8a878
MATLAB
10,994
285
% eegmovie() - Compile and view a Matlab movie. % Uses scripts eegplotold() and topoplot(). % Use seemovie() to display the movie. % Usage: % >> [Movie,Colormap] = eegmovie(data,srate,elec_locs, 'key', val, ...); % % Or legacy call % >> [Movie,Colormap] = eegmovie(data,srate,elec_locs,title,m...
40a9950b43c79b5e8213b0c5f41c8e782eabfc3de7b01f3095de745eefba0f83
MATLAB
10,994
226
classdef log_code_object < handle % This helper object saves the code of files that have been run. It is useful for saving information about % the exact code that was run so that one has a record of how particular results were generated. This object % gives several different methods for saving code in different fil...
c1fb6a6b235ef62310f4692eddcc83e8c0801f08904891dedabb089f790ab553
MATLAB
10,994
272
function [input,pls_opts,save_opts] = myPLS_initialize(input,pls_opts,save_opts) % This function sets up the defaults and checks the validity of inputs for myPLS_analysis disp('... Initialization ...') %% 1. Inputs % Compatibility with X0 and Y0 inputs if ~isfield(input,'brain_data') && isfield(input,'X0') inp...
fef6df7ef6ba83ef36de5eeb1dd6224cdc434be94167b1dc914bced7786abecd
MATLAB
10,994
309
%% Thresholds are calulcated as 2SD above baseline %% Extracting and Ploting sound evoked DF/F Data across time and individual neuron (MK) % Requires NormCorrFissa extracted data (_tifFIleData.mat), cellOrder and Soundfile % header in the workspace to work % DF/F using mean F from 1 sec before each sound stimulai...
3429f279aa1a0bc190155717c9003fed6e67e647cfe078897592490d06504967
MATLAB
11,010
287
function CFA_RunAllJob2(SetUpPara,Template,Para) Indir = SetUpPara.Indir; Outdir = SetUpPara.Outdir; filp = which('CFA_RunAllJob.m'); [pth,nam,ext] = fileparts(filp); spmjobdir = [pth,filesep,'NormJobmat',filesep]; Atlasdir = [pth,filesep,'TemplateUsed',filesep]; voxelsize = SetUpPara.OutVsize; BrainMaskdir = [pth,file...
97f99a0bdf867f9cd0fcb5c24b6c4a78a4b0a5f145498c9689937c5d6abb5845
MATLAB
11,020
254
% std_erpimage() - Compute ERP images and save them on disk. % % Usage: % >> std_erpimage( EEG, 'key', 'val', ...); % % Inputs: % EEG - a loaded epoched EEG dataset structure. May be an array % of such structure containing several datasets. % % Optional inputs: % 'components' - [numeric ...
120ef8207fa9f1dea7950a36ce79fb95d2902afdcd1c197cfcad3c797c84dfe3
MATLAB
11,025
309
function varargout = ea_sweetspotcontrol_hemi(varargin) % EA_SWEETSPOTCONTROL_HEMI MATLAB code for ea_sweetspotcontrol_hemi.fig % EA_SWEETSPOTCONTROL_HEMI, by itself, creates a new EA_SWEETSPOTCONTROL_HEMI or raises the existing % singleton*. % % H = EA_SWEETSPOTCONTROL_HEMI returns the handle to a new E...
ff61f0b3e1c5fabaf09f119c9ab6fefd1b84f3b231d3af29f5f95b495598c6cc
MATLAB
11,031
362
function cs_fmri_conseed_pmap(dfold,cname,sfile,cmd,writeoutsinglefiles,outputfolder,outputmask) tic % if ~isdeployed % addpath(genpath('/autofs/cluster/nimlab/connectomes/software/lead_dbs')); % addpath('/autofs/cluster/nimlab/connectomes/software/spm12'); % end if ~exist('writeoutsinglefiles','var') wr...
8b3c5eff524e14954634533b90e005d484f22185a548938b467be0a477e056ee
MATLAB
11,033
278
%% ============================================================ % WT-only wrapper based on your original PrL SB code % % Purpose % Run ONLY the WT mice with: % - random 60% neuron selection % - 50 repeats % % Output % 1) PrL_SB_WTonly_struct_results_downsample60_repeat50.mat % 2) PrL_SB_WTonly_detaile...
055d103136ae6aea8acce1a0f8c4bb3d86a8076d8f8aef7d12ca24c56ed4032c
MATLAB
11,035
371
function y=processBiopacStruc(x,fs,fco,t0avg,dtt,po2cal,po2tr,refvar,skp) % Usage ... y=processBiopacStruc(x,fs,fco,t0avg,dtt,po2cal,po2tr,refvar,skp) % % x- parseBiopac variable % fs- sampling rate in Hz, fco- cutoff frequency in Hz, t0avg in time % note: a second entry in fs will be the interpolated desired sa...
2a695fd82496fdd2baec70f42d65c103121470af2d1948a9983e2e3389d67090
MATLAB
11,039
286
function [varargout]=lye_r(X,Fs,tau,dim,varargin) % [out]=lye_r(X,Fs,tau,dim) % inputs - X, If this is a single dimentional array the code will use tau % and dim to perform a phase space reconstruction. If this is % a multidimentional array the phase space reconstruction will % n...
87ce38e2a10e4d9ac210c7ff196cd927e4a990fe607630716507d9c7b3c4164a
MATLAB
11,064
307
function DBExportGallery(name,query,varargin) %DBExportGallery - Create figure gallery from current database. % % Select figures and create an HTML gallery (although not required, installing % <a href="http://sites.google.com/site/oliverwoodford/software/export_fig">export_fig</a> will yield better PNG images). % % U...
250b2baffd411885af3aed076f5e1f5ca8a2327482a0922d7f9a8e8733d8c630
MATLAB
11,069
237
% Script to define all Inputs for PLS for Medical Image Processing Toolbox % % Parameters to be defined in this script are: % % - input : struct containing input data for the analysis % - .X : N x M matrix, N is #subjects, M is #imaging variables % - .Y : N x B matrix, B is #behav...
4012658a145a9dc6f1d1293390e020b7c7dfc7004df8d17d079aa31ca1abf1c6
MATLAB
11,073
330
function [] = run_model_fitting(SANDIinput) % Main script to fit the SANDI model using Random % Forest (RF) and/or multi-layers perceptron (MLP) % % Author: % Dr. Marco Palombo % Cardiff University Brain Research Imaging Centre (CUBRIC) % Cardiff University, UK % 8th December 2021 % Email: palombom@cardiff.ac.uk mask...
2dcf6e3f64a045ef6147529992c3f899bc3a906f00c2c3b4eca6db486553bf94
MATLAB
11,090
322
function [h,stats] = CompareDistributions(group1,group2,varargin) %CompareDistributions - Compare two N-dimensional distributions (e.g. prospective place fields). % % This non-parametric test determines in which dimensions two distributions are % significantly different. For example, the two distributions could be %...
efcdeb8210883cc02787d9ff719d7cd61fe06efddb99ef308de0359ebf0b6e3d
MATLAB
11,102
276
%% Datasets used in CANlab tutorials % % Note: this report was generated from |canlab_help_2c_loading_datasets.m| % in the repository <https://github.com/canlab/CANlab_help_examples> % %% The Neuroimaging_pattern_masks Github repository and website % % For these walkthroughs, we'll load several image datasets. % Some ...
24c85ef7fdc5e1ce6796c87cc0bade7ce2824a59e6f5bfd3b2aa80a7eb9186cd
MATLAB
11,112
337
function filteredTracks = filterDuplicateTracks(aggregatedTracks, options) % FILTERDUPLICATETRACKS Detect and remove duplicate cell tracks from a % compiled tracking table produced by compileResultsFromCSV. % % Two tracks are considered duplicates if, over their shared timepoints, % their XY distance stays within XYTol...
5b21315e8a55c0b53d6fe4e261d1476c9e6ff1b06a06cb4c97c6755874a22e81
MATLAB
11,131
333
function stats = FieldPSP(stims,lfp,varargin) %FieldPSP - Measure field EPSPs (waveforms, slope, amplitude) across time. % % Slope is determined as the maximum slope during the time window around stimulation. % Amplitude is determined as the maximum amplitude during the same time window. % % USAGE % % stats = Fi...
7b84b25cd904e8056674f15bbaf13190c853a7909f4621a76168174551817e4a
MATLAB
11,138
233
%% LaBGAScore_secondlevel_ooFmriDataObjML_example.m % % % *USAGE* % % This is merely an example script to illustrate the object-oriented ML % toolkit for fmri_data objects (and beyond), developed by Bogdan Petre % @CANlab. % % This is a toolkit inspired by Python's scikit-learn, including more % flexible options for al...
5405b1f008c57f8737b23ac3e4d10e49abc48062340a50901bf6b12c896e46ea
MATLAB
11,141
261
%% LaBGAScore_firstlevel_s3c_phMRI_neurotransmitter_maps.m % % % *USAGE* % % This scripts calculates cosine similarity with selected PET neurotransmitter maps % (Hansen et al, Nature Neuroscience 2022) on every first-level beta % (one per timebin per condition) and writes a summary table in long format % for mixed mod...
958840cfe96918d353ccfc77b8b179f86c862c3de86a5bb17de85036244d5a3c
MATLAB
11,144
287
function ConvertKlusta2Neurosuite(shank,basepath,basename,numCores) % Converts .kwik/kwx files from Klusta into klusters-compatible % fet,res,clu,spk files. Works on a single shank of a recording, assumes a % 16bit .dat and an .xml file is present in "basepath" (home folder) and % that they are named basename.dat...
9cbd880219e5b322ee08d4b6a5827ea89fddfcae1aaa4b28bf7450dd0b6c2d86
MATLAB
11,158
229
function tests = testSurrTheiler %TESTSURRTHEILER Contract tests for Surr_Theiler. % % Each surrogate algorithm exists to hold one property of the data FIXED % while destroying everything else. The test is therefore not "does it run" % but "did the property it promised survive". The promises differ per % algori...
4c4d57985945d389f62ce787e83d7b3b4f7420da26f3c8dfe96a78c28bcc1f62
MATLAB
11,162
324
function [ripples,sd,bad] = FindRipples(filtered,varargin) %FindRipples - Find hippocampal ripples (100~200Hz oscillations). % % USAGE % % [ripples,stdev,noise] = FindRipples(filtered,<options>) % % Ripples are detected using the normalized squared signal (NSS) by % thresholding the baseline, merging neighbo...
ff6b356c70683ebe882fe3b8fec29777f003134d93be6a9123864ec466e6501a
MATLAB
11,163
264
% pop_biosig() - import data files into EEGLAB using BIOSIG toolbox % % Usage: % >> OUTEEG = pop_biosig; % pop up window % >> OUTEEG = pop_biosig( filename, channels, type); % % Inputs: % filename - [string] file name % % Optional inputs: % 'channels' - [integer array] list of channel indices % 'blockrange'...
07c28cbda163c1e5c25b014da4915f366fe5aa1235fe093e44f196d1cc5d59f5
MATLAB
11,169
244
function ea_warp_parcellation(reference,options) directory=[options.root,options.patientname,filesep]; % Regenerate the template or not if isfield(options, 'overwriteapproved') && options.overwriteapproved overwrite = 1; else overwrite = 0; end % BIDS FIX: Check if normalization has been run - if not, run SPM...
83f66dafbaef230913c7ad74b02143e9bfc565ffa3bc4fff5fa13c9feb391b41
MATLAB
11,173
310
function [ specvarcorr,specbyvar ] = bz_LFPSpecToExternalVar( LFP,extvar,varargin ) %[ specvarcorr,specbyvar] = bz_LFPSpecToExternalVar(LFP,extvar,<options>) %calculates the relationship of the LFP spectrum to an external %(e.g. behavioral) variable. %Note: spectrogram are in units of dB (log(abs(spec))) % %INPUT % ...
31ab5445548f95f6b69cca0dcdf2228880c812051061bb91b12532a9a260c091
MATLAB
11,193
366
function CFA_Checkandrun(H) % function CFA_Checkandrun pathss = which('CFA_Checkandrun.m'); [pth nam ext] = fileparts(pathss); IOsetupdir = [pth,filesep,'IOparameter',filesep]; iosetup = dir('SetUpPara.mat'); if isempty(iosetup) iosetup = dir([IOsetupdir,'SetUpPara.mat']); if isempty(iosetup) [fil pg] =...
959009356aebe5a2ea983a77d8403e2a8091d1a6f82717e677362303520f7902
MATLAB
11,194
234
% 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...
fd4ddf4d95fe170b4886c24026d87cc788fe6dd9de486193172822327be722ad
MATLAB
11,195
206
function cifti_write(cifti, filename, varargin) %function cifti_write(cifti, filename, option pairs...) % Write a cifti file. % % Specifying "..., 'keepmetadata', true" leaves the file-level metadata as-is: % if false or not specified, the 'Provenance' metadata value is moved to % 'Paren...
17e72a5d570fbbb420e224e87dcb235a6421fcf83d139e74e0180cd916ca5554
MATLAB
11,198
256
% std_stat() - compute statistics for ERP/spectral traces or ERSP/ITC images % of a component or channel cluster in a STUDY. % Usage: % >> [pcond, pgroup, pinter, statscond, statsgroup, statsinter] = std_stat( data, 'key', 'val', ...) % Inputs: % data - [cell array] mean data for each subject g...
94659d338926c719570ba00314a1d56cc4b1e469312b4aea47f046cecfc0ceeb
MATLAB
11,211
287
%Adapted from power_over_time %goal: to see visualize the relationship between power and running speed %across animals and groups %to do - add steps to loop through windows to get LFP data and adjust %channel-layer assignments for drift %make sure speed value accounts for each animal's baseline %add somethin...
de0f42e430bddf4b620cfab3a34dce92c88e0254dfc9c1614fe86f1437d3870c
MATLAB
11,240
253
function [Cmn,Phimn,Smn,Smm,f,ConfC,PhiStd,Cerr] = coherencyc_unequal_length_trials( data, movingwin, params, sMarkers ) % This routine computes the average multi-taper coherence for a given set of unequal length segments. It is % based on modifications to the Chronux routines. The segments are continuously structured...
0199e8b269c98dee06f0559776f6f755480b708d7a65b5e1819179b46d7eda8c
MATLAB
11,246
239
function vw = videoWriter(url, varargin) % videoWriter class constructor % Creates a object that writes video files. We use a plugin % architecture in the backend to do the actual writing. For example, % on Windows, DirectShow will typically be used and on Linux, the % ffmpeg library is often used. % % v...
d049ba284154665c472bde923697209226528bbd6baba9a28c9e860994ee5468
MATLAB
11,264
263
function harmonic_oscillatory_shear(strain_amp, nsteps, interval, seed, Npts, P0_value, KA_value, dt, ... L_thresh, v0_value, Dr_value, omega, B, stress_only) % HARMONIC_OSCILLATORY_SHEAR Run an Active Vertex Model (AVM) simulation % of a confluent epithelial tissue with cell-cell viscous adhesion, under % Lees-Ed...
ec543eede11259788c8f6c1f8d3d0a34341b8817561728d4633db35323f73887
MATLAB
11,268
317
clc clear all close all set(0,'defaultfigurecolor',[1 1 1]);% set figure background color if ~contains(path, '/Users/guofanhua/Desktop/gfh/tools/MatlabTools/BrainSpace-latest/matlab') addpath(genpath('/Users/guofanhua/Desktop/gfh/tools/MatlabTools/BrainSpace-latest/matlab')); end %% ======================= step 1 ...
944a2755e3c26f3608dedef94adc3e02846f1a9b83eb9f767e88ed5c8ebae4d0
MATLAB
11,271
215
function [decompTrack] = decompoundCompTracks(compTrack) %DECOMPOUNDCOMPTRACKS decompound (separate) all interacting segments of comptracks into separate tracks (ignore merge-split/MS) % %SYNOPSIS: [decompTrack] = decompoundCompTracks(compTrack) % %INPUT : compTrack : compound tracks structure (in alternative forma...
8762e656a948aac0567e02f9af8080897ec74c922795964d244927a00a474a40
MATLAB
11,278
253
%% DATA REQUIREMENTS % % To get started on applying topic models to your own corpus of text, there % are various Matlab variables that need to be constructed. The exact format % depends on which type of topic model you want to run. Below is a list of % specification for the input that needs to be provided to each ...
4c0c91a31049708d4ea7ebed4a45c11d16d47caa21db8b3751beeb17955bf996
MATLAB
11,280
315
function out = catStruct(dim,structName,separator,string) %CATSTRUCT catenates values from multilevel structures % % SYNOPSIS out = catStruct(dim,structName) % % INPUT dim : dimension along which you want the struct to be catenated % structName : (string) full tree of the structure down to the fi...
8332087b926e38c6a1f4b3b391cd018b45b49c61fa69c7d0567c06d3ef088f15
MATLAB
11,290
314
function [ S, itypes ] = cvx_create_structure( varargin ) %CVX_CREATE_STRUCTURE Construct a basis for a structured matrix. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Parse the arguments, if needed % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% S = []; itypes = {}; if iscell( varargin{1} ), orig = varargin{1}; name = varargi...
ccf72f1b83797695099b89c3a2c40d6722a810d538eedb503711137e38a95045
MATLAB
11,296
265
% std_createclust() - dreate a new empty cluster. After creation, components % may be (re)assigned to it using std_movecomp(). % Usage: % >> [STUDY] = std_createclust(STUDY, ALLEEG, 'key', val); % Inputs: % STUDY - STUDY set comprising some or all of the EEG datasets in A...
70cc748c581ec8af0b55787bb4ee68ebab65c65d12af9f29be5a30adb64233a6
MATLAB
11,307
315
function p = pass_index_parser(varargin) % PASS_INDEX_PARSER - Parses pass-index related inputs % % Parses pass index related inputs for pass_index and function that % pass_index uses % % P = PASS_INDEX_PARSER(POS_TS,POS,SPK_TS) % P = PASS_INDEX_PARSER(POS_TS,POS,SPK_TS,LFP_TS,LFP_SIG) % P = PASS_INDEX_PARSER(POS_TS,P...
9c549c0774b325388b0aac0ca45ceee7126e43348716225ffffeb4c86bdfa1cd
MATLAB
11,315
319
function varargout = InputMapping(varargin) % Edit the above text to modify the response to help InputMapping % Last Modified by GUIDE v2.5 13-Sep-2023 17:00:21 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singl...
b195a3806ab88e8594818b0374ecec66f752d24a1d49dd27d3e6ce8a51d100c7
MATLAB
11,319
465
function [C,T]=hungarian(A) %HUNGARIAN Solve the Assignment problem using the Hungarian method. % %[C,T]=hungarian(A) %A - a square cost matrix. %C - the optimal assignment. %T - the cost of the optimal assignment. %s.t. T = trace(A(C,:)) is minimized over all possible assignments. % Adapted from the FORTRAN IV code i...
2dc92644f4bdeb20567c61ecffe0f4ca94628c960631688977e83aa74423d8c3
MATLAB
11,329
279
% condstat() - accumulate surrogate data for comparing two data conditions % % Usage: % >> [diffres, accres, res1, res2] = condstat(formula, naccu, alpha, ... % bootside, condboot, arg1, arg2 ...); % % Inputs: % formula - [string or cell array of strings] formula(s)...
d9d17d5d8f58b1247bd60b478f866fc08e95f776ce43f414579d191babd74bcd
MATLAB
11,330
366
function sleepStats = fun_sleep_statistics(sleepstages, varargin) % Calculate sleep statistics. Automatically generate sleep % macroarchitecture information including time in bed, total sleep time, % sleep onset latency etc, as well as time and % spent in each sleep stage. % % Required inputs: % % sleepstages: Either a...