sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e1915ac31394038606c7a4f28ff8fc95fa8ccaf7c2679307e56af75906647da0
MATLAB
2,975
79
function plot_footprint(PATH, cfg, fieldNames) % Plot the previously calculated gait artifact footprint proposed by Jacobsen et al.,2020 % The group-average footprint will be plottdt across the raw data and five % different artifact attenuation strategies in one spider plot % download toolbox at % https://de.mat...
479c11493216d39df117a0e58dd4caabdf336c3dcee4572acc6b546a372b0619
MATLAB
2,976
80
function [alpha, beta, r2] = CharnessRabinModel(Thap) % function [alpha, beta, r2] = CharnessRabinModel(Thap) % % Fits the Charness & Rabin (2002) inequality model to the happiness data. % Input is table, with happiness and outcome values; outputs are the % best-fitting parameters (grid search). % % In this analysis, I...
7b92bbf36f05e93f4bdc1adb35bf8eb406116a3f7755316edd9d14b3d6890f46
MATLAB
2,976
78
function [selCh_all, selCh_groups] = ch2roi_selCh_atlasRoi(params, nCh, useOnlySignif) % TBD (now=Oct23) % returns all selected channels 'selCh_all' & channel groups 'selCh_groups' % returns channel indices 'ch' indexing the selected channels: selCh_H(ch) % specified in: params.connectivity.selectedChnls % based on atl...
8cc8e88b72991259e8399d55daad5503e56861f70b37dfaf7fb5a0d8924a4fdb
MATLAB
2,977
119
function [movie_trim]=trimMovieEdges(h5Path,varargin) % [movie_trim]=trimMovieEdges(h5Path) % trimMovieEdges(h5Path) % % h5Path can also be a local workspace variable. % Variable input arguments: % options.timeChunk=false; % options.saveData=true; % options.verbose=1; % options.dataset='mov'; % options.windowSize=5000...
383a7a4b4ee6bb16926eed22fcc89c60039986e6eee8d944a516dca60933302c
MATLAB
2,978
125
function sero_pulseq_plotMechSpectrum(seq, n, mode, fInterval, tRes, ascData) % function sero_pulseq_plotMechSpectrum(seq, n, mode, fInterval, tRes, ascData) % % Function to plot the mechanical spectrum from seq based on the Matlab % function "pspectrum". % n is 1x2 index vector that defines start and end index. % mode...
d976ae48e4d9b3a68aad1cd3f8f0067c8266f95e8783f6d54acaf63d726d935f
MATLAB
2,978
82
function [simControl, simMuscimol] = simDynamics(ratList, behaviorDataPath, ... simType, twin, binSize, smoothfactor) %Simulate wait times and wait time dynamics around block transitions using different %versions of the behavioral model. SSS 08/2023 %INPUTS: % ratList = matfile containing a list of rat names to ...
1090c3d1bdddfec6bcedd2159249fec60c85aa463e60f91342b9ecb9f0edcd48
MATLAB
2,980
78
% REALPROBA - compute the effective probability of the value % in the sample. % % Usage: % >> [probaMap, probaDist ] = realproba( data, discret); % % Inputs: % data - the data onto which compute the probability % discret - discretisation factor (default: (size of data)/5) % ...
c98a4d1bb1473f196ed834b6182824daf71f73ac1b61d1df2fffdc09b8ec467c
MATLAB
2,982
54
function preprocess_nsd_SWI(subjix) % function preprocess_nsd_SWI(subjix) % % <subjix> is 1-8 % % Use ANTS to use a BSplineSyN to match the SWI magnitude image (gradunwarped) % to the EPI 1.0-mm resolution. We use some carefully crafted parameters. % % We then create a final 0.5-mm SWI image and some other resolution...
48601b6ad6d1c3c8429a09f6d7d8c6f0b1dddf6834d146ff694b62d51ad89e71
MATLAB
2,984
83
% Expects subjix to be defined. % Creates a number of variables in the workspace (does not include the data). % define hemis = {'lh' 'rh'}; datanames = {'lh' 'rh' 'subcortex' 'func1pt8mm' 'cerebellum'}; imageres = 50; % resolution for the prf model (8.4/50 = 0.168 deg) pxtodeg = 8.4/imageres; % calc fsdir = sprintf(...
a5b98cb0d0690c760278fdacaca81c9a7236eb894be1d00907e855a6e4b15c30
MATLAB
2,984
84
function data = osp_import_Tarquin_fit_ouput(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % data = IMPORTFILE(FILENAME) Reads data from text file % FILENAME for the default selection. % % data = IMPORTFILE(FILENAME, STARTROW, ENDROW) Reads % data from rows STARTROW t...
01014f5af3f3a559d3a99d68cf418e83bdee5f2e619371c7875b610b12c50673
MATLAB
2,985
77
%% Main Simulation Functions Suite % Refactored spiking neural network simulation code % Author: Deying Song % Date: Aug 15th, 2025 % Version: 2.0 %% ======================================================================== % MAIN SIMULATION WRAPPER %% ==================================================================...
29c7ec0e71bafe32dcc5ad6ba52ce8864c5ce1783ef1635a36c46a4e93eb15cd
MATLAB
2,987
86
lossless_marks = load('derivatives/EEG-IP-L/code/scripts/lossless_marks.mat'); timeOrdering = {'manual','init_ind','ch_sd','low_r','mark_gap','logl_init', ... 'ic_sd1','logl_A','logl_B','logl_C','ic_sd2','ic_dt','ic_a','ic_b','ic_lg','ic_hg'}; for mark=1:length(lossless_marks.extra.chan_info) id = 0; for ...
d0cf5a754a4cd58a252b90265832d0e812cae87e818f4ba0ec109e296698761f
MATLAB
2,987
118
function showVoxObj(mapORcoords, figI, subplotTriple, adjustMargin, axisLabels, materialDef) % USAGE % showVoxObj(mapORcoords[, figI, subplotTriple, adjustMargin, axisLabels]) % % FUNCTION % to display a binary voxel object defined by mapORcoords % % ARGUMENTS % mapORcoords % this can be a 3D binar...
709a08c6e9522df429a7d67cc3312802d0c0e54a767fcf07d9de0114a5d404fb
MATLAB
2,988
89
% firfiltsplit() - Split data at discontinuities and forward to dc padded % filter function % % Usage: % >> EEG = firfiltsplit(EEG, b); % >> EEG = firfiltsplit(EEG, b, causal); % >> EEG = firfiltsplit(EEG, b, causal, usefftfilt); % % Inputs: % EEG - EEGLAB EEG structure % b ...
5619ec87058c13022db2a1254b3367ae67ca2205f991faca3e87368fb0e33a57
MATLAB
2,989
108
function [Out] = GetRMSError(sn) Azimuths = [-75:15:75]; for idx = 1:length(Azimuths) TargetAzimuth = Azimuths(idx); % --- lp ResponseAzimuths = sn.lp_Azi(:,idx); nTrials = length(ResponseAzimuths); nTrialsHalf = nTrials * 0.5; n1 = nTrials/2; % last idx of first half of trials n2 = ...
bac1a5f84b5f31fb2b242a3afb2e6781b3c6e411d7b1ec0c295384b2e7801c08
MATLAB
2,989
76
function task_gaitERSP_IC(sii, PATH, cfg, fieldName) % perform spectral PCA à la Seeber % - sii: vector of subject IDs to be processed % - PATH: structure with all paths leading to diff processing steps % generated in naj_neurCorGait_paths % - cfg: structure with all processing variables generated in naj_neur...
74213877d31aff853be5f08881fc73cbac7fd67a9dc1f897dc28f51336a6e604
MATLAB
2,990
97
function FCMap = WMMultiSeedFC(FunDir,SeedDirS,MaskDir,OutDir) % SeedDir is a structure % SeedDir={'a/s.nii';'d/ss.nii'} if nargin==3 OutDir=[]; end [funhead fundata] = TMSReadNii(FunDir) ; dim1 = funhead(1,1).dim(1); dim2=funhead(1,1).dim(2); dim3=funhead(1,1).dim(3); if iscell(SeedDirS) ...
da3df1dcaaf5534300750d3c2432d1e5414643fd090705e634c579114bce79db
MATLAB
2,990
67
function y = BF_TieBreakNoise(y, seed) % BF_TieBreakNoise Adds tiny, reproducible jitter to break exact ties in y. % % Returns y unchanged unless it has a high proportion of repeated values % (< 90% unique), in which case Gaussian noise with standard deviation % 1e-10 x std(y) is added: small enough to leave any well-...
f5d7a085364dac96f8d938c67044df297f1fd05de4bd3f8549adaf814d39feee
MATLAB
2,990
72
% script to find potential conflict between Matlab functions in the current % path % % A. Delorme, May 25th, 2012 % Copyright (C) A. Delorme, May 25th, 2012 % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and details. % % Redistribution and use in source and binary forms, with or wit...
62e37e003e9a322eaae05b44eb6d49e8ed6b2c7d7979105c4846179587f92439
MATLAB
2,991
97
function [dat dt t0] = loadHWS(fn,group,waveform) % Function for loading data written by HWS from NI Labview dat = []; fid = H5F.open(fn,0,0); gid = H5G.open(fid,'/'); % iterate through all the wfm_group for i = 0 : H5G.get_num_objs(gid)-1 % check the name attribute of the wfm_group/id group id_group = ...
a329e0311a21a43248427e7552b4f13962618b2f7c740723bd5dfdd0d3a1a27c
MATLAB
2,991
116
function conmask = xyz2density(XYZmm,mask,V,str,radius,studyweight,varargin) % conmask = xyz2density(XYZmm,mask,V,str,radius,studyweight,[enter vox xyz flag] AND [no write image]) % % Take a list of xyz mm coordinates and turn it into a density mask % with spherical convolution. % % XYZmm: n x 3, mask = zeros of corr...
c44b9a42d1e4c8cb1ab9dd9b504d04e6a4ce877b37326f810fff0b43d8cce9e2
MATLAB
2,992
103
function [SH3D,Residuals,b] = spherical_harmonic_shimming(img,mask,order) dim = size(img); %% for volume fitting % find non-zero elements Indices = find(mask(:,:,:)); % get Cartesian coordinate of the non-zero elements [x1,y1,z1] = ind2sub(size(img(:,:,:)),Indices); % solutions of the linear operation R = img(Indices...
c2b5934a87c1553abd9f94bfce856bfca24526bb3708f156fc510565143c8451
MATLAB
2,994
87
% fit_sortBasisSet.m % Helge Zoellner, Johns Hopkins University 2020. % % USAGE: % basisSetOut = fit_sortBasisSet(basisSetIn) % % DESCRIPTION: % This function sorts an external basis set according to the conventions % used in Osprey % % OUTPUTS: % basisSetOut = FID-A basis set container that only contains the basis %...
26441006bda41dae89543660e3d7fd196277dd814df23c98aaf4edfe37a71e7d
MATLAB
2,996
68
%% cluster based rois % follow the methods here to manually find and save your clusters % marsbar and spm save a .mat file % this script reads the .mat file and the base space image that you select % manually to create rois, based on the resolution of the image you cretaed % step 1: % we can open marsbar and choose th...
3ed592d43397926aa3b8fd23228750b8f8ad838d0d7c6204cf091fe3aa6901d0
MATLAB
2,996
74
function out = EN_LZComplexity(y, n, preProc) % EN_LZComplexity Lempel-Ziv complexity of a n-bit encoding of a time series % % ---INPUTS: % y, the input time series % n, the (integer) number of bits to encode the data into % preProc [opt], first apply a given preProcessing to the time series. For now, % j...
6fce54d8a0d33b06289bd3123a9b869b21d38ee10a1236c06b243447225897fa
MATLAB
2,996
117
function result = GKclust(data,param) %checking the parameters given f0=param.c; X=data.X; [N,n] = size(X); [Nf0,nf0] = size(f0); X1 = ones(N,1); %default parameters if exist('param.m')==1, m = param.m;else m = 2;end; if exist('param.e')==1, e = param.m;else e = 1e-4;end; if exist('param.ro')==1, rho=param.ro; else ...
e2986f071ec59b59c5080dad29fb2877863b6576c2dad359afd1be76e9cec37b
MATLAB
2,996
60
function [Nens,ensId,centInd,delta,rho,templates,predbounds,pcs,bincor] = ensembles_pca(raster,minSpk,prctdata,isHalo,thrMet,npcs,filename) % % [Nens,ensId,delta,rho,Ts,sampCent,templates] = subSample_ensembles(raster,minSpk,sampFac,kernel,prctdata,thrMet,savemem,isGpu) % % Find ensemble on several subsamples of the ra...
f4cc13d77fd9831dedeab0215e3c0220d689d2cce6e3fcd3def5779f5b98b27d
MATLAB
2,996
79
function physio = tapas_physio_fill_empty_parameters(physio) %fills empty values with default parameters, typically derived from other %parameters, e.g. time_slice_to_slice from TR and Nslices % % NOTE: for real default values that do not depend on other input % parameters, set them in tapas_physio_new directly! % % p...
1e4d81f87cc69cc45a5630abb6cf329534b4ea3478e3026560f4d22335885112
MATLAB
2,998
84
function this = MrAffineTransformation_load_from_file(this, testFile) % Unit test for MrAffineTransformation Constructor from file % % Y = MrUnitTest() % run(Y, 'MrAffineTransformation_load_from_file') % % This is a method of class MrUnitTest. % % IN % % OUT % % EXAMPLE % MrAffineTransformation_load_from_file % %...
1f401ed04803d590ae0b90f58272d94068e55bd50fbd501ef5062f5830efd609
MATLAB
2,998
118
function [x,err,it] = perform_conjugate_gradient(A,y,options) % perform_conjugate_gradient - perform conjugate gradient % % [x,err,k] = perform_conjugate_gradient(A,y,options); % % Solves for A*x=y. % Works both for vector x,y and matrix x,y (parralel soving of many % linear equations). % % Works only for...
d9e215703cb50f2b881358d0de655b280ca1d372e54b7e45a5924b5bc85ee4c4
MATLAB
2,998
78
function [Data, Header] = y_Read(FileName, VolumeIndex) %function [Data, Header] = y_Read(FileName, VolumeIndex) % Read NIfTI file Based on SPM's nifti % ------------------------------------------------------------------------ % Input: % FileName - the path and filename of the image file (*.img, *.hdr, *.nii, *.nii.gz)...
16c2855a731c43ed3f72bc40ab7801cc0e8f908576d9d68b342c7bf8dc8b0cb1
MATLAB
2,999
84
% logging_fcallstack() - Return the current stack trace as a string % formatted with the provided format string and % starting with the preamble % Usage: % >> output = logging_fcallstack(message, formatstr, unroll, stack) % % Inputs: % message - The message to print ...
9895449c93b499b27f48bca949217a43115f7945572da4b3059528660f1ebac9
MATLAB
2,999
89
% GAUSS2D - generate a 2-dimensional gaussian matrix % % Usage: % >> [ gaussmatrix ] = gauss2d( rows, columns, ... % sigmaR, sigmaC, peakR, peakC, mask) % % Example: % >> imagesc(gauss2d(50, 50)); % image a size (50,50) 2-D gaussian matrix % % Inputs: % rows - number of rows in mat...
c8ddd0f9fd7ec3eba312fadf14879f8c9db2d545785927cbbf2e01e143a3345b
MATLAB
2,999
53
function [photoFrames,photo_duration,photoOff_duration,photo_subsession,photo_durations] = get_photostim_times(T,session_idx, num_subsession_frames,Fs) % read photostim times from excel % num_subsession_frames are the frames within minutes of interests photo_start_times = []; photo_end_times = []; photo_durations = ...
307eaf9b68f8004caaa647a10fce5783d7c6acb17c7ba96761078e7080f75107
MATLAB
3,000
94
function HalfViolinPlot(data, pos, colour, width, kdeWidthForOnePoint) % Parameters % ----------- % data : % pos : float % center position on the x axis % color : % width : has nothing to do with kde computation, just the plotting (ie. % not to be confused with bandwidth) % kdeWidthForOnePoint : % created May 20...
32e2c06f70689f219440dd311717912367f5433fedf8e74885d845bbc470f040
MATLAB
3,000
74
%{ # pixelwise responses to full-field directional stimuli -> tuning.OriDesignMatrix -> preprocess.PrepareGalvo -> preprocess.Slice --- regr_coef_maps : longblob # regression coefficients, width x height x nConds r2_map : longblob # pixelwise r...
793a5109cb33a60522760b3b0a2fc33c6b7e015fed1e6201ea838905f7ec1e7f
MATLAB
3,000
82
function simulationOptions = simulationOptions_demo_SL() % % simulationOptions_demo % % This function is used to make a simulationOptions struct for use in the % simulation part of the demo. The options should be set to personal % preference. % % Cai Wingfield 7-2010 %__________________________________________________...
e09ac6ec4b6a13cc75ec71b7bead6c133053f0310551741b9059abfd644eaff2
MATLAB
3,000
68
function [] = start_NBSPredict(varargin) % start_NBSPredict shows welcome message to user and run NBSPredict % toolbox. It bypasses and immediately starts analyzing the data if a % configuration file is provided (please check MANUAL to see how to create % a configuration file). If any configuration file provided, % sta...
7081fe66e53ed0d3b62cfb887de8c85d9cf38c85a1699cf6fd3a16c74f5252cf
MATLAB
3,001
93
% Using Phantom 100x100 example, look at conductance maps interactively % Author: Aina Frau-Pascual % Input image im = phantom(100); % Change compute_connmatrix flag to true if you want to compute conductance matrix compute_connmatrix = false; % Construct mesh structure Lx = size(im, 1); % domain le...
b7033afc80185c525f9e3b3537688e4cc8511fb751738d1f9f68b6101ae00127
MATLAB
3,001
92
function [score,in,out]=clusterquality(f,S,partition) %function [score,in,out]=clusterquality(f,S,partition) % %PURPOSE % %To compute a simple quality (compactness) index for the given %clusters. The more dense and isolated a cluster is the bigger %value the index gets; however, if there is only one item in a %cluster ...
78accc45ecc7804a62bdfd55647e5e442e624ed158ca41a8b268cefdaa8180cd
MATLAB
3,004
123
function [pos, mom, ampl, time] = read_asa_dip(fn) % READ_ASA_DIP reads the dipole position, moment and amplitude % This importer is designed for fixed-dipole models and only supports % a limited number of the options that ASA has. % % Use as % [pos, mom, ampl, time] = read_asa_dip(filename) % % See also READ_ASA_V...
06b01d4eee07272bb45d67e6b70f37a5245b1eab85148e6adcf8e3b0f9c76c94
MATLAB
3,006
120
function fear_amyHFOtrigReact(basename,varargin) % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; % basename='~/data/Fear/triple/booyah180430/booyah180430'; load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) %% param.binSiz...
c3dd1f7451b0dafb1d584e6ee96526d1723745c0f42eb1fae31af623574c8767
MATLAB
3,006
98
function tapas_rdcm_plot_pred(Ep, Y, X, region_id) % tapas_rdcm_plot_pred(Ep, Y, X, region_id) % % Plots Yd_fft vs the linear combination of the 'true' (according to the % given model) regressors and parameter values for region_id (if it is % specified) in frequency (separate real and imaginary) and time domain. % %...
483dc18051753f3f75b1629e678021b56438efe65a66f3d6287f05237a9e3599
MATLAB
3,007
108
function OUT = tor_knn(data,clas,k) % OUT = tor_knn(data,clas,k) % % tor wager % % k nearest neighbor classification of T. Denoeux % with cross-validation % % % Example: % Create a fake dataset and test % x = randn(100,3); y = repmat((1:4)',25,1); %x(find(y==1),1) = x(find(y==1),1) + 2; % add some discriminability to...
5bf4025b053efa15740e913c1d581764ae352bac381218641ac04ba65719e2d8
MATLAB
3,008
81
% RUNPCA - perform principal component analysis (PCA) using singular value % decomposition (SVD) using Matlab SVD or SVDS % >> inv(eigvec)*data = pc; % Usage: % >> [pc,eigvec,sv] = runpca(data); % >> [pc,eigvec,sv] = runpca(data,num,norm) % % Inputs: % data - input data ma...
61ad991789b4ddf4214c3609149413ea8ebc45fb30dcd0c86deba4e4c03c5191
MATLAB
3,008
112
function Test_EDM() % function test_EDM() % % Low-rank Euclidean distance matrix completion % This test file is related to the paper, % % B. Mishra, G. Meyer and R. Sepulchre, % "Low-rank optimization for distance matrix completion", % IEEE CDC, 2011 % % Paper link: http://www.montefiore.ulg.ac.be/~mishra/papers/1112.p...
1115c71ab31823ea3424f3e8040d2bc30fffc406e12d2160c9d8b5306808dcb0
MATLAB
3,009
104
function fear_getAvarageNremWaveletPow(basename,varargin) % basename='~/data/Fear/triple/karmeliet190901/karmeliet190901'; load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName); %% param.lfp=basicMetaData.lfp; param.Ch=[basicMetaData.Ch.hpcTheta,...
ad0d65e97a04cdd71421892b51d8d96a9e000c0eb281ba0eb32b8eef6e687731
MATLAB
3,009
107
function hhh=tapas_uniqc_vline(x,in1,in2) % function h=tapas_uniqc_vline(x, linetype, label) % % Draws a vertical line on the current axes at the location specified by 'x'. Optional arguments are % 'linetype' (default is 'r:') and 'label', which applies a text label to the graph near the line. The % label appears in...
b1d26962d46edd5aa148712dc58673a69251072b304266b61c97ff609d4f450b
MATLAB
3,009
126
function varargout= flatColorMap(n,L,r,pos,useCenter) % colormap=flatColorMap(n,L,r,pos,useCenter) % make color maps with similar brightness % % default values % n (8): number of color; % L (60): brightness (L in Lab color, 0 - 100) % r (0.9): radius on a-b plane (0-1), regulates color saturation % pos ('octagon'...
2f1ef6dee1b920503e222bcf56016b1947942c217a60c3eeb94e17a3be42de37
MATLAB
3,010
72
function task_GA_footprint(PATH, cfg, fieldNames) % Calculated the gait artifact footprint proposed by Jacobsen et al.,2020 % Since data from the best cluster after independent component clustering % is included, of which not every subject is part of, only the footprint of % the group-averaged data will be calculated %...
79d0c98aae52dc72a552161ab7c487b0fd00a0c8327220c8f520e7a44c3ae828
MATLAB
3,011
111
function cell_sig = CellsortApplyFilter(fn, ica_segments, flims, movm, subtractmean) % cell_sig = CellsortApplyFilter(fn, ica_segments, flims, movm, subtractmean) % %CellsortApplyFilter % Read in movie data and output signals corresponding to specified spatial % filters % % Inputs: % fn - file name of TIFF movie fi...
5c12ce67ed14fd5ca5ad1a8abeb0934a54e1e1ce57bd6422541b3835da01ea34
MATLAB
3,012
82
function out = IN_MutualInfo(y1, y2, estMethod, extraParam) % IN_MutualInfo Mutual information of two data vectors. % % Uses the information dynamics toolkit implementation. % % ---INPUTS: % % y1: input time series 1 % y2: input time series 2 % % estMethod: the estimation method used to compute the mutual informati...
107951860e7f9ffc7c6d1c1f0786ff72c7a984f9146d988b4fd862eb45b6c2e5
MATLAB
3,014
85
classdef convertIntegrationTest < matlab.unittest.TestCase %CONVERTINTEGRATIONTEST End-to-end smoke test for petraToCT.convert. % % DESCRIPTION: % Runs the full debias -> segment -> normalise -> HU map pipeline % on the small PETRA fixture and checks that the output % pseudo-CT file ...
edae1f5af21fc7cfbe4ebf9ca26683c7cb56161a78a87b6284f044c8d19be916
MATLAB
3,014
116
function afni_fig_interface(src, evnt) cf = gcf; figure(src); % evnt ud = get(src,'UserData'); if (isempty(ud) | ~isfield(ud,'axes_lock')), ud = default_ud(); set(src,'UserData',ud); end if ( lower(evnt.Character) == 'l' ), ud.axes_lock = ~ud.axes_lock; set (src,'UserData...
042d0aba8929c047c554a63d97fbffefdb161d64ff155100ce26079ef7c1f43d
MATLAB
3,016
85
function [cs,index] = sort_nat(c,mode) %sort_nat: Natural order sort of cell array of strings. % usage: [S,INDEX] = sort_nat(C) % % where, % C is a cell array (vector) of strings to be sorted. % S is C, sorted in natural order. % INDEX is the sort order such that S = C(INDEX); % % Natural order sorting sorts ...
7b0338d955da218d1b602a9a750b69234bf6b63e0519adb2de643c6f83e0013a
MATLAB
3,016
96
function this = add_dims(this, iDim, varargin) % Adds additional dimensions to existing dimInfo % % Y = MrDimInfo() % Y.add_dims(iDims, varargin) % % This is a method of class MrDimInfo. % % IN % iDim (vector of) dimension indices to be added (e.g. 3 for 3rd % dimension) % o...
a25bcc958875d2c5b8588d9a19e01d6a1c87d7bd3490588e1546302a1beac3f0
MATLAB
3,017
64
function out = SY_DriftingMeanCUSUM(y) % SY_DriftingMeanCUSUM Parameter-free CUSUM test for a drifting mean. % % SY_StatAv and SY_DriftingMean both test for a drifting mean by splitting the % time series into segments -- requiring a choice of segment length or number % of segments. This is the analogous test with no f...
36e8dd51fcfeb83d4fe140b83ec95483dc0e519aac5bd9b561d63262d5832bca
MATLAB
3,019
93
% LOADELEC - Load electrode names file for EEGPLOT % % Usage: >> labelmatrix = loadelec('elec_file'); % % Author: Colin Humprhies, CNL / Salk Institute, 1996 % % See also: EEGPLOT % Copyright (C) Colin Humphries, CNL / Salk Institute, Aug, 1996 % % This file is part of EEGLAB, see http://www.eeglab.org % for the docu...
055b90a39d90c462186858ceab0f6ddc31956eb61a11a6c1ab2139959b2cfe71
MATLAB
3,020
85
%{ # masks created manually -> meso.Segmentation %} classdef SegmentationManual < dj.Computed properties popRel = meso.SummaryImagesAverage end methods(Access=protected) function makeTuples(self, key) images = ne7.mat.normalize(fetch1(meso.SummaryImagesAverage & key,...
c85ee482bde10f9373707e844836460e999ee3d2e8d796a561102faa4e458999
MATLAB
3,021
82
function DataSegmentation( BASEdir ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Wrote by David André Barrière 09th September 2022 % This function permit to create and launch Normalization and Segmentation % processing using SPM8 function. % Usage : set BASEdir variable with your ...
7d318a40fdcf9c6cb846f7970130a72cfe920126530ac223696b0396169db6bc
MATLAB
3,022
76
% EEG_URLATENCY - find the original (ur) latency of a time point in % the original continuous data. % % Usage: % >> lat_out = eeg_urlatency( event, lat_in ); % % Inputs: % event - event structure. If this structure contain boundary % events, the length of these events is added...
8023c777acb1afe486d95067b1f5d9891db74c423241789c42e6833b7f2f10bc
MATLAB
3,023
108
function status = Hide(parameter1,parameter2) %Hide - Hide (or show) existing or future figures, e.g. to speed up batch processing. % % USAGE % % Hide(figures,'on') % hide these figures % Hide(figures,'off') % un-hide this figure % Hide('all') % hide all existing figures % Hide('none') ...
c2775d571ad8c3766c185ce545612ca17184cfe0b22292df264d9e19f458b8b0
MATLAB
3,023
118
function [LatOpt, LatMdl, BlkInf, RPE, Belief, Kappa] =... GenerateLatencyData_Bayes_subopt_onlylambda(params, ratTrial,... gen_arg, noise_arg, noise_params) %%Similar to GenerateSynthData_Bayes, but with two new parameters: lambda %%(prior weighting) and lapse rate. cmc 8/19/21. %% Pull Parameters H0 = 1/40; ...
ef86dc893797732b21a679b3736d4a359ecca59562bac890f8aa4199ef108505
MATLAB
3,024
87
function [dyn_wc, mean_wc] = dyn_wavcoh_pleakage(data, options) % Computes the wavelet coherence (WC) with pairwise % leakage correction/pairwise orthogonalisation % Tewarie et al., 2019 Tracking dynamic brain networks using high temporal % resolution MEG measures of functional connectivity ...
0205cc05ae9e61217b5947b89d964a924b5cd0e910f4e88c5b1e86e6a8e5c1ae
MATLAB
3,025
89
function verbose = tapas_physio_plot_raw_physdata(ons_secs, verbose) % plots raw data from physiological logfile(s) to check whether read-in worked % % fh = tapas_physio_plot_raw_physdata(ons_secs) % % IN % ons_secs structure with the following fields % .t [Nsamples, 1] time onsets vector (in seconds...
0f260c4e734ba842a426a43100107cf6e9eda5868d5202df5a6f737ef69bf36a
MATLAB
3,026
123
function coactPaper_tableS07() labelWeight=true; labelCase=true; labelSize=9; letGapX=5; letGapY=5; fontsize=6; close all fh=initFig('width',18.6,'height',2.3,'font','Arial','fontsize',fontsize); x=1;y=1; panel_01(x,y,7); drawnow(); print(fh,sprintf('~/Dropbox/FearAnalyses/paper/figure/tableS07_%s.pdf',datestr(now,...
dcf4da307f95a233f42738505217c73ce0d9b44460d10f350fa6a5be22dfd17f
MATLAB
3,026
87
function [COEFF, SCORE, LATENT, EXPLAINED, MU] = tapas_physio_pca( timeseries, method ) % Performes the Principal Component Analysis (PCA) % % [COEFF, SCORE, LATENT, EXPLAINED, MU] = tapas_physio_pca( timeseries ) % % IN % timeserie (nVoxels x nVolumes) % method 'svd' or 'stats-...
fe25d39e9e7e931695d04bd62a59b1145d43d8b7615cb2a6db7fc85944d12e0d
MATLAB
3,027
90
% LAPLAC2D - generate a 2 dimensional laplacian matrice % % Usage : % >> [ gaussmatrix ] = laplac2d( rows, columns, sigma, ... % meanR, meanC, cut) % % Example : % >> laplac2d( 5, 5) % % Inputs: % rows - number of rows % columns - number of columns % sigma - stand...
aa7037c121f1f07361d8550632de92a9581a33aa310c9b36fdb6c877f98f691b
MATLAB
3,030
124
function tnet = vl_simplenn_tidy(net) %VL_SIMPLENN_TIDY Fix an incomplete or outdated SimpleNN network. % NET = VL_SIMPLENN_TIDY(NET) takes the NET object and upgrades % it to the current version of MatConvNet. This is necessary in % order to allow MatConvNet to evolve, while maintaining the NET % objects clea...
ae703c182978a430270f5cd347d7c8a6055c1a47da240296b2a9ec65d6059405
MATLAB
3,030
84
function [newx, newkey, info, hooked] = applyHook(problem, x, storedb, key, options, info, last) % Apply the hook function to possibly replace the current x (for solvers). % % function [newx, newkey, info, hooked] = % applyHook(problem, x, storedb, key, options, info, last) % % Applies the options.hoo...
e25a8e6acc28db6f2ff4c2fdff89f174099806398bc50bbfe5ec39ba1aa17134
MATLAB
3,030
86
%% Figure 5 main YOURDATAPATH = ''; savePath = [YOURDATAPATH '/' 'models' '/']; %% Load model outputs load(sprintf('%sall_regression,M1,angles,radrates', savePath), 'outputsM1_rr') load(sprintf('%sall_regression,S1,angles,radrates', savePath), 'outputsS1_rr') %% Panel A and B: % RADICaL decoding for mouse 1 plotVE(ou...
72f908ed5709e55a339a5e4b402535efa8748cb9de3d9e8d966cc30e88c161cf
MATLAB
3,033
43
matlabbatch{1}.spm.tools.physio.save_dir = {'physio_out'}; matlabbatch{1}.spm.tools.physio.write_bids.bids_step = 4; matlabbatch{1}.spm.tools.physio.write_bids.bids_dir = {''}; matlabbatch{1}.spm.tools.physio.write_bids.bids_prefix = 'sub-control01_task-YOURTASK_run-1'; matlabbatch{1}.spm.tools.physio.log_files.vendor ...
250083728499fd1c70bfa0acb0a78441c0157bcee62f5b2ed210b616a8d73acf
MATLAB
3,034
81
function roi_statistics() % Correlate ROI values with self-construal and TAS-20 scores. %% USER SETTINGS roiValuesFile = 'D:\path\to\roi_values.csv'; selfConstrualFile = 'D:\path\to\SC_Collectivism_forMRI.csv'; tasFile = 'D:\path\to\TAS20_with_demographics_N40_z.csv'; outputDir = 'D:\path\to\roi_statistics'; expectedN...
fc9825569d3f0ce17036a558600649527343892c7cca2d0d25c247f46551ef70
MATLAB
3,034
76
function create_volume_meshes(input_img, maxvoxelvolume, input_coordsys, ... output_coordsys) % % Input: input_img <string> fullpath to folder, where the results of % mysegment.m are stored % maxvoxelvolume <float> desired maximal volum...
4285555dddf072e520af2ef44cb7278da3ac3a1b925c986ceec51cd7b35a4371
MATLAB
3,035
84
function [cpx_file, Ref, img_array, img_body ,noise_array, noise_body] = loadRefScan(cpx_file) %% [cpx_file ,Ref, img_array, img_body, noise_array, noise_body] = loadRefScan(cpx_file) % Loads a Philips coil reference scan (*.cpx format). % % Input: % cpx_file Coil sensitivity scan (*.cpx). % % Output: % ...
e9d2ed2fc469307491c8343e3aae175faf6123e24d7a6f24b8ef10a062d88bbe
MATLAB
3,036
81
function [hasSPM,OspreyVersion] = osp_CheckRunPreviousModule(MRSCont, module) %% osp_CheckRunPreviousModule(MRSCont, module) % This function checks that all required modules have been run prior to % executing the module name that is passed as an argument to this % function. % % There is no output, the function ...
4c50dd99141cd8ac32b4f46cf38d1a8669ee4a8099cb02662babe237b3778776
MATLAB
3,038
91
function [indx, label, blockindx, blocklabel] = labelcmb2indx(labelcmb, label) % LABELCMB2INDX computes an array with indices, corresponding to the order % in a list of labels, for an Nx2 list of label combinations % % Use as % [indx] = labelcmb2indx(labelcmb, label) % or % [indx] = labelcmb2indx(labelcmb) % % Lab...
8151281196b823720ce39e6ae21f8d73d6ade4658f32369498bf3f4702e59208
MATLAB
3,038
77
function test_suite = test_expDesign %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> catch % no problem; early Matlab versions can use initTestSuite fine end initTestSuite; end function test_exDesignBasic() in...
125ee4ea60f8bf872c3f0c1a5f19efdb192a5522eb6312c3c6b5600b3effea88
MATLAB
3,039
102
function [y, pst] = tapas_ceode_gen_erp(P, M, U) % [y, pst] = tapas_ceode_gen_erp(P, M, U) % % Compute predicted data based on a specified DCM, with variable integrator % specification. % % Adapted from spm_gen_erp.m (original function lincense below). % % % INPUT % P struct parameter structure %...
9798d881f8858b5a8d4f8d3a454fdb853f7214c2b7ba9574afb101407bf6ef1d
MATLAB
3,039
101
function [tracedtensor] = diagsum(tensor1, d1, d2) % C = DIAGSUM(A, d1, d2) Performs the trace % C(i[1],...,i[d1-1],i[d1+1],...,i[d2-1],i[d2+1],...i[n]) = % A(i[1],...,i[d1-1],k,i[d1+1],...,i[d2-1],k,i[d2+1],...,i[n]) % (Sum on k). % % C = DIAGSUM(A, d1, d2) traces A along the diagonal formed by dimensions...
2825a0ad32c429401c9fa106e65f0ded3649ceef79e199bbc688bb9d73633cfd
MATLAB
3,041
88
function fear_swrTrigIcaReac(basename,varargin) % basename='~/data/Fear/triple/achel180320/achel180320'; % 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.tWindow=2...
2f0362c432869b790f5a0b8d2b2d1a2459f6f7a4a1c4456527e531d7c4702bef
MATLAB
3,041
105
function this = plot_stat_images(this, varargin) % plots statistical images (mean/snr/sd/diffLastFirst) in comprehensive % plot for several slices % % Y = MrSeries() % Y.plot_stat_images('ParameterName', ParameterValue) % % This is a method of class MrSeries. % % IN % 'ParameterName' % 'selectedSlices [1, n...
70388e452d202cba65fa4c667d2b6f2399ad781de2012924f0b54050a1bae4e7
MATLAB
3,042
64
function osp_OverviewTabChangedFcn(src,~,gui) %% osp_OverviewTabChangedFcn % This function is triggered when the overview tab is changed. It refreshes % the figure. % % % USAGE: % osp_OverviewTabChangedFcn(src,~,gui); % % INPUT: src = handle of the fit tabs % gui = gui class containi...
845a8b8bac470a13076638a8738622e933898f297d80c59a3388fa65361d2ed8
MATLAB
3,042
90
% fit_runFit.m % Georg Oeltzschner, Johns Hopkins University 2019. % % USAGE: % [fitParams, resBasisSet] = fit_runFit(dataToFit, basisSet, fitModel, fitOpts); % % DESCRIPTION: % This function performs spectral fitting of the data in dataToFit, using % the basis set in basisSet, using a set of options defined in fitOpts...
bd6e7960849fb755a079ce959f9555c8ea7d3be6dd104bba2568343ea1961303
MATLAB
3,042
106
function [output_file] = Intarpolate_and_align_AP(name, data_file, Blender_file, channels, start_point, end_point) % input: % name: string, name of subject % data_file: full path to ap.bin file % Blender_file: full path to mat file with blender output % channels: a vector with all cha...
10751c5f6a4d5303236f6e6ace49689825dde3bd18f1fdba31e4c318eb9fe8d9
MATLAB
3,044
43
matlabbatch{1}.spm.tools.physio.save_dir = {'physio_out'}; matlabbatch{1}.spm.tools.physio.write_bids.bids_step = 4; matlabbatch{1}.spm.tools.physio.write_bids.bids_dir = {''}; matlabbatch{1}.spm.tools.physio.write_bids.bids_prefix = 'sub-s999_task-random_run-99'; matlabbatch{1}.spm.tools.physio.log_files.vendor = 'BID...
226f892d52b454fa11e2dfd88b1ca445971a51c2d39ce68a5749c97c9f4e134a
MATLAB
3,045
71
function export_in_set(app, openfilename) % export an input eegfile into a .set events = ''; % In case no events in input file nOutFiles = 1; % FREQ files will yield 1 file per frequence, other formats: just 1 % Load file [~,FileName,FileExtension] = fileparts(openfilename); if strcmpi(FileExtensi...
e8ab7d40a6164c6d1d3a972a0e4e29f45224a34443ee6f9110dc8aeeeb407f79
MATLAB
3,045
97
function H = decode_nifti1(blob) % DECODE_NIFTI1 is a helper function for real-time processing of MRI data % % Use as % H = decode_nifti1(blob) % % Decodes a NIFTI-1 header given as raw 348 bytes (uint8) into a Matlab structure % that matches the C struct defined in nifti1.h, with the only difference that the % vari...
09c879b9d18981479b0f49215ed8a696cf3be8b8fe49a1099f99b92ffee3649e
MATLAB
3,046
84
function plotSingleChannel_stackedTrials(params, spectra, spectralData) % plot single stracked single trials for all freq. bands (ch-by-ch) % spectra = % data: [129×85×57×188 double] = 4D: [freq x time x chnl x trials] % freq: [1×129 double] % time: [85×1 double] % labels: [1×188 double] ...
7ca628ff8c8e4be3d265ca03d8ffcb6a39a9068dfa236ecbe939c91fd2f9c141
MATLAB
3,046
95
function output = poolVar(matFileName,varargin) % poolVar(matFileName,varargin) % poolVar(matFileName,'presetType',varargin) % % For each session, load % [rootDir]/[sessionName]/[subDir]/[[sessionName] [delimiter] [matFileName]] % as output.(sessionName) % % when presetType is set as 'base', defalut option is follow...
e6bd43e7ac705e858bef7970fe491742b64c7f7698cebaccf812e1ae8b69d335
MATLAB
3,046
80
function useCh = ch2roi_getSignificance(groupInfo, signif_criteria, ch_hVals, ch_xVals, method) % determines if to use the channel based on 'signif_criteria' % if the channel is significantly activated for longer than a threshold % value, useCh = true (else false) if nargin < 5 method = 'contEpochs'; end %% selec...
aa0c48ce53d54650be2007a044d7792828aeb573d32bfce9e84edaa3fa8b6015
MATLAB
3,047
73
% (C) Copyright 2020 CPP visual motion localizer developpers %direction matrix has motion directions in sequential order %one block: 0 180 0 180 0 180... %another block: 90 270 90 270 %targets introduced at the positins of fixation targets (repeation of %either of the direction chosed with equal probability function ...
b70fc9902e98d2ff9b6e94e8138710dce65700b86a564d19665bbbe51dda05ff
MATLAB
3,047
107
function [Cstar, gamma, T] = clsutil_shrinkage(X, opt) %CLSUTIL_SHRINKAGE - Shrinkage of covariance matrix with 'optimal' parameter % %Synopsis: % [CSTAR, GAMMA, T]= clsutil_shrinkage(X, OPT); % %Arguments: % X: DOUBLE [NxM] - Data matrix, with N feature dimensions, and M training points/examples. % OPT: PROPLIST -...
1aa5bc1513a02cdd47d36d2ebdb5cf490e3b792e6d2bc099c2b220c80d7b7143
MATLAB
3,048
43
matlabbatch{1}.spm.tools.physio.save_dir = {'physio_out'}; matlabbatch{1}.spm.tools.physio.write_bids.bids_step = 3; matlabbatch{1}.spm.tools.physio.write_bids.bids_dir = {'physio_out'}; matlabbatch{1}.spm.tools.physio.write_bids.bids_prefix = 'sub-control01_task-YOURTASK_run-1'; matlabbatch{1}.spm.tools.physio.log_fil...
8499a1f2a849e4840a7df652f1e8d535059808da1c7c3b4c36e8f792457b75fb
MATLAB
3,048
87
function pred = knnpred2(Xtest,X,class,class_exp,K,dist_type,pret_type) % prediction of new samples with calculated model % % pred = knnpred(Xtest,X,class,K,dist_type,pret_type) % % ------------ INPUT --------------------------------------------------- % Xtest: dataset to be predicted [n_test x p] n objects, p ...
d566b6c71b49a5e3e5745530968edc8fb9436c8c231a9a12858008c1ab6196cc
MATLAB
3,048
90
%% h = sepia_handle_panel_qsm_NDI(hParent,h,position) % % Input % -------------- % hParent : parent handle of this panel % h : global structure contains all handles % position : position of this panel % % Output % -------------- % h : global structure contains all new and other handle...
0578123a19b4ac318e42435829caf9499f409e24d0c26ca34c594bc13248482a
MATLAB
3,049
92
function [gradf, err] = tapas_riddersgradient(f, x, varargin) % Calculates the gradient of the function f at point x according to Ridders' method: % % Ridders, CJF. (1982). Accurate computation of F'(x) and F'(x) F''(x). Advances in Engineering % Software, 4(2), 75-6. % % INPUT: % f Function handle o...
87f7d4a16580ac601798c8acbe11801a0c45a92678c9f0f3c4fe58ff410fbaf1
MATLAB
3,049
79
% GENERATE_NLS_DATA Solve the Nonlinear Schrödinger (NLS) equation % using a split-step Fourier method via ode45. % % Equation: i*psi_t + (1/2)*psi_xx + |psi|^2 * psi = 0 % Initial condition: psi(x, 0) = 2*sech(x) (2-soliton solution) % % This script generates the spatiotemporal data (psi_...
d0f15ecf00bc48c92e004aa13ebb9bc2380c3038f7f51e56713aff5dbfa4cef9
MATLAB
3,049
117
function far = far_for_threshold(th,hsi,det_img,filt,params) % far = far_for_threshold(th,hsi,det_img,filt,params) % % finds the false alarm rate for a given threshold in the detector output image (det_img) % % 5/7/2013 - Taylor Glenn - tcg@cise.ufl.edu if ~exist('params','var') || isempty(params) params = Bullw...
6acf6213cc483cc40a7119c648023101e198394d45ad68a66355b331afe07ba8
MATLAB
3,050
91
function map = osp_generateMRSImap(MRSCont, kk, nominator_spec,denominator_spec, nominator, denominator) %% map = osp_generateMRSImap(MRSCont, kk, nominator_spec,denominator_spec, nominator, denominator, figTitle) % Creates a matrix with the corresponding metabolite map % % USAGE: % out = osp_plotFit(MRSCont,...