sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
2a2e502cfc18a21aaf7bd7f596234f9e3b4c5bc39a9ffd0da9d20fc729df0fb1
MATLAB
6,065
228
function [vertices, edges, colors, points, point_colors] = u3d_pre_line(ax) %U3D_PRE_LINE Preprocess line output to u3d. % % usage % points = U3D_PRE_LINE % points = U3D_PRE_LINE(ax) % % optional input % ax = axes object handle % % output % points = position vectors as columns of matrix, as row cel...
e6be506e646ef3c61f9b194c53bb5d3fa69d15773094ca25fbb03fb73874b2f2
MATLAB
6,065
172
function [x, y, orientation] = FlyTracker(filename, FrameRange,... NBackFrames, opt1, sqrsize,... alpha, ellipse) %FLYTRACKER % Usage: % [x, y, orientation] = FlyTracker(filename, FrameRange, ... % NBackFrames, opt1, sqrsize,... % ...
58bf50092fce9eff55c03fa355ea8ca4b3c2e5698c67b82c0e55eb655c528195
MATLAB
6,068
210
function fig_handles = plot_channel_level_hb( ... layout, data2use, clim, date_value, task_type, montage_type, ... hbr, interp_limit, output_dir) %FNIRSPOWER.HELPERS.PLOT_CHANNEL_LEVEL_HB % Plot channel-level HbO and optional HbR topographies using FieldTrip. % % Usage: % fig_handles = fnirspower.helpe...
abe02190c6d4b1edd2ade6964222d7a484d7b91dcf4029a0f8142b1ce385d8a0
MATLAB
6,068
135
function perm_id = rotate_parcellation(coord_l, coord_r, nrot) % % Usage: % perm_id = rotate_parcellation(coord_l, coord_r, nrot) % % Description: % Rotate parcellation (authors: @frantisekvasa, @saratheriver) % % Inputs: % coord_l (double array) - Coordinates of left hemisphere regions on the sphere, size = [m x...
36019a1d0df6984d4303b805d62246ae8732fe33554c262cb8a619c595cdb1c6
MATLAB
6,075
174
function list = find(varargin) % XMLTREE/FIND Find elements in a tree with specified characteristics % FORMAT list = find(varargin) % % tree - XMLTree object % xpath - string path with specific grammar (XPath) % uid - lists of root uid's % parameter/value - pair of pattern % list - list of uid's of matched ...
2998028d690118d0448fdf031466e618c3f312c0ade276fa43686057fc76783e
MATLAB
6,077
173
function imData=bigread2(path_to_file,sframe,num2read) %reads tiff files in Matlab bigger than 4GB, allows reading from sframe to sframe+num2read-1 frames of the tiff - in other words, you can read page 200-300 without rading in from page 1. %based on a partial solution posted on Matlab Central (http://www.mathworks....
0a6f64cf285198bcc48c39f0001d0773d0469764b5e4346e8ea5af4cf43576b8
MATLAB
6,079
152
function ea_exportvatmapping(M,options,handles) selectedregressor=M.clinical.vars{M.ui.clinicallist}; selectedregressor=selectedregressor(M.ui.listselect,:); if size(selectedregressor,2)==1 bh='global'; elseif size(selectedregressor,2)==2 bh='lateralized'; else ea_error('Please select a regressor with entr...
ae0ced97f754705ab1587a963aab88685a0dd419ed98d41b8bca75a3ad55ab93
MATLAB
6,082
168
function affinefile = ea_flirt(varargin) % Wrapper for FSL linear registration fixedimage = varargin{1}; movingimage = varargin{2}; outputimage = varargin{3}; if nargin >= 4 writeoutmat = varargin{4}; else writeoutmat = 1; end if nargin >= 5 if isempty(varargin{5}) % [] or {} or '' otherfiles = {...
ec8c8ff1124fc135d8b3330c8a73fdfe6440738ea2f72648b7980e4c40ea4052
MATLAB
6,083
154
% mmo() - create a memory-mapped data class % % Usage: % >> data_class = mmo(data); % % Inputs: % data - input data or data file % % Outputs: % data_class - output dataset class % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2012- % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % This progra...
775f7eba09a7714b6c6b0371024ac2cec524f79b17b62ce03eb75ffeb792fcbc
MATLAB
6,087
170
function [y,k, DAy] = loopPcg(L,Lden,At,dense,d, DAt,K, b,p,ssqrNew,cgpars, restol) % [y,k, DAy] = loopPcg(L,Lden,At,dense,d, DAt,K, b,p,ssqrNew,cgpars, restol) % % LOOPPCG Solve y from AP(d)A' * y = b % using PCG-method and Cholesky L as conditioner. % If L is sufficiently accurate, then only 1 CG-step is needed. % It...
bedf52c2436c0704ce31bb5a3a5fec24e42f947518491c3cb1d0ff0b0f0dbe91
MATLAB
6,094
147
% pop_importegimat() - import EGI Matlab segmented file % % Usage: % >> EEG = pop_importegimat(filename, srate, latpoint0); % % Inputs: % filename - Matlab file name % srate - sampling rate % latpoint0 - latency in sample ms of stimulus presentation. % When data files are exporte...
b5f05a87d15803efeb5029c648b8b6f532b47f7d85721ddc24f7df46ae5ff23b
MATLAB
6,096
216
function hdr = load_nifti_hdr(niftifile) % hdr = load_nifti_hdr(niftifile) % % Changes units to mm and msec. % Creates hdr.sform and hdr.qform with the matrices in them. % Creates hdr.vox2ras based on sform if valid, then qform. % Does not and will not handle compressed. Compression is handled % in load_nifti.m, which ...
f4abd2e9c25543b3deeceb830b99a5a6404fa094ecb696b5f41938fec3ad7b3c
MATLAB
6,097
166
%% d_signature_responses_generic.m % % % *USAGE* % % This script plots selected signature responses calculated by % prep_4_apply_signatures_and_save.m, and tests their significance, for % conditions and contrasts defined in DAT. It % % # calls a_set_up_paths_always_run_first, then loads DAT/DATA_OBJ*/DATA_OBJ_CON* % ...
1712f3a5b8a09c6c98577b2f86d182508ff30c78bec5d2b37ba4ef35b7d983e1
MATLAB
6,098
178
function compiledData = compileResultsCSV(inputFolder, outputFolder, options) % COMPILERESULTSCSV Compile manual tracking results from multiple trackers % into a single table with physical unit conversions applied. % % Scans an input folder for subdirectories (one per tracker). Within % each tracker subdirectory it loo...
f2cd46f058f29f08f37853accf2054326af682bcfc7f2a987350fb455233032f
MATLAB
6,105
182
% Minimize beamwidth of an array with arbitrary 2-D geometry % "Convex optimization examples" lecture notes (EE364) by S. Boyd % "Antenna array pattern synthesis via convex optimization" % by H. Lebret and S. Boyd % (figures are generated) % % Designs an antenna array such that: % - it has unit sensitivity at some targ...
261e9e67a639d4b8970bd808337b161d68c532784a59e71a83503b9b1c0d28c1
MATLAB
6,111
183
function [tracking] = bz_processConvertOptitrack2Behav(fbasename,varargin) % USAGE % % bz_processConvertOptitrack2behavior(fbasename,varargin) % % % INPUTS % fbasename -basename of the recording (this is only used in generating % the .mat output file) % <options> optional list of pro...
143bec3defa54350c3613fe501e634eeb7b6cbae83f8e66c61f471e3ac58e574
MATLAB
6,112
151
function rename_dicm(files, fmt) % Rename dicom files so the names are meaningful to human. % % RENAME_DICM(files, outputNameFormat) % % The first input is the dicom file(s) or a folder containing dicom files. % The second input is the format for the result file names. Support format % include: % % 1: run1_...
c64ade66bc88bf6b2d6ee37fa991ad152cc311db0276f6541b2e134c1bac840c
MATLAB
6,116
163
function [placeFieldTemplate] = bz_findPlaceFieldsTemplate(varargin) % [placeFieldTemplate] = bz_findPlaceFields1D(firingMaps) % Creates a template with all cells acording to the arragement of their % place fields in a 1D maze. % % INPUTS % % placeFieldStats cellinfo structure from bz_findPlaceFields1D with ...
e697405b563285eb761388c8cd0bcd477a6e2bb1048f4ce91098f1f2e156c670
MATLAB
6,117
139
function [results]=CBIG_gwMRF_graph_cut_clustering_iter_split(prams) % This function loads the data, normalizes it and calls the clustering function % % Input % - prams = a struct containing various input parameters % % Ouput % - results = a struct containing the labels and various addi...
b80961ec8ad90cf6b0d585f2aa942f5b17e224243f5ac107f654586db77ade4e
MATLAB
6,119
164
function plotfluordirections_tile(avgfluor,redtemps,ROIs,Xpix,Ypix,framerate) %plot the data averaged for each ROI %show the ROI? fn=fieldnames(avgfluor); [numROIs,triallength]=size(avgfluor.(fn{1})); %make the layout as 3 separate figures fig1=figure('units','normalized','outerposition',[0 0 0.2 1]);%make each figure...
82587fe09bcf13d4636b6959d27ddc72933100db3016239d60c66a9bc5a6eb99
MATLAB
6,122
115
function [C,phi,S12,S1,S2,f,zerosp,confC,phistd,Cerr]=coherencypt(data1,data2,params,fscorr,t) % Multi-taper coherency - point process times % % Usage: % % [C,phi,S12,S1,S2,f,zerosp,confC,phistd,Cerr]=coherencypt(data1,data2,params,fscorr,t) % Input: % data1 (structure array of spike times with dimension...
f9ec12cece677f157e9be852f8e7229da52c8495649b0abad76aac29b3829e81
MATLAB
6,127
190
%% % FIRST, % process the metadata as usual: [out filenames] = AF_OF_importer('230511','f3e1'); fly = AFOFdata_struct_CL(out,filenames); % for exp7 %% % SECOND, set up for & run concatCEM % here's the setup date = '251021'; fpt = 148; % frames per trial driver = 'SS02255'; datename = 'oct2125_f3'; %...
464be9fdb15e20fdc6eb86473740b06a39f0e2c19048b50caf0875d8f6af7057
MATLAB
6,130
192
function [Theta_sol]=... constrained_solution_MetaInfer(rp,X,F_prime,o_use_initial_guess,algorithm,nCores) % 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 biologically relevan...
22878615a5f0d96428c71e00478239c6940f51384fa505e18e28411472894bad
MATLAB
6,133
177
function [res, errStr]= dtdstruct_init(varargin) % function [res, errStr]= dtdstruct_init(typeStr, mrStruct, [mrData1, nameStr1, [mrData2, nameStr2, ...]]) % % Creates a valid dtdStruct of the type DTD % %typeStr 'DTD': % [res, errStr]= dtdstruct_init(typeStr, eigenVec, eigenVal, [mrData1, nameStr1, [mrData2, nameSt...
c1182c466fb36b19f766a18d3899832cace87892d24c9e8e143379b3e0e19af1
MATLAB
6,133
154
function myPLS_plot_loadings_1D(var_type,var_PLS_type,vars_PLS,vars_b_vect,vars_mean,vars_std,... vars_lB,vars_uB,var_names,signif_LC,nGroups,fig_pos,save_opts) % This function plots one-dimensional loadings (e.g. behavior, 1D imaging % metrics) of all significant latent components (LCs) as barcharts. % % Inputs: ...
54bb50e598334ff7675375e8b44656445c16b753b7b8e45e186e0bca5490f7cf
MATLAB
6,136
181
function [Spike, spikeWaves, allSpikeWaves, startSpike] = dacq_tetrode(basePath, cutFiles, dotnums, startSpike) %[root.spike root.wmfs] = dacq_tetrode(dataPath,prefix,varargin) % %For a given directory and file prefix, checks for any *.cut files. For all %if any are found, cross references with .# file to create a CMBH...
c1c8f7e94dfb2d239273716042303e9ba0c3ee1f781bb4a30355da0f07a34674
MATLAB
6,138
113
function [C,phi,S12,S1,S2,f,zerosp,confC,phistd,Cerr]=coherencycpt(data1,data2,params,fscorr,t) % Multi-taper coherency,cross-spectrum and individual spectra -continuous data and point process as times % % Usage: % % [C,phi,S12,S1,S2,f,zerosp,confC,phistd,Cerr]=coherencycpt(data1,data2,params,fscorr,t) % Input: % ...
53d73f420628a542d6e75675d827e6e347469b4b04de0e4d4dcc1ebd349fdadc
MATLAB
6,139
139
function this = subsasgn(this, subs, A) % Subscript assignment for GIfTI objects %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: subsasgn.m 6513 2015-08-05 17:52:13Z guillaume $ switch subs(1).ty...
36e372872ae4b8a57a152bd666c6db677e7b4a6be5564f045f0ac33b16691a3f
MATLAB
6,148
164
function [keep_species,intervene_matrix_filtered,data_counts_filtered,species_names_filtered,total_count_norm,biomass_norm,scaleFactor,med_counts,med_biomass] = preProcessData(intervene_matrix,data_counts,species_names,biomass,experimentBlocks,uniqueExperiments,blockIdx,paramFileName) % This file is a part of the MDSI...
86551d68f4c623f40fb2c45791d78ad310464024ba974a31372f6eb25fea1945
MATLAB
6,148
162
function Obj = SOFAupdateDimensions(Obj,varargin) %SOFAupdateDimensions % Obj = SOFAupdateDimensions(Obj) updates the dimensions in the SOFA % structure % % Obj is a struct containing the data and meta. % The dimension sizes are created as .API.X and updated corresponding to the % conventions % flag i...
2d60f741015a7c7b37487aa2c016d699d1bb149d2e7111ba41daa84ff7d37c3f
MATLAB
6,149
168
function Spikes = findSpikes(NSx, varargin) % findSpikes % % Searches NSx data structure for spikes by thresholding. The output is % compatible with NEV.Data.Spikes data structure. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Use OUTPUT = findSpikes(NSx, 'threshold', 'preThres...
bc001e05f619ebde688e4201c2428d14e744247f8b49a56db31ebd704b9176ab
MATLAB
6,149
233
% cbar() - Display full or partial color bar % % Usage: % >> cbar % create a vertical cbar on the right side of a figure % >> cbar(type) % specify direction as 'vert' or 'horiz' % >> cbar(type,colors) % specify which colormap colors to plot % else % >> cbar(axhandle) % specify the axes to draw cbar in % % ...
9dc4d11d6d477f83d1b98792ff7016b81ebf22134a9992a9e95f4fbe12d4675e
MATLAB
6,152
147
function lh_rh_Neighborhood = CBIG_hMRF_generate_fs6_lhrh_nborhood(outdir) % CBIG_hMRF_generate_fs6_lhrh_nborhood(outdir) % % The left and right fsaverage6 hemispheres were first registered using the Freesurfer's 'mris_left_right_register' % function. After registration, the closest right hemisphere vertex was found f...
1363d05d875b5d5e32047ccc61db1db796a37340b296f2928c467bce544c9c1d
MATLAB
6,160
209
% compheads() - plot multiple topoplot() maps of ICA component topographies % % Usage: % >> compheads(winv,'spline_file',compnos,'title',rowscols,labels,view) % % Inputs: % winv - Inverse weight matrix = EEG scalp maps. Each column is a % map; the rows correspond to the electrode positions ...
288b0461077c9382f638016594f95342349610a45613146a14029061e9a40ff9
MATLAB
6,162
171
function obj = stat_violin(obj,varargin) % stat_violin display violin plots of y data for unique x % % Options can be given as 'name',value pairs: % - all options from see stat_density() are present: % 'bandwidth', 'kernel', 'npoints', 'extra_y' % - 'normalization': 'area' (default) all violins have the same % areas. W...
abddde077696ac7e115c5768ba70a72d8fe30c4299e566aa547f2200d75e65fd
MATLAB
6,164
218
clc clear all close all set(0,'defaultfigurecolor',[1 1 1]);% set figure background color if ~contains(path, '/Users/guofanhua/Desktop/gfh/tools/MatlabTools/BrainSpace-latest/matlab') addpath(genpath('/Users/guofanhua/Desktop/gfh/tools/MatlabTools/BrainSpace-latest/matlab')); end %% ======================= step 1 ...
9a1253965b30056451d7065a63beb879867405a13988b6a4d968277a48d2af33
MATLAB
6,170
167
function ea_apply_coregistration(varargin) % Wrapper to apply linear transformation % % The 4th parameter (transformation) can be: % 1. Not specified, the transformation will be automatically detected % if there is only one transformation file in the folder. % 2. String ('SPM', 'ANTs', 'FSL' and 'BRAINSF...
ee3faf55cffc2c987dd8bd70b6cf77049786a3f81a8add667df5335fdd4ca738
MATLAB
6,175
181
%% Evaluate the Reliability of Functional Connectivity Analysis % Generate simulated data for 2 neurons % Control the spike firing rate % Control the level of synchronous firing clc clear % close all %% Parameter settings % ************************* para_Len = 1000; % Length of the sequence (number of time...
963855600b9da05ec01282d502609e4eaa6bf7d06a258f00db1840233599dbd6
MATLAB
6,176
113
function chronux % This library performs time-frequency analysis (mostly using the % multi-taper spectral estimation method) of univariate and multivariate % data, both for continuous processes such as LFP/EEG and for point % processes such as spike times. Point process can either be stored as % times or as a binned pr...
00e426d320c1548e0ccd2fbdae62d5b007d4a2fef3e1c9deab003720e1a0f566
MATLAB
6,177
121
% Several examples for using StructDlg %% % Note: The values the user enters to the dialog box for numeric fields are being 'eval'-uated, % so inputs such as (sin(0.34)+2)^my_func(34.2) are possible. % The field's numeric limits can be displayed by placing the mouse over the field. % % % Free Strings: Limited ...
5a7848a923f9a4b8d971f974822bcf278772049704e823be8b8e2e26d75b5b62
MATLAB
6,178
160
function varargout=ea_ft_mesotracking_reisert(options) % __________________________________________________________________________________ % Copyright (C) 2014 Charite University Medicine Berlin, Movement Disorders Unit % Andreas Horn if ischar(options) % return name of method. varargout{1}='Mesoscopic Fibertrack...
b55f17b8bf7dc8536312984011a9b3104724d99299edc2435bdfd6bb023d294a
MATLAB
6,180
144
% 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...
b27b966526ded4ed4c54a9006a54fe5bbc57bd59f65b1d5d61a536745e5d48ff
MATLAB
6,182
191
% Load NIFTI or ANALYZE dataset, but not applying any appropriate affine % geometric transform or voxel intensity scaling. % % Although according to NIFTI website, all those header information are % supposed to be applied to the loaded NIFTI image, there are some % situations that people do want to leave the origi...
ade22a1eccad3810d8dc7802f994b24a2f02cb3da2851cfbed3454e2f71ec32b
MATLAB
6,183
170
function [ cluass,cluNRG ] = bz_GradDescCluster( simMat, varargin ) %[cluass] = bz_GradDescCluster(simMat) clusters recording sites given a pairwise %similarity matrix using gradient descent to find minimize within-cluster %interaction energy. (i.e. maximize within-cluster coherence, see Berenyi %et al 2014 for deta...
bc0b7b84455a8764653b45f31287d56ddeac2600642cca54fcca53d067929e19
MATLAB
6,183
219
function A = convnfft(A, B, shape, dims, options) % CONVNFFT FFT-BASED N-dimensional convolution. % C = CONVNFFT(A, B) performs the N-dimensional convolution of % matrices A and B. If nak = size(A,k) and nbk = size(B,k), then % size(C,k) = max([nak+nbk-1,nak,nbk]); % % C = CONVNFFT(A, B, SHAPE) controls the s...
f6edca7fe0e1a6a1a3c3c75f915df046497c68f1632825793b8b5b293cd7435a
MATLAB
6,184
192
% This functions computes the FFT of the data and aftewards the PLV and % power % % INPUTS: % EEG EEGLAB structure % OPTIONAL INPUTS: % condition indexes for different conditions (size Nepochs x 1 ) % If not proveded or empty it is computed for all trials % Default [] % ...
152e981583c93db433f8927adf5bea4a053d7a50a6574c11f0a13034dc5a9669
MATLAB
6,191
209
%% 1. Create strings listing where the toolbox and the tutoral data directories are toolbox_directory_name = '../../ndt.1.0.4/' % put name of path to the Neural Decoding Toolbox raster_data_directory_name = 'Zhang_Desimone_7objects_raster_data/'; % put name of path to the raster data %% 2. Plot a rasters a...
f2223b92074d62fc1c8294e4e3c0463625099f1da0f80690ea88bb0e303b6e61
MATLAB
6,200
124
function [all_XTr_pseudo all_XTe_pseudo] = turn_all_simultaneous_data_into_pseudo_populations(all_XTr_simul, all_YTr, all_XTe_simul, all_YTe, feature_to_siteID_mapping) % A helper function that takes simultaneously recorded data and turns it into pseudo-populations. % This function should return results that are v...
e3dfab305af59d1d432c59d2ecc68916a000cacf3e9a9822c7d771a6ea36e2da
MATLAB
6,201
204
function [out1,out2,out3] = ginput(arg1) %GINPUT Graphical input from mouse. % [X,Y] = GINPUT(N) gets N points from the current axes and returns % the X- and Y-coordinates in length N vectors X and Y. The cursor % can be positioned using a mouse (or by using the Arrow Keys on some % systems). Data poin...
f748dce2ccc12c30911272824fad9c2d5f5843f42b51929966a0a078d94e71f1
MATLAB
6,211
177
function CBIG_factorHierachy(k_bestRun) % CBIG_factorHierachy(k_bestRun) % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md noSplits = size(k_bestRun, 1)-1; K_0 = k_bestRun{1, 1}; K = k_bestRun{end, 1}-1; which2_order_avgCorr_beta = cell(noSplits, 3); which2_order_avg...
b8a869bd8e053c9916a9b281c1ec145c3a2a5c56b822bd44dda8767bd5f7d85d
MATLAB
6,212
192
% This functions computes the FFT of the data and aftewards the PLV and % power % % INPUTS: % EEG EEGLAB structure % OPTIONAL INPUTS: % condition indexes for different conditions (size Nepochs x 1 ) % If not proveded or empty it is computed for all trials % Default [] % ...
25d2423ed73afd2cd53f4efd76724d7c2b6b6a1c0fbedcbaa2b8e2f625243dea
MATLAB
6,213
160
function positions = GetPositions(varargin) %GetPositions - Get position samples. % % USAGE % % positions = GetPositions(<options>) % % <options> optional list of property-value pairs (see table below) % % ========================================================================= % Properties Valu...
b33bd892639cc4a11ca55db1bac3303ba2c14a7d2449deefe785a6f6ddd0574b
MATLAB
6,216
150
classdef max_correlation_coefficient_CL % max_correlation_coefficient_CL is a classifier object (CL) % that learns a mean population vector (template) for each class from the % training data. When the classifier is tested, the correlation coefficient % is calculated between a test point and each of the class tem...
1a2f43b8411000f8ba4833895ea2bac4f3f0175c1471f3a269339ab9ecba314a
MATLAB
6,219
142
function [id_sites, id_dx, id_age, id_sex, id_motion, id_fiq, id_scores, id_factorLoading] = CBIG_ASDf_getSubData(... sub_info_file,id_sub, behav_score_file, idx_scores, factorLoading_file) % [id_sites, id_dx, id_age, id_sex, id_motion, id_fiq, id_scores, % id_factorLoading] = CBIG_ASDf_getSubData(sub_info_file, id...
43a256e0614d4ca1e6274a220f11dadd1f7a7c27459d2b85bd0c792086df74a4
MATLAB
6,222
181
function [PowerPhaseRatemap,spikebinIDs] = bz_PowerPhaseRatemap(spikes,filteredLFP,varargin) %[PowerPhaseRatemap,spikebinIDs] = bz_PowerPhaseRatemap(spikes,filteredLFP,varargin) % %INPUTS % spikes structure containing spikes.times from bz_getSpikes % filteredLFP structure containing filteredLFP.timesta...
cc33c58ece2ccc1d2dda819416b4211d17bd8aa54406607d2d4629450966074e
MATLAB
6,222
184
function varargout=wt(d,varargin) %% Continous Wavelet Transform % Creates a figure of wavelet power in units of % normalized variance. % % USAGE: [wave,period,scale,coi,sig95]=wt(d[,params]) % % d: a time series % wave: the wavelet transform of d % period: a vector of "Fourier" periods associated with wave ...
1be774ca45fcb2a8cdb58fc331236433f926197aeb34c732a8253d6c8a182681
MATLAB
6,230
151
function tests = testLyapunov %TESTLYAPUNOV Contract tests for the lyapunov wrapper. tests = functiontests(localfunctions); end function setupOnce(tc) tc.TestData.lorenz = nonantest.signals('lorenz', 3000); tc.TestData.fs = 1/0.03; end function teardown(~) dbclear all end % ------------------------------------------...
c3fb552753ffb1a82b838619570e25a8d720728e814167957eeee8f7d7bd80ee
MATLAB
6,234
216
%% % MSE script % first, run per-fly getPFNdata.m, e.g. [leftmeans rightmeans] = getPFNdata(allflies,[1:19],[1:10],5,[1,2]); % then run this for f = 1:10 ivc{f} = makeIVC(leftmeans{f},rightmeans{f},3,2); end %% for f = 1:10 for i = 1:19 means(f,i) = mean(ivc{f}{i}); sems(f,i) = st...
6d61f09ca9fd0a4648f2b58a7a2e4e2dd2a7113fbe70239a695a0df52be00a69
MATLAB
6,235
175
% THIS SCRIPT RUNS BETWEEN-PERSON CONTRASTS % Assuming that different conditions are tested on different groups of % participants. For within-person contrasts, where each individual has an % image for each condition being compared, use DAT.contrasts, not this. % If conditions being compared include images for differen...
88f193973969e4d683364560378eea58cd8c61408103e0a7392ad115f3ebecb1
MATLAB
6,236
172
function [x, y, orientation] = FlyTracker(filename, FrameRange,... NBackFrames, opt1, sqrsize,... alpha, ellipse) %FLYTRACKER % Usage: % [x, y, orientation] = FlyTracker(filename, FrameRange, ... % NBackFrames, opt1, sqrsize,... % ...
c9c25cd0dc442994c184d2a089927725b213e056ac9e05f99b46594eaa96b478
MATLAB
6,240
230
function AlignTsp2Whl(fbasename,colorvec,varargin) % USAGE: % AlignTsp2Whl(fbasename,colorvec) % % convert .tsp file to .whl file. Requires the .meta file % % INPUT: % 'fbasename': the file base names ('fbasename.tsp', etc.) % 'colorvec': a 2 value vector [colFront colRear] which defines which % color from [R G ...
2e667bac3a2dc7e610cf9e12228b3d4c46adb0ef79a8d6edb3114f95d3a8f400
MATLAB
6,242
137
%% control_mvpa_reg_cov_permutation.m % % POSITIVE CONTROL for the permutation test added to prep_3a's % domvpa_reg_cov block (prep_3a v_next, 2026/09/23). % % WHY THIS EXISTS % predict() returns pred_outcome_r, mse, rmse, meanabserr and cverr, and % nothing inferential - there is no p-value anywhere in its output stru...
9ba64d0a412e7d7da4c6ab517b9430295762d8dd756ab693d858835e3dad7edc
MATLAB
6,242
164
function vol2surf_fc = CBIG_IndCBM_compute_vol2surf_fc(lh_surf_file, rh_surf_file, vol_file, template_file, output_file) % vol2surf_fc = CBIG_IndCBM_compute_vol2surf_fc(lh_surf_file, rh_surf_file, vol_file, template_file, output_file) % % This function computes the functional connectivity between the cerebellum % in t...
cbf5b1e2daa92523bc9c7c21426dcc4b4c08d8f3619a23ced1b418e543cb2f10
MATLAB
6,242
181
function [nPeaks, nTroughs, mainPeak_before_size, mainPeak_after_size, mainTrough_size, ... width_before, width_after, widthTrough, peakLocs, troughLocs, PKS, TRS, troughLoc] = getWaveformPeakProperties(thisWaveform, param) % Flexible handling of different spike widths waveformWidth = size(thisWaveform, 2); if wave...
963f5db6f67d7c0349f0b573db0880aee2b1cd81b6b802f949660aab548f57ec
MATLAB
6,244
168
%% Check whether contrasts are defined % ------------------------------------------------------------------------ if ~isfield(DAT, 'contrasts') || isempty(DAT.contrasts) % skip disp('No contrasts specified. Skipping contrast estimation'); return end %% Specify which montage to add title to. This is ...
5e3484b3119f55c4f01a48b5123168f29076f831aa9f44227583a6e83391f7e0
MATLAB
6,245
180
function cc = ea_conncomp(A) % conncomp Find connected components in 2D grayscale or label image % Four-connected neighborhood is used. % % CC = CONNCOMP(A) returns the connected components CC found in A. % A is a two dimensional array (image) of sixe I-by-J. Elements in A should % be positive, if A...
94085befd7d7fc686ecdd3b59e2147cb5a7e22b46f92f905e8f5ad22de727061
MATLAB
6,249
174
%%***************************************************************************** %% HSDsqlpcheckconvg: check convergence. %% %% ZpATynorm, AX, normX, normZ are with respect to the %% original variables, not the HSD variables. %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last ...
1883c094bfcef923830881c746f19e941ac331d67a680ed94949e1d15a2b58dc
MATLAB
6,251
113
function [C,phi,S12,S1,S2,f,zerosp,confC,phistd,Cerr]=coherencycpt(data1,data2,params,fscorr,t) % Multi-taper coherency,cross-spectrum and individual spectra -continuous data and point process as times % % Usage: % % [C,phi,S12,S1,S2,f,zerosp,confC,phistd,Cerr]=coherencycpt(data1,data2,params,fscorr,t) % Input: ...
693d5aa141f4541dcf22e6042601d32be7647fd58b4bf9bbf820f880dc396f05
MATLAB
6,255
162
function aggtree(spikes) % AGGTREE Generates a graphical summary of an aggregation procedure. % AGGTREE(spikes) % Takes a spike-sorting data structure that has undergone hierarchical % aggregation and visualizes the hierarchy. % The function draws its output over the current axis. The labels of the % initi...
6a3624af76065bc6c4a58527c3bdbe1bbdb8487742df3eccdd8b7f9c191140cc
MATLAB
6,255
204
classdef report_generator < handle %REPORT Summary of this class goes here % Detailed explanation goes here %% Public Properites properties name; fid; output_dir; report_dir; css_dir; img_dir; end %% Private Properties prop...
87756c0f0543d0ed03bcd10789bfe4fd3c6091ee5154658e9ddff1b5a1d4bb45
MATLAB
6,257
173
function [weightedMean,weightedStdOfMean,weightedStdOfSample] = weightedStats(data, weightsOrSigma,sw) %wStats calculates weighted statistics (mean, stdev of mean) for a list of inputs with corresponding weights or {std} % %SYNOPSIS [weightedMean,weightedStd] = weightedStats(data, weightsOrSigma,sw) % %INPUT data:...
51cd994c87a4757681dc3b670de4715e4bf0697a83528300761c7809b507307b
MATLAB
6,259
173
function M2T = mni2tal_matrix() % MNI2TAL_MATRIX - Talairach to MNI coordinates (best guess) % % MNI2TALAIRACH = mni2tal_matrix % % MNI2TALAIRACH is a struct containing rotation matrices % used by mni2tal and tal2mni % % See also, MNI2TAL, TAL2MNI & % http://www.mrc-cbu.cam.ac.uk/Imaging/mnispace.html % % $Revis...
64fa005983a07afff6377d37dec3a955de89fe96b4110bdf55b09d1669b402ad
MATLAB
6,263
165
function dir_angles = ea_diode_darkstar(roll,pitch,yaw,dirlevel,radius) vizz = 0; %% create vectors symbolizing the gaps between directional contacts at 60, 180 and 300 degrees % and transform them to match lead trajectory and directional level dirlevel = dirlevel(1:3); ven = [0 0.65 -0.75 ]'; dor = [0 0.65 0.75 ]'; [...
9314154d3835f84d08d30c20ed3df865bdc0bf79b5046163250a4781f206550b
MATLAB
6,267
193
% Combined sizing of drivers, repeaters, and wire % Section 5.2, L. Vandenberghe, S. Boyd, and A. El Gamal % "Optimizing dominant time constant in RC circuits" % Original by Lieven Vandenberghe % Adapted for CVX by Joelle Skaf - 11/25/05 % Modified by Michael Grant - 3/8/06 % % The first driver drives an interconnect ...
06aeb980650e749486fabd6b2c6c91cc1c6b531a9f222b421f94b8de5b726e0d
MATLAB
6,272
137
%% LaBGAScore_pet_dcm2bids.m % % % *USAGE* % % This script completes partial BIDS conversion of (TSPO) PET data by a previous % run of KUL_dcm2bids.sh % % % *OPTIONS* % % * tracer_string default 'DPA714', tracer identifier for name of pet dir and filenames % * filename_search_string default 'TSPO', string ...
b5d9444628f9394d4bdb06e45abfa09418311f0cbf6ed11fcf8b17b9f18cc8fe
MATLAB
6,276
149
function varargout = impexp_run_nifti2dtdStruct(cmd, varargin) % Template function to implement callbacks for an cfg_exbranch. The calling % syntax is % varargout = impexp_run_nifti2dtdStruct(cmd, varargin) % where cmd is one of % 'run' - out = impexp_run_nifti2dtdStruct('run', job) % Run a job, and r...
4da523a8bedb9d3096dead24e5371cb7ef1f2a29031c8a1c0fd861e20adef55a
MATLAB
6,279
203
function [p,F] = CircularANOVA(angles,factors,method) %CircularANOVA - One or two-way ANOVA on circular data. % % Circular ANOVA can be performed using one of three methods with different % assumptions and limitations: % % 1) Watson & Williams (1956) % The data are drawn from von Mises distributions with ...
f94b1de71d08196d28c48d454af1388203b6e83248c5e2820eb573aa584acbdd
MATLAB
6,280
138
function [x,y] = optstep(A,b,c, y0,y,d,v,dxmdz, K,L,symLden,... dense,Ablkjc,Aord,ADA,DAt, feasratio, R,pars) % [x,y] = optstep(A,b,c, y0,y,d,v,dxmdz, K,L,symLden,dense,Ablkjc,Aord,... % ADA,DAt, feasratio, R,pars) % % OPTSTEP Implements Mehrotra-Ye type optimality projection for % IPM-LP solver. %...
07e4445427cbb0c654582e55ca74b1e349bd9bc72514452c35041d3d6b09fc90
MATLAB
6,285
197
% Load NIFTI or ANALYZE dataset, but not applying any appropriate affine % geometric transform or voxel intensity scaling. % % Although according to NIFTI website, all those header information are % supposed to be applied to the loaded NIFTI image, there are some % situations that people do want to leave the origi...
b793f0cd8ab8425cd499380e2b577aef51aa55998873bda0bcc8c255db65da9b
MATLAB
6,287
151
function [C, log] = SOFAmerge(A,B) %SOFAmerge % [C, log] = SOFAmerge(A,B) merges the SOFA objects A and B to a single one, C. % % A and B are structs containing the data and meta. A and B % must be of the same SOFA conventions. % % C is a struct containing merged data % log contains log data % SOF...
341be72a173ec172d78464ae399b3135ed6bc0da8896c1b33b708b3586792306
MATLAB
6,289
113
function chronux % This library performs time-frequency analysis (mostly using the % multi-taper spectral estimation method) of univariate and multivariate % data, both for continuous processes such as LFP/EEG and for point % processes such as spike times. Point process can either be stored as % times or as a binn...
b590bc0e0708dcce88aed6c8d82c79e8a9d3ad9ea964c115eeb9816e9a415401
MATLAB
6,290
120
function ea_gentrackingmask(options,threshold) directory=[options.root,options.patientname,filesep]; ea_newseg(fullfile(directory,options.prefs.prenii_unnormalized),0); b0_anat = [ea_stripext(options.prefs.b0),'_',ea_stripext(options.prefs.prenii_unnormalized)]; if exist([directory,'ea_coreg_approved.mat'], 'file') ...
5ef7a7a6ce490fce401fa7d7e2713a2f1f88ac91e0dd6552482cebee86cecba5
MATLAB
6,291
186
function OutWin = createWindow(varargin) % Create a Hann or exp. window with specified onsets/offsets % % OutWin = iosr.auditory.createWindow(WinLen, Type, Duration) % % Other (non-symmetric) uses include: % % OutWin = iosr.auditory.createWindow(WinLen, ... % Hann, ... % OnDuration, ... % Hann, ... % ...
09653e7ab6afe6e701536afe622ace1e4d8abd2cca170b6ddd6c0bfbc7c03ecd
MATLAB
6,295
154
function [min_bound_per_contact, max_bound_per_contact, S] = ea_get_currents_per_contact(min_conc,max_conc,min_segm,max_segm, reconst, side, check_S) % create bounds (limits) for current optimization % and adjust the amplitude in S % min_conc,max_conc,min_segm,max_segm - thresholds for contacts % reco...
2a299e5984c43be3ae32406ca81ae0c452a57e59221baf12c10f81510b53e157
MATLAB
6,298
231
function [chg]=KummerComplex(a,b,z) % %KUMMERCOMPLEX Confluent hypergeometric function 1F1 % (Kummer function). % % KUMMERCOMPLEX(a,b,z) is the confluent hypergeometric % function 1F1 (Kummer function) for complex % parameters a, b and complex variable z. % % Example: % KUMMERCOMPLEX(1+0.5i,2-3.1i,...
6b697a3b3d93eddb697821d95531780d869984f7d55db57ef85447b3902b749f
MATLAB
6,300
164
function [coherence,f,s] = MTCoherence (lfp1,lfp2,varargin) %MTCoherence - Compute Coherence by multi-taper estimation. % % The spectrum is computed as the average spectrogram, using the <a href="http://www.chronux.org">chronux</a> toolbox. % % USAGE % % [coherence,f,s] = MTSpectrum(lfp1,lfp2,<options>) % % lf...
d842611561c78410d2ea3a3a80b34f665d7c8dbc4676878f5d479c63335fb96f
MATLAB
6,300
197
%% Example: Mapping images to an atlas and visualizing them with a river plot % Often, we would like to map a results image (e.g., t-map or functional connectivity map) % to an atlas to help localize where the activity is. The table() method is one way to do this, % as it auto-labels regions using an atlas. Here, we w...
984767ffe45a49a870791650d73a183c79a0582e8b2b2f3d74d5d25ccb913f11
MATLAB
6,305
168
function ea_ants_run(cfg) % Proxy to run ANTs registration based on provided configurations % Make sure the transformation folder and output folder exist. ea_mkdir(fileparts(cfg.outputbase)); ea_mkdir(fileparts(cfg.outputimage)); ants_transforms = dir(fullfile(fileparts(cfg.outputbase), '*_desc-ants.*')); refinewarp...
1adeaf3ab17aa2be57ae7890c26839c72b6a60d50c063d8bc9e382c5cd093cf2
MATLAB
6,307
136
function [Obj, log] = SOFAexpand(Obj,VarName) %SOFAexpand % Obj = SOFAexpand(Obj) expands the singleton dimensions of all variables. % Only variables will be expanded. Data and attributes won't. Note that % also Obj.API.Dimensions will be updated to the new dimensions. % % Obj = SOFAexpand(Obj,VarName) ex...
e42b6726d78a88b56d5ec1ba82d248dcdfd85b73050daa8d1c7b9f385be2edee
MATLAB
6,308
183
function [cont,dirflag] = getContents(directory,varargin) %GETCONTENTS Get the contents of a specified directory % % This function returns the contents of a specified directory. % % CONT = IOSR.GENERAL.GETCONTENTS(DIRECTORY) returns the files and % folders in a directory and returns them to the cell array cont. I...
9866bb0c56a8db4b39226ae9be2c79b21e1d5fe883ece48fe7278fb54e591fb7
MATLAB
6,313
180
%% Use spike data clc close all; addpath(genpath('functions')) load([save_folder_name '\' file_name_spike '.mat'],'root') num_cells = length(root); num_points = length(root(1).ts); dt = root(1).ts(2)-root(1).ts(1); % unit: s %% Spatial rate map of the whole population positions_data = [root(1).x root(1).y] / 100; % ...
a97d7f46cf5dbfe0463d32032074f462d21a417fd671ec81c455dfff602f1ef2
MATLAB
6,318
251
function [pval table] = circ_hktest(alpha, idp, idq, inter, fn) % % [pval, stats] = circ_hktest(alpha, idp, idq, inter, fn) % Parametric two-way ANOVA for circular data with interations. % % Input: % alpha angles in radians % idp indicates the level of factor 1 (1:p) % idq indicates the level...
fa09045d6c4ee3e0d0b3c52bba8c1b87678ac0400f5ff21363631d8820381061
MATLAB
6,324
158
function p_10foldCV = CBIG_MMLDA_10foldCV_wrapper(out_dir) % p_10foldCV = CBIG_MMLDA_10foldCV_wrapper(out_dir) % % Wrapper function to do 10 fold cross validation. % % Input: % - out_dir : absolute path to the output directory % % Output: % - p_10foldCV: correlation p values used for FDR correction later % % Exam...
16ab0c87792dc831a4405d5e8f80f6998aa6c65d409755c13d71d68959ca20a1
MATLAB
6,325
146
function this = subsasgn(this, subs, A) % Subscript assignment for GIfTI objects %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: subsasgn.m 6513 2015-08-05 17:52:13Z guillaume $ switch subs(1).type c...
e5023022508bdd4a501598d842e57b6ff4fb6776e8228802f1b5abf4c2ca52ef
MATLAB
6,329
166
function varargout = ea_waveletfusion(varargin) % EA_WAVELETFUSION MATLAB code for ea_waveletfusion.fig % EA_WAVELETFUSION, by itself, creates a new EA_WAVELETFUSION or raises the existing % singleton*. % % H = EA_WAVELETFUSION returns the handle to a new EA_WAVELETFUSION or the handle to % the exis...
5190e4c2d9afa86c58be2e61900fc83ad440e393ec944d6732630459d3b130d6
MATLAB
6,334
167
%To combine vessel diameter along pericytes across animals stimAllTrials=[]; allnames={ 'Tser4954b_res_cfr.mat' 'Tser4954_res_cfr4.mat' %original _cfr was returning the same vessel measures as in 4954b; 'Tser5199_res_cfr.mat' 'Tser5072_res_cfr.mat' 'Tser5215_res_cfr.mat' }; groupname='stimAllTrials'; all_rr1a_micro...
9279fce3ff129c4203ed60d06c736e403c98d746408f980a9c58aa0e0d3a1ee0
MATLAB
6,336
238
function [arclen,seglen] = arclength(px,py,varargin) % arclength: compute arc length of a space curve, or any curve represented as a sequence of points % usage: [arclen,seglen] = arclength(px,py) % a 2-d curve % usage: [arclen,seglen] = arclength(px,py,pz) % a 3-d space curve % usage: [arclen,seglen] = arc...
a8a71241297804ea8dbe35d71e023482505ae0310282e34a86de2435bd38e173
MATLAB
6,337
184
function plugin = plugin_getweb(type, pluginOri, mode) if nargin < 1, help plugin_getweb; return; end; if nargin < 2, pluginOri = []; end; if nargin < 3, mode = 'merge'; end; % 'merge' or 'newlist' % convert plugin list format if necessary if isfield(pluginOri, 'plugin'), pluginOri = plugin_convert(pluginOri); end; ...
e4d7614f36d663000f6d4d7b9d89df84d4e0a1644d7ef05713880099223c032c
MATLAB
6,339
161
function DataSimulationFunction(ModelParams,SeqParams,SimParams) Sufix(1).name='BrainExtracted'; Sufix(2).name=''; savedata = 1; B0_dir=[0 0 1]; gyro = 42.57747892; modelname = SimParams.Output_dir ; for BackGroundFieldRemoval = [1 2] M0=load_nii(ModelParams.M0map_file); R1=load_nii(ModelParams.R...
07c3d92b51687e07e8f846ff4d407b24cf335296124089c99570b5787bbbd2fa
MATLAB
6,340
155
function [S_all, S_same, S_other, W_same, B_all, B_same, B_other] = segregation_by_type_eqcont(M, Ci, Ti, varargin) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % segregation_by_type_eqcont.m % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: % ...