sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
24d9dc43c6b44b9aa080bc96e2b71ad3f757d9d1f206b3f134513f2233db4163
MATLAB
2,561
78
function event = read_brainvision_vmrk(filename) % READ_BRAINVISION_VMRK reads the markers and latencies % it returns the stimulus/response code and latency in ms. % % Use as % event = read_brainvision_vmrk(filename) % % See also READ_BRAINVISION_VHDR, READ_BRAINVISION_EEG % Copyright (C) 2003, Michael Schulte % Co...
ad4d63690c3816f7ee6eb4aeda9466b35712d5da50d7c1b1ccac5225797e8cdf
MATLAB
2,561
67
function outputImage = shift(this, dr, worldOrVolumeSpace) % geometric shift of MrImage % % Y = MrImage() % outputImage = Y.shift(dr, worldOrVolumeSpace) % % This is a method of class MrImage. % % NOTE: This is a method of MrImage rather than MrImageGeometry, because % the latter is composed on the fly from ...
5d845537f4e040cac2cf8866b7ef6ca9aaf4d96be609d5384e97e4b20f6442ff
MATLAB
2,562
112
%% LOAD h5 File Fs=400; M=h5read('F:\U01Grant_Mark_20200418\Movie_Spike\MoCoDataCrop2Dfilt.h5', '/movie'); % crop around the 2 opposite-going neurons ROI=double(M(74:96,181:206,:)); % each one to get the time trace n1=ROI(13:19,8:14,:); n2=ROI(5:12,14:19,:); %% No Standardization tic; imdenW=zeros(size(M)); for i=1:s...
64c7e68c33041bedbc0b50bd1899ca9503680aadcf7574abf67a2e8edb9f86c2
MATLAB
2,562
56
function [appliedBasisSet, B] = fit_applynlinOspreyMultiplex(basisSet, x, spl_pos, fitRangePPM) % 1. Extract parameters nMets = basisSet.nMets; nMM = basisSet.nMM; nMultiplex = size(basisSet.fids, 3); nBasisFcts = nMets + nMM; % number of basis functions % 1. Extract parameters zeroPhase = x(1); % z...
be6025c29648d08ad8d3bdec6d951364200433ca55442e360108b76b7cdf9cd5
MATLAB
2,562
75
function D = knn_calc_dist(X,Xnew,dist_type,pret_type) % function for calculating distances between samples of X and Xnew % % dist_type: 'euclidean' Euclidean distance % 'mahalanobis' Mahalanobis distance % 'cityblock' City Block metric % 'minkowski' Minkowski metric % ...
44eecd0342805e8defe6eca054dbb4201a49c74a8c14235b53366e734d9b53fa
MATLAB
2,563
76
function ft_write_tsv(filename, tsv) % FT_WRITE_TSV writes a MATLAB table to a tab-separated-values file. Compared to the % builtin MATLAB function, this implementation deals a bit different with missing % values, booleans, and NaNs. % % Use as % ft_write_tsv(filename, table) % % See also FT_READ_TSV, FT_READ_JSON, ...
f677843c707b9d0f74277919e4d2c0f04c14b8fc4548073447200b84029d73ab
MATLAB
2,563
81
function C = figureConstants() % FIGURECONSTANTS Define global constants for all figures % % Purpose: % Centralizes all constants used across figures to maintain consistency % and avoid magic numbers in the code. % % Outputs: % C - Structure containing all constants organized by category % % Usage Example: % C ...
32c949cce5354cac4da8096b784c6284c2ff1b474cff47afd6f06d42ccf2791c
MATLAB
2,564
74
function band_signal = modwtmra_single_band(wpt, wavelet_type, target_band) % MODWTMRA_SINGLE_BAND - Reconstruct a single band from MODWT coefficients % % Optimized function to reconstruct only ONE wavelet band instead of all bands. % Eliminates the need to allocate the full (Bands × Samples × Channels) MRA array. % % ...
22752eb40f1f5738aad122b2b5edce1bd946c2acaaf9e2aaf77dc5480ce688d8
MATLAB
2,565
75
function result = compute2propXtest(N1, p1, N2, p2, alpha, print_result) %compute2propXtest Compare two independent proportions using the % N-1 Chi-squared test (Campbell 2007; Richardson 2011). % Also computes CI for the difference in proportions (Altman et al. 2000). % % Usage: % result = compareProportions(N1, p1,...
6bad76ad8e1ca4685ea6c6d045358a65fd10a1385d4bd61b9f2344bde484bafa
MATLAB
2,566
62
function [fileNameArray, fileNameDeletedArray] = tapas_uniqc_delete_with_hdr(fileNameArray) % Deletes given files; for .nii (nifti-) files, also deletes .mat-header, % and _dimInfo.mat (if existing); % for given .img (analyze) files, also deletes .hdr-header and _dimInfo.mat % % fileNameArray = tapas_uniqc_delete_wit...
c12669e4f844ad3059f78d42717fd0d74d1b8b5c8910984fee9b22ded288a5d5
MATLAB
2,566
106
% op_averaging.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_averaging(in); % % DESCRIPTION: % Combine the averages in a scan by adding the averages together and then % dividing by the number of averages. % % INPUTS: % in = input data in matlab structure format. % % OUTPUTS: % out = Output following...
319afb0f4c8d464b7740ddc217ed1def2e78976035efa44e4869dc1ed8e1e803
MATLAB
2,567
69
function osp_onRightZ( ~, ~ ,gui) %% osp_onRightX % Callback function on process click on left x voxel direction button. % % % USAGE: % osp_onRightX( ~, ~ ,gui); % % INPUT: gui = gui class containing all handles and the MRSCont % % OUTPUT: Changes in gui parameters and MRSCont are written i...
608d9ee75d5fe32fa452e96a7d2f6cba42bd7dcc1618bc34a18f310fc32e7bd2
MATLAB
2,567
75
close all clear all tt1 = load('Z:\CLOOSE benchmark tests\testing_bci_bench_marktest\halfimage_uint8_external.mat'); tt2 = load('Z:\CLOOSE benchmark tests\testing_bci_bench_marktest\fullimage_uint8_external.mat'); tt3 = load('Z:\CLOOSE benchmark tests\testing_bci_bench_marktest\halfimage_uint16_external.mat'); tt4 = l...
74d60f4bfc4c4aef056e99db0066134bde3b5c6874ff68329d83b2286dc1e848
MATLAB
2,567
69
function osp_onRightY( ~, ~ ,gui) %% osp_onRightX % Callback function on process click on left y voxel direction button. % % % USAGE: % osp_onRightY( ~, ~ ,gui); % % INPUT: gui = gui class containing all handles and the MRSCont % % OUTPUT: Changes in gui parameters and MRSCont are written i...
ae2c2c1b27ee7c7c6adaede2424409e92a678287a1c1dafe46017f865ec9bc3b
MATLAB
2,567
69
function osp_onRightX( ~, ~ ,gui) %% osp_onRightX % Callback function on process click on left x voxel direction button. % % % USAGE: % osp_onRightX( ~, ~ ,gui); % % INPUT: gui = gui class containing all handles and the MRSCont % % OUTPUT: Changes in gui parameters and MRSCont are written i...
c6e0848e221856f500319c1c7b688475e06f8f7fd55bc3ed785d0641a6aa8984
MATLAB
2,567
94
% extract features for the ICLabel Classifier % if there are any issues, report them to lpionton@ucsd.edu function features = ICL_feature_extractor(EEG, flag_autocorr) %% check inputs if ~exist('flag_autocorr', 'var') || isempty(flag_autocorr) flag_autocorr = false; end ncomp = size(EEG.icawinv, 2); % check for i...
dab925756f73e51fa39d7e6a9e3df9cc5a7a2b7aebb7c3fc40bac076c9917269
MATLAB
2,567
47
function [answer] = EnsemblesGUI_linker_SGC(ffo, pars) disp(" - MAT SGC: Finding significant dFF coactivity") [activity_raster, activity_raster_threshold, activity_raster_peaks] = findSignificantDF_FCoactivity(ffo', pars); % From SGC_ASSEMBLY_DETECTION disp(" - MAT SGC: Getting activity patterns") ...
846c09babff8bcc969b7629a8aa90098c862984ad45b5c190d4e54062a5c8fd5
MATLAB
2,568
115
function [v,f]=freesurfer_asc_load(varargin) % Loads freesurfer ascii surface files % % [V,F]=FREESURFER_LOAD(FN) % INPUT: % FN Filename of ascii freesurfer to load % OUTPUT % V Nx3 coordinates for N nodes % F Px3 indices for nodes for P faces (base1) % % If multiple filenames are given, say Q, then V...
10a22aca282b12788473cbc18d1f485b5443129338e761a0b970112b10913292
MATLAB
2,569
68
% PLUGIN_UIFILTER - support function for plugin_menu % Copyright (C) 2019 Arnaud Delorme % % 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 without % modification, are permitted provided that the following condi...
67babb1b36d10f31a5ec12355a5d8c61eb02b59182e1da48b593cc45d6418ed1
MATLAB
2,569
72
function Latencydynamics =... block_latencydynamics_macro_stages(twin, smoothfactor, prctile_cutoff,... f_ratlist, RatBehaviorData) %% average change in latency around block dynamics. cmc 11/03/21. %inputs: %twin = time window, or number of trials around each block transition (40 is good). %smoothfactor is smoo...
cbe18fca46ae4d31c113be80ac0011febab9ac9f78395723817c6bf7e435537f
MATLAB
2,569
66
clc; clear all; % this code calculate the distance dependence of MFC % the geodesic distance betweeen vertices is measured on the mnid-thickness surface subj = 'CC00056XX07'; % the demo subject sess = '10700'; % the demo session of the subject %%%% load geodesic distance matrix on the mid-thickness surafce load('di...
2450884368c1c4c93b450f2c5ac002324d41a6d87814a570041d8262a52a4c18
MATLAB
2,570
58
% This script converts the tracked points from Universal Probe Finder into % insertion trajectories which can be read in by the IBL alignment GUI. % load atlas sAtlasParams = PF_getAtlasIni(); cellAtlases = {sAtlasParams.name}; [intSelectAtlas, boolContinue] = listdlg('ListSize', [200, 100], 'Name', 'Atlas Selection',...
4633cee92c719319741343365627f358c4688c2f98f6160e79c1a1484f10e198
MATLAB
2,570
83
function [Y, I, J] = shake(X,dim) % SHAKE - Randomize a matrix along a specific dimension % Y = SHAKE(X) randomizes the order of the elements in each column of the % 2D matrix. For N-D matrices it randomizes along the first non-singleton % dimension. % % SHAKE(X,DIM) randomizes along the dimension DIM. %...
25dc51f01db513b24e386819dc69b6a03154645797de34979d3203cc3eb42304
MATLAB
2,571
132
function showCase % Example showing a variety of effects possible with notBoxPlot % % function NBP.showCase % % % Purpose % Showcase notBoxPlot % % % No inputs or outputs % % % Rob Campbell W=which(['NBP.',mfilename]); fprintf('Running example located at %s\n',W) hFig=figure(1984); set(hFig,... 'Name','notBo...
e5656d5f089ed8f1557ec97d317efba2caa1561306d65c2fb810e4dc7e1441a7
MATLAB
2,571
81
%% PREPARE GUIDELINES % ensure SUBJECTS_DIR is correct in MATLAB environment % load in what the fsaverage flat surface looks like surfL = cvnreadsurface('fsaverage','lh','full.flat.patch.3d','orig'); surfR = cvnreadsurface('fsaverage','rh','full.flat.patch.3d','orig'); % map to individual subject's surface (LH) subj...
f8b7fb89a903e8c78f426ebe0f81bdb2a3a1918d6f93b9a7895c4fa54a0aa132
MATLAB
2,571
77
function pred = knnpred(Xtest,X,class,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 variables %...
0927aefea721752e28f10a67e17c6e867128e0224138e5944789160582fdc5ca
MATLAB
2,572
78
function this = load_par(this, filename) % Loads Par (Philips)-Header information referring to geometry into object % % Y = MrImageGeometry() % Y.load_par(fileName) % % This is a method of class MrImageGeometry. % % NOTE: This is based on the header read-in from GyroTools ReadRecV3 % % IN % % OUT % % EXAMPLE % lo...
165f38315d466a7f70adef9e60e210df593980476508fce1b32fbf2b80bbb1a2
MATLAB
2,572
76
% load file0 = sprintf('~/nsd/nsddata/information/b3pcnum_%s.tsv','func1pt8mm'); a1 = load(file0); % compute tempmd = []; temppp = []; for subjix=1:8 tempmd(subjix) = nanmean(a1(:,subjix)); temppp(:,subjix) = prctile(bootstrapdim(a1(:,subjix),1,@(x) nanmean(x,1),1000),[16 84]); end % visualize figureprep([100 100...
1dc5d593c3965109c963cb2120bc5250ffda9bb450ebbf3c0fceea9d33613a1e
MATLAB
2,572
83
function [Y, I, J] = shake3D(X,dim) % SHAKE - Randomize a matrix along a specific dimension % Y = SHAKE(X) randomizes the order of the elements in each column of the % 2D matrix. For N-D matrices it randomizes along the first non-singleton % dimension. % % SHAKE(X,DIM) randomizes along the dimension DIM. ...
276ace3f0406a30cb900c1596444537b1f199e89f6f98debb15fd97ceb01eb65
MATLAB
2,572
90
function addMECEtoSleepState(basename) % remove short (<1sec) gaps automatically and longer gaps manually % then added MECE field to the SleepState.mat load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basicMetaData.Basename '.SleepSt...
c3d301c894d87d4f83bb3fe27154264d7f803617af258895f70d9eda57c613c5
MATLAB
2,572
78
%% ClassifyUnits % Classify units into groups %% Load All Unit Data dataset = load('..\AllUnitData.mat'); Unit = dataset.output; %% Extract zscores zscoreMatrixHE = zeros(632, 80); zscoreMatrixHW = zeros(632, 80); zscoreMatrixHW_A = zeros(632, 80); zscoreMatrixHW_E = zeros(632, 80); for cell = 1 : 632 zscoreMatr...
2a9e2a50a77a04e76cf8afc7f62fcd52c3e7590686fd392eba99065df60b3c39
MATLAB
2,573
69
function [y,best] = BF_Whiten(y,preProc,beVocal,randomSeed) % BF_Whiten Whiten a time series by comparing a range of preprocessings. % ------------------------------------------------------------------------------ % Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail.com>, % <http://www.benfulcher.com> % ...
f34da80b5553e66fd046dd1159d5494b9ba91d454c9169960290bc14f2edae68
MATLAB
2,573
80
function processEphysData(ephysPath, codePath, savePath) % process firing rate resoponses for 20ul trials before and after the first % incongruent trial %INPUTS: % ephysPath = local path to ephys folder downloaded from zenodo for the % recording area you want to analyze % codePath = local path to where code...
99b353d2eeb6a4c19b47697088878d96e847eaba7762b46befb119b6b3919b90
MATLAB
2,574
71
function this = coregister(this) % Affine coregistraton of given images to a stationary image (geometry only) % % Y = MrSeries() % Y.coregister(inputs) % % This is a method of class MrSeries. % % IN % parameters.coregister -> % .nameStationaryImage (e.g. 'mean') % .nameTransfor...
a7f52b095c7f4fe32f08718b837dc07aff48c75c8ebc3e68170011f3b7b61211
MATLAB
2,575
75
% SUM - sum of memory mapped underlying array % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008 % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % 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 withou...
e189ec7778b0b468093d0ac1fba557f6adcce1a5028b91f9b20fac6ff4bb4dc2
MATLAB
2,575
89
% An interal function to parse input arguments for MEDI_L1 % Created by Tian Liu on 2011.03.16 % Modified by Tian Liu and Shuai Wang on 2011.03.15 % Last modified by Tian Liu on 2013.07.24 % Date last modified: 27 Feb 2020 (v0.8.0, KC) function [N_std,iMag,lam,pad,delta_TE,CF,B0_dir,merit,smv,radius,data_weighti...
0e5da082efa6b1bc05287f993952f5798a1eebb62a402236f5f632227d9a23ca
MATLAB
2,577
68
function Avg = CPi_data %generates the CPi figure data %% load Jonny DCS load("Z:\histology\Jonny\Analysis\RUN25 heatmats\RUN25_slide1 heatmats\RUN25_1_3.mat") R1 = Count.VTA; load("Z:\histology\Jonny\Analysis\RUN26 heatmats\RUN26_slide1 heatmats\RUN26_1_2.mat") R2 = Count.VTA; load("Z:\histology\Jonny\Analysis\X01...
3e068999e1970587d0d1ae01ca6fd1ea4771370d361c90a9dbadfff6fe39e081
MATLAB
2,578
99
function [LatOpt, RPE, Kappa, Rewards] =... GenerateLatencyData_VanillaAlpha_cg(params, ratTrial, opto_arg,... gain_arg, fig) %% Pull Parameters alpha = params(1); if gain_arg rpe_gain = params(2); end %% Pull Data from Rat Trial % Only use trials where we have data from the rat (basically covers all % no...
813c7bab2072257112590e4a8c5e6ad305f3c207769ed48993456df75bd11d6d
MATLAB
2,578
97
%% load MEG data (see NeuroImage 2004 paper) load megdata %% Estimation % Reduce dimension from 122 ordinal signals to 20 % Resample 25 times using random initial conditions and bootstrapping % (use FastICA parameters: kurtosis as non-linearity, % symmetric estimation approach sR=icassoEst('both', megdata, 25, 'la...
f1e420f6a572052a7c4e82ed849897bff1031b7fb654ba688c7df242e56d57f1
MATLAB
2,578
74
function egrad = getPartialEuclideanGradient(problem, x, I, storedb, key) % Computes the Euclidean gradient of a subset of terms in cost function. % % function egrad = getPartialEuclideanGradient(problem, x, I) % function egrad = getPartialEuclideanGradient(problem, x, I, storedb) % function egrad = getPartialEuclidean...
b30464b645c38ecacb65cc299e35a814c0f374cc3b891b7ae2d3111b2e694679
MATLAB
2,579
66
% Script demo_image_geometry % Exemplifies creation and usage of MrImageGeometry from nifti files, % dimInfo and affineTrafo and par/re files % % demo_image_geometry % % % See also MrImageGeometry % Author: Saskia Bollmann & Lars Kasper % Created: 2017-10-30 % Copyright (C) 2017 Institute for Biomedical Engineer...
ee3981fbe5119e802c03ae26fe5c1f9ec11ed712c10258f0037a19999f3598f6
MATLAB
2,579
64
% This script runs multiple stochastic simulations (pp) of the agent based model and will store either % spatial or population level outputs. % Please note that results are saved at each timestep %% Simulation settings save_spatial_data = 0; % Choose whether to save spatial outputs or population level results s...
aedbd77a46d1f629c1671d9996fa236549afef2d167939b69e0a605bd70a2c52
MATLAB
2,580
89
%% fig: subtighplot - examplary figure % useful for copy-pasting % (c) Jiri, Jul23 %% examplary figure % f = fig_make; f = fig_make('fig_W',20, 'fig_H',20); nRows = 6; nCols = 6; nPlot = 1; marg_h = [0.10 0.05]; % margin from [bottom, top] marg_w = [0.10 0.05]; % margin from [L, R] side gap = [0.05, 0.01]; ...
d350025c35154ae345abd97633dc13446a924b1f0cbe353d894ea356ac02ff44
MATLAB
2,580
89
function [movie_dns,optiRank]=denoising1Movie(h5Path,varargin) options.windowSize=1000; options.spatialChunk=false; options.dataset='mov'; options.ranks=100; if nargin>=3 options = getOptions(options,varargin(1:end)); % CHECK IF NUMBER OF THE OPTION ARGUMENT OK! end meta=h5info(h5Path); disp('h5 file detected') ...
66ed937ba764774550e052054263df43fc0bac7b4f1bfc885bf6110ca8945b2e
MATLAB
2,581
96
a1 = load('/research/papers/2022 nsd/figures/INSPECTIONS/ROTATINGBRAIN/b3nc.mat'); allvals = []; for p=1:8 a = cvnloadmgz(sprintf('~/Dropbox/nsddata/freesurfer/subj%02d/label/lh.prf-visualrois.mgz',p)); allvals(:,p,1) = nsd_mapdata(p,'lh.white','fsaverage',a(:),'nearest'); a = cvnloadmgz(sprintf('~/Dropbox/nsdd...
9948883ba1c97684c18a2d806c716e27fe4a50426e23a9960a56015367f6b5a0
MATLAB
2,581
69
function reducedIDs = TS_ReduceFeatureSet(whatData,distThreshold,useSpearman) % Unsupervised clustering to a reduced feature set % %---Output: % reducedIDs, A set of Operation IDs that forms the new reduced feature set % ------------------------------------------------------------------------------ % Copyright (C) 201...
ba9c7095541b60dfaee220cea3fb12b4ea0021d29dd5c5c819ea64e21b365841
MATLAB
2,582
127
function tapas_sem_display_posterior_summary(results, summary) %% Display the posterior summary. % % Input % results -- Results structure % summary -- Summary structure of the posterior. % Output % % aponteeduardo@gmail.com % copyright (C) 2019 % CONG = 0; INCONG = 1; data = results.data; % Off...
941ec79d9d8a2ef29ceecf44bd0528b9028a8c9b7acfedd2d414699f9675407c
MATLAB
2,583
97
function run_conductance_model(data_folder) % Compute conductance maps from tensors computed with DSIstudio % This is a generic example. % Adapt paths and file names to your own! % % Example: run_conductance_model(your_path) % % Author: Aina Frau-Pascual %%% Load folders and code % Add code folders to path folder_ni...
5900998988fe63f2d15137c733bae10c93d650eb0f93503cc809706934c603e4
MATLAB
2,584
107
function [LatOpt, LatMdl, BlkInf, RPE, Belief, Kappa] =... GenerateLatencyData_BayesModel(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; kappa_mi = p...
d545e051ed375c3b87e35588add18183faddc91a346b23b5b46555528f8963a3
MATLAB
2,585
75
function [low2hi,ds]=surfing_maplow2hires(clow, chigh, epsilon) % finds mapping between nodes from low and high res surfaces % % [L2H,D]=SURFING_MAPLOW2HIRES(CLOW,CHIGH[,EPSILON]) % INPUTS: % CLOW: 3xNLOW coordinates for N nodes from low resolution surface % CHIGH: 3xNHIGH " " hig...
77858bd200fe93fc6362be6bc8ff8091125d7512fb117913d0330f57a7a084a9
MATLAB
2,586
85
%% LOAD DATABASE clear all t1 = tic; % load('/Users/tor/Documents/Tor_Documents/Presentations/2010/Columbia_fMRI_Prediction_Workshop_2010/NBC/full_data.mat', 'MC_Setup') % % volInfo = MC_Setup.volInfo; % MC_Setup.cl = []; % MC_Setup.unweighted_study_data = logical(MC_Setup.unweighted_study_data); load('/Users/tor/Do...
be5b9eebc1fd5b3ed1ed0b51a8a6b7e82bc66ab7af86a4d68163e2833aa94f33
MATLAB
2,586
77
% fit_runFitMultiplex.m % Georg Oeltzschner, Johns Hopkins University 2019. % % USAGE: % [fitParams, resBasisSet] = fit_runFitMultiplex(dataToFit, basisSet, fitModel, fitOpts); % % DESCRIPTION: % This function performs multiplexed spectral fitting of the datasets stored % in the cell array dataToFit, using the basis s...
084271e64d98fd01ad91989301c7d988bb540f14ecf74d42d08ffa031c58effc
MATLAB
2,587
71
function [datafit, f0Significant, FvalSig, aSig, fSig, sig]= ... fitSignificantFrequencies(data, f0, lineNoise) % Fits significant sine waves to specified peaks in continuous data % % Usage: % [datafit, f0Significant] = fitSignificantFrequencies(data, f0, lineNoise) % % Parameters: % ...
1bcdd80802c1bae59a3c26a2559bc3db7f09d7099e87c0f6e52fabff24ebb138
MATLAB
2,588
71
function [stats] = boxplot2_hmt(x, bp, left, isDep, names) % Generates paired boxplot where significantly different pairs of boxes are % labeled with an asterisk. Data points of box pairs can be dependent or % independent samples, which is specified by isDep and defines the % statistical test (permutation test with...
c441bcd1a4824a4c32f3d8b4d49ec339a75e0674f344bc66e57deca1c7b6f18a
MATLAB
2,588
65
function [T1map, M0map, R1map]=T1M0estimateMP2RAGE(MP2RAGEnii,MP2RAGEINV2nii,MP2RAGE,varargin) % usage % [T1map, M0map, R1map]=T1M0estimateMP2RAGE(MP2RAGEnii,MP2RAGE,varargin) % MP2RAGEnii is the nii structure resulting from loading the MP2RAGE % UNI image % with load_nii or load_untouch_nii % MP2RAGEINV2nii is the nii...
d28ca5f0c32d5e00398d70a61e6d5d11d49a7c3c0a6840920017b2e4819d6632
MATLAB
2,588
56
function [p,h,stat] = test_global_measure(A,B,group1str,group2str,parameterName,freqs) % where A and B the input data, which have the size Subjects x Frequencies % perform nonparametric Mann-Whitney-Wilcoxon test and plot the figures % based on work of Adham and Yiwen, see there papers. Adopted a bit to work % with t...
e0349ba282b902c2f3cd942ee5e663068173990a729fe81d65b9d1e3175ced0f
MATLAB
2,588
65
function out = osp_add_nii_mrs_field(in,OspreyVersion) %% nii_hdr_ext = osp_add_nii_mrs_field(in,OspreyVersion) % This function adds nii_mes field to input data matlab structure format % following the standard described in "Clarke WT, Bell TK, Emir UE, % Mikkelsen M, Oeltzschner G, Shamaei A, Soher BJ, Wilson M. ...
f4bae2a80e4830ab2f3b7bd10e4dc3f0f9fbc71685e06e588f57c926324e1fc9
MATLAB
2,588
99
function [traj, infStates] = tapas_hmm(r, p, varargin) % Estimates a hidden Markov model (HMM) % % This function can be called in two ways: % % (1) hmm(r, p) % % where r is the structure generated by fitModel and p is the parameter vector in native space; % % (2) hmm(r, ptrans, 'trans') % % where r is the ...
07527e3c162885a2cdc8064f212a26d220c6e0de90686461fb65ad2383be8686
MATLAB
2,589
59
%% Calculate firing times, frequency and spiketrain from membrane potential % % Copyright 2025 Laura Schmid % Permission is hereby granted, free of charge, to any person obtaining a % copy of this software and associated documentation files (the % “Software”), to deal in the Software without restriction, including % ...
0b3791956587b998b55ef82ad0ec7e4f15dcbd77eae154c34e9a3d0875dfac80
MATLAB
2,590
86
function [fieldNames, fieldValues] = get_nonempty_fields(obj) % Returns field names and values of all empty fields of MrCopyData-object % % Y = MrCopyData() % Y.get_nonempty_fields(inputs) % % This is a method of class MrCopyData. % % IN % % OUT % % EXAMPLE % Y.get_nonempty_fields % % See also MrCopyData % Aut...
c7ede6daf2d9af6856fda630dec28f1a2ca9cc3d77f8c8babbc414bb90fceca3
MATLAB
2,591
76
function task_clean_e(sii, PATH, cfg) % Add task description here % - 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_neurCorGait_config % di...
68754ab1f29dba7d40367323ecec889038726931760c4454b64b8020448a415f
MATLAB
2,592
71
%% [RDF] = Wrapper_BFR_PDF(totalField,mask,matrixSize,voxelSize,algorParam, headerAndExtraData) % % Input % -------------- % totalField : total field map (background + tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial resolution of each dimension ...
44660420160afe56955103e3afd0a238503cfa5984db32ff55f7bf990e74ce92
MATLAB
2,593
77
function outputImage = threshold(this, threshold, caseEqual) % sets all voxel values < (=) threshold(1) to zero, and, optionally ceils % all voxel values above threshold(2) to threshold(2); % % NOTE: Nans are set to zero, Infs are kept, if at/above threshold % % Y = MrImage() % Y.threshold(threshold, caseEqual) % %...
c98888a6b24050b7f70fbde254c2791c6fdca860d462d4ac33d258ce590b2014
MATLAB
2,593
90
function test_sphere_distance n = 5; M = spherefactory(n); % Pick a deterministic point&vector or a random pair. % Advantage of deterministic: reduces errors due to M.exp() x = M.rand(); u = M.randvec(x); % has unit norm % x = [1 ; zeros(n-1, 1)]; % u = [0 ; 1 ; zeros(n-2, 1)]; % The three distances we compare dist1...
484d951bc862022bc5e3313060bc3bff251eb209c602f5e1599bc752a5a623ab
MATLAB
2,594
63
function [fixedVols, clrmap, inds_vol] = brainVolumes_fixed(params, struct_plotBrain) % returns/loads pre-defined brain volumes (fixed, same for all channels) & colormap % with indices for each brain volume specied in: struct_plotBrain.volumes2plot % input: % - params % - struct_plotBrain = params.plot_brainSlice...
58693bed35fefa7ca9b66922090dd582dee8d040537f6aab6ac36ed80a8a1eac
MATLAB
2,594
104
function [traj, infStates] = tapas_sutton_k1_binary(r, p, varargin) % Calculates the trajectories of v under the Rescorla-Wagner learning model % % This function can be called in two ways: % % (1) tapas_sutton_k1_binary(r, p) % % where r is the structure generated by tapas_fitModel and p is the parameter vector...
07c0cfc4b8954a25f79cbde1e9c100025685d77b26c7c7acac3ddc7950d2980f
MATLAB
2,595
126
%% chi = FANSI_4sepia(phase,magn,spatial_res,alpha,mu,noise,options,B0_dir) % % Description: Wrapper to use FANSI under Sepia % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 1 April 2019 % Date last modified: % % function chi = FANSI_4sepia(phase,magn,spatial_res,alpha,noise,options,B0_dir) params =...
773d096bd06c98cfa0becba6109378dcbef0de4eaf4597d98438d5a351c2e1e7
MATLAB
2,596
72
function binMatrix = BF_ToBinaryClass(groupLabels,numClasses,makeLogical) % BF_ToBinaryClass Converts a group vector to a binary class coded matrix % % Columns code observations, rows represent classes % %---INPUTS: % groupLabels, a vector of integers (or categorical labels) coding the class of each observation % numCl...
4f023a1fe6e4ef729fa9971f4cec2fb095ecc14dd9b654acb7f1a5271ac46857
MATLAB
2,597
80
% % This function allows you to manually add or remove peaks that would not % have been correctly detected % Inputs % ---------- % time_vec = time vector (in s and horizontal format) % fs = sampling frequency (in Hz) % time_series = signal time serie % peak_time = previous detect...
862e64f52ab1c30e67d67ca4f5da763440defbd3dedf92a4eaa8dff0008f7b42
MATLAB
2,597
87
function fMRIStats_SummaryCSV(citiFile, varargin) % fMRIStats_SummaryCSV(citiFile, varargin) % % Loads fMRIStats output from a single CIFTI dscalar file and writes % summary CSV with cortex/subcortex regional averages. % % Arguments: % citiFile - Path to CIFTI dscalar file % % Optional name-value arguments: % 'Car...
c4703fab2e1a577c73bf08f53ba8f9dacd674f3509537579910d4e87b4905164
MATLAB
2,597
79
% create rectangular patches for displaying a meshed network function [X,Y,patchind] = meshPatches(MSH,NT,radii,extend) % convert a mesh of a network into coordinates for plotting % patch rectangles along the edges % patchind gives the order of mesh indices for the patches % to get the right field values for the color...
c98157876bf43bf7b54b0e4b8871673e57a0fd3453289de4f93d702ba912ad61
MATLAB
2,597
113
function [posterior] = tapas_sem_example_single_subject_estimate(model, param) %% Example for estimate for single subjects. % % Input % model -- String. Either seria or prosa % param -- String. Parametric distribution. % Output % posterior -- Structure. Contains the posterior estimates. ...
4877baadf1fee093bfada2031a866c9c272f202ff8e2c78f165b7f8e4b8d2c9a
MATLAB
2,598
71
function [cell_metrics,basepath] = ExportCellExplorer(basepath,varargin) % brainRegions = session.brainRegions; [~,basename] = fileparts(basepath); filename = fullfile(basepath,[basename '.cell_metrics.cellinfo.mat']); if exist(filename,'file') load(filename,'cell_metrics'); return end [~,animalName] = file...
97875634c6a07742685e857d369120831750875437ea1d0e3e59a19bdb370629
MATLAB
2,598
66
function outputFilename = debias(inputFilename, outputFilename) %DEBIAS Debias nifti image using N4ITK. % % DESCRIPTION: % debias debiases a nifti image using the N4ITKBiasFieldCorrection % module that is packaged with 3D Slicer. The number of iterations is % set to 50,40,30,20,10 to give an output image wi...
f80d16de686f4374f442c92962d52da88549f98633c6fd0f2e7c3287f1deca32
MATLAB
2,598
75
function [ D ] = hausDim( I ) % HAUSDIM Returns the Haussdorf fractal dimension of an object represented by % a binary image. % % Returns the Haussdorf fractal dimension D of an object represented by the % binary image I. Nonzero pixels belong to an object and 0 pixels % constitute the background. % %...
4379e458af4b9a93985d7b8db6f77211a04f154d0161ab493e761296822424ee
MATLAB
2,599
85
function [verbose, c_outliers_low, c_outliers_high, r_hist] = tapas_physio_plot_raw_physdata_diagnostics(cpulse, yResp, ... thresh_cardiac, verbose, t, c) % plots diagnostics for raw physiological time series as monitoried by the % MR scanner breathing belt/ECG % Author: Lars Kasper % % Copyright (C) 2013, Institu...
a0bf50aa324245335ae5d1b270d8d33e11b64a1e24213b4dda56e5d3b5daf2e5
MATLAB
2,599
69
function anorm = update_gbound(anorm,alpha,beta,j) %UPDATE_GBOUND Update Gerscgorin estimate of 2-norm % ANORM = UPDATE_GBOUND(ANORM,ALPHA,BETA,J) updates the Gersgorin bound % for the tridiagonal in the Lanczos process after the J'th step. % Applies Gerscgorins circles to T_K'*T_k instead of T_k itself % since ...
f064a8425692fa05956a351256ab063357b35c0129932b523e9678c9df8d8d41
MATLAB
2,600
89
classdef ConvTranspose < dagnn.Layer properties size = [0 0 0 0] hasBias = true upsample = [1 1] crop = [0 0 0 0] numGroups = 1 opts = {'cuDNN'} end methods function outputs = forward(obj, inputs, params) if ~obj.hasBias, params{2} = [] ; end outputs{1} = vl_nnconvt(... ...
41f7373920b120ea52b40cce8b946e4c1f50fdcb0566900e832af582e15199ee
MATLAB
2,602
64
function [postLow, postHigh, postLow_q1, postHigh_q1, postLow_q1Con, ... postHigh_q1Con] = quartileAnalysis_SS(data) % split mixed blocks into quartiles to look at changes in wait time over % the course of a block % INPUTS: % data = data struct containing behavior data containing wait_time, % reward, etc field...
764ef5463312747452c1cc7fab7019b44de32771c839b50a34c1415aeb75f803
MATLAB
2,603
56
%{ preprocess.ClusteredEyePos (computed) # my newest table # add primary key here -> preprocess.EyeTrackingFrame ----- center_x : smallint # center of the circle with the largest percentage of points, # x dim, and this point is a member of that # circle ce...
f4104e6d451df928ed8855af766cf77128206e4ece8340f5b7e10a74747ace36
MATLAB
2,603
89
classdef ConvTranspose < dagnn_bc.Layer properties size = [0 0 0 0] hasBias = true upsample = [1 1] crop = [0 0 0 0] numGroups = 1 opts = {'cuDNN'} end methods function outputs = forward(obj, inputs, params) if ~obj.hasBias, params{2} = [] ; end outputs{1} = vl_nnconvt(......
8a2139d60792b88a55a4854407ae4d87120c1549bbc31666f1776dc48f9499c1
MATLAB
2,604
93
function run_all_modalities() % RUN_ALL_MODALITIES % Convenience driver to run the pipeline for multiple FC modalities. % % Adapt the lists below to your setup. For each modality, you can: % - give it a label (used for subfolder under out/) % - point to an edges CSV % - optionally override which levels to run % ...
cb3fe7720f797889f8bc46a4afb5c83faae4a0aa5e802312e1d94d9cc48b49e4
MATLAB
2,604
95
%% h = sepia_handle_panel_bkgRemoval(hParent,h,position) % % Input % -------------- % hParent : parent handle of this panel % hFig : handle of the GUI % h : global structure contains all handles % position : position of this panel % % Output % -------------- % h : global stru...
36b33e5de227e8e9789e61a61ade9fab3c30e5fb014f10dda99ac19162292375
MATLAB
2,606
77
function ft_write_json(filename, json, varargin) % FT_WRITE_JSON writes a MATLAB structure to a JSON file. Compared to the builtin % MATLAB function, this implementation deals a bit different with missing values, % booleans, and NaNs, and results in a more human-readable file. % % Use as % ft_write_json(filename, st...
80bfd37fcce4b91c9ea9c074d89b6510ccfa3c49164d7ab0a6a426df49f354ab
MATLAB
2,606
88
function GenTrialVectors % Function outputs trial vectors (U, product of crossover). global filename numFact numDose numComb sheetname vectorState countVectors global mutCon crossCon global XdoseRangeR UdoseRangeW VectorSet % Generate a matrix R that contains r1, r2, r3 for the mutation of the % target ...
a0d3c8579bd31a18fb552a27972f88f2049ba2219f7123b9f09dff9729002b50
MATLAB
2,606
111
function [posterior, summary] = tapas_sem_example_hier_estimate(model, param) %% Example for inversion with a linear model for the prior. % % Input % model -- String. Either seria or prosa % param -- String. Parametric distribution. % Output % posterior -- Structure. Contains the poster...
a10284e90305eb65d4ae283123e8988d070300c51e92557f8c1a25e4342cafdc
MATLAB
2,606
60
clear all %#ok<CLALL> % Clear all variables from the workspace close all % Close all open figure windows %% INSERT YOUR RECEIVER IPv4 ADDRESS HERE IPv4 = '127.0.0.1'; %% RUN THE REST % Define Image Dimensions and Preallocate Storage xpixels = 512; % Image height (number of rows) ypixels = 796; ...
eafdf996bef6737fb79b01fe0b5ede7c6a7ebaa46a93bdbe2d295732fe0961a7
MATLAB
2,606
63
function [bestParam,bestParamScore,bestParamIdx] = randomSearch(objFun,... data,paramGrid,varargin) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % randomSearch performs pure random search over parameters provided. % Each parameter or combination of parameters are selected from a unifo...
d49e03acd6a607c5d31442069cf726d9aa411a3032de5b40674a7f6a505623e2
MATLAB
2,607
78
function [this, matlabbatch] = get_matlabbatch(this, module, varargin) %ONE_LINE_DESCRIPTION % % Y = MrGlm() % Y.get_matlabbatch(inputs) % % This is a method of class MrGlm. % % IN % module 'specify_1st_level' % varargin limited set of options to be determined for each module % % OUT % matlabbatch spm...
8070cb554e0fca8e0200de530403631b7f42064f7a088c572cc9dbef2e08f445
MATLAB
2,608
50
function handles = renderEpochSpectogram(hObject, handles) %Plot current spectogram window handles.data.lastWindowPosition = handles.data.windowposition; windowsize = round(handles.data.audiodata.SampleRate * handles.data.settings.spect.windowsize); noverlap = round(handles.data.audiodata.SampleRate * handles.data.se...
aeb21f544963a96d370b2ef368ddfc458ae29e166133216f95a21950f799dbd0
MATLAB
2,608
62
function ord = BF_LinkageOrdering(distMat,links) % BF_LinkageOrdering attempts to use optimalleaforder for dendrogram orderings % ------------------------------------------------------------------------------ % Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail.com>, % <http://www.benfulcher.com> % % If you ...
0c180ac1afbdce8d44f11e8348d3ff6cd0632bbdc80c993a89d8a982a46393da
MATLAB
2,611
80
function [ output_args ] = SGC_ASSEMBLY_DETECTION( ACTIVITY_RASTER_file ) %SGC_ASSEMBLY_DETECTION( ACTIVITY_RASTER_file ) % % % === Jan Moelter, The University of Queensland, 2018 =================== % narginchk(1,1); fprintf( 1 , [ '\n' ] ); timerVal = tic; %% > PRINT FUNCTION-CALL if( isdeployed ) printCons...
9ebdf72d3d221fba1b5b1119e62a64a1c0b7a6ca5895808bf0eb21c4bd16b02f
MATLAB
2,611
57
function ProcessData_ExtendedData7(datadir, savedir, codedir) %ProcessData_ExtendedData7 - Process raw data saved under datadir such that it can be plotted by PlotExtendedData7. % INPUTS: % datadir - Local directory where 'Golden_Nature/RawData_ExtendedData7.mat' from Zenodo was saved % codedir - Local directory wh...
0da8e8b28c251b660e5d34525fdcd55d8a898e271dd3ff83f3efcc1aec644127
MATLAB
2,612
76
% orchestrator_run_minimal.m % Minimal pipeline orchestrator: set grid, export to base, verify steps, run. % Edit the grid below as needed. %% 0) grid / seeds (edit here) seedList = 1:30; Nvals = [10 20 30]; sparsityList = 0.05:0.05:0.50; snr_vals = [0 5 10]; Tval = 12000; % expose to base work...
231f21c22877d31e09ad583ad624f3981bc1861ff15a77ca072506c12b00d473
MATLAB
2,612
103
function [amplitude,tau,drift,noise]=estimateSpikeParam(trace,fs) %% options.minPeakProm=0.01; options.maxPeakWidth=20; % in ms options.minPeakHeight=0.01; options.spikeDelay=25; % in ms options.savePath=[]; options.plotFigure=false; %% trace=double(trace); trace=trace-mean(trace); % estimate drift parameter temp...
0f522ec023c31763824555717d49aa267ac422d18f5e80719d093fc45b1aa7a1
MATLAB
2,613
83
function fear_frzTrigCoact_opt_meanShift(basename,varargin) load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) param.binSize=0.02; param.halfWindow=5; param.targetHC=3; param.targetSes=2; param.varName='frzTrigCoactChamber'; param.saveFile=[...
01f02d69350409ef2b008833456d4007de4fbbb388180779079ad6d63f95eb75
MATLAB
2,614
73
function [varargout] = likUni(hyp, y, mu, s2, inf, i) % likUni - Uniform likelihood function for classification. The expression for % the likelihood is % likUni(t) = 1/2. % % There are no hyperparameters: % % hyp = [ ] % % Several modes are provided, for computing likelihoods, derivatives and moments % respectivel...
90fe49b1b1ac7b4857b2187d59bdd6793160cd49c7717573b8db46b00ea425ea
MATLAB
2,614
84
%% Kmeans clustering clear all; clc; random_concept = false; addpath(genpath('lib')); load("lib\vik.mat"); for i=1:30 if i == 1 load("lib\Yumodel_RDM_eval_TransE_21to30.mat"); elseif i == 11 load("lib\Yumodel_RDM_eval_TransE_31to40.mat"); elseif i == 21 load("l...
9333890d8e781eea2b38d52ce76e5bab91069925473aaefae3dece45a4eaf748
MATLAB
2,615
78
function varargout = preprocDownsample(S, params) % Usage: [Spp, params] = preprocDownsample(S, params) % % Downsamples stimuli to (fMRI or other) sampling rate; e.g., takes frames % of a movie presented at 15 Hz and downsamples them to an fMRI sampling % rate (TR) of .5 Hz (2 seconds / measurement). % % Inputs: % ...
eaf7b1a69451f310eaa942a37e3f613076c83000fd7386663c844efa2d68786b
MATLAB
2,615
95
%CONVERTUNITS Convert energy, frequency and wavelength units % % Description % % Using fundamental physical constants, there is a unique way of % converting an energy into different units. For example, we often want % to know the energy, wavelength or frequency of a photon. This function converts between th...