sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d18cd3b25625a2f95bda71bfaef7a3deb7eb10df50ddb2f68eae432e6f0a482e
MATLAB
3,662
104
function [X,electrode,err]=ea_mapelmodel2reco(options,elspec,elstruct,side,resultfig) err=0; load([ea_getearoot,'templates',filesep,'electrode_models',filesep,elspec.matfname,'.mat'],'electrode') A = [electrode.head_position,1; electrode.tail_position,1 electrode.x_position,1 electrode.y_position,1]; % ...
d50756c16b744943288eee96facfe1632cc220240177a66a3c1c66ae2615ef28
MATLAB
3,662
108
function [periods,in] = Threshold(x,criterion,threshold,varargin) %Threshold - Find periods above/below threshold. % % Find periods where samples lay above or below a given threshold. Optionally, % keep only periods of sufficient duration and ignore brief interruptions. % % USAGE % % [periods,in] = Threshold(x,c...
3398951e5ec85b3ccfd487fa3aa9c3e9d6f9612f7d86a9f8e708b8ea29f6b6a4
MATLAB
3,664
100
% UPGMA: Unweighted pair-group hierarchical cluster analysis of a distance % matrix. Produces plot of dendrogram. To bootstrap cluster support, % see cluster(). % % Usage: [topology,support] = upgma(dist,{labels},{doplot},{fontsize}) % % dist = [n x n] symmetric distance matrix. % ...
fdfb3954a93ecc754052776f357f123ec6fab7e363da3c6addaceaf89e9c2699
MATLAB
3,665
97
function [filtered_data, mu_gauss, std_gauss, summary] = filterLognormalGaussian(data, sigma_cut, makePlot, alpha) % Fits Gaussians and filters NSC or fraction data if nargin < 2 || isempty(sigma_cut), sigma_cut = 2; end if nargin < 3, makePlot = true; end if nargin < 4, alpha = 0.01; end % --- Convert input t...
16e0fbc08a363eca7f7b712bc0b14695252e840b42a29f92a6b6c2a76c2b2362
MATLAB
3,667
92
function [boxedImage, boxedImageMeasure] = boxImage(inputImage, boxSize, intstMeasureFlag) %BOXIMAGE: split cells into boxes, divide an image up into blocks is by using mat2cell(). % %SYNOPSIS: [boxedImage, boxedImageIntst] = boxImage(inputImage, boxSize, intstMeasureFlag) % %INPUT: inputImage : (matrix) image ...
db66ca51ff6d74b54515cac58ce76802f72590fcbd44f76448f922125b01a7dd
MATLAB
3,669
91
%needs LFP, run_times, timesync chspershank=64; fpass1=0; fpass2=200; for shank=1:8 exp_dir=get_exp(animal); % load(strcat(exp_dir, '\stimuli\', animal,'_VRtimesync.mat')); load([exp_dir '\LFP\' animal '_shank' num2str(shank) '_LFP.mat'], 'LFP'); %loads LFP % load(strcat(exp_dir, '\stimuli\', ...
d04d544cc266e9ba7fc506ffa009e996c644a8dd8fed2364a95b70c965252cc0
MATLAB
3,670
90
function [RegPara, handles, imageinfo, figuretitlename, continueflag, w, fext]... = get_imageinfo(handles, k, RegPara) continueflag = 1; [imagefolder, imagefilename, fext] = fileparts(handles.Datalist{k}); RegPara.imagefolder = imagefolder; RegPara.filename = imagefilename; savename = handles.savenamelist{k}; figur...
2163b734a2a996c72666dd44895b412cb9de95c1c014465d03edccf8add8a452
MATLAB
3,671
132
function plot_hypnogram(stages, varargin) % Plot a hypnogram. Scores can either be a sleepstages struct or a nx1 % array where n is the number of epochs and each row contains stage % information for that epoch. If an array is used, argument 'EpochLength' % can be specified as epoch length in seconds (Default = 30) %% %...
c44d4f2407760c63e73222226be342ac82e97444d13a79d7eb8f12a6a9f15700
MATLAB
3,671
117
function AdjustAxes(f,varargin) %AdjustAxes - Adjust axes limits for all subplots % % USAGE % % AdjustAxes(f,<options>) % % f optional figure handle (default = gcf) % <options> optional list of property-value pairs (see table below) % % ===================================================...
609eb8a3ed1649babfb946b8e827742a8848b26b32923d263655da610b71709d
MATLAB
3,672
70
something= [dyn1l1p0a_nk1r_bioall.tt (([mean(dyn1l1p0a_nk1r_bioall.FLUX,2)-tmpfix*0.05,... mean(dyn1l1p0b_nk1r_bioall.FLUX,2)-tmpfix*0.16,... mean(dyn1l1p0c_nk1r_bioall.FLUX,2)-tmpfix*0.15,... mean(dyn1wh1_nk1r_bioall.FLUX,2)]-1)*100)]; ...
050fe3bdc5f58ac40d8b764d2dfb5c187755802317d1d7165a0000e479158819
MATLAB
3,673
102
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
97cd99d0d85a562dc8a4c8ce744cd7a1201262801937fe80734d176e61699115
MATLAB
3,673
83
function [allow, scores, cdfs] = isiQuality(unit1times, unit2times, tmin, tmax, tref, Fs) % ISIQUALITY Computes statistical measures of refactory period quality. % [allow, scores, cdfs] = isiQuality(unit1times, unit2times, tmin, tmax, tref, Fs) % % Returns a boolean specifying whether the refractory period sta...
84d83879b57fdb464f069ccce19de2a7cbe30595c331380fa4745322081cdd23
MATLAB
3,674
94
function [fibsvalBin, fibsvalSum, fibsvalMean, fibsvalPeak, fibsval5Peak, fibcell] = ea_discfibers_calcvals_cleartune(vatlist, fibcell, thresh) % Calculate fiber connection values based on the VATs and the connectome prefs = ea_prefs; if ~exist('thresh','var') thresh = prefs.machine.vatsettings.horn_ethresh*1000; ...
e59974344c17f2e394655720768c25b2df923fac2a5de351ae68c7ae61dfae8b
MATLAB
3,674
69
function [S,f,Serr]=mtspectrumtrigc(data,E,win,params) % Multi-taper event triggered time-frequency spectrum - continuous process % % Usage: % % [S,f,Serr]=mtspectrumtrigc(data,E,win,params) % Input: % Note units have to be consistent. See chronux.m for more information. % data (single channel) -- require...
b92db6c903c2ab9fbfcd9c17b1fc7a581b97b8a661f89e63426ffc97738c3f0c
MATLAB
3,676
85
figure(1) subplot(211) plot(dyn1l1p0a_new.tt,([mean(dyn1l1p0a_new.FLUX,2),... mean(dyn1l1p0b_new.FLUX,2),... mean(dyn1l1p0c_new.FLUX,2)]-1)*100) axis('tight'), grid('on'), tmpax=axis; axis([-4 44 tmpax(3:4)]); ylabel('LDF (CBF; %)'), xlabel('Time (s)'), dofontsiz...
6c36918be883f1005848f0e8aee3c1a5ce22464e9eeffc1846cb8a97c31dbe0f
MATLAB
3,677
94
% rejtrend() - detect linear trends in EEG activity and reject the % epoched trials based on the accuracy of the linear % fit. % Usage: % >> [rej rejE] = rejtrend( signal, winsize, maxslope, minR, step); % % Inputs: % signal - 3 dimensional signal (channels x frames x trials)...
785751a8d1a40a43aaee571fa74912fda5dea2a9e5784d1deb93a217681aa7d9
MATLAB
3,677
93
function [Obj] = SOFAsave(filename,Obj,varargin) %SOFASAVE % [] = SOFAsave(filename,Obj,Compression) creates a new SOFA file and % writes an entire data set to it. % % filename specifies the name of the SOFA file to which the data is written. % Obj is a struct containing the data and meta % data to be...
9bacc970b86a2a20769c11d73c1ec73cf2a0bafa30fc1e8ccd49fd8cf4b5f8e9
MATLAB
3,677
94
function [faces, vertices, vertexColors, data] = ea_readMz3(filename) %function [faces, vertices, vertexColors, data] = readMz3(fileName) %inputs: % filename: the nv file to open %outputs: % faces: face matrix where cols are xyz and each row is face % vertices: vertices matrix where cols are xyz and each row a vertex...
a8ccab5825cf15423497d9234ec72b1ce5c5769e1b87a2ca1b13f0db8aed6b14
MATLAB
3,677
116
function [z_irm,z_ibm,t] = applyIdealMasks(xt,xi,nfft,hop,fs) %APPLYIDEALMASKS Calculate and apply ideal masks via STFT % % Z_IRM = IOSR.BSS.APPLYIDEALMASKS(XT,XI) calculates the ideal ratio mask % (IRM) and applies it to the mixture XT+XI, where XT is the target % signal and XI is the interference signal. The I...
e82c5d8bc5680585372e73b94ea205103d1f34710a3c1174690c41ba7c0b8be4
MATLAB
3,678
87
% std_mergeclust() - Commandline function, to merge several clusters. % Usage: % >> [STUDY] = std_mergeclust(STUDY, ALLEEG, mrg_cls, name); % Inputs: % STUDY - EEGLAB STUDY set comprising some or all of the EEG datasets in ALLEEG. % ALLEEG - global EEGLAB vector of EEG stru...
cc302f032e9d59983d00619050e926cbe84c879affa173c6d885c99cb3963465
MATLAB
3,679
91
classdef CondColocPt2Pt2BlobProcess < ImageAnalysisProcess % A concreate class for measuring conditional colocalization between 3 images % Anthony Vega 09/2014 %Adapted by Jesus Vega-Lugo (May, 2019) to run conditional colocalization % % Copyright (C) 2021, Jaqaman Lab - UTSouthwestern % % This file is pa...
e61c3c0c70e6c2691a292b7db6745bc5a7adf85a76b2d1be602f27efc502baf9
MATLAB
3,685
92
% imagesclogy() - make an imagesc(0) plot with log y-axis values (ala semilogy()) % % Usage: >> imagesclogy(times,freqs,data); % Usage: >> imagesclogy(times,freqs,data,clim,xticks,yticks,'key','val',...); % % Inputs: % times = vector of x-axis values % freqs = vector of y-axis values (LOG spaced) % data = matr...
dd8a1f6d277970b2e0dd77aca6a111c25faa41c91db392a20698b3b0a5649a97
MATLAB
3,686
118
function [R, t, corr, error, data2] = icp2(data1, data2, res, R0, t0, tri) % [R, t, corr, error, data2] = icp2(data1, data2, res, tri) % % This is an implementation of the Iterative Closest Point (ICP) algorithm. % The function takes two data sets and registers data2 with data1. It is % assumed that data1 and data2 a...
fd9cb74381a9991fb5800945349eae4c1eb8e7b1de85f1ae99b4239534848c88
MATLAB
3,687
113
% spec() - power spectrum. This function replaces psd() function if the signal % processing toolbox is not present. It uses the timef() function. % % Usage: % >> [power freqs] = spec(X); % >> [power freqs] = spec(X, nfft, fs, win, overlap); % % Inputs: % X - data % nfft - zero padding to lengt...
c617d28765394374c349132141f2c55c14459d4b5c231299acb5c9aba4588de1
MATLAB
3,688
107
function [data,extra] = palm_ciftiread(varargin) % Provides limited support for reading CIFTI files % (surface only) using the wb_command as the backend. % % [data,extra] = palm_ciftiread(filename,temp_prefix,wb_command) % % Inputs: % - filename : Filename of the CIFTI (surface only, dtscalar). % - temp_prefix : (Op...
daf6a9415d6aae51740e4a7436aef950673f13bbe3f4ebdfe3098f253bbb22f4
MATLAB
3,688
101
% setfont() - Change all the fonts properties of a figure. % % Usage: % >> newdata = setfont( handle, 'key', 'val'); % >> [newdata chlab] = setfont( handle, 'key' , 'val', ... ); % >> [newdata chlab] = setfont( handle, 'handletype', handletypevalue, 'key' , 'val', ... ); % % Inputs: % handle - [gcf,gca...
b92067b6789827672183873a3867d30cae5f559ac3b106eb9f4bdd1fb249d583
MATLAB
3,689
85
%% LaBGAScore_pdm_regenerate_reports.m % % *USAGE* % % Regenerates c2a-style reporting (overview montage, labelled region table, % regioncenters montage) for PDM analyses that have already been run, reading % the written PDM*.nii rather than refitting. Each bootstrap takes over an % hour, so refitting purely to improve...
f0bd4aa407cbea9a6dcdf710a913528724291009edb071a10771ffe29d926ee2
MATLAB
3,695
148
function CCF = parseCCF(varargin) % parseCCF % % Parses an XML CCF file. % % Nick Halper % support@blackrockmicro.com % Blackrock Microsystems % Version 1.1.0.0 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Version History % % 1.0.0.0: % - Initial release. % % 1.1.0.0: Janua...
65b20ea4a67a0d11021f90d7b3cb76331545c2dc83fd18ce5cbb36a1df593f18
MATLAB
3,696
117
function cpSummary = couplingsum(coupling, srate, samples) % Summarize coupling features. Calculates coupled and uncoupled density, % coupling phase, and coupling strength. circStats toolbox required to % calculate average phase and coupling strength % % Required inputs: % % coupling: A structure containing coupling da...
818a7b608be954c95162ef5be9212e198b54d471dbf06b37cb9fc8e28b6b69ee
MATLAB
3,697
115
% fillcurves() - fill the space between 2 curves % % Usage: % h=fillcurves( Y1, Y2); % h=fillcurves( X, Y1, Y2, color, transparent[0 to 1]); % % Example: % a = rand(1, 50); % b = rand(1, 50)+2; b(10) = NaN; % figure; fillcurves([51:100], a, b); % % Author: A. Delorme, SCCN, INC, UCSD/CERCO, CNRS % Copyright ...
8581c9045edf6e488090d17f8de3a80ceb2c76bd0a396a24bf2386f2aba88632
MATLAB
3,697
130
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
dd2cc778f651e91db9ba346634ab856d24bf7857fea46b5901e0b033da4e4ffb
MATLAB
3,697
114
% pop_readsegegi() - load a segmented EGI EEG file. Pop up query % window if no arguments. % Usage: % >> EEG = pop_readsegegi; % a window pops up % >> EEG = pop_readsegegi( filename ); % no pop-up window % % Inputs: % filename - first EGI file name % % Outputs: % EEG ...
3a0e37fbdcc2ef4dc256c79c2c55e66395e85c0c6273f035f4e987866b2ae5a1
MATLAB
3,698
109
% Date: 05-10-2026 % export_two_layer_instr_lesion_results_to_excel.m % Description: Export two-layer one-modality (instr) lesion-result .mat files % from trained_models/two_layer_models_wo_inh_feedforward/lesion_results into % a single Excel workbook with one sheet per .mat file. % % Each sheet contains three columns:...
4bfcbdba528a9275b72fdcb62c683f09a0734ca54702ce2964e11cd33ee32555
MATLAB
3,700
100
function fig = draw_surface_bluewhitered_gallery_dull(surface_to_plot, data_to_plot, hemisphere, medial_wall, with_medial) % draw_surface_bluewhitered_gallery_dull.m % % Draw multiple data on surface using blue-white-red colormap for % negative-zero-positive values with dull plot lighting % % Inputs: surface_to_plot : ...
1548ebb68fd0824fa88dcbaed54f45afc25e86e1a19f8adc906d5314fd7251b6
MATLAB
3,703
130
function CFAT % clinic frequency analysis main function % Version 1: fisrt build in 02 Dec. 2021 % Updata on 11 Mar. 2022 % Updata on 18 Oct. 2022 % Updata on 30 Dec. 2022: Add permutation&bootstrap for cluster correction. % Which need updata later: Add permutation of cluster correction for % Chisquare. # 10:20 30 Dec....
173bb4877febcb5e33657ad854394ce9f7a83fda31db75b1a8fef886a271443b
MATLAB
3,703
110
% chancenter() - recenter cartesian X,Y,Z channel coordinates % % Usage: >> [x y z newcenter] = chancenter(x,y,z,center); % % Optional inputs: % x,y,z = 3D coordintates of the channels % center = [X Y Z] known center different from [0 0 0] % [] will optimize the center location according %...
74bfa5650d197831c80911e573cc1076692162778363c3c61e924bec23372d72
MATLAB
3,705
102
% [data, names] = loadData(filename) % Load one of several formats of data expected from a recording with either: % Doric (csv), Multifiber (csv), Inscopix (csv), XLS files, or Axon (abf). % % [data, names] = loadData(filename, sheetName) % [data, names, sheetName] = loadData(filename, sheetNumber) % If the file...
0fa3a4fd7df40a3c59f3a47eac84a211b95da53907e03ec46ebf447c45342363
MATLAB
3,708
114
function h = PlotRepeat(X,Y,pattern,varargin) %PlotRepeat - Plot repeated (tiled) copies of the data. % % USAGE % % h = PlotRepeat(X,Y,pattern,<options>,<options2>) % % X abscissae % Y ordinates % pattern 'xxy','xyy' or 'xxyy' depending on repeated axes % <options> ...
52e6896d71cc0b0c7786e6711927c174f0fa2031f8e17bf08dcd7a632c229bad
MATLAB
3,708
89
function T2_simulation(seg_file, T2_star_file, M0_file, T2_uniform_file, R2_file) % Load the NIfTI segmentation file seg_img = load_untouch_nii(seg_file); seg_data = double(seg_img.img); % Define the region values lookup table region_values = [57.46, 41.47, 50.44, 44.07, 71.71, 47.255, 56.62,...
9bc5380cb4d096ddaaf779b2ab1771a5c063021343406be8278b9695c4bef59f
MATLAB
3,710
72
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Create meshes for a sphere inside a cubic domain %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % preparation % you have to add the path to iso2mesh toolbox % addpath('/path/to/iso2mesh/toolbox/'...
8e4ed8369422838189c7570ca8f0ff9e5e75e23fe5a9ed57f63629d6973d4bd9
MATLAB
3,712
67
function centroid = centroid_extraction_sphere(sphere_coords, annotfile) % % Usage: % centroid = centroid_extraction_sphere(sphere_coords, annotfile) % % Description: % Extract centroids of a cortical parcellation on a surface sphere (authors: % @frantisekvasa, @saratheriver) % % Inputs: % sphere_coords (d...
dc0e6a861189525226b0f0625fd799dbfc2a7f4d54bf3e9dbc1efb0e48e5fc79
MATLAB
3,712
103
function transforms = ea_ants_nonlinear_coreg(varargin) % Wrapper for ANTs 3-stage nonlinear coregistration fixedimage = varargin{1}; movingimage = varargin{2}; outputimage = varargin{3}; if nargin >= 4 && ~isempty(varargin{4}) normsettings = varargin{4}; else umachine = load(ea_prefspath('mat'), 'machine'); ...
fd2cb854139982f217bf26909f51999c9288c188df48359d2bce0b2a7dbe0a04
MATLAB
3,712
142
% PAD_NII: Pad the NIfTI volume from any of the 6 sides % % Usage: nii = pad_nii(nii, [option]) % % Inputs: % % nii - NIfTI volume. % % option - struct instructing how many voxel to be padded from which side. % % option.pad_from_L = ( number of voxel ) % option.pad_from_R = ( number of voxel ) % option.pad_from_P ...
12c6f2b6ffceb835e32660730aefcdf1f274eca6c7131d37b6a11e94952d14a2
MATLAB
3,713
97
function [intervals,indices] = ExcludeIntervals(intervals1,intervals2,varargin) %ExcludeIntervals - Exclude intersecting intervals. % % Given two lists of intervals, exclude from the first list those intervals % that intersect with one or more of the intervals in the second list. % % USAGE % % [intervals,indices]...
18f3265543afdfafc6c7accd10fff9130fa488e70d148ac1257769db7ee67fe2
MATLAB
3,713
141
% PAD_NII: Pad the NIfTI volume from any of the 6 sides % % Usage: nii = pad_nii(nii, [option]) % % Inputs: % % nii - NIfTI volume. % % option - struct instructing how many voxel to be padded from which side. % % option.pad_from_L = ( number of voxel ) % option.pad_from_R = ( number of voxel ) % option.pad_from_P =...
7548fb9ce6b23844f72dfb29876571b9dc27c019d3596abb6be5465daf4490c9
MATLAB
3,714
128
function [Ygreen, Yred] = makeStacks5D_ndk(folder) % This function will make 4-dimensional stacks from 5-dimensional data. % 5D data: x, y, z, t, c % Volume imaging time series with two color channels. %make 5D stacks Ygreen = []; Yred = []; chan = {'ChanA_0*.tif', 'ChanB_0*.tif'}; for c = 1:2 files = jdi...
7dd39ad916202b29e7878a530c311b181348b67442230b2bef309f502eb40ab7
MATLAB
3,719
122
function M = Array2PagedMatrix(A) %Array2PagedMatrix - Transform an N-dimensional array into a paged matrix. % % Vertically concatenate all pages in the array, and add N-1 % columns listing the subscripts for all dimensions except the % second dimension (which is implicit, since it becomes the % second dimension o...
08d1aef38d91d05101c73b43e7403f780e7c84ebb6e2e33d82b301616882c56c
MATLAB
3,720
126
function [slope, idx, info] = scaling_region(d, fs, opts) %SCALING_REGION Automatic linear scaling region of a divergence curve. % % [slope, idx, info] = nonantest.scaling_region(d, fs) % % d is the average line divergence curve (LyE_R column 3), fs the sample % rate. Returns the fitted slope in natural log units...
ffaa09be44a6b59317aa44d6c045a9b6b87acf602655dda077482aca30694115
MATLAB
3,720
69
function [S,f,R,Serr]=mtspectrumtrigpt(data,E,win,params,fscorr) % Multi-taper time-frequency spectrum - point process times % % Usage: % % [S,f,R,Serr]=mtspectrumtrigpt(data,E,win,params,fscorr) % Input: % data (structure array of one channel of spike times; % also accepts 1d c...
5801494ea348e9d7940ace67b58774ad1447357a83605af0ce3f8ca7543e1007
MATLAB
3,723
80
function [tapers,pad,Fs,fpass,err,trialave,params]=getparams(params) % Helper function to convert structure params to variables used by the % various routines - also performs checks to ensure that parameters are % defined; returns default values if they are not defined. % % Usage: [tapers,pad,Fs,fpass,err,trialave,para...
4bcf28f5f0a822bdbd108d20fef494384921bf98c050e1e18bed0ebf13b6382e
MATLAB
3,725
122
function bb_gradient_plot(data, varargin) % % Usage: % bb_gradient_plot(data, varargin) % % Description: % Stratify parcellated data according to the BigBrain gradient % (authors: @caseypaquola, @saratheriver) % % Inputs: % data (double array) - vector of data % Parcellated data. % % Name/value pairs...
a6e5c14713f981a8ad9951c311efa2ee09c35a7b89ae00e67b8811cbb3f937e7
MATLAB
3,725
83
% function [tracksFeatIndxCG,tracksCoordAmpCG] = pairwiseSegTracks(tracksFeatIndxCG,tracksCoordAmpCG,segmentMerge,segmentSplit) % % Copyright (C) 2022, Jaqaman Lab - UTSouthwestern % % This file is part of SMI-FSM. % % SMI-FSM is free software: you can redistribute it and/or modify % it under the terms of the GNU Gen...
1919f8416dd3d63ab95f351ca40ff354936fbb990371c01443d71f2aa1b9a155
MATLAB
3,726
139
function [slope integral] = Pr2Radon(varargin) % computes max projection line, using radon transform, on Pr matrix if nargin == 1 Pr = varargin{1}; plotting = 0; elseif nargin == 2 Pr = varargin{1}; plotting = varargin{2}; end Pr(isnan(Pr)) = 0; theta = 0:.5:180;%0:.5:180; [R xp] = radon(Pr,theta); y(...
10139daddcb3da813c90356e95360d15389090d37c9ccb8cc4b0833efca77bcd
MATLAB
3,727
112
function [spectralPower, freqs] = fun_spectral_power(data, srate, varargin) % Obtain estimates of power spectral density (PSD) in EEG data using the pwelch % function. The default settings obtain PSD estimates on the temporal % derivative of the data using a Hamming window (5 seconds long, 50% % overlap) % % Required i...
b0906fdad73d56dc881415dae06c71f4e062a5b1424549380ddc3bff70474a9f
MATLAB
3,727
117
function [x,m,e] = RunningAverage(X,Y,varargin) %RunningAverage - Compute running linear or angular average. % % Computes the running average of y=f(x). Variable y can be linear or circular % (use radians). The error bars are standard errors of the mean for linear % data, or 95% confidence intervals for circular data....
007b0062dcf05414e4f859fa28b6bcc36c5b9f9d11333f72c32f17cdb4ce7ac8
MATLAB
3,728
89
function [fibsvalBin, fibsvalSum, fibsvalMean, fibsvalPeak, fibsval5Peak, fibcell] = ea_sweetspot_calcvals(vatlist, cfile, thresh) % Calculate fiber connection values based on the VATs and the connectome disp('Load Connectome...'); load(cfile, 'fibers', 'idx'); prefs = ea_prefs; if ~exist('thresh','var') thresh =...
10b5d522d87bb0df3543c929169705f58c8dbfb5522cd2d3a431a543f5ddba1b
MATLAB
3,728
85
function [trials] = crossValidateDiet(cfg,T,perturbations,intervene_matrix,data,species_names,BMD,experimentBlocks) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome time-series datasets, and % predicts biological...
5cea4cdc95cd996f9e2118fb5bc213e7d4747a86db7a21e6ecb4fc96bccdbb71
MATLAB
3,730
123
function out = globalBaselineCV(X, Y, C, opts, kind) % globalBaselineCV Cross-validated global-signal baseline. % % out = globalBaselineCV(X, Y, C, opts, kind) % % Companion to the in-sample global-signal baseline that every pipeline % already reports. The in-sample version fits fitlm/fitglm on all subjects % ...
78740ac475def33a4e42905446d69ff96ec9de5576adab68874d68b36cfc459f
MATLAB
3,730
75
function [corr_lasso,corr_select,corr_L2,rms_lasso,rms_select,rms_L2] = computeDietTrialTrajectories(T,perturbations,trials,densities,intervene_matrix_filtered_merge,experimentBlocks) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems model...
a367275dcf53a03377226723402eb97733b813f1f000302f65115c3a2edd6bb5
MATLAB
3,731
114
% anova1rm_cell() - compute F-values in cell array using repeated measure % ANOVA. % % Usage: % >> [FC dfc] = anova2rm_cell( data ); % % Inputs: % data = data consisting of PAIRED arrays to be compared. The last % dimension of the data array is used to compute ANOVA. % Out...
f31f0ffb2c092ba63032d5ef96621e157753097d6a32ca8c6fddb987ee02f2a4
MATLAB
3,731
94
function varargout = add(tree,uid,type,parameter) % XMLTREE/ADD Method (add childs to elements of an XML Tree) % FORMAT vararout = add(tree,uid,type,parameter) % % tree - XMLTree object % uid - array of uid's % type - 'element', 'chardata', 'cdata', 'pi' or 'comment' % parameter - property name ...
5fb72127c32884a036435f6261734c2ceabc429ce7160c1757e425c709c01703
MATLAB
3,732
78
function [S,f,R,Serr]=mtspectrumpb(data,params,fscorr) % Multi-taper spectrum - binned point process % % Usage: % % [S,f,R,Serr]=mtspectrumpb(data,params,fscorr) % Input: % data (in form samples x channels/trials or a single vector) -- required % params: structure with fields tapers, pad, Fs, fpass, err, t...
210dc9565e1892f76ed7d6f4dc12253512982cb8768aad99ed1f4cdad3fe5dfc
MATLAB
3,739
115
function version=ea_getvsn(com, num) % This function simply exports the version of the current Lead % distribution. For updates please see lead-dbs.org % __________________________________________________________________________________ % Copyright (C) 2014 Charite University Medicine Berlin, Movement Disorders Unit % ...
744761b82bb86705dd2f1d37a3dfca9130e6540e2b10ef0fcf6bf9c1b7f6cd7d
MATLAB
3,739
84
function [node,elem]=meshresample(v,f,keepratio) % % [node,elem]=meshresample(v,f,keepratio) % % resample mesh using CGAL mesh simplification utility % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2007/11/12 % % input: % v: list of nodes % f: list of surface elements (each row for each triangle) % keep...
1bb868cf525038f551c4d8a0f4e55f4a6e9a52f0cf09e37bbcd0c209538f4429
MATLAB
3,742
102
function [assign, confidence] = CBIG_IndCBM_wta(surf_labels, vol2surf_fc, topX) % [assign, confidence] = CBIG_IndCBM_wta(surf_labels, vol2surf_fc, top) % % This function use winner-take-all to assign labels to the cerebellum. % For each cerebellar voxel, this function first identifies the X highest % correlated surfa...
7dbb0139ccea29c980ba1c0001c9133e8cc359bcddab70e876efe32acca3b35f
MATLAB
3,743
69
function [S,f,Serr]=mtspectrumtrigc(data,E,win,params) % Multi-taper event triggered time-frequency spectrum - continuous process % % Usage: % % [S,f,Serr]=mtspectrumtrigc(data,E,win,params) % Input: % Note units have to be consistent. See chronux.m for more information. % data (single channel) --...
5a79b83c94b7ed0c3ef4aac0e68bd0f0c03ede098a1c4013535844d149da83c5
MATLAB
3,744
117
function events = GetEvents(selection,varargin) %GetEvents - Get events. % % USAGE % % events = GetEvents(selection,<options>) % % selection optional list of event descriptions; see examples below % <options> optional list of property-value pairs (see table below) % % ===========================...
b2bb3d7d2268b740d0d5aa4ad1b66c7e29f02030d426c6a707a7df1bf7f29598
MATLAB
3,745
116
function output = GetCustomDefaults(current,property,value) %GetCustomDefaults - Get custom default value for a given function property. % % This is an 'internal' function used by FMAToolbox. You should not need % to use it, unless you are developping new functions for this toolbox. % % See Example below. % % WARN...
2e7685582edc1a02306bbb0cc69680f2d31323cf48ad33f8ab710b071e9957a5
MATLAB
3,746
98
% Name: Robert Kim % Date: 05-12-2023 % Email: robert.f.kim@gmail.com % fnc_task_neus.m % Description: Identify task-selective (anti-DMS vs. pro-DMS) neurons in a % trained one-modality (instr) RNN. The function generates random trials, % averages each unit's firing rate over a stimulus-aligned window, and uses % a Wil...
ecb9e1fb0828211e926c5a8cc93a829c53c51bbd979b9cd46c66f926bb9e41cd
MATLAB
3,746
109
function varargout=xmlwrite_xerces(varargin) %XMLWRITE_XERCES Serialize an XML Document Object Model node using Xerces parser. % xmlwrite_xerces(FILENAME,DOMNODE) serializes the DOMNODE to file FILENAME. % % The function xmlwrite_xerces is very similar the Matlab function xmlwrite % but works directly with the ...
97596e410a0f84633dbb01f2b77b731b6a47a05f62a67fba44f510f244543485
MATLAB
3,748
104
function handles = dan_stage_epoch(handles, stage) % Assign a sleep stage to an epoch %% % Authors: Dan Denis % Date: 2021-07-14 %% % Get the current epoch number epochIdx = str2double(get(handles.current_epoch_number, 'String')); % Set sleep stage as a number if stage == 0 handles.psg.stages.s1.stages...
1a3cc5cfb03c40aa12104cb997c1352c8704cb9d664bd9bb8cd95d90ce10a892
MATLAB
3,750
63
% General-purpose data processing and statistical tests for FMAToolbox. % % Bins and histograms. % % Accumulate - Accumulate repeated observations. % Bin - Assign each input value a bin number between 1 and N. % % General Statistics. % % sem ...
226fea16bd49bf5c573cbf1aab933942209209451214cd4bfb8b9d37ecbef202
MATLAB
3,750
75
function [tmat,postopct] = ea_getrawct2preniimat(options,inverse) % Gets the transformation from options.prefs.rawctnii_unnormalized to % options.prefs.prenii_unnormalized and extracts the transformation matrix % % Returns: transformation matrix in LPI- (= RAS+) % % 2018, Andreas Husch, University of Luxembourg, Intenv...
072e16c307feb1d9fdf44503864cd3e18d20770860652374338b8d985ee02745
MATLAB
3,752
97
clear; clc; %% Load and process experiment data % data location path_root = getenv('DECIDENET_PATH'); path_beh = fullfile(path_root, 'data/main_fmri_study/sourcedata/behavioral'); path_jags = fullfile(path_root, 'data/main_fmri_study/derivatives/jags/samples'); fname_beh = 'behavioral_data_clean_all.mat'; fname_meta =...
6ed8dd4f13d3c112c7411cfb2772eed0c5b58179a7c7c7e54a4cb49142b9afe3
MATLAB
3,753
109
function res = on_off_de(params,inputs,initcond) % This function generates a vector of intensity values over time for one % half of the PB to a sequence of single-modality experience (either AF or % OF). It can handle PFNpc offset responses if given the correct % parameters (see 'script_20240404.m') % 'params'...
b1acedd511cacaee3f17d9bfaa63a3db89cfb97832c4a729bf728e3d4f6dfcf7
MATLAB
3,753
113
function [cY,mY,ng] = motion_metrics(Y,bnd,batch_size,var_name) % computes several metrics for the quantitative assessment of the registration % INPUTS % Y: registered time series in a loaded or memory mapped array % bnd: number of pixels to be exluded to avoid NaN effects % ...
a7b9dec1072df26db27ca410f18cfa8a6a6c8ee88b25a7e1d61122a83fb428ef
MATLAB
3,754
96
function [] = register_rois2(sourceFolder, otherFolders, FOV) HEIGHT = FOV(1); WIDTH = FOV(2); clipAmount=0; files = fullfile([sourceFolder; otherFolders(:)],'MC_Video.tif'); N_files = length(files); templates = NaN(HEIGHT,WIDTH,length(files)); for i_file = 1...
1f68c0b20a8861408b32b4a89c73f6346a93541d334a824efdbdf8cc7bac3246
MATLAB
3,756
132
% matsel() - select rows, columns, and epochs from given multi-epoch data matrix % % Usage: % >> [dataout] = matsel(data,frames,framelist); % >> [dataout] = matsel(data,frames,framelist,chanlist); % >> [dataout] = matsel(data,frames,framelist,chanlist,epochlist); % % Inputs: % data - input data...
6d86a955608b59feca679b21155654335d0c83a408771f37eabbb13de835cc54
MATLAB
3,757
91
function ea_unified_save_model(obj, ExternalModelFile, ss_val, ff_val, nm_val) exportedAnything = false; % we want to define the model outside of cross-validation if ~exist('obj.explorer.patientselection','var') % patsel can be supplied directly (in this case, obj.patientselection is ignored), e.g. for cr...
2ee63b3382037ac2c8b450a53843803bd3fbe27e22a5736c2f31dedd006248c6
MATLAB
3,759
86
function []=CBIG_gwMRF_write_cifti_from_annot(lh_annot,rh_annot,output_name,nparcels,lh_fslr_orig,rh_fslr_orig) % [] = CBIG_gwMRF_write_cifti_from_annot(base_folder) % %This script writes files from freesurfer annot format into HCP cifti %format. It has dependencies on CBIG, Workbench and Fieldtrip. Further it %also n...
43ea8b35ddc617198330e522a04271001b8f2235251e7487b8d38cd90d337b76
MATLAB
3,759
98
% pop_snapread() - load an EEG SnapMaster file (pop out window if no arguments). % % Usage: % >> [dat] = pop_snapread( filename, gain); % % Graphic interface: % "Relative gain" - [edit box] to compute the relative gain, fisrt look at % the text header of the snapmater file with a text editor. % ...
5c4c1c4cc8b34cc30c3eb48c8a7610a589963bd2cc938654fcd32689be7c0dfc
MATLAB
3,760
111
function obj = export(obj, varargin) % export Export gramm plot to vector or bitmap image % % Example syntax: gramm_object.export('file_name','my_figure','export_path','./test/','file_type','pdf') % export() must be called after a draw() call and will save the plot to % file using the specified 'name',value options: % ...
d551bb059dd96948638bb327325d602f7f0875eeae96e96a129f0d04bdeecde1
MATLAB
3,762
62
% plugin_installstartup() - install popular toolboxes when EEGLAB starts % % Usage: % >> restartEeglabFlag = plugin_installstartup; % pop up window % % Outputs: % restartEeglabFlag - [0|1] restart EEGLAB % % Author: Arnaud Delorme, SCCN, INC, UCSD, Oct. 29, 2013- % Copyright (C) 2013 Arnaud Delorme, SCCN, INC, UCS...
6ff415198972e54324fd0a0ad82b568fde0a599c3a07b88dea9aefae9fcf62d2
MATLAB
3,764
138
function output = err(n,maxit,pmax,family) if n==0 output.n=0; output.fatal=false; output.msg=''; else switch family case 'gaussian' output = err_elnet(n,maxit,pmax); case 'binomial' output = err_lognet(n,maxit,pmax); case 'multinomial' ou...
b59b450175ceaa1e2e864e623abf441a1280f28a0764cf2d87b555773669c9ca
MATLAB
3,765
107
%% NPS SUBREGION NAMES % ------------------------------------------------------------------------- posnames = {'vermis' 'rIns' 'rV1' 'rThal' 'lIns' 'rdpIns' 'rS2_Op' 'dACC'}; negnames = {'rLOC' 'lLOC' 'rpLOC' 'pgACC' 'lSTS' 'rIPL' 'PCC'}; %% CONDITIONS % ------------------------...
b23922395d508e536ee4e7dae99d9726556dcbf0059814ff1b7e37e81eca131a
MATLAB
3,766
81
function contours = getContoursMap2D(smoothGrid, gridMask, xB, yB, thresholds, contourSmooth, method) % Compute contours for thresholded values of a 2D map of scalar values % thresholds is an array of desired percentile values for thresholding the map % contours is a 1 x length(thresholds) struct array of XY contour po...
27be9c2694866dcbafb92360e4329462418d760d6bd892b2976eb65a16fb7b7e
MATLAB
3,768
70
fprintf(1,'Executing %s at %s:\n',mfilename(),datestr(now)); ver, try, if isempty(which('spm')), throw(MException('SPMCheck:NotFound', 'SPM not in matlab path')); end [name, version] = spm('ver'); fprintf('SPM version: %s Release: %s\n',name, version); fprintf('SPM p...
41d6d7c9baaa07b14e9bf6897f36e4482e3375417a9f4022e1852417d8643e69
MATLAB
3,771
118
% listdlg2() - listdlg function clone with coloring and help for % eeglab(). % % Usage: same as listdlg() % % Author: Arnaud Delorme, CNL / Salk Institute, La Jolla, 16 August 2002 % % See also: inputdlg2(), errordlg2(), supergui(), inputgui() % Copyright (C) Arnaud Delorme, CNL / Salk Institute, arno@s...
84161eb2105fa4ccbba16d45112e74e0812f9bde1c654d1aeadb6dbad3f3f6b6
MATLAB
3,771
115
function pvals = palm_gamma(G,mu,sigsq,gamm1,rev,prepl) % Return the p-values for a Gamma distribution, parameterised by % its first three moments. % % pvals = palm_gamma(G,mu,s2,gamm1,rev) % % Inputs: % - G : Statistics for which p-values are to be computed. % - mu : Distribution mean. % - sigsq : Distribution...
b90d6b4d558a2145c745ff12075cb4c67370cd780a0c72e5ee9f97f12f808f12
MATLAB
3,772
98
classdef VButtonBox < uix.ButtonBox %uix.VButtonBox Vertical button box % % b = uix.VButtonBox(p1,v1,p2,v2,...) constructs a vertical button box % and sets parameter p1 to value v1, etc. % % A vertical button box lays out equally sized buttons from top to % bottom. % % See also...
2fc403584c5ac9f1d430ed1adfaa15e3af27231fae00c506a15a2ebf3ecf8735
MATLAB
3,773
146
function [cimat,reldist,mat]=ea_sample_cuboid(varargin) % This function samples image points alongside a trajectory specified. % usage: [cimat,~,mat]=ea_sample_cuboid(trajvox (trajectory in voxel space),options (regular lead options struct),volume_to_be_sampled_from,interpolation_mode (see spm_sample_vol),width_of_samp...
1528ae29e1029fb710b2c4feb38c153ccbf62408c6d6354cbe854db6192e6c91
MATLAB
3,775
104
function h=ea_heatmap2surface(nii,surface,sides,colormap,opts) % surface can be a char (smoothed/full) or a cell pointing to rh and lh % .mz3 surface files. if ~exist('nii','var') nii=[]; end if ~exist('opts','var') opts.posvisible=1; opts.negvisible=1; end if ~exist('surface','var') surface='smoothed'; e...
6845cce8ca58663034e80a61327011193cab034fb6720ff22ff8f4a951f29385
MATLAB
3,777
119
function [s,f,t] = stft(x,nfft,hop,fs) %STFT Calculate the short-time Fourier transform of a signal % % S = IOSR.DSP.STFT(X) calculates the short-time Fourier transform (STFT) % of signal X using 1024-point segments in steps (hops) of 512 points. S % is a series of one-sided FFTs of size [N,K] where N is the num...
c6f8855812e96329048cb53ba517b822e4ecb08ebcf6fda9a348e59c539d656e
MATLAB
3,778
95
function I = bfGetPlane(r, varargin) % BFGETPLANE Retrieve the plane data from a reader using Bio-Formats % % I = bfGetPlane(r, iPlane) returns a specified plane from the input % format reader. The index specifying the plane to retrieve should be % contained between 1 and the number of planes for the series. Give...
2325d303c0f3f1775d90b2c52a11878085e74cde1a44e7e2fcc4b2c2f33c3294
MATLAB
3,780
117
function AlignTsp2Whl_All(varargin) % USAGE % AlignTsp2Whl_All('parameters','values') % % Inputs: % SIMPLEST THING TO DO: call AlignTsp2Whl_All() % % WARNING: it is assumed that the root folder name and the final merge name are the same. If not, use % the 'mergename' option. Typically the root folder...
f744142bedeadcd8a39fd2c464f59f5966215bcb88ecd2fc3fbf7c43299cee40
MATLAB
3,780
114
function [ structout ] = bz_CollapseStruct( structin,dim,combine,NEST ) %structout = CollapseStruct( structin,dim,combine,NEST ) Combines elements in a %structure array % %INPUT % structin struct(N).fields structure array with N elements where each % of the N elements has the same fields and field st...
3a8176a3a5056e76ee1ed2ba36ef4a5dc3f017178626ac652cbbfa85878c7cca
MATLAB
3,781
107
function ea_update(varargin) % lead update local=ea_getvsn('local'); web=ea_getvsn('web'); if strcmp(local,'Unknown') % full update update=1; elseif strcmp(local,web) % no update update=0; else % incremental update update=2; end if nargin if strcmp(varargin{1},'force') update=1; else ret...
88ca646e9d921156f27c75584d2344704fa0ae3000081f7ab0bccc1607aa1dc5
MATLAB
3,788
84
%% Set-up Model visang_rad = 2 * atan(27/2/34); Ecc = visang_rad * (180/pi); % diameter Ecc = Ecc/2; % radius ApWidth = [size(ApFrm,1),size(ApFrm,2)]; % Which pRF model function? (default = prf_gaussian_rf) Model.Prf_Function = @(P,ApWidth) prf_gaussian_rf(P(1), P(2), P(3), ApWidth); % Which pRF model function? Model.N...
05fce07445703407392038a7324e4226a8adb85a58b6bade30b1ab159c7f283b
MATLAB
3,791
93
function labels = watershed_algorithm_all_par_cifti(edgemetrics, ... minimametrics, stepnum, fracmaxh, neighbors, minh, maxh) %Label initial markers with unique value labels = zeros(size(minimametrics), 'single'); if ~exist('minh', 'var') || isempty(minh) minh = min(edgemetrics(:)); end if ~exist('maxh', 'var...
bc184d261295edd2d0052a6b193c224d31402a43dd6b48e67d4420ca49f2c5d3
MATLAB
3,792
89
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...