sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a0abc9a3cb24cbf00e00d1af03f2474134e6aa6352884416c2b71abcf5573246
MATLAB
6,817
198
function [out, commuteOrder] = osp_onOffClassifyHERMES(in, target,Order) %% [outA, outB, outC, outD, commuteOrder] = osp_onOffClassifyHERMES(in, target,Order) % This function decides how the four-provided HERMES/HERCULES sub-spectra are % being edited. Currently, this function works for all combinations of % HERM...
4b92c69e0c46c8d3193961d4cf1d4969fcea3b8b95f817124ba098756ce671e8
MATLAB
6,819
220
% COMPHEADS - plot multiple TOPOPLOT maps of ICA component topographies % % Usage: % >> compheads(winv,'spline_file',compnos,'title',rowscols,labels,view) % % Inputs: % winv - Inverse weight matrix = EEG scalp maps. Each column is a % map; the rows correspond to the electrode positions % ...
5466f2e95f0115836c532bd83b3d96b411cefc0114bc4635dda9270787952f9c
MATLAB
6,819
187
function [cardiac_sess, respire_sess, mult_sess, ons_secs, order, verbose, ... c_sample_phase, r_sample_phase] ... = tapas_physio_create_retroicor_regressors(ons_secs, sqpar, order, verbose) % calculation of regressors for physiological motion correction using RETROICOR (Glover, MRM, 2000) % % USAGE: % [cardi...
1743b89831b83fa8bc54a88512df64bc3d8b4865761f3dd083ab5d69049cee5f
MATLAB
6,820
169
function [ Sequenzen ] = DicomDatenLaden( folderraw ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here % folderraw: Angabe des letzten Ordners, in dem viele Subordner sind % Beispiel: folderraw = % 'C:\Users\LutzAn\UserData\BETTINA\TEST\BS167\DICOM\0000A628\AAC90853\AA80BB63'; Se...
fdbd39a9efa976371ae809cdee2f5ba0369e4cc322087c8666bf6d056474a2ec
MATLAB
6,822
161
function TOL_fig_tolman1946(config,params,dat) % TOL_fig_tolman1946, figure of Tolman et al.'s (1946) apparatus and design % Figure 1 for: Duvelle and Grieves (2026) Tolman's Sunburst Maze 80 % years on: A meta-analysis reveals poor replicability and little evidence for % shortcutting. European Journal of Neuroscienc...
b0ea20631bc864446e168ab5d843fca267802ce7b7017e052844f4f78c66567a
MATLAB
6,829
153
function plot(staObject, cfg, varargin) % Plot the contents of a McsCmosStaExplorerSource object. % % function plot(analogStream,cfg,varargin) % % Produces a time series plot for each identified unit in the object. % % INPUT: % % staObject - A McsCmosStaExplorerSource object % % cfg -...
26c7eaf7391e4446e1ae0c051f8353e8af4f0e7ad77783991ed6a35394311848
MATLAB
6,834
206
function xsol = radio_interferometric_calibration(N, K) % Returns the gain matrices of N stations with K receivers. % % function xsol = radio_interferometric_calibration(N, K) % % N >= K is always assumed. % % The example considers calibration of an array of N stations. % We simulate a system with N stations, each havi...
3c10e42bad5e5c59034ff4eeaf071b2858f3e906787a6da80a959bb812260aa4
MATLAB
6,849
253
function net = cnn_imagenet_init_inception(varargin) % CNN_IMAGENET_INIT Initialize a standard CNN for ImageNet opts.scale = 1 ; opts.initBias = 0.1 ; opts.weightDecay = 1 ; opts.cudnnWorkspaceLimit = 1024*1024*1204 ; % 1GB opts = vl_argparse(opts, varargin) ; net = dagnn.DagNN() ; net.meta.inputSize = [299 299 3 1...
5290c33d0fd0068de693573cc9807582deaefa8a604e10d5650e1d9474c03246
MATLAB
6,851
252
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) % OUT = whole_brain_ptask_givena(OUT,2,'Activation_thresholded.img') % verbose flag if length(varargin) > 0, vb = vara...
289f1d808fc133b2aeb2f7ec6ff253b1d582f09b7d946b2d3fd468cd05129a94
MATLAB
6,855
203
function out = HT_DistributionTest(x, theTest, theDistn, numBins) % HT_DistributionTest Goodness of fit of a distribution fitted to a data vector. % % Fits a distribution to the data and then computes the test statistic of an % appropriate goodness-of-fit test, as an effect size that quantifies the % difference betwe...
6e687be459ffc625bad93262abb1170558a3ac200933393924d982236c00ec9f
MATLAB
6,856
193
function [Ae, indice, Rp] = vca(R,varargin) % Vertex Component Analysis % % [Ae, indice, Rp ]= vca(R,'Endmembers',p,'SNR',r,'verbose',v) % % ------- Input variables ------------- % R - matrix with dimensions L(channels) x N(pixels) % each pixel is a linear mixture of p endmembers % signatures R = M...
b6e7c70e12949aaba925ab7cc464c1de7e95f766d992b3204e8003a76d92cb20
MATLAB
6,857
185
function [est model] = baydiff(data,varargin), %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % estimates microstructural diffusion parameters by Bayesian estimation % written by Marco Reisert, Medical Physics, University Hospital Freiburg % % [est model] = baydiff...
629a2d2f83ea2cc24897545bdbf323c0e287158a20ea4a23fc5f7b3a188e4ebe
MATLAB
6,858
120
function plot_region_by_region_interactions_across_analyses close all clear all clc % Plot region-by-region interaction relationships across analyses. % Select a folder containing data. folder_name = uigetdir; cd(folder_name) load('functional_connectivity.mat') load('trial_by_trial_correlation.mat') load('regression...
6f23fbb6d50e4f27a258fcd04ff83f15bbf7cbef6125c6dd2850f6835c098154
MATLAB
6,864
188
% POP_SAVESTUDY - save a STUDY structure to a disk file % % Usage: % >> STUDY = pop_savestudy( STUDY, EEG ); % pop up and interactive window % >> STUDY = pop_savestudy( STUDY, EEG, 'key', 'val', ...); % no pop-up % % Inputs: % STUDY - STUDY structure. % EEG ...
d74fafe305822a13b10f84dbf9a715f60b264c7498dcbc79d17b32ad0ba1dbd9
MATLAB
6,864
229
function fear_reactFrzModShBase(basename,varargin) % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; %% load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) %% param.sesIdx=2; param.nIte=500; param.recalculate=false; param=pars...
1e70d0adf9ce46d7b28883846b58d2d03d8342ac414c1f7b91c37cd64e07bbff
MATLAB
6,874
169
function makeHeatMap(spikeMatrix,option,channels, fs) % outputs a heatmap figure handle for your spikes % Assume numSamp x 60 matrix % INTPUT % spikeMatrix % number of samples x numChannels binary spike matrix % where 0 means no spike and 1 means spike ...
f7b0ac147ded2ba42a5a21fc988a1d9de27346c78d4bfdf70711096e071e97ee
MATLAB
6,875
165
function results = get_Fisher_information(data_folder, file_prefix, file_ind1, Nfile, Ntr, ds, batch_ID, opts) % GET_FISHER_INFORMATION % Syntax: % results = get_Fisher_information(data_folder, file_prefix, file_ind1, Nfile, Ntr, ds, batch_ID) % results = get_Fisher_information(..., opts) % Description: % Compute...
4f09d711e30900577e4ffb24e026827f6f4e370c7c30ce72ee8208b78b546664
MATLAB
6,879
258
function handle = imab(data, clims, bSep, noCols) % function handle = imab(data, clims, bSep, noCols) % % Just show the 2D, 3D or 4D data as quickly as possible % % Concatenates the slice dimension from left to right, and the time % dimension from top to bottom. % % When Mosaiced, lowest slice is in bottom-left corner...
648054ffb73c5444eb1c0dd27acb4924484db18311edc7e89cb8e03d28a84ea8
MATLAB
6,882
223
function coactPaper_figureS02() labelWeight=true; labelCase=false; labelSize=9; letGapX=6; letGapY=5; fontsize=6; close all fh=initFig('width',18.6,'height',7.5,'font','Arial','fontsize',fontsize); x=10;y=6; panel_01(x,y,fontsize); panelLetter2(x-letGapX-1,y-letGapY+1,alphabet(1,labelCase),'fontSize',labelSize,'isBol...
818e430cd2404d6ad11d32745768a645506d63e143d6bca8edeb17bb71b445da
MATLAB
6,884
176
function [result,tracked,myelin,spatial] = main_script_function(save_spatial,intervention) threshold_oligo_apop = intervention.oligo_apop; threshold_stop_myelination = intervention.oligo_stop_my; %% Sim Conditions step_cap = 21600; %21600 is 300 days %% Setup Simulation [funcs,PB,sizing,borders,myelin] = Setu...
5468298e959ceac21de66f5a35d651a9254b49010424ef1091c0695b1e9d847c
MATLAB
6,886
191
function [dat] = read_brainvision_eeg(filename, hdr, begsample, endsample, chanindx) % READ_BRAINVISION_EEG reads raw data from an EEG file and returns it as a Nchans x % Nsamples matrix. % % Use as % dat = read_brainvision_eeg(filename, hdr, begsample, endsample) % where the header should be first read using READ_...
e99e22e5086331bab7a89a0c7c68071f0da0bd2ba8f6b86830bdf744abde3650
MATLAB
6,889
189
function [map,lo,hi] = cubehelix(N,start,rots,sat,gamma,irange,domain) % Generate an RGB colormap of Dave Green's Cubehelix colorscheme. With range and domain control. % % (c) 2017 Stephen Cobeldick % % Returns a colormap with colors defined by Dave Green's Cubehelix colorscheme. % The colormap nodes are selected along...
e764305fc027b942bd3628002448aa0c73ef1025004c3b6de76b03b89b76e50b
MATLAB
6,895
172
%% Creating imrpoved hybrid image (T1w+QSM) by matching DGM contrast accurately to the hybrid atlas % Dependencies: (1) SEPIA v1.2.2.4 % Data: (1) ABRIM dataset (https://doi.org/10.34973/7q0a-vj19) (2) MuSus-100 (https://doi.org/10.1007/s00429-022-02547-1) % Created by Kwok-Shing Chan % Date created: 25 April 2023 % fu...
820d9472ac27a9ffbfa34660d9ec9406003f266f0ec890be1e2caadc9ee8ec53
MATLAB
6,896
198
function [C2,cfg] = lda_iem_trialwise(dat,theta,cfg) % [C2,cfg] = lda_iem_trialwise(dat,theta,cfg) % author: N Myers if nargin < 2 help lda_iem_trialwise error('missing input arguments!') end ntrl = size(dat,1); % number of timepoints nsens = size(dat,2); % number of M/EEG sensors ntim...
26c2b41fb184f1eabf4a3c289eff068a7858da6f912f734b12f6ded69164b158
MATLAB
6,898
192
% prepareScan — Prepares experimental session. % Opens window, defines parameters, device input, loads/creates textures, generates frames, and makes stimuli for drawing. % % Syntax % [p, w, t, stimuli, frames] = prepareScan(p, w, t, dirs, toggles) % % Input Arguments % p – structure containing scan parameters % ...
5371c23c05b075737b78ff48751a3b1be464d28e7c5d02db4b8074bedac525df
MATLAB
6,904
220
function [ all_subjects ] = nmri_statistics( all_subjects, opt, params ) %[ all_subjects ] = nmri_statistics( all_subjects, opt, params ) % Will do generate a tabulated overview of metrics (all that are readable) % via nmri_load_metrics for any number of subject % % all_subjects = cell array of subjects (see n...
c1c77016ba1c3d71f6664749015a57b97ff9d4e532ee683135cfea5ce5c4a716
MATLAB
6,908
145
function inside = in_polyhedron(varargin) %% Point within the volume test %IN_POLYHEDRON Tests if points are on or inside a 3D triangulated surface % (faces/vertices) or volume (tetrahedrals/vertices). There is NO % assumption about orientation of the face normals. % % IN = IN_POLYHEDRON(X,POINTS) tests if th...
f3b573999a0fb7fd6ada8134a5fc8424db9ff08e36d837cfca02569c0542c703
MATLAB
6,908
246
% 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...
026756ed9bc7bea248339ba7b872df5adf2479fd65d3391a85ed5af00f6d77e3
MATLAB
6,911
191
function [map,data] = PhaseMango(spikes,phases,varargin) %PhaseMango - Compute phase as a function of spike rate and acceleration. % % Compute spike phase as a function of spike rate and acceleration, as in % Harris et al. (2002). The name of the function refers to the aspect of % the resulting phase plot. % % USAGE ...
ed64613fd23e261395268797380feb6504fbe4a07ac412829d998af8fa077163
MATLAB
6,917
163
function spectra = spectra_stft_baseRS(params, trials) % computes spectra for each trial using STFT % baseline = resting state (if resting state not found, use spectra_stft_sessions) % trials = % data: [3073x125x500 double] % time: [3073x1 double] % sessTime: [3073x500 double] % label...
cf6217dc9e8682d0e4ff8a159f786c24feba256182f6865e8b4199bae6f5feec
MATLAB
6,918
176
function out = NL_BoxCorrDim(y, numBins, embedParams) % NL_BoxCorrDim Correlation dimension of a time series. % % Estimates the correlation dimension of a time-delay embedded time series % using a box-counting approach, via TISEAN's 'boxcount' (this operation % previously used TSTOOL's 'corrdim'). % % 'boxcount' estim...
3bbc737e3a478b9abec9bb053bafa8667ccc35c8f83b4995bbf3d5e844b95d3e
MATLAB
6,922
132
%% Script to plot brain maps of subcortical MIND associations. % Copyright (C) 2026 University of Seville % Written by Natalia García San Martín (ngarcia1@us.es) % This file is part of Hierarchy Longitudinal MIND Gradients Psychosis toolkit. % % Hierarchy Longitudinal MIND Gradients Psychosis toolkit is free...
4338916ad0c3896f6f5a7a8e7d23b548f13b12d772dc3985de2afe2c6a2d827c
MATLAB
6,922
169
%% Creating imrpoved hybrid image (T1w+QSM) by matching DGM contrast accurately to the hybrid atlas % Dependencies: (1) SEPIA v1.2.2.4 % Data: (1) ABRIM dataset (https://doi.org/10.34973/7q0a-vj19) (2) MuSus-100 (https://doi.org/10.1007/s00429-022-02547-1) % Created by Kwok-Shing Chan % Date created: 25 April 2023 % fu...
d72ca4e74aa0e0158102da6cbd46292d535a4afc5c3c906c943aab4af3f6beec
MATLAB
6,922
159
function [varargout] = likLaplace(hyp, y, mu, s2, inf, i) % likLaplace - Laplacian likelihood function for regression. % The expression for the likelihood is % likLaplace(t) = exp(-|t-y|/b)/(2*b) with b = sn/sqrt(2), % where y is the mean and sn^2 is the variance. % % The hyperparameters are: % % hyp = [ log(sn) ...
2b8388d633c965fd181a446170ed2e22d5bdd42dc6600550bbd6f41b0f2858d6
MATLAB
6,925
182
function res = arg_report(type,func,args) % Report information of a certain Type from the given Function. % Result = arg_report(Type,Function,Arguments) % % Functions that declare their arguments via arg_define() make their parameter specification % accessible to outside functions. This can be used to display auto-gene...
8052193b0a92bb21da17db8530d0c6bfe008b9cf924aca75c602a8936ed81a4e
MATLAB
6,925
291
%% drakontos(Enunciado) % % Regresa los Ciclos de Hamilton y Euler del Enunciado. % % Enunciado = "string" % % %% function HandE=drakontos(e) e_c=getCiclo(e); % obtiene todos los ciclos del enunciado n_he=0; % número de ciclos de hamilton y euler encontrados % busca entre todos los ciclos del enunciad...
29881aa8fba37199cb39067dfeaed5704ae0de2fef2da075f0cf72270ece0eeb
MATLAB
6,929
212
function [f,p,ci,stats,tbl,dist] = permuranova2(x,varargin) %PERMURANOVA2 Permutation-based two-way repeated-measures ANOVA and Friedman test. % F = PERMURANOVA2(X) performs a balanced permutation-based two-way % repeated-measures analysis of variance (ANOVA) for comparing the means % of data in a 3D matrix X (w...
f5a7bb5f0bdf7c4e4468bd05679ba055c1847fed3b605159afc5805294181dbc
MATLAB
6,931
167
%% [chi,chi_para,chi_dia] = Wrapper_QSM_Chi_separation(localField,mask,matrixSize,voxelSize,algorParam,headerAndExtraData) % % Input % -------------- % localField : local field map (tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial resolution of e...
77c0b5ab365e4ce0858cd98db0bef68805a00829b1f3d511318b2638b2fa9c1b
MATLAB
6,934
165
function [updatedCategories, updatedMatches, updatedWeight,... updatedNumCategories] = ARTwarp_Recat_Single_Cats(categories,... matches, contours, weight, vigilance, bias, learningRate,... compareWarped) % A function to recategorise contours which are alone in their category, if % they match another catego...
2bce4d7cb9773172101a26935209358439077515b23b361d4925fc41f9d43e2e
MATLAB
6,936
117
clc clear all close all anglerror =[]; distance_list= []; x_distance = []; y_distance = []; whicheye = input('Please enter left or right to choose eye: ','s') filepath = input('Enter procesed_data location: ', 's'); if isempty(dir(filepath)) disp([filepath, '" does not exist.']); end for user_num = 1:1 %(user_nu...
0affa17fbf10bf675747c70c67bbb34f98ab8b52a641e5fbf196bd4beb90216f
MATLAB
6,940
193
function [mBIS, mBISp, etaBIS] = analyzeBehaviorWithEig_3way(data, Tmean) % ---------- reshape ---------- data = permute(data,[1 3 2 4]); % [subj x epoch x comp x time] [~, nEp, nComp, nTime] = size(data); % ---------- ensure categorical with desired order ---------- Tbl = Tmean; if ~iscategorical(Tbl.Subjec...
519ff10c627c58a999483d9ae88dd9882117984ca10689a4edb8805e2c4a43fc
MATLAB
6,941
219
function [aps, speed] = fast_rcnn_evaluate(varargin) %FAST_RCNN_EVALUATE Evaluate a trained Fast-RCNN model on PASCAL VOC 2007 % Copyright (C) 2016 Hakan Bilen. % All rights reserved. % % This file is part of the VLFeat library and is made available under % the terms of the BSD license (see the COPYING file). run(fu...
86afbaf983e1c89a5befce505b9544200a94e98d908e3fde66d3633354bbbda0
MATLAB
6,943
249
function [traj, infStates] = tapas_ehgf(r, p, varargin) % Calculates the trajectories of the agent's representations under the HGF % % This function can be called in two ways: % % (1) tapas_ehgf(r, p) % % where r is the structure generated by tapas_fitModel and p is the parameter vector in native space; % % (2)...
76c602723112f78c7ee2cd35c6f7ff70f5e7742b4893c1298807c66d5576615a
MATLAB
6,946
201
% readneurolocs() - read neuroscan polar location file (.asc) % % Usage: % >> CHANLOCS = readneurolocs( filename ); % >> CHANLOCS = readneurolocs( filename, method, 'key1', val1, ...); % % Inputs: % filename - file name or matlab cell array { names x_coord y_coord } % method - [1 2, 3, 4 or 5] different imp...
8fd76d7c0a93fa990d965549897255df85a028af0868c351f48b0ee3389acc59
MATLAB
6,946
156
function groupLevelTTest_cluster(output_dir) nFiles = 16; rsa_tool_path = 'rsatoolbox'; spm_path = '/data/holly-host/smark/spm'; data_path = fullfile('/data/holly-host/smark/fmri_sub_preproc_dir',output_dir); addpath(genpath(fullfile(data_path,rsa_tool_path))) addpath(spm_path) ana_name = 'standard_L100_FSLcleaned280...
43e2426da181a223fee0377c73735a401937054daab0ff1fe6204b6f3befd448
MATLAB
6,950
265
function [traj, infStates] = tapas_hgf_categorical(r, p, varargin) % Calculates the trajectories of the agent's representations under the HGF for categorical inputs. % % This function can be called in two ways: % % (1) tapas_hgf_categorical(r, p) % % where r is the structure generated by tapas_fitModel and p is...
8ecc337b3ffc79b0c6eb6b93860a8f85436d71cc4a66b5524b15b946264e0f90
MATLAB
6,957
196
function fd_ft = getMaxCCFD_FT(predTraj, respTraj, realTraj, parms) % computes windowed CC between predTraj and respTraj, both have format: % predTraj: samples x FD groups (freq) % and returns its maximum freq. -> ccMax % computes windowed FT, smoothes and returns its maximum freq. -> ftMax % (c) Jiri, Jul12 nSamples...
990c6640f2720a1a3b6b301299f5fab6a5750cb84583cd9455596b8cd75f6376
MATLAB
6,957
177
function [Ephys] = firingRatesBursts(spikeMatrix,Params,Info) % Detects firing rate bursts % INPUT % ----------------------- % spikeMatrix : matlab double % Params : struct % Info : struct % OUTPUT % ---------------------- % Ephys : struct % structure with fields relating to firing rate and burst properties...
c52e2085efb5f2e95d230540dce205f78b63fc4dd578627d1d7173ec08e3e67e
MATLAB
6,958
268
function hh = myErrorbar(varargin) %MYERRORBAR Adds errorbars to existing plot (unlike errorbar.m, which creates a new plot, and allows only bars for y values) % MYERRORBAR(X,Y,L,U) adds error bars to the graph of vector X vs. vector Y with % error bars specified by the vectors L and U. L and U contain the % low...
09bf9d8d5086040fb8a84cd9f6ef9094cdee9dbaf7903a3bf89ba8e4f0194c2a
MATLAB
6,959
265
function [traj, infStates] = tapas_hgf_categorical_norm(r, p, varargin) % Calculates the trajectories of the agent's representations under the HGF for categorical inputs. % % This function can be called in two ways: % % (1) tapas_hgf_categorical(r, p) % % where r is the structure generated by tapas_fitModel and...
1aec7d5c5f516401eed08405706c79c600ed816e8fca2fc45cdbc14e3716c604
MATLAB
6,962
203
function varargout = ft_version(command) % FT_VERSION returns the version of FieldTrip and the path where it is installed % % FieldTrip is not released with version numbers as "2.0", "2.1", etc. Instead, we % share our development version on http://github.com/fieldtrip/fieldtrip. You can use % git to make a local clon...
0f55326692f6b78959867f28ceb4119c558c3f045fcaff0141e3e6de5f4939b9
MATLAB
6,963
175
%% Take HOA to t1 space analyfold = '/home/NCPL10/Desktop/Wanglu-scz/Cross_AHMU' [TMSPath, fileN, extn] = fileparts(which('TMStarget.m')) t1path = [analyfold,'/T1ImgNewSegment'] hoamask = [TMSPath '/mask/HOAsub25prob.nii'] ; sublist = dir (t1path) ; for i = 3 : length(sublist) % cd ([t1path,filesep,sublist(i)....
eb05b8ed4a8d5a273e00c746f544ee0bc519ab9b62b9cebc1620865c6ce307b9
MATLAB
6,963
222
function addImageSequenceToAxes(ax,il) % USAGE % addImageSequenceToAxes(ax,imagelabels) % FUNCTION % places a set of images at equal distances along a line in a 2d % coordinate system, which is then mapped to the axes of the RDM % in ax. imagelabels is a struct with the following fields:...
13258136aa1840d62dafe68bb3dcd516b8c3d4ec9fb6579c50218cffe41ef500
MATLAB
6,966
169
function [K,dK] = covSM(Q, hyp, x, z) % Gaussian Spectral Mixture covariance function. The covariance function % parametrization depends on the sign of Q. % % Let t(Dx1) be an offset vector in dataspace e.g. t = x-z. Then w(DxP) % are the weights and m(Dx|Q|) = 1/p, v(Dx|Q|) = (2*pi*ell)^-2 are spectral % means (freq...
345213d9860c2e1859dba88071c479c8b7554e2dca0fca4c56e19d4aa71d4e6f
MATLAB
6,967
215
function M = fixedrankfactory_2factors(m, n, k) % Manifold of m-by-n matrices of rank k with balanced quotient geometry. % % function M = fixedrankfactory_2factors(m, n, k) % % The first-order geometry follows the balanced quotient geometry described % in the paper, % "Linear regression under fixed-rank constraints: ...
dcc24863df9ab420efd1c113001279b636503d368ebc610557c642494d350705
MATLAB
6,969
195
function [channels,coords] = getCoordsFromLayout(channelLayout) %GETCOORDSFROMLAYOUT Specifies mapping from channel number to spatial %coordinates % We provide a few default coordinates from % the Multichannel systems (MCS) (60 electrode In Vitro MEA set up) and % the Axion system. Alternatively, you can specify your ...
6e4a0a7b267c1b4f0b0200435ea1ec2af549e245c4657ff2bb22b5c845686d6c
MATLAB
6,981
267
function [traj, infStates] = tapas_hgf_whichworld(r, p, varargin) % Calculates the trajectories of the agent's representations under the HGF % % This function can be called in two ways: % % (1) tapas_hgf_whichworld(r, p) % % where r is the structure generated by tapas_fitModel and p is the parameter vector in n...
7028c1d1c5404f7f489ed565e835de091e9debd5bea12c57903d76ec046ef280
MATLAB
6,981
155
%% plot 3D brain model: test script % - define 3D brain structures (should be coregistered & normalized to MNI space) % -> sees truct: params.plot_brain3D % - define MNI coordinates and values to plot % -> chnls_MNI_VAL = 2D: [ch x 4], where 4 = 3 MNIs + 1 VAL % - load brain volumes -> surfaces % -> ...
72f97d09f48df0c2eac64ad9b6ea7c1558df54f31521dc18bb8401142583414e
MATLAB
6,981
207
function [N,X,sp] = smoothHistogram(varargin) % HISTOGRAM generates a histogram using the "optimal" number of bins % % If called with no output argument, histogram plots into the current axes % % SYNOPSIS [N,X,sp] = histogram(data,factor,normalize) % [...] = histogram(data,'smooth') % [...] = histogra...
6a4da5e4cd0ab003d2ec7a7631c5192ec6a1a5835baf60287286f6c5c362f79f
MATLAB
6,982
231
% plot3dmeshalign - align a first meshes or volume with a second mesh % to check alignment. % % Usage: % pop_roi_connectplot(file1, file2, transform, color1, color2, region); % % Inputs: % file1 - [string] name of the first mesh/volume % file2 - [string] name of the second mesh % transform...
614c62516854e62fd73931b171f05092b9d5f0ba15e4034281e487b3c87e9b43
MATLAB
6,983
181
function res = hlp_varargin2struct(args, varargin) % Convert a list of name-value pairs into a struct with values assigned to names. % struct = hlp_varargin2struct(Varargin, Defaults) % % In: % Varargin : cell array of name-value pairs and/or structs (with values assigned to names) % % Defaults : optional list of n...
e8e6020343a68c08054d210f34ace8ccf90758f83ee0aeec38f29ac465787da0
MATLAB
6,985
200
function [C2,cfg] = mahal_lin_trialwise_xtime(dat,theta,cfg) % [C2,cfg] = mahal_lin_trialwise_xtime(dat,theta,cfg) % authors: M Stokes, E Spaak, N Myers if nargin < 2 help mahal_lin_trialwise_xtime error('missing input arguments!') end ntrl = size(dat,1); % number of timepoints nsens ...
b2d3c4b6e19aab4e61c63a9a667aad9127824573e4c34fc0e06634c2bc901aaa
MATLAB
6,986
210
%% BiExpFitModelS0.m % This function contains a biexponential diffusion model % % lossFunction - calculates loss function for optimizer % forwardJacobian - calculates the forward jacobian for optimizer % forwardModel - converts parameter struct into model prediction % x2pars - converts x vecto...
949b82466e6d2aefbe2b2ac14a2ed3aade01d34798312d50982f4aa01cf7d40e
MATLAB
6,987
202
function plotFigure3_expertEphys(ephysPath, processedEphysPath, codePath) % Plot figure 3. YOU MUST RUN processEphysData_experts ON THE OFC % ELECTROPHYSIOLOGY DATA BEFORE RUNNING THIS FUNCTION. Plots average firing % rates for 20ul trials before and after the first incongruent trial. % INPUTS: % ephysPath = local p...
9d9956668726e911bd97185f9fb1837daebca115acb6a4c4d2efe224566f4845
MATLAB
6,989
197
function TS_LocalClearRemove(whatData,tsOrOps,idRange,doRemove) % TS_LocalClearRemove Clear or remove data from an hctsa dataset % % The result is saved back to the hctsa-formatted .mat data file provided as whatData. % %---INPUTS: % tsOrOps -- either 'ts' or 'ops' for whether to work with either time series % ...
3b64230e08b38f7e72b4432213792ae9381e298d9d39b5f36d0f153f26798818
MATLAB
6,991
150
function [status, res] = BF_RipserSystem(ripserCommand, timeoutSecs) % BF_RipserSystem Run a ripser command-line call with a bounded timeout. % % Sibling of BF_TiseanSystem.m for the ripser persistent-homology binary % (Toolboxes/ripser), with the same timeout-wrapping and exit-code % classification logic -- kept as ...
5e9eed23e73b6ae70964872e05eebaa62d7487adb22f1ae5c9ea2ad3855ab9d2
MATLAB
6,992
180
function [] = tapas_physio_write2bids(ons_secs, write_bids, log_files) % Converts trigger, cardiac and respiratory data from physio structure into % a .tsv file according to BIDS format. Meta data is written in a corresponding .json file. % % Parameters: % IN: % ons_secs: ons_secs (onsets in seconds...
fcea6ca9abcbca9f32a365125e3ef1542cacc56fb66207d01d4d45569afd6d69
MATLAB
6,992
213
function run_permuregress_examples %RUN_PERMUREGRESS_EXAMPLES Run permutation multiple linear regression examples. % Generates random multivariate data for a predictor sample X and % dependent variables Y. Y contains 20 variables, each with a correlation % of 0 to X, except for the first 5 variables which have a...
e12b1b6ffec081ca953896d3a2676ffdff5fa80f6b2ece2014b4af787c2fe7a9
MATLAB
7,007
147
% Group SPM preprocessing script for longitudinal data in BIDS % % Script prepared for preprocessing of fMRI data obtained for research project: % "Temporal dynamics of functional connectivity changes induced by cognitive training", % in which participants were fMRI scanned four time during intensive working memory t...
086646132478a363e847a397db50a20c15b9d893e61cbf310e6b5926662856ab
MATLAB
7,015
215
function fear_getMeanFR(basename,varargin) % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basicMetaData.Basename '.SleepState.states.mat']); load([basicMetaData.Bas...
454568041d117a09dfd0a73b01aeb8b737123a4974d58df8e58e7521e0a5e3c9
MATLAB
7,015
212
function [BCMatrix, BCRHS] = boundaryConditionCylindrical3D(BC) % It creates the matrix of coefficient based on the BC structureprovided % by the user. It also generates the right hand side vector of the linear % system of equations % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyri...
14608ae7fd3a1e81223467b009471716989582f76dbb34f6a7397683ff2fed13
MATLAB
7,017
165
function out = CO_MatrixProfile(y, m, maxN) % CO_MatrixProfile How well each subsequence shape recurs elsewhere in a time series. % % Computes the matrix profile: for every length-m window (subsequence) of the % time series, the distance to its nearest neighbour among all other windows, % after z-normalizing each win...
61902bc80dcc0e30a28301db251a721f2a4475ff0c8c8ae917aa55501a77ad60
MATLAB
7,023
255
function varargout = permcca(varargin) % Permutation inference for canonical correlation % analysis (CCA). % % Usage: % [pfwer,r,A,B,U,V] = permcca(Y,X,nP,Z,W,Sel,partial,Pset) % % Inputs: % - Y : Left set of variables, size N by P. % - X : Right set of variables, size N by Q. % - nP : An integer re...
e0a19b954214626984d55ce3fae33cca4106e34a4ae09562a98521a7990ca637
MATLAB
7,024
175
% STD_READTOPO - returns the scalp map of a specified ICA component, assumed % to have been saved in a Matlab file, [dataset_name].icatopo, % in the same directory as the dataset file. If this file does % not exist, use STD_TOPO to create it, else a pre-clustering %...
cc8672b20c5f3214a3cd4fa034b1d56c25e7f88a096f25ee5c52c90a19115676
MATLAB
7,026
135
classdef McsRecording < handle % Stores a single recording. % % The different streams present in the recording are sorted into the % {Analog,Frame,Event,Segment,TimeStamp}Stream fields where they are stored % as cell arrays. % % (c) 2016 by Multi Channel Systems MCS GmbH properties (SetAccess = privat...
d8aa9e6e36d3858e56100793c3b6879371690ebfe9c30e969be7a768f3cb89c6
MATLAB
7,026
239
function [str, p, h, stats] = signrank_nice(x,y,varargin) %SIGNRANK Wilcoxon signed rank test for zero median. % P = SIGNRANK(X) performs a two-sided signed rank test of the hypothesis % that the data in the vector X come from a distribution whose median % (and mean, if it exists) is zero, and returns the p-value...
192db478fd6d55ed7c0c71df1e26397bbc7b9c771d6f741d675188c7f147e708
MATLAB
7,029
204
function out = DN_RemovePoints(y, removeHow, p, removeOrSaturate, randomSeed) % DN_RemovePoints How time-series properties change as points are removed. % % A proportion, p, of points are removed from the time series according to some % rule, and a set of statistics are computed before and after the change. % % ---IN...
b80d746e4d7cd8132181f7dd01d8cc34f1991074a8708223f4c067adf249bca8
MATLAB
7,033
116
function gui = upper_navigate_box(gui, name,Selection,Overview) MRSCont = getappdata(gui.figure,'MRSCont'); % Get MRSCont from hidden container in gui class gui.upperBox.(name).upperLeftButtons = uix.Panel('Parent', gui.upperBox.(name).box, ... 'Padding', 5, 'Title', ['Navigate model'],...
0c38a4e18ac2868b637a559b58cae758f8c7d8da048d2c340db5e27a3a0a6069
MATLAB
7,036
174
function [newImg,xform,deformField] = mrAnatResliceSpm(img, xform, bb, ... mmPerVox, bSplineParams, showProgress) % Use SPM spline-based interpolation to reslice a volume image to a specific % resolution in mm. % % Also crops the image to be constrained inside a specific bounding box (bb) % also specified in mm. ...
4541849f947fc406fc058ff158fe7f5eef6db9f6089ced4f8ac62e90d40fc197
MATLAB
7,036
145
function [mu,sig,alpha,beta] = fit_eeg_distribution(X,min_clean_fraction,max_dropout_fraction,quants,step_sizes,beta) % Estimate the mean and standard deviation of clean EEG from contaminated data. % [Mu,Sigma,Alpha,Beta] = fit_eeg_distribution(X,MinCleanFraction,MaxDropoutFraction,FitQuantiles,StepSizes,ShapeRange) % ...
6a83e7f8e1c5b631434f5e7a391461309c5638242f04351fbc63d608bba057ab
MATLAB
7,040
206
% Main script for comparing laminar depth profiles of SANDI intra-soma signal fraction % between primary motor and visual cortices % % Reference: % Lee H, ..., Huang S, Communications Biology, 2026 % % Requirements: % - FreeSurfer installed and configured % - FreeSurfer recon-all completed for each subject % - FreeSurf...
aba725f48c59629c9d65f54b0463641fcfaa6d85a8b751cf837aa48861c3e4b0
MATLAB
7,042
202
function y = mvnpdfln(X, Mu, Sigma) %MVNPDF Multivariate normal probability density function (pdf). % Y = MVNPDF(X) returns the probability density of the multivariate normal % distribution with zero mean and identity covariance matrix, evaluated at % each row of X. Rows of the N-by-D matrix X correspond to obse...
9c00ee1d1961f6cfea73e8f6c5ac449296f4812c234afffdf5a1f045e00f3b50
MATLAB
7,044
192
function out = WL_cwt(y, wname, maxScale) % WL_cwt Continuous wavelet transform of a time series % % Uses the function cwt from Matlab's Wavelet Toolbox. % % ---INPUTS: % y, the input time series % % wname, the wavelet name. For a continuous wavelet transform, a proper % continuous analyzing wavelet like '...
e2b636a1fb1af1740bfdc54db5c22ec2256bf173323aae6e66e5c29fc2130f70
MATLAB
7,047
168
% STD_GETTRIALSIND - return the index of the trials that comply with the % defined values from trialinfo % % Usage: % >> trialindsx = std_gettrialsind('testnewstudyfile.mat', 'type', { 'C' 'X' 'Y' }, ... % 'load', [0 1 2 3 4 5 6], 'uncertainty1',[1 2]) % >>...
479080b49ba9821c5d292c5f28aa45206c4d6888b9a6a5fe1b4e3179fa1619d7
MATLAB
7,052
179
function shuffle_icaReacCCG(basename) [rootPath,sesName,~]=fileparts(basename); fprintf('%s load files for %s\n',datestr(now),sesName); load(fullfile(rootPath,'data',[sesName '-icaReac.mat'])) load(fullfile(rootPath,'data',[sesName '.sleepstate.states.mat'])) load(fullfile(rootPath,'data',[sesName '.sessions.events.ma...
6cb511c2df490ab547872af26d6889316a51682da91c8c8623a32c8ad1b8290d
MATLAB
7,052
214
function info = convert_open_ephys_to_kwik(varargin) % % Converts Open Ephys data to KWIK format % % by Josh Siegle, November 2013 % % info = convert_open_ephys_to_kwik(input_directory, output_directory) % % input_directory: folder with Open Ephys data % output_directory (optional): folder to save the KWIK files...
c08759766f1ce9e24fef4d5d45d4c3564f41c21b162378017917d0b776ab2029
MATLAB
7,056
190
% op_sortMRSIsdat.m % Helge Zoellner, The Johns Hopkins University 2020. % % USAGE: % out=osp_MRSIRecon(in); % % DESCRIPTION: % % % in = input data in matlab structure format. % % OUTPUTS: % out = Output dataset following zeropadding. function out=op_sortMRSIsdat(in); % 2D MRSI data %Now that we've ...
fb66e05a2dd4402413ee6b3362cd96f6b93451b6199c624d275ffdd2c7557c31
MATLAB
7,063
173
function processBehaviorData(behaviorPath, codePath, savePath) % Process behavior data. Must run for plotFigure1_expertBeh, % plotFigure6_naiveBeh, plotFigureS1_rawWTexperts, % plotFigureS9_naiveBehSupp %INPUTS: % behaviorPath = local path to behavior data downloaded from Zenodo % codePath = local path to where c...
a6d0b688e830fc83c1efacd7730c47269dfcb65e0e3c87202fe1a0ab227be6e3
MATLAB
7,068
189
function DBAddFigure(f,eid,name,comments,parameters,mfiles,varargin) %DBAddFigure - Save figure in current database. % % Save figure as MATLAB fig and PNG image. Also save code used to generate it % (although not required, installing <a href="http://sites.google.com/site/oliverwoodford/software/export_fig">export_fig<...
b13f3a9cd76afdd0b76e78441ba0b5ee037ef92aadd1973b63c1162d7f9b2426
MATLAB
7,074
219
% Bang et al (2020) Private-public mappings in human prefrontal cortex % % Reproduces Figure 2-figure supplement 1 % % Visualises behavioural data for prescan phases and performs associated % regression analyses % % Statistical tests can be reproduced by applying one-sample t-tests to % regression betas: e.g. [H,P,CI,...
3ceed15c8004099f57cdc55274bbf8d140754c64a766e5fc92d44cb2c8ee3ea7
MATLAB
7,076
260
% Collapse multiple single-scan NIFTI files into a multiple-scan NIFTI file % % Usage: collapse_nii_scan(scan_file_pattern, [collapsed_fileprefix], [scan_file_folder]) % % Here, scan_file_pattern should look like: 'myscan_0*.img' % If collapsed_fileprefix is omit, 'multi_scan' will be used % If scan_file_fol...
c300aab2946ca3b76efa3589267655d84ed8f86144ad73c94030677cbf17287d
MATLAB
7,079
199
function [MP2RAGEimgRobustPhaseSensitive, multiplyingFactor] = RobustCombination(MP2RAGE, regularization, HG) % FUNCTION [MP2RAGEimgRobustPhaseSensitive, multiplyingFactor] = RobustCombination(MP2RAGE, [regularization], [HG]) % % This script creates MP2RAGE T1w images without the strong background noise in air regions...
adfa98ab7e2e7290676ff98d1b442ff76af357955d63f39abc78d70028d2f3e0
MATLAB
7,083
203
function [hdr] = read_ctf_res4(fname) % READ_CTF_RES4 reads the header in RES4 format from a CTF dataset % % Use as % [hdr] = read_ctf_res4(filename) % % See also READ_CTF_MEG4 % "VSM MedTech Ltd. authorizes the release into public domain under the % GPL licence of the Matlab source code files "read_ctf_res4.m" and...
4814365dc243e54b21b788ea7a3cb45ef6881df6ef382034cd4d3447bf8a37e3
MATLAB
7,084
200
function [rate_dat,lambda,trial_idx_final,lambda_var,data_idx,mod_idx,XKnew] = ... cleantrials(f,trialmask,alignment, tmin,tmax,ops) %parse up continuous data into trials and trim edges correctly to compare data and a model fit % %Inputs: % f: loaded fit structure % trialmask: (ns x 1) boolean for w...
3b2619a3081be64f1aaf8843c545a443c9bfbb1bdeef1ce248145134f0f37b0e
MATLAB
7,085
196
function fp = hlp_fingerprint(data) % Make a fingerprint (hash) of the given data structure. % Fingerprint = hlp_fingerprint(Data) % % This includes all contents; however, large arrays (such as EEG.data) are only spot-checked. For % thorough checking, use hlp_cryptohash. % % In: % Data : some data structure % ...
b2e412c2c2d31479e8a551f30ca649baedea454eff2c6982ab428cd0eea6ccb5
MATLAB
7,087
232
function varargout = semplot(x,y,color,smooth,solid,opt) %semplot - Plot mean (line) +/- s.e.m. (shaded area) of a matrix 'y' % % USAGE % % handles = semplot(x,y,color,<options>) % % x abscissae (optional, default is 1 : size(y,2)) % y ordinates, each column contains multiple valu...
6e1ac08c79b4f62781bae0bd9494a25603536ef881b95e9835526d1c5354d209
MATLAB
7,092
244
function [channels,overall_amplitude] = eeg_amplitudearea(EEG, channels, resrate, wstart, wend) % EEG_AMPLITUDEAREA - Resamples an ERP average using spline interpolation % at a new sample rate (resrate) in Hz to get the exact limits % of the window of integration. Finely sa...
8baa68a285c299ca682ae0793adef3e50b83beb8ba8a0e27fdef11b9bd2cf6eb
MATLAB
7,093
203
% CALIPER - Measure a set of spatial components of a given data epoch relative to % a reference epoch and decomposition. % Usage: % >> [amp,window]=caliper(newepoch,refepoch,weights,compnums,filtnums,times,'noplot'); % % Inputs: % newepoch = (nchannels,ntimes) new data epoch % refepoch = a (nchan...
2db564d473de4437e0edc5e04edc6498feff8892752ebea25c7b0448d8e4af9c
MATLAB
7,098
183
% TEXTGUI - make sliding vertical window. This window contain text % with optional function calls at each line. % % Usage: % >> textgui( commandnames, helparray, 'key', 'val' ...); % % Inputs: % commandnames - name of the commands. Either char array or cell % array of char. All style ar...
78361e94c715bcbfdbbd8bfc0751524fe802fb9a45499fe840c28b687cab0ac8
MATLAB
7,098
265
%% save_sepia_header(input,userDefine,output) % % Usage: % % Input % -------------- % % Output % -------------- % % Description: % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 23 May 2019 % Date modified:11 August 2021 % % function save_sepia_header(input,userDefine,output) % constant gyro = 42.57747...