sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
655e2925c5554808ec1d1e178980a15990f51945850db7472966486ac678d53f
MATLAB
6,568
201
%IM2GIF Convert a multiframe image to an animated GIF file % % Examples: % im2gif infile % im2gif infile outfile % im2gif(A, outfile) % im2gif(..., '-nocrop') % im2gif(..., '-nodither') % im2gif(..., '-ncolors', n) % im2gif(..., '-loops', n) % im2gif(..., '-delay', n) % % This function converts a mu...
70117497e91f3935ef7e39bc3871f8fe6e650d480dda2bee13a337267ce0c37f
MATLAB
6,569
153
% STD_PREPARE_NEIGHBORS - prepare Fieldtrip channel neighbor structure. % Only prepare the structure if necessary based % on statistical options in STUDY.etc.statistics. % Use the 'force' option to force preparing the % ...
614664a984b7021f9af9d3922c5e308f43ac0b7fa3bc17bcd2982c4177f8cd28
MATLAB
6,572
221
% Bang et al (2020) Private-public mappings in human prefrontal cortex % % Reproduces Figure 2 % % Visualises behavioural data for fMRI session and performs associated % regression analyses % % Statistical tests can be reproduced by applying one-sample t-tests to % regression betas: e.g. [H,P,CI,STATS]= ttest(beta.con...
d8393e67437b939389cb1a31a082318e52f5bf88f215777cf3f9a602f38af241
MATLAB
6,573
261
function Mn = powermanifold(M, n) % Returns a structure describing a power manifold M^n = M x M x ... x M. % % function Mn = powermanifold(M, n) % % Input: a manifold structure M and an integer n >= 1. % % Output: a manifold structure Mn representing M x ... x M (n copies of M) % with the metric of M extended element-...
72ebdb6da4e1a9190fc0e7dde18ca667614f2c1429e241e204413e40c35bb19f
MATLAB
6,574
274
function [ err ] = mmwrite(filename,A,comment,field,precision) % % Function: mmwrite(filename,A,comment,field,precision) % % Writes the sparse or dense matrix A to a Matrix Market (MM) % formatted file. % % Required arguments: % % filename - destination file % % A - sp...
829177dff56a9c972c6cbc33ab1f0950a0e98885c08098a07fb333bdfc7aa93b
MATLAB
6,577
159
function [BASISdiff] = osp_addDiffMMPeaks(BASISdiff,BASISoff,fitOpts) n = BASISdiff.n; sw = BASISdiff.spectralwidth; Bo = BASISdiff.Bo; centerFreq = BASISdiff.centerFreq; % The amplitude and FWHM values are determined as for the LCModel and % TARQUIN algorithms (see Wilson et al., MRM 2011). ...
0910cb5073c3edf9abd110d937948260c83171ce479554a76310ea2e8ec9cf85
MATLAB
6,581
159
function sii = task_gaitERSP_cluster(PATH, cfg, fieldName) PATHIN = PATH.ICAdecomp; PATHOUT = PATH.(fieldName); % load clustered study [STUDY ALLEEG] = pop_loadstudy('filename', [cfg.study_name, '_',fieldName, '.study'], 'filepath', PATHOUT); CURRENTSTUDY = 1; EEG = ALLEEG; CURRENTSET = [1:length(EEG)]; % ide...
e4d9c9dce11148e95a0eae75ad8a8d68deb5307cd92f5aeb68489615171462e8
MATLAB
6,583
113
% check folder eeglab if ~exist('n400.study', 'file') error([ 'You must change the path to the folder containing the data to run this script' 10 ... 'Download the data from https://eeglab.org/tutorials/tutorial_data.html (5 subject study)' ]); else filepath = fileparts(which('n400.study')); end %% impo...
927e4c827048dc62186aa11b3ba4a50da781c7c73dae2382c7b4e10f20331453
MATLAB
6,584
176
function res = permutation_null_brain(img_data, geneset, expressions, gene_symbols, background) % PERMUTATION_NULL_BRAIN(...) performs permutation testing to examine % whether imaging profiles associate with gene expression profiles, based % on the null-brain model (where random genes were selected from % brain-expres...
55f728101fb8c89519edcbdf89f744d873f261c1ec8b82f0d12f3ea291ab0591
MATLAB
6,585
185
function net = cnn_imagenet_deploy(net) %CNN_IMAGENET_DEPLOY Deploy a CNN isDag = isa(net, 'dagnn.DagNN') ; if isDag dagRemoveLayersOfType(net, 'dagnn.Loss') ; dagRemoveLayersOfType(net, 'dagnn.DropOut') ; else net = simpleRemoveLayersOfType(net, 'softmaxloss') ; net = simpleRemoveLayersOfType(net, 'dropout')...
77b3531f164c55be6fa85badf0a9483421e326bf66117f45d4534a2f36a43f9a
MATLAB
6,589
217
function detectTTLpulses(basicMetaData,varargin) paramNames={'fileType','lfpFile','samplingRate','nCh','nSample',... 'bufferSize','threshold','minInterval','minDuration',... 'evtFileName','saveFileName','chList','chName','detectionintervals',... 'varName'}; %default values p...
50e261473f4273a31726dc4bd1c102b82abb0f6860ecf590dabb7c27cd50cf21
MATLAB
6,590
176
function verify_cli() % verify_cli is a test script to validate run_NBSPredict_cli function. % It tests input validations, required parameter check, default overrides, % and backward compatibility with pre-built config files. fprintf('===============================================\n'); fprintf(' Starting run_NBSPre...
5978cf63ecef2fca1f6a1ab15e615d8b2cf54db9cb84b23f615ac20688a3b161
MATLAB
6,595
194
function [out_proj,variance_proj,cfg] = mante_proj(dat,cfg) % [out_proj,variance_proj,cfg] = mante_proj(dat,cfg) if nargin < 2 help mante_proj error('missing input arguments!') end ntrl = size(dat,1); % number of timepoints nsens = size(dat,2); % number of M/EEG sensors ntime = size(dat...
78b8d3545d4b8cd42f07ec10d838b99897d3fe72128dd6312919828f4638aeeb
MATLAB
6,596
167
function out = PD_PeriodicityWang(y) % PD_PeriodicityWang Periodicity extraction measure of Wang et al. (2007) % % Implements an idea based on the periodicity extraction measure proposed in: % % "Structure-based Statistical Features and Multivariate Time Series Clustering" % X. Wang and A. Wirth and L. Wang % Sevent...
d258a5d54954b8924ab114f6678aa5763fe20edb2ae4081495481bf30f5c7a63
MATLAB
6,596
207
function shuffle_icaReacCCG_dropEvt_cueRet(basename) tempIdx=2; [rootPath,sesName,~]=fileparts(basename); fprintf('%s load files for %s\n',datestr(now),sesName); temp=matfile(fullfile(rootPath,'data',[sesName '-icaReac.mat'])); icaReac=temp.icaReac(1,tempIdx); load(fullfile(rootPath,'data',[sesName '.sleepstate.sta...
efd8a7504516a7dd34a39b224e81b480e4a99503d841409c8d00ae7decc3c86d
MATLAB
6,596
172
function plot_example_choice_mode_activity_RNN close all clear all clc % Plot choice mode activity of RNNs with distractors. rng(0) % Set parameters for example RNNs. RNN_variable = get_example_choice_mode_activity_RNN; % Control. left_choice_mode_std_norm = RNN_variable.control.choice_mode.left_choice_mode_std_n...
5dccd2fdd0e350b646213813c4153d1e260c5f12f7f5e18ba8d7576cb589e22e
MATLAB
6,597
213
%% mapVBVD - a short Tutorial % Philipp Ehses <philipp.ehses@tuebingen.mpg.de> % Created: September 2016 %% Parse twix file % The basic idea of mapVBVD is to divide reading the data into two parts: % First, parsing the twix file and saving all relevant information from the % 'measurement data headers' (mdh) for each a...
e6798a95b4ec27c05722afdf2dc27d426fa50401fe703a68079bb1752da3e28e
MATLAB
6,601
170
% plot accuracies % NOTE THE ORDER OF SUBJECTS IN ALL THE TABLES subList ={'001','002','003','004','005','006','007','008',... '009','010','011',... '013','014','015','016','017',... 'pil001','pil002','pil004','pil005'}; vis =readtable("visAccu.xlsx"); hu =readtable("ha...
78966ed1327e1bda802d9afdc75a2cc2d87a5f4a39eb7a983877f25bd59d4a0f
MATLAB
6,603
196
function fear_getHFO_spike_PETH(basename) % basename='~/data/Fear/triple/innis190601/innis190601'; load([basename '.basicMetaData.mat']) if ~exist([basicMetaData.Basename '.amyHFO.events.mat'],'file') warning('hfoTrigHist.mat was not generated since %s not found',[basicMetaData.Basename '.amyHFO.events.mat']) ...
838caee8df0dd2a41e8c4fff84b0039f07cb025e49e2a76db45b36143d8cf79a
MATLAB
6,603
189
function [C2,cfg] = mahal_lin_trialwise(dat,theta,cfg) % [C2,cfg] = mahal_lin_trialwise(dat,theta,cfg) % authors: M Stokes, E Spaak, N Myers if nargin < 2 help mahal_lin_trialwise error('missing input arguments!') end ntrl = size(dat,1); % number of timepoints nsens = size(dat,2); % n...
2935eede3e03da5d379ff3d31a9eb54ef921dc6e7f95694fc4011deb67ae45df
MATLAB
6,604
139
%% BipolarCorr = BipolarEddyCorrect(Bipolar,unwrap) % % Input % -------------- % bipolarCplxME : complex-valued multi-echo GRE data with bipolar readout % unwrap : phase unwrapped method (optional) % % Output % -------------- % bipolarCorr : eddy current corrected data % FIT3D : bipolar readout induced...
d1ace5ba5812eba672f7485bdb2fe524b688ac286c16e6790730cba0908205e5
MATLAB
6,610
149
function out = SP_SpectralTimeFreq(y, numWindows) % SP_SpectralTimeFreq Time-varying spectral statistics from a spectrogram. % % SP_Summaries computes statistics from a single, static spectral estimate of % the whole time series. This function instead divides the series into % overlapping windows and tracks how the sp...
952776a68ff4dcb2a0504589a2ca2667a8282af2fa93a9894e4e39cd947c7a2f
MATLAB
6,613
219
function [lambda,p,ci,stats,tbl,dist] = permumanova1(x,group,varargin) %PERMUMANOVA1 Permutation-based one-way multivariate ANOVA and rank MANOVA. % LAMBDA = PERMUMANOVA1(X,GROUP) performs a permutation-based one-way % multivariate analysis of variance (MANOVA) for comparing the means of % two or more groups of...
119f1597ee042a94dfa3b847b4a77193df0762e3b90ec48aa455af23cc7ec2f1
MATLAB
6,617
153
function TS_Init(INP_ts,whatFeatureSet,beVocal,outputFile) % TS_Init Produces a formatted HCTSA .mat file from input files % %---EXAMPLE USAGE: % Initiate an HCTSA.mat file on a custom time-series dataset using the hctsa % feature library, using a formatted input file, 'my_TS_INP_file.mat' % >> TS_Init('my_TS_INP_file...
cb51053178f53ebe62ed3fa5a506937878c5bb1a80ac49c2652a0730cd5818b1
MATLAB
6,617
214
%RadialMazeVisits - Compute distribution of successive visits in radial maze. % % In order to detect stereotypic egocentric strategies that a rat could employ to % solve a radial maze task, this function determines the distribution (over trials) % of successive arm visits: if the rat does follow an egocentric strateg...
4df0b0f5964eb77d46c892988d512d1558c3d88a0901bee1acc484a784d03edd
MATLAB
6,618
209
% % Regress photoplethysmography data from the fNIRS signal. % % Parameters % ---------- % participant: integral number % Participant to process. % type: "HbO" or "HHb" % Type of data % % Outputs % ------- % The outputs are saved as .csv files. % % Author % ------- % Ségolène M. R. Guérin % March 11, 2025 % URePS...
905d4c63e0c42e2c24fdee84952139cf837047ea9df76a60d1f235c43e9d625b
MATLAB
6,622
178
function [rvt, verbose] = tapas_physio_rvt_hilbert(fr, t, sample_points, verbose) % Computes respiratory volume per unit time (RVT) from filtered time series % % RVT is computed by calculating the instantaneous amplitude / frequency % of the breathing signal via the Hilbert transform, as proposed by % Harrison et al. %...
e81befdc7002ece7af38d2335194ee6a559bf223d26b0bfc880a8e0327b2f5c9
MATLAB
6,622
172
function positions = GetPositions(varargin) %GetPositions - Get position samples. % % USAGE % % positions = GetPositions(<options>) % % <options> optional list of property-value pairs (see table below) % % ========================================================================= % Properties Valu...
5b3d21134b48649b6d0930577b25c3d3b35411f4882231b652288a13ed4a4002
MATLAB
6,627
198
clear all close all clc % Calculates subspace generalization between simulated voxels. % Each voxel is an average over simulated grid cells according to their % phase. grid cells with closer phases are averaged within the same voxels. global dv_voxels r_voxel a_noise exp_root = 'C:\Users\User\Documents\fMRI_EXP\'; ...
0ecd75ab149cbe9deb42008f9335b4e34bd88c597903a4ced191081aa3d078a5
MATLAB
6,630
216
function M = obliquecomplexfactory(n, m, transposed) % Returns a manifold struct defining complex matrices w/ unit-norm columns. % % function M = obliquecomplexfactory(n, m) % function M = obliquecomplexfactory(n, m, transposed) % % Oblique manifold: deals with complex matrices of size n x m such that % each column has...
d7d14e1246cadbb0eabc165395bc643bd15e8c47d5dbc90f940422db0fc99a87
MATLAB
6,631
177
function info = step1RunSearchlightProprioception(opt) % Step 1 : running searchlight (SL) % get the smoothing parameter for 4D map funcFWHM = opt.funcFWHM; % set output folder/name savefileMat = fullfile(opt.pathOutput, ... [opt.taskName, ... '_SL_Prop...
38108600c239731699f033f195dff15f21ff91f0ab316cfeac059be6b2fc322b
MATLAB
6,632
177
function info = step1RunSearchlightAcrossHandAnat(opt) % Step 1 : running searchlight (SL) % get the smoothing parameter for 4D map funcFWHM = opt.funcFWHM; % set output folder/name savefileMat = fullfile(opt.pathOutput, ... [opt.taskName, ... '_SL_Acro...
b3705301b565a3653236e6ef7dbe3b3f4166ecf2812100e2bab9331b7a2839a7
MATLAB
6,634
226
function out = io_loadspec_lcmraw(rawFile) %% LCMparam = io_loadspec_lcmraw(rawFile) % This function reads a LCModel-formatted .RAW file. % % USAGE: % LCMparam = osp_readlcm_raw(rawFile) % % INPUTS: % rawFile = LCModel .RAW data file % % OUTPUTS: % % out = Input dataset in FID-A s...
0d8a1b6a3e6f566fba939b3336076c5cffdc6bf2798c2e66e119821fb423ce8c
MATLAB
6,637
177
function info = step1RunSearchlightAcrossHandExt(opt) % Step 1 : running searchlight (SL) % get the smoothing parameter for 4D map funcFWHM = opt.funcFWHM; % set output folder/name savefileMat = fullfile(opt.pathOutputTemp, ... [opt.taskName, ... '_SL_A...
4bf56479c738a34449971690ae455c26a81be68063171fdf6e981897af63593d
MATLAB
6,637
212
function [newcl,DB] = database2clusters(db_mat,clusters,mydist) % function [newcl,DB] = database2clusters(db_mat,clusters,mydist) % % tor wager % % This function turns a database file (stored as variables in a .mat file) % as created with read_database.m % into a clusters structure, by finding the points % that fall wi...
a6b087349854a21d3231ce171721ad1e6681f26efc53f2cb60c57883340a0201
MATLAB
6,638
109
clc clear all close all whicheye = input('Please enter left or right to choose eye: ','s') rawfilepath = input('Enter raw_data location(such as /home/raw_data): ', 's'); processedpath = input('Enter processed_data location(such as /home/processed_data): ', 's'); % whicheye = 'left'; % choose which eye to start tracking...
b32356e5b1980dc6e72a264f0708ca8e71b3d57bcc0eedbe97171bebe47174d0
MATLAB
6,638
197
% openbdf() - Opens an BDF File (European Data Format for Biosignals) in MATLAB (R) % % Usage: % >> EDF=openedf(FILENAME) % % Note: About EDF -> www.biosemi.com/faq/file_format.htm % % Author: Alois Schloegl, 5.Nov.1998 % % See also: readedf() % Copyright (C) 1997-1998 by Alois Schloegl % a.schloegl@ieee.org % ...
5ed7d87a285f52d7ec9130117d525489b623bf1df4526a11eaf09711a6714b69
MATLAB
6,639
152
% INSTALL Installs the hctsa code package from scratch. % %---INPUTS: % silentInstall, (binary) set true to run non-interactively (no 'Press any % key to continue' prompts), e.g., for scripted/CI installs. % Defaults to false. % ----------------------------------------------------------...
60391af50cfe528c99eb946b55c2d7b7117c1c6ac6905523a2ba54cd3e422af0
MATLAB
6,640
193
function metrics = evalRegQualityMetrics(frameFixed, frameRegistered, varargin) % Evaluation of the image registration performance between two images, % frameMoving and frameFixed. % % SYNTAX: % metrics= evalRegQualityMetrics(frameFixed, frameRegistered) % metrics= evalRegQualityMetrics(frameFixed, frameRegistered, 'Ba...
76c746ecea0d264fb0960eb69cdc76fe0596132b4d9ead09a247a99837be5ed6
MATLAB
6,650
197
function plotFigure4_TCA(ephysPath, codePath, processedEphysPath) % Plot figure 4. Process and plot heatmat of neural responses based on TCA model % Process and plot responses to 20ul trials pre- and post-incongruent trial % by TCA cluster s = pathsep; pathStr = [s, path, s]; onPath = contains(pathStr,... codePat...
2ae5b88f61e5e80cf866b18331786394aa3a63777ab3770ff5cdc480a6e18155
MATLAB
6,651
174
function [density,xdata,sampleinfo] = support_func_event_density(trl,ttime,twin,tstep) %% ######################################################################## % - Plot density of events % ######################################################################### % Determine density of events per twin [s] % % -------...
4b6bb315df1d9caefd5b1f1342a9598aaee70e820a68a016cfe67957430380f2
MATLAB
6,652
168
function [ClusteringData, clustAssign, freqRange, maxDuration, spectrogramOptions] = CreateClusteringData(handles, varargin) %% This function prepares data for clustering % For each file selected, create a cell array with the image, and contour % of calls where Calls.Accept == 1 p = inputParser; addParameter(p,'forClu...
c70394c1977dca8337c3e6f15c256d9d583d98dedae65148a4314f9340f76782
MATLAB
6,654
140
function rawConvertFunc(HomeDir, raw_file_dir, batch_csv_fname, autofill_div, autofill_genotype, genotype, fs) % Parameters % ---------- % HomeDir : % raw_file_dir : % batch_csv_fname : % autofill_div : % autofill_genotype : % genotype : % fs : int % sampling frequency of your recording (Hz) % Use this scr...
bc8a8e4a20789decc18925925a7317c97e807c2f8224921523795bd9815c8fb7
MATLAB
6,655
173
%% raincloud_plot - plots a combination of half-violin, boxplot, and raw % datapoints (1d scatter). % Use as h = raincloud_plot(X), where X is a data vector is a cell array of handles for the various figure parts. % Seee below for optional inputs. % Based on https://micahallen.org/2018/03/15/introducing-raincloud-plot...
d22bc6dc27ff48172a924e81c7f77801e33033f82e074590a52d1c84ab3a856f
MATLAB
6,658
119
%% outputFileList = construct_output_filename(outputDir, ouputPrefix, outputSufffix) % % Input % -------------- % outputDir : output directory % ouputPrefix : output filename prefix % % Output % -------------- % outputFileList: structure contains all output filenames % % Kwok-shing Chan @ DCCN % kwokshing.chan@do...
c31fd4de60d068bb54fe2ebc912d5df06ae1efaaad62061c370210c35e690188
MATLAB
6,660
190
function dm = mask2density(mask,radius,varargin) % function dm = mask2density(mask,radius,[opt] searchmask, [opt] sphere_vol) % % mask is the mask with ones where activation points are % radius is in voxels % % optional arguments: % 1 searchmask % searchmask is the whole brain search space [optional] % Mas...
24452cded4a15e3740112cb6f723913b143a77b3536860cd64f98d16a80c8751
MATLAB
6,661
130
function results = assembly_patterns(SpikeCount,opts) % Patterns = assembly_patterns(Activitymatrix,opts): extracts assembly patterns from the spike matrix. % % Description of inputs: % Activitymatrix: spike matrix. Rows represent neurons, columns represent time bins. Thus, each element of the matrix carries the spi...
075791a579d77a57204170fd2129d544a90b0254565047575dd4ff44e65b183e
MATLAB
6,664
137
function [ons_secs, VOLLOCS, LOCS, verbose] = tapas_physio_create_scan_timing(... log_files, scan_timing, ons_secs, verbose) % Extracts slice and volume scan onsets (triggers) from different vendor formats % % [ons_secs, VOLLOCS, LOCS, verbose] = tapas_physio_create_scan_timing(... % log_files, scan_t...
48d422a5af111fc85e89d5fbb438f40abd2e8b78bea9cf41c76a22a31e364fa9
MATLAB
6,669
160
function burstData = singleChannelBurstDetection(raster, N, samplingRate, isiThreshold) % singleChannelBurstDetection Get bursts within channels using Bakkum method % INPUTS % ----------- % raster : T x N matrix % number of time samples (T) x number of units (N) binary spike matrix % N : int % minimum number of ...
747f059ad5010b716e5f7a610ed2964da2801c749f629c583a09d3ac6c3669b3
MATLAB
6,669
188
function output = targetClassifier(data, config) % Params nFolds = 1; nPartitions = 5; % Fit on only time period after cue fitBins = find(ismember(config.tPts, 50:config.postT)); predictors = getPredictors(data, 'data', [], fitBins); % Fit output = cvClassifier(predictors, nFolds, nPartitions, config.type); % Save ...
815914b24a28ca6be57d0995c33881815425b6a5f05591952199884601b210b3
MATLAB
6,672
176
function spindles = FindSpindles(filtered,varargin) %FindSpindles - Find thalamo-cortical spindles (9-17Hz oscillations). % % USAGE % % spindles = FindSpindles(filtered,<options>) % % filtered spindle-band filtered LFP <a href="matlab:help samples">samples</a> (one channel). This must % ...
028bbfb78550f18a581aca828c0fb2fe02419bffcd012999c721fbdc8c980823
MATLAB
6,678
169
function saveNetMet(ExpName, Params) %SAVENETMET Summary of this function goes here % Parameters % ---------- % ExpName : str % Name of experiment file % Params : struct % Parameter structure used in MEANAP % Output % ------- % None %% groups and DIV Grps = Params.GrpNm; AgeDiv = Params.DivNm; %% Varia...
137447324c43e3056fef8b51a176677972630e56edbf89fb8f966874425e39a9
MATLAB
6,678
232
function [Cs, sall] = rgbdectohex (Mrgb,strg, prompt) % % Mode 1: % [Cs, sall] = rgbdectohex (Mrgb,[string]) % Mode 2: % rgbdectohex % Mode 3: % Mrgb = rgbdectohex (sall) % % Mode 1: %This function takes as an input the rgb matrix Mrgb (size is Nx3) % where each row represents the rgb gun values ...
b1cbae4aa28ac178fc4903063d25433ac679eab25d241cdce785255bf64cbc8b
MATLAB
6,685
188
function [r, LB, UB, F, df1, df2, p] = ICC(M, type, alpha, r0) % Intraclass correlation % [r, LB, UB, F, df1, df2, p] = ICC(M, type, alpha, r0) % % M is matrix of observations. Each row is an object of measurement and % each column is a judge or measurement. % % 'type' is a string that can be one of the ...
b7ae5fafc2ade483484e009aac3be56b219ec16c74071c87d1c412fa1619ef49
MATLAB
6,685
160
function task_GA_gaitERSP_cluster(sii,PATH, cfg, fieldName) PATHIN = PATH.ICAdecomp; PATHOUT = PATH.(fieldName); % load clustered study [STUDY ALLEEG] = pop_loadstudy('filename', [cfg.study_name, '_',fieldName, '.study'], 'filepath', PATHOUT); CURRENTSTUDY = 1; EEG = ALLEEG; CURRENTSET = [1:length(EEG)]; % id...
ec8da1bd679119e67450bd0fe26ef0f0b92829841cddf0cdbbe09cfaf6b18d06
MATLAB
6,688
208
% CART2TOPO - convert xyz-cartesian channel coordinates % to polar TOPOPLOT coordinates. Input data % are points on a sphere centered at (0,0,0) % or at optional input 'center'. This function % is now DEPRECATED! See Important warning below. % % Usage: >> [th r]...
7f44d0ef385f1494f10f07274a4ef671e8a876fbe5b227188c6453a363c412ab
MATLAB
6,690
140
classdef MrImageGeometry < MrCopyData % Geometry properties of MrImage, in particular for operations on niftis % Provides full voxel to world mapping, i.e. affine transformation % Including rotation/translation/voxel scaling % % % EXAMPLE % MrImageGeometry % % See also MrImage ta...
f5ccd884a92870b5ca83a6d6060fe9adede87ddaeef1457c7af5740f75be2f67
MATLAB
6,690
235
% this script builds a bunch of connected reservoirs % representing a meshing of a polygonal region % ---------------- %% Create a decomposed geometry matrix, with line segments giving boundary of polygon % documented here: % https://www.mathworks.com/help/pde/ug/create-geometry-at-the-command-line.html % set up th...
1a51272dd03eb25443e9cf625f3ac217448ff95db8819e2318fe5a5f2decdecf
MATLAB
6,691
156
function [mouse_position,chamber_frames,chamber_masks,cup_centroids,... mouse_bodyparts,juv_bodyparts,juv_presence_frames] = proc_dlc_data(this_file,this_session_type,frame_size) %% get mouse position, chamber masks, and cup positions from DLC result file % ZZ 2022 [dlc_vars,chamber_names] = set_dlc_vars(this_s...
67082d9a75dad00b7794bca77d867526dd3b073b0f6b3ac49aa5023c070309d0
MATLAB
6,697
139
function [ens_seq,maxcor,templates,core_cells,clust_out,pars] = neuronRaster2EnsRaster(spktimes,filename,pars) % % [ens_seq,templates,clust_out] = neuronRaster2EnsRaster(spktimes,pars) % % Generates ensemble raster (N_ens x T) from neuron raster (N_neu x T), % whose timestamps are contained on the cell array spktimes. ...
981901d1331f1b95036e5d1d0f776cb081eedaa22265cc7e78ac5d25aac0ed96
MATLAB
6,697
199
function plotFigureS7_TCAsupp(ephysPath, codePath, processedOFCPath) % Plot TCA error and model, incongruent respones for LED on and LED off %INPUTS: % ephysPath = local path to ephys data downloaded from zenodo % processedEphysPath = local path to saved incongruent response data from % running processEphys...
1911932886d3c122c0b8b01132ee92790d2f8d38adda6bcab945161cc6f4b515
MATLAB
6,698
159
function yth = SB_CoarseGrain(y, howtocg, numGroups) % SB_CoarseGrain Coarse-grains a continuous time series to a discrete alphabet. % % ---INPUTS: % howtocg, the method of coarse-graining: % (i) 'quantile': an equiprobable alphabet by the value of each point % (ii) 'diff': as 'quantile', but applied to t...
4d279ef62755e8f9265518da2edc9d63920f5c4c6700e1367488d76f1c5897da
MATLAB
6,700
197
function A0_RSA_YuModel(subject_id, model_lib_path, varargin) % RSA_ANALYSIS_OPTIMIZED - Optimized multi-model RSA analysis % % Syntax: % rsa_analysis_optimized(subject_id, model_lib_path) % rsa_analysis_optimized(subject_id, model_lib_path, 'ParameterName', ParameterValue) % % Input Arguments: % subject_id ...
8b19abe8fff9dacbd5b2ff8224871d0e597f0c7197c9eb0e1f6d50f706a9a566
MATLAB
6,709
154
function hyp = MF_GP_LearnHyperp(t, y, covFunc, meanFunc, likFunc, infAlg, nfevals, hyp) % MF_GP_LearnHyperp Learns Gaussian Process hyperparameters for a time series % % Used by main Gaussian Process model fitting operations. % % References code 'minimize' from the GAUSSIAN PROCESS REGRESSION AND % CLASSIFICATION ...
334b8851b51405471c07bd0db685cbd30d86dd8e73c7e94089c5369d8a0b84af
MATLAB
6,712
172
function [MRSCont] = osp_fitWater(MRSCont, kk, fitWhich) %% [MRSCont] = LCG_fitWater(MRSCont) % This function initializes and runs fitting of the water reference and % short-TE water scans. % % USAGE: % [MRSCont] = osp_fitWater(MRSCont, fitWhich); % % INPUTS: % MRSCont = Osprey MRS data containe...
e3489b3a0ce55bcd3d2d66faa871f95d1e042cd9e0124d2a9d7659d6dfedf9ce
MATLAB
6,717
195
function net = cnn_imagenet_init_resnet(varargin) %CNN_IMAGENET_INIT_RESNET Initialize the ResNet-50 model for ImageNet classification opts.classNames = {} ; opts.classDescriptions = {} ; opts.averageImage = zeros(3,1) ; opts.colorDeviation = zeros(3) ; opts.cudnnWorkspaceLimit = 1024*1024*1204 ; % 1GB opts = vl_argp...
edefca2da739c986085b5e68ad5b7868df93914c633fc95e5280677e4cd2a998
MATLAB
6,717
195
function [stat,p,ci,stats,dist] = permuztest(x,m,sigma,varargin) %PERMUZTEST Permutation-based one-sample Z-test. % STAT = PERMUZTEST(X,M,SIGMA) performs a one-sample permutation test % based on the Z-statistic of the null hypothesis that the data in X come % from a distribution with mean M, and returns the test...
c85b4b44c82ffe7b52289153df2425fe0cef2a51f116d6fd985bc03ae2dd9894
MATLAB
6,720
196
classdef circularGraph < handle % CIRCULARGRAPH Plot an interactive circular graph to illustrate connections in a network. % %% Syntax % circularGraph(X) % circularGraph(X,'PropertyName',propertyvalue,...) % h = circularGraph(...) % %% Description % A 'circular graph' is a visualization of a network of nodes a...
e1d322192938ff00e335644a318884eb9b1e3ef08fad3da1707e2673df96cfe3
MATLAB
6,721
162
%% [mask_refined,r2s,relativeResidual,gradientMagnitude,gradientStats] = MaskRefinementMacro(mask,algorParam,headerAndExtraData) % % Input % -------------- % Mask : Logical brain mask to be refined % algorParam : Struct containing the method and method specific parameters % headerAndExtraData : St...
80bf866772ee8a588575a397d9b3ca2ef5331bd20f269b38859c3dffca5353c2
MATLAB
6,722
205
function fear_evtTrigIcaCoactStrength(basename,varargin) % basename='~/data/Fear/triple/booyah180430/booyah180430'; %% param.templateIdx=2; %id of template behavior session param.targetIdx=3; %id of homecage session for significant selection param.beh='nrem'; %name of behaviror type for siginificant selection : 'nrem' ...
a6e57c8c7aaf46628149737b66a6402cbc869f46ae94b9455162db6a51f33f4c
MATLAB
6,722
248
function OUT = whole_brain_ptask_givena(OUT,varargin) % OUT = whole_brain_ptask_givena(OUT,verbose level, mask image or threshold value(for pa_overall) ) % OUT = whole_brain_ptask_givena(OUT,2,.001) % verbose flag if length(varargin) > 0, vb = varargin{1};, else, vb = 1;, end P = OUT.PP; task_indicator = OUT.allcondin...
1e96a1a4fb4f24e21ca212bd16fe76222557b3d333f0caf07a2505f83cddb091
MATLAB
6,723
172
% POP_CHANSEL - pop up a graphic interface to select channels % % Usage: % >> [chanlist] = pop_chansel(chanstruct); % a window pops up % >> [chanlist strchannames cellchannames] = ... % pop_chansel(chanstruct, 'key', 'val', ...); % % Inputs: % chanstruct - channel structure. See READLOC...
290a189468c17d5122eeff9f16a899535e94493e3851293e84a877cf41dea0f6
MATLAB
6,723
186
function ft_block_contrast(img_input, cond_input, TR, name_output, name_sess, ... output_folder, null_input, multi_input, cutoff_highpass, microtime_onset, hrf_cbv, ... hrf_derivative, lowpass, cutoff_lowpass, order_lowpass) % GLM analysis % % ft_block_contrast(img_input, cond_input, TR, name_output, name_sessoutput_fo...
55415d6a54f18371833fd53193d095d12a9a3e23614a0c8b0bd6c9f6df18336a
MATLAB
6,734
165
% MMO - create a memory-mapped data class % % Usage: % >> data_class = mmo(data); % % Inputs: % data - input data or data file % % Outputs: % data_class - output dataset class % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2012- % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % This file is ...
13654192cbaece995d289e5526f07d6c8eff3256e70913ad04a1688cfa4c912a
MATLAB
6,737
268
function [xdata,ydata,Wout,Weff,Wrdn,Win,Wirr] = ... make_train_data(parm,T,Wout,Wrdn,Win,Wirr) % Make training and test data set % [xdata,ydata,Wout,Weff,Wrdn,Win,Wirr] = ... % make_train_data(parm,T,Wout,Wrdn,Win,Wirr) % - Output % xdata : Xdim x Tsample x Ntrial % ydata : Ydim x Tsample x Ntrial % Wo...
f88466f12f5d775714647ca50bfbb9e3c1cd0d64ae734adca5b07e1d24ecb233
MATLAB
6,737
199
function runMainFigures(varargin) % RUNALLFIGURES Generate all figures for the normalization paper % % Purpose: % Main script to generate all publication figures with proper error % handling and progress reporting. % % Inputs (optional): % 'figures' - Array of figure numbers to generate (default: 1:6) % 'verify...
d945fca7eb5dafffc4d81a27fa0653a1d292fb28a175f58dcec4314bcd9e197c
MATLAB
6,739
198
function [condmask,condnames] = condmaskLibrary(type,file_idx,A,ops) %create a conditional mask library for different filtering operations % %Inputs: % type: string to decide what to condition on % file_idx: neuron index in concatenated A data structure, or index in % fnames % A: concatenated alldat...
856d52cdffa1a280a33c18a56755b83cabe4dcbb7f045d9da6937d45f0097e95
MATLAB
6,742
128
function pairwiseResults = runbehavioralanalysis(T, dependent, outputFolder) if ~ismember(dependent, {'ACC', 'RT','BIS'}) error('Invalid dependent variable. Choose either ''ACC'', ''RT'' or ''BIS''.'); end % Fit the linear mixed-effects model mdl = fitlme(T, [dependent, ' ~ Condition * Age * Group + ( 1 + ...
9d4af50d62cd40095a13e70652ac48f46954659510105dc710dfe495fb51cd30
MATLAB
6,743
208
function shuffle_icaReacCCG_exEvt_cueRet(basename) tempIdx=2; [rootPath,sesName,~]=fileparts(basename); fprintf('%s load files for %s\n',datestr(now),sesName); temp=matfile(fullfile(rootPath,'data',[sesName '-icaReac.mat'])); icaReac=temp.icaReac(1,tempIdx); load(fullfile(rootPath,'data',[sesName '.sleepstate.state...
40f973cc95303958ef184f0af9e16048b6b7c4d3da481c1cb539045f65815d9b
MATLAB
6,752
163
function [comp] = ft_datatype_comp(comp, varargin) % FT_DATATYPE_COMP describes the FieldTrip MATLAB structure for comp data % % The comp data structure represents time-series channel-level data that has % been decomposed or unmixed from the channel level into its components or % "blind sources", for example using ICA...
d9608d4d88bd8d1c32c1989d0561e5ab7ef8cabbab4f6ec48e7a26b6d116af9d
MATLAB
6,754
196
function [highc,highe,lowc,lowe,mixc,mixe]= wt_notsided(ExpA,ConA,Raw_data,varargin) %no side bias wt % Inputs: % ExpA: Opto A struct % ConA: control A struct % Rawdata: Both control and opto S structs % varargin: 1 - plots each animal wt curves for a = 1:length(ExpA) %generate the mean wt across ...
9b5ce14623e5a4467cf3d3c73efbf109515d73d6a5f600cd8c4db4dd288faac2
MATLAB
6,755
181
% NEWTIMEFBASELN - Remove baseline power values for newtimef. This % function assumes absolute power NOT log transformed power. % This function only removes baseline. Data has to be % averaged subsequently if necessary. This function % works bo...
082faa9bfacf67b2fc1daefb685396534fd0223b842318c82a70c5532bff79e5
MATLAB
6,759
208
function cluster_manova(clusters,fnames,varargin) % function cluster_manova(clusters,fnames,verbose) % tor wager % % clusters is output of clusters2database, with all fields % from database % fnames is cell array of strings with names to test % e.g., {'Rule' 'Task'} % % uses stats toolbox % example: cluster_manova(...
ec4a4938d88c4aa76585f40566be7ec188d277455b640a55c24ec4c1791fbf2a
MATLAB
6,759
171
function PlotIntervals(intervals,style,direction,opt) %PlotIntervals - Plot lines, rectangles or bars next to an axis to show interval limits. % % Given a list of [start stop] intervals, draw each of them with either: % 1. a green (red) line representing its beginning (end) % 2. a rectangle % 3. a bar next to the x or...
410c239fdd134d7b09045aa076a9db198efc29e25c2c7eff4279cc138e6e6b1a
MATLAB
6,760
176
function [spectrogram,t,f] = MTPointSpectrogram(times,varargin) %MTPointSpectrogram - Compute point process spectrogram by multi-taper estimation. % % The spectrogram is computed using the <a href="http://www.chronux.org">chronux</a> toolbox. % % USAGE % % [spectrogram,t,f] = MTPointSpectrogram(times,<options>) %...
8f96166f5733869a8953c1c66eb05366b3b3882daa03d8f4ec13ebe811440293
MATLAB
6,761
201
%% 13.01.2025 pupil size regression analysis on stimlocked data // clean script, autoregressive model clc clear all clc load('stim_locked_data.mat') time = -1: 0.005 : 5; time(end) = []; % crop pupil data (0 - 4000 ms) % start_crop = find(time == 0); % end_crop = find(time == 4); % % data_...
1d4c01690b25ac2ee9d8ac4a71f9617c060e51fbb7750fab22f265585b6de959
MATLAB
6,762
167
function [U, S, V, info] = truncated_svd(A, p) % Returns an SVD decomposition of A truncated to rank p. % % function [U, S, V, info] = truncated_svd(A, p) % % Input: A real matrix A of size mxn and an integer p <= min(m, n). % Output: An orthonormal matrix U of size mxp, an orthonormal matrix Y of % size nxp an...
f65b44c25263df84080e2a6b9634766ac6e1bb8b57454689354021bff2e35ffb
MATLAB
6,762
158
function [varargout] = constructRDMs(responsePatterns, betaCorrespondence, userOptions) % % [RDMs =] constructRDMs(responsePatterns, betaCorrespondence, userOptions) % % constructRDMs is a function which takes a matrix of imaging data and % computes RDMs from it, one RDM for each ROI, subject, and scanning % session. T...
68f418240cb8651229ca50938444ba38eef6dd6ad653679beec99f8bd5f123fa
MATLAB
6,765
174
%A script for testing function New_HEAD %Choose from 3 options fprintf(1,'\n Demo for New_HEAD function.\n'); fprintf(1,' BEFORE you proceed, make sure you have no AFNI\n'); fprintf(1,' session running with the -yesplugouts option.\n'); fprintf(1,' 1- From a matlab 3 dimensional matrix, create\n'); f...
91c055c2dd84d77806efb34349f9a9237f96ce96065648706289224797f50c15
MATLAB
6,769
151
function out = PH_KramersMoyal(y, tau, numBins) % PH_KramersMoyal State-dependent drift and diffusion (Kramers-Moyal coefficients). % % Treats the time series as a sampled Langevin process, % dx = D1(x) dt + sqrt(2 D2(x)) dW, % and estimates the conditional-moment (Kramers-Moyal) coefficients as a % function of the...
40b252ab8395468fec0e56017f750e94aed58c48d6400106a8f9f1380073884e
MATLAB
6,770
180
%% raincloud_plot - plots a combination of half-violin, boxplot, and raw % datapoints (1d scatter). % Use as h = raincloud_plot(X), where X is a data vector is a cell array of handles for the various figure parts. % Seee below for optional inputs. % Based on https://micahallen.org/2018/03/15/introducing-raincloud-plot...
e76fd52f6a6fa8d889d67a38ceeeabd37fb6e6200489de066a8c2437cff173a3
MATLAB
6,772
161
% POP_IMPORTEGIMAT - import EGI Matlab segmented file % % Usage: % >> EEG = pop_importegimat(filename, srate, latpoint0); % % Inputs: % filename - Matlab file name % srate - sampling rate % latpoint0 - latency in sample ms of stimulus presentation. % When data files are exported ...
17ce2f2b8bbc6a39373a9365f0a5d57fc337d68816384b14fa14c8cb72ffd5a2
MATLAB
6,777
186
function create_training_images_Callback(hObject, eventdata, handles) % hObject handle to create_training_images (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Select the files to make images from [trainingdata, traini...
493d53e5e877a9e5c4ca64e3a30dfea9ed060e25ea49004b2f17cd47b22cac8f
MATLAB
6,778
188
function H = calcSubspaceGener(rawData,SPM) % rawData: raw data from searchlight % calculate the subspace generalisation (area under the curve of explained % variance as a function of number of EVs) flagCal = 1; % flag whether to caclulate subspace generalisatoin, will change to 0 only if there is a problem with NaNs ...
4ccb8ffffe5bdfab906c08f9ded7fc443148fcd5c3b778673c7319e4cd58a342
MATLAB
6,778
168
function bids_T1B1correct_job(BIDSroot, InvEff, B1Scaling, Realign, FWHM, Target, ... Correct, Fingerprint, B1correctM0, MP2RAGE, B1map, B1Ref, R1mapname) % Performs the work for bids_T1B1correct() % % Marcel Zwiers, 20/03/2023 Debug = 0; % Load the headers & data B1Src = spm_vol_gz(fullfile(B1map.folder, B1m...
99735207d074dcf5d913d1f7b8b11e0e06b8dd5a98d64344a5de41dc34d77878
MATLAB
6,780
206
function M = fixedrankfactory_3factors(m, n, k) % Manifold of m-by-n matrices of rank k with polar quotient geometry. % % function M = fixedrankfactory_3factors(m, n, k) % % The first-order geometry follows the balanced quotient geometry described % in the paper, % "Linear regression under fixed-rank constraints: a R...
9ff25ba1e2fe8515d501e5148ee706fc4bac5c912aad2902f7bdd5e87254c983
MATLAB
6,790
144
function [stats, stats_overview] = DescriptiveStats(data, PathName, layer_numbers) % by Julia Becker, 10/04/2020 %DESCRIPTIVESTATS % For each condition and ROI, calculate % - median % - lower quartile (25th percentile) % - upper quartile (75th percentile) % - minimum value % - maximum value % - mean % % T...
2b238f3094d3fbc1786016ead21eefb482cc004e47c052c571eaed7c01093062
MATLAB
6,802
148
% (C) Copyright 2019 bidspm developers %% analyze localizers clear; clc; bidspmDir=fullfile(fileparts(mfilename('fullpath')),'..', 'lib','bidspm'); addpath(fullfile(fileparts(mfilename('fullpath')),'..', 'lib','bidspm')) bidspm(); %changed it to absolute because there were erros.bids_dir = fullfile(fileparts(mfilen...
9736d39cb18d8d850169fabafd8ca852141eefc61d8457c561a2543dafd87e14
MATLAB
6,810
117
clc clear all close all whicheye = input('Please enter left or right to choose eye: ','s') rawfilepath = input('Enter raw_data location(such as /home/raw_data): ', 's'); processedpath = input('Enter processed_data location(such as /home/processed_data): ', 's'); outputFile = input('Enter output result location:','s');...
f049a1c9200830a38502a83ec1420bf54b8ddce23a5715bcc1d04bbabc823a47
MATLAB
6,812
173
%% statistical significance in mvpa % non-parametric technique by combining permutations and bootstrapping % step1: % For each subject, the labels of the different conditions (eg. motion_vertical and motion_horizontal) were permuted, % and the same decoding analysis was performed. % The previous step was repeated 10...