sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b4041ca67b895640b9f743423c75fd4a217036a9f94f83b3dd301e1fa87d28bc
MATLAB
993
38
function self = downsampleSpiking(self,cel,f) % Randomly removes spikes to achieve a lower mean firing rate % % root = root.downsampleSpiking(cel, newMean) if ~exist('cel','var') if isempty(cel) cel = self.cel; end else self.cel = cel; end % duration of current epoch selection t = sum(diff(sel...
30b576588f355b69356b3c32d7275547acdc842795f35e0e54fd9b251d6d0e8e
MATLAB
994
34
function [ ints ] = MergeSeparatedInts( ints,minseparation ) %[ ints ] = MergeSeparatedInts( ints,minseparation ) merges close or %overlapping intervals with a minimum separation. % %INPUT % ints (n_ints x 2) matrix of interval start and end times % minseparation merge ints separated by less than or eq...
50705837c0b416900dd33da27de11d0fe5ac59fa0e658c3d8f8ae15dcc79cc06
MATLAB
995
42
%isstring - Test if parameter is an (admissible) character string. % % USAGE % % test = isstring(x,string1,string2,...) % % x item to test % string1... optional list of admissible strings % % SEE ALSO % % See also isdmatrix, isdvector, isdscalar, isimatrix, isivector, isiscalar. % % Copy...
543cc2e7aebec78a0228146c3c4a59c7082087caf59cdc75775bd5f37e0fa0fb
MATLAB
996
34
function line = UIAddLine(dir,varargin) %UIAddLine - Interactively add horizontal/vertical line to existing plot. % % USAGE % % line = UIAddLine(dir,<options>) % % dir 'v' for vertical, 'h' for horizontal % <options> options for function <a href="matlab:help plot">plot</a> % % NOTE % % Cl...
6eef6483bbc3cbd2a826d10f5e5a27618432434a1fe057bed86069bef8888d68
MATLAB
996
25
function ea_displayOptimResults(activ_profile_fig, symptom_profile_fig) %info1 = [ea_getearoot, 'ext_libs/OSS-DBS/OSSSettings_pt1.png']; %info2 = [ea_getearoot, 'ext_libs/OSS-DBS/OSSSettings_pt2.png']; if ispc winopen(activ_profile_fig); winopen(symptom_profile_fig); elseif ismac ...
23d6308eaa9d17687abe7a978326421b2cf1f1e610852ec91c54ae5f69fe6cae
MATLAB
997
25
function cvx_tic %CVX_TIC Resets the CVX timing functionality. % % CVX collects the following timing information: % --- Elapsed time since CVX_TIC was last called. If CVX_TIC was never % called, this measures the time since CVX was first initialized. % --- Elapsed time spent between top-level CVX_BEGIN an...
39e7d3011815034c4e1f07fdc9415a70f0049af9e274e6e507a5e1b42b636297
MATLAB
997
39
function lc=ea_initlcopts(varargin) % usage: ea_initlcopts([handletolcfig],[lc]) if nargin>1 lc=varargin{2}; else if isempty(varargin{1}) handles=lead_connectome; else handles=varargin{1}; end prefs = ea_prefs; lc.general.parcellation = prefs.lc.defaultParcellation; lc.graph...
47dc178a007da332d29d68089ac13956305d730a92e358345267e2dfa12f3df6
MATLAB
998
33
% Check conditions: fmridisplay_is_ok = true; if ~exist('o2', 'var') || ~isa(o2, 'fmridisplay') fmridisplay_is_ok = false; elseif length(o2.montage) < whmontage % wrong fmridisplay object for this plot fmridisplay_is_ok = false; elseif ~all(ishandle(o2.montage{whmontage}.axis_handles)) % Figur...
0f5391aca3383bf2b17a90a85c244f421359c7e685fa0922250bc1a12088eb89
MATLAB
1,000
24
function cvx_optval = norm_largest( x, k ) %NORM_LARGEST Sum of the k largest magnitudes of a vector. % NORM_LARGEST( X, k ) computes the 'largest-k' norm; that is, it computes % the sum of the magnitudes of the k largest elements in X. X must % be a vector, and k must be a real scalar. % % Disciplined convex ...
db944b2356ba3355d2cbbb4109025ea749c5ec75d730021aefff7766e19a4a22
MATLAB
1,000
38
% % gives you a matrix where % d( ix(i,j) , ix(ii,jj) ) = distance^2 between (i,j) & (ii,jj) % % cyclic_type % 1 => cyclic boundary rules % 2 => non-cyclic boundaries function d = simpledistance( dim , cyclic_type ) d = 0; ix = indexmatrix( dim ); N = prod( dim ); d = zeros( N , N ); for i=1:d...
df7e73ca4c813e7846575559813d4182f44e12c80f31c99041832bcc35905f41
MATLAB
1,000
29
% ENCODE serialize MATLAB data as a TOML string % % ENCODE(some_struct) returns the TOML representation of the data in % `some_struct`. % % See also TOML.DECODE, TOML.WRITE function toml_str = encode(m_strct) if isstruct(m_strct) if isscalar(m_strct) % order fields so nothing gets nested wrong ...
74a167e022188f74806f51b6d2bdfccec4454d044b4e024f7f97c1cde674fca3
MATLAB
1,001
29
function obj=set_title(obj,title,varargin) %set_title Add the specified title to the figure % % Example syntax: gramm_object.set_title('Title','FontSize',14) % % set_title takes as first argument the string to use for the % title, and cant receive optional 'Name',value pairs to % specify additional text properties of t...
af48acc0d2b7a3d4b2057966505ddecf429b7f3c2693c32f0267756267ccf00a
MATLAB
1,001
37
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%% CPC METACOGNITION TUTORIAL 2019: CALCULATE TYPE2ROC %%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Function to calculate the area under the type2 ROC curve %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
f92f0802036cb0fc2d33cdf204d30366a9adacb6062704379d1079afebe1851f
MATLAB
1,001
30
%%************************************************************************ %% HSDNTcorr: corrector step for the NT direction. %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%************************************************************************ f...
6945a731d54e49823f25d7a2727d56d114cf7a47375f14d444894a5b45320a13
MATLAB
1,003
36
function outpoints = tal2mni_brett(inpoints) % Converts coordinates to MNI brain best guess % from Talairach coordinates % FORMAT outpoints = tal2mni(inpoints) % Where inpoints is N by 3 or 3 by N matrix of coordinates % (N being the number of points) % outpoints is the coordinate matrix with MNI points % Matthew Bret...
efb607464c0e173ae641d6cec7682bf5b6cfd5818272bc96b6d2ee298fd02d0f
MATLAB
1,003
27
function ea_dbsegment_menu(handles) % Run DBSegment from Tools menu. bids = getappdata(handles.leadfigure, 'bids'); subjId = getappdata(handles.leadfigure, 'subjId'); if isempty(bids) || isempty(subjId) ea_cprintf('CmdWinWarnings', 'No patient selected!\n'); return; else subj = bids.getSubj(subjId{1}); ...
4935f003d476505850b24394a93fbe393c16db9e89bb8411d43a5df131f872bc
MATLAB
1,004
44
function [nch, npoints, freq, d] = ddt(filename) % ddt(filename) Read data from a .ddt file % % [nch, npoints, freq, d] = ddt(filename) % % INPUT: % filename - if empty string, will use File Open dialog % % OUTPUT: % nch - number of channels % npoints - number of data points for each channel % freq - A/D freque...
c3ff588854909686c11db2c7f8ddb93ad7d88ea81878f2bddb0ce7929e468467
MATLAB
1,004
43
function f=surfaceclean(f,v) % % f=surfaceclean(f,v) % % remove surface patches that are located inside % the bounding box faces % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2008/04/08 % % input: % v: surface node list, dimension (nn,3) % f: surface face element list, dimension (be,3...
36606b1a95c81e3d7645927e4cb8ab88e9451f9643f7eeedf608d25d790e3f19
MATLAB
1,005
52
function node_coord = gmsh_mesh2d_node_data_example ( node_num, node_dim ) %*****************************************************************************80 % %% GMSH_MESH2D_NODE_DATA_EXAMPLE returns the node information for the example. % % Licensing: % % This code is distributed under the GNU LGPL license. % % M...
6a4a4a778862e25a295efa16d611e06a4883ff136d47f1e053d99321ca44f662
MATLAB
1,005
33
function kap=kappa0(x,y,varargin) % Compute the constants for `tube-formula' based simultaneous % confidence bands. % % Works for regression models only. Density estimation problems % should be converted to counts, and use poisson regression % 'family','poisson'. % % Essentially, this is a front-end to locfit, and so ...
fe33179ff76bd5117c1faac903f73d0e76c09ba5257d916c02e861d7264ec972
MATLAB
1,005
26
function target = copyaxes(source) %COPYAXES Duplicate axes in a new figure. % COPYAXES(AX) makes a copy of the axes specified by the handle AX in a % new figure. The copied axes are identical to the original except that % their position is modified to fill the new parent figure. This can be % used t...
050c4a78444687b9e8bc2080e635c7fdc425470f7a32df12c690a3e4bb7cf27b
MATLAB
1,006
37
function binname=mcpath(fname) % % binname=mcpath(fname) % % get full executable path by prepending a command directory path % parameters: % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % fname: input, a file name string % % output: % binname: output, full file name located in the bin directory % % ...
4e1ea6d0c0c148099ad2b49b1d2d9e4e7564a94684e92873e9394294f7dd4ce1
MATLAB
1,006
45
function [ ] = sjMotif( genomeDir, sjIn, sjOut ) %sjMotif add splice junction motif as the last column % genomeDir: STAR genome directory % sjIn: splice junction loci file name (chr intron_strart intron_end) % sjOut: output file name %% load genome fin1=fopen([genomeDir '/chrName.txt']); chrName=textsca...
5524dc6f33817d5329211683e99866679a6536632e47a324dcf83ed60a69f7e6
MATLAB
1,006
34
function s = sem(x,varargin) %sem - Compute standard error of the mean (SEM). % % USAGE % % s = sem(x) % % x vector or matrix over which the SEM should be computed % dim dimension to run SEM across (default = 1) % Copyright (C) 2008-2013 by Michaël Zugaro % % This program is free sof...
01fd855065156c6f7793148358ad95c4d65ce790bd98a40fa4a1b493608ceb2b
MATLAB
1,007
23
function v = ea_unring(v,params) % unring - tool for removal of the Gibbs ringing artefact % Usage: outvol = unring(invol,params) % Options: invol - input volume % params - 3x1 array with [minW maxW nsh] % nsh discretization of subpixel spaceing (default 20) % minW lef...
356b2d11668e4506f17ec7377e1b4db557e390e039d93f794eff6a11296877f2
MATLAB
1,007
14
% Graph Laplacian eigenvalue optimization % <a href="http://stanford.edu/~boyd/cvx_opt_graph_lapl_eigs.html">Convex Optimization of Graph Laplacian Eigenvalues</a> % % larger_example.m - FDLA and FMMC solutions for a 50-node, 200-edge graph % cut_grid_example.m - FDLA and FMMC solutions for a 64-node, 95-edge cut-g...
84d7a3ebb13c3342bb2797d2885ae5b41dcdc6621dc97e56cc16a3c6cc37911a
MATLAB
1,009
26
% Local Estimation a spike firing rate (in spikes per unit time). % % The estimation procedure approximates the log of the spike firing % rate by a quadratic polynomial, within a sliding window. % % The first argument to locfit() is a column vector of the spike times. % 'family','rate' specifies that the output o...
030d86c83dccd1e1951409756933cc4128d63a6e50b178b26dfd65f47caf9d6a
MATLAB
1,010
37
%%******************************************************************* %% schurmat_lblk: compute A*D*A' %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%******************************************************************* function [schur,UU,EE] = schu...
ccfd11288a2b0acb41edcb3db7f9434beeb3e30389eda3ad5968e9a1fcf8776c
MATLAB
1,010
19
function fileList = getAllIntanFiles(dirName) dirData = dir(dirName); %# Get the data for the current directory dirIndex = [dirData.isdir]; %# Find the index for directories fileList = {dirData(~dirIndex).name}'; %'# Get a list of the files fileList=fileList(cellfun(@any,strfind(fileList,'.int')));...
f16302ab2341d49ce95ff1f797218f755b3ccf7751c2043d195273780a86e8c4
MATLAB
1,010
37
clear all cbmex('open'); cbmex('trialconfig',1,'absolute') samplingFreq = 30000; eventChannel = 1; contChannel = 1; EventLFPs = []; EventLFPTotal = []; contRange = -50:50; pause(0.5); while size(EventLFPTotal,1) < 500 [spikeData, procTime, contData] = cbmex('trialdata',1); %Example channel to choose for per...
f49cbc8fcf678c2f18b5c6e015fb148d68225f923614d7f4dbc0d41fb3357162
MATLAB
1,010
29
%% Figure 3 supp 1 YOURDATAPATH = ''; % Load ROIs and PETHs data fileList = searchFilesRecursive(YOURDATAPATH, 'allROIs.mat'); load(fullfile(fileList.folder, fileList.name)) load('allenDorsalMap.mat'); % Get modulation data areas = {'M2', 'M1', 'S1-fl', 'S1-hl', 'S1-tr'}; modField = 'modCue'; areaMods = getAreaModula...
2beed688d8f4b37c754ba6556d9fbb67d196cc3886d9332ff3a6b3d60021074a
MATLAB
1,011
44
function dataOUT = fun_normalize_psd(dataIN, freqs, lims, method) % Normalizes power spectral density estimates. % % Required input: % % dataIN: A frequency x channel array containing the PSD estimate % for each frequency bin from each channel % % freqs: A nx1 array indicating the frequency at each bin (each row of % d...
888d504c2a69161d830182e0bb69be9ca2e4c0d754159f31d336222c63549cfb
MATLAB
1,011
41
function [fname] = array2path(fnameArray,replaceString) % Recombines the strings stored in fnameArray % with the system appropriate % filesep symbol to generate a valid path. % % INPUT ARGS: % fnameArray - A cell array in which each cell holds the names of folders % and the last cell may hold a file name. % % OUT...
afa00f72dc4ba10840f66678680ddd13db8b3b689ac2ddf59e5d3b6be0589ed3
MATLAB
1,011
29
function y = sum_square( x, dim ) %SUM_SQUARE Sum of squares. % For vectors, SUM_SQUARE(X) is the sum of the squares of the elements of % the vector; i.e., SUM(X.^2). % % For matrices, SUM_SQUARE(X) is a row vector containing the application % of SUM_SQUARE to each column. For N-D arrays, the SUM_SQUARE oper...
0a876a9bb16caaa44c1c3cd5c9f9c91f672d306bb2f8d99868856d01b6b2798d
MATLAB
1,012
33
% Section 6.1.2: Residual minimization with deadzone penalty % Boyd & Vandenberghe "Convex Optimization" % Joelle Skaf - 08/17/05 % % The penalty function approximation problem has the form: % minimize sum(deadzone(Ax - b)) % where 'deadzone' is the deadzone penalty function % deadzone(y)...
a8640dfa009e3a18b92e0b493e603992dfdea36a67fffc487d104df253dd5c0d
MATLAB
1,012
33
function ea_unarchivefolder(options) % function to unarchive lead-dbs folders as lossless as possible. % unzip sourcedata: if exist([options.subj.sourcedataDir,'.zip'],'file') unzip([options.subj.sourcedataDir,'.zip'],fileparts(options.subj.sourcedataDir)) ea_delete([options.subj.sourcedataDir,'.zip']); end %...
fb73725257db753eef94bdb8738a18bad3dab05685d3f496fe065f4d034bdb7e
MATLAB
1,012
33
function obj=set_names(obj,varargin) % set_names Set names for aesthetics to be displayed in legends and axes % % Example syntax : gramm_object.set_names('x','Time (ms)','y','Hand position (mm)','color','Movement direction (°)','row','Subject') % Supported aesthetics: 'x' 'y' 'z' 'color' 'linestyle' 'size' % 'marker' '...
2ef9ac391407d73d1b48ca5c651529dc84f04ffa9322d7f813b1ae1a501bcd3a
MATLAB
1,013
26
% Model the success probability of successive trials of a monkey % performing a task. % % The 'y' variable is a vector of 0/1, with 1 denoting success on % the trial; 0 failure. The fitting procedure uses logistic % regression within sliding windows (specified by the 'family','binomial' % arguments). % % Choosing the b...
d3ed6e2c575edab8228518bb58f6c6c38d95c7691e36db97b90e1c5017c5f460
MATLAB
1,013
24
% std_plot() - This function is outdated. Use std_plottf() to plot time/ % frequency decompositions and function std_plotcurve() to % plot erp and spectrum. % Copyright (C) 2006 Arnaud Delorme % % This program is free software; you can redistribute it and/or modify % it under the terms of the...
92c2c2a7c29af988304e70e9c4ebfc03c1a31fcf4ad20a9b0cdb217195a4ed92
MATLAB
1,014
31
function data_out = Trinh_filterEEG(data_in,filter,freq) % filters data according to need, can be bandpass, noise, low or high % insert data from ft_processing % insert filter (bp,lp,hp) as string % insert freq in array [0.3 30] % trinh nov 22 if filter=='bp' cfg = []; cfg.bpfilter...
9cb890ebf5e51caa921497b411d1cda74e4c46e6d6ba7d150ce2e431ea6da7ad
MATLAB
1,015
28
% Local Regression and Likelihood, Figure 7.1. % % Estimating the hazard rate for censored survival (or % failure time) data. Hazard rate estimation is specified % by 'family','hazard'. % % The censoring indicator variable is passed as the 'cens' % argument. This should be a vector of 0's and 1's, with 1 % indicating a...
0b55be8efd8a01072f31dd9dd8dd1c1ec09bb1505ea5130ecc90003a0d1a7b84
MATLAB
1,016
32
function ea_archivefolder(options) % function to archive lead-dbs folders as lossless as possible to save % storage space. % zip sourcedata: if ~exist([options.subj.sourcedataDir,'.zip'],'file') try zip([options.subj.sourcedataDir,'.zip'],options.subj.sourcedataDir); end ea_delete(options.subj.sourcedataDir); ...
66fafb269073cb9f0e6f0c24b95d49a3935bdbc7bc55358877a2c180008ddb4b
MATLAB
1,016
31
function expressions( varargin ) %EXPRESSIONS Declares one or more CVX expression holders. % EXPRESSIONS x1 x2 x3 ..., where x1, x2, x3, etc. are valid % variable names, declares multiple cvx expression holders. It is % exactly equivalent to issuing a separate EXPRESSION command % for each x1, x2, x3, ... % ...
ae5ddd889779674db0ac2f9272dd30f3c9b4e68363cb14839edf70f52d73af68
MATLAB
1,016
27
function z = uminus( x ) % Disciplined convex programming information for UMINUS (-): % Unary minus may be used in DCPs without restrictions---with the % understanding, of course, that it produces a result with the % opposite cuvature to its argument; i.e., the negative of a convex % expression ...
b37af1aee8e10d971883d555d1f10957dedd9794568263277d6ff9dabaa9a433
MATLAB
1,016
33
function initialise(fa) % Initialise file on disk % % This creates a file on disk with the appropriate size by explicitly % writing data to prevent a sparse file. %__________________________________________________________________________ % Copyright (C) 2013 Wellcome Trust Centre for Neuroimaging % % $Id: initialise....
bb27ec971ba0e19036cd1b110389d3538ad59abf49c6fe1775ea0a118d2f5f91
MATLAB
1,016
38
% Section 8.1.1: Separating a point from a polyhedron % Boyd & Vandenberghe "Convex Optimization" % Joelle Skaf - 10/09/05 % % The goal is to produce a hyperplane separating x0 and the polyhedron % defined as {x | Ax <= b} % minimize mu'*x0 - b'*lambda % A'*lambda = mu % ...
690e00143760c697932e446fbbdaa0d840fa3aa480f9c7ba0cb988b584d820d8
MATLAB
1,017
42
%isstring_FMAT - Test if parameter is an (admissible) character string. % % USAGE % % test = isstring_FMAT(x,string1,string2,...) % % x item to test % string1... optional list of admissible strings % % SEE ALSO % % See also isdmatrix, isdvector, isdscalar, isimatrix, isivector, isiscalar....
ce1252a94e049b9307319683311f4b8686bcf06901cd2f1630718fb874823b99
MATLAB
1,017
27
function A = read_raw_file(filename,framenum,window,FOV,bitsize) %% Starting from frame number: 'framenum', read 'window' fid = fopen(filename); imsize = FOV(1)*FOV(2)*bitsize; % Bit size of single frame current_seek = ftell(fid); fseek(fid, 0, 1); file_length = ftell...
7ee6d4209be20200e97df667b83730138e71bbdd53aa4448c2c7a4c6e52e54c8
MATLAB
1,018
46
function [A,xy]= cut_grid_data % Generate a cut-grid graph for the ICM 2006 talk example % % The graph has 64 nodes and 95 edges % A is an n x m incidence matrix (n is number of nodes, m is number of edges) % xy is the location data % % Original code by Arpita Ghosh, modified for ICM06 talk by Almir Mutapcic n = 8; ...
58068179c2288e1828e1d4b4fe35c02cf5b4f94d0d1b6d97896b0ba0d8524a89
MATLAB
1,019
29
function obj = set_line_options( obj , varargin ) % set_line_options Set line size and style options % % 'name',value pairs: % 'base_size': Default/starting line width for geoms that take in account size % aesthetics. Default is 1.5 % 'step_size': Increment in line width for 'size' categories. Default is 1 % 'use_input...
9d3d0b6c0c70a12ec947bf13d4db96520c4bbf570b7b1072e1aa18201572b347
MATLAB
1,019
37
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%% CPC METACOGNITION TUTORIAL 2019: CALCULATE TYPE2ROC %%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Function to calculate the area under the type2 ROC curve %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
9fdfef085397545118c6bd522ef673b9499221c819aba504c45d8a2e16dcf80a
MATLAB
1,019
35
function [ops, mean_cor] = reg_iterative(data, ops) fracImgPreAlign = getOr(ops, 'fracImgPreAlign', 1/2); maxImgPreAlign = round(size(data,3) * fracImgPreAlign); ops.mimg = pick_reg_init(data); dsold = zeros(size(data,3), 2); err = zeros(ops.NiterPrealign, 1); %% tempSubPixel = ops.SubPixel; ops.SubPixel = Inf; for ...
159997e2bc5161357ed05aeef2fd532184d77e192d8a44c3c7edcdebb7e4517d
MATLAB
1,020
32
function ea_precoreg(anchorImage, templateModality, preCoregImage, preCoregTransform) % Pre-coregister pre-op anchor image to template (without reslicing). % Make dirs ea_mkdir(fileparts(preCoregImage)); ea_mkdir(fileparts(preCoregTransform)); % Copy anchor image to pre-coregistered image and leave anchor image untou...
26e30fb5e524a0de1e4de5c6de1d4673f3559c01cc88bd6dc56dd4e621a2e0d6
MATLAB
1,021
38
function [y,arc]=myarfilt(x,ord) % Usage ... [y,arcoeffs]=myarfilt(x,order) if prod(size(x))>length(x), for nn=1:size(x,2), arc(nn,:)=aryule(x(:,nn)-mean(x(:,nn)),ord); y(:,nn)=filter(arc(nn,:),1,x(:,nn)-mean(x(:,nn))); end; else, x=x(:); arc=aryule(x-mean(x),ord); y=filter(arc,1,x-mean(x)...
6e105b563af137b7519d9515c1046c8288e10d675e6660138fc04a2a726643aa
MATLAB
1,021
33
function data = data_WT_raw() % TOTAL NSC COUNTS (FACS) data.NSC.times = [60 210 660]; data.NSC.raw = { % 60 days [768, 919, 813, 670, 839, 704, ... 764, 755.5, 1254.5, 845.5, 708, 1221, 804, 699, 660, ... 1108.5, 788, 607.5, 659, 861, 666], % 210 days ...
323cb0bb9d39cedbb3809dfa3db9ef2d8b6a2e13e14d1d62d9b20abad977250a
MATLAB
1,022
23
function J=mtfftc(data,tapers,nfft,Fs) % Multi-taper fourier transform - continuous data % % Usage: % J=mtfftc(data,tapers,nfft,Fs) - all arguments required % Input: % data (in form samples x channels/trials or a single vector) % tapers (precalculated tapers from dpss) % nfft (length of padded data...
82e1512d649583247b23b9e1b18d3794eef5bd333fda6127f9d29d282a72255f
MATLAB
1,022
41
function [] = plx_ad_info(filename) % plx_ad_info(filename): prints .plx file a/d channel info % % plx_ad_info(filename) % % INPUT: % filename - .plx file name. Will use file open dialog if filename is empty string % % OUTPUT: % (none) if nargin ~= 1 error 'expected 1 input argument'; end [ fil...
8b3be38d94106fa010a851d97de6541375eadc0a2eca4f99bb030435b250007f
MATLAB
1,022
18
function ModelParams = Anisotropy(ModelParams, AnisotropyFlag) % Check if AnisotropyFlag is true or false if AnisotropyFlag disp('Simulating GRE data with anisotropy'); ModelParams.Chimap_file = 'data/chimodel/Chi_with_anisotropy.nii.gz'; ModelParams.Chiposmap_file = 'data/chimodel/...
8fc5c3d68eff9fb8c5d6d7ecede0df42489086bff6e413d20075ed79d108742e
MATLAB
1,022
43
function [node,elem,edges,edgemap]=readgts(fname) % % [node,elem,edges,edgemap]=readgts(fname) % % read GNU Triangulated Surface files (GTS) % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2008/03/28 % % input: % fname: name of the OFF data file % % output: % node: node coordinates of the mesh % elem: l...
00518d44b52cf279361f6ab04f3da3d5cd0ed70fda01b1f3f94d627e76e8dd27
MATLAB
1,023
27
%% Example 3 for utilizing the LDA model % This example shows how to order topics according to co-usage in documents % This will an ordering over topics where topics that co-appear often with % other topics in documents to have similar indices. % % This examples uses the OrderTopics function. In this procedure, fo...
17bcab70ec063ef34dab96fb1c08aa6c61e78b0a16e5db90847f1e7a72405d81
MATLAB
1,024
34
function vw = close(vw) %VW=CLOSE(VW) % Closes video VW and releases any system resources necessary to access it % (e.g. threads, file handles, etc.). Do NOT just clear a videoWriter % object without first closing its handle: % % % BAD code--typically will leak system resources % vw = videoWriter(...);...
1a53cf4c459a698a96a0ef0793935c14160e2d7b341c97edce109863db8b249f
MATLAB
1,024
32
function [ ] = set_alpha(input_handle,line_alpha,point_alpha) persistent old_matlab if isempty(old_matlab) old_matlab=verLessThan('matlab','8.4.0'); end if ~old_matlab %Works for continuous color points made with scatter, but alpha goes %back to 1 when CLimMode is set to manual in draw(), line 835 if...
2230015e334cc6e0c7b74cd8dda8890ad3741332f425cecf33bf3997425a2479
MATLAB
1,024
28
function obj3 = bsxfun(f, obj1, obj2) if isa(obj2, 'mmo'), error('bsxfun does not work yet with the second argument being a memory mapped object'); end; data1 = memmapfile(obj1.dataFile, 'writable', obj1.writable, 'format', { 'single' obj1.dimensions 'x' }); data2 = obj2; % make new memory mapped data...
a8aef9295ef1155be1400aa625343eb47e1d14f87ac452094c7190c1e59dc2dd
MATLAB
1,024
28
function y = sum_square_pos( x, dim ) %SUM_SQUARE_POS Sum of squares of the positive parts. % For vectors, SUM_SQUARE(X) is the sum of the squares of the positive % parts of X; i.e., SUM( MAX(X,0)^2 ). X must be real. % % For matrices, SUM_SQUARE_POS(X) is a row vector containing the % application of SUM_SQU...
c56c8b8dfeee3c90a4114522d4d9f69b56964c8f99e3a058873c27e78e45fc97
MATLAB
1,024
52
function MIhat = MutualInfo(L1,L2) % mutual information %=========== L1 = L1(:); L2 = L2(:); if size(L1) ~= size(L2) error('size(L1) must == size(L2)'); end Label = unique(L1); nClass = length(Label); Label2 = unique(L2); nClass2 = length(Label2); if nClass2 < nClass % smooth L1 = [L1; Label]; ...
e5861e79575e8602983553d4059a9826aa5cff13daa2eb173b17e432c637d943
MATLAB
1,024
32
function CleanBatches %CleanBatches - Delete completed batch jobs from memory. % % Batches cannot be removed from memory using 'clear' (they are based on Matlab % timers, which are kept in memory even after the variables are cleared). This % function will take the appropriate steps. % % This will not affect pending or...
f8642bfa1c698b01078ca16f8bdad0f3bf26a773856c784bb04b3c30a7c8aa70
MATLAB
1,024
21
function SJ = buildPathAdjJacobian(nirs_model, epsilon_mm_uM, brain_nodes_idx) %BUILD_SPECTRAL_JACOBIAN Compute spectral Jacobians and pathlengths. % SJ = BUILD_SPECTRAL_JACOBIAN(nirs_model, epsilon_mm_uM, brain_nodes_idx) % % Output struct SJ % .J_chrom : (2*nCh)×(2*nV) chromophore Jacobian % .J...
1f3105f36f87800d5b3ca8ed45085e336babe8fa7fba98ba6b138ad8031765e2
MATLAB
1,025
26
function ClincFreq_Norm2MNI_CT_clinc(indat,inroi,outdir,outname,voxelsize,pth) %% Need to rebuild [patdat,namdat,extdat] = fileparts(indat); % [patroi,namroi,extroi] = fileparts(inroi); load([pth,filesep,'norm2ct.mat']); % load([pth,filesep,'Norm2CT_est.mat']); pathspm = which('spm.m'); [patspm,namspm,extspm] = filepa...
514fdc285064ef6efbb73f8ee9dbaafc58bc9c6b453fa2419436ded53107cc7d
MATLAB
1,025
38
%% scatterSpheres - plot scattered points % % Andreas Husch % Centre Hospitalier de Luxembourg, Dep. of Neurosurgery / % University of Luxembourg - Luxembourg Centre for Systems Biomedicine % 2014 - 2017 % mail@andreashusch.de, husch.andreas@chl.lu function h = scatterMatrix3(pointcloud, options, varargin) fixedA...
fec5356a6c2d5bf8f40aeeb68f4faf90569481814299d27a1bb4b45f5ecae887
MATLAB
1,025
33
function [List,ListSize,ListDate] = LeG_findSubFiles(RootDir,SearchStr) % Searching RootDir % h = waitbar(0,'Searching...'); a = cell2mat(cellfun(@genpath,{RootDir},'uniformoutput',false)); if regexpi(computer,'win') b = regexp(a,';','split'); else b = regexp(a,':','split'); end List = {}; ListSize ...
162d25138f6b725f29d0eb5df0cf65b70f5230f7355dbf7feb8331a00ff3777e
MATLAB
1,026
34
% this function creates the weight matrix for making edge weights % and saves some other constants (like node-in-lattice index) to a 'frame' % used when the graphs are made from saliency/feature maps. % % edge types (by default, instantiate fully connected graph. % use inter/intra-type = 1 to connect only to neares...
9a002dd825823323b03bd9aa2b5ec1b30ed2f23f429f358702c48c5301ecb59f
MATLAB
1,026
33
function [vals,p_vals] = ea_discfibers_TwoSample_weightedLinearRegression(activ_prob, outcome, output_stat) % by Till Dembek, publication TBA % Warning: this metric takes time to be calculated outcome_over_fibers = repmat(outcome,[1,size(activ_prob,2)]); vals = zeros(size(activ_prob,2),1); p_vals = zeros(size...
e6cc27ae97f74695daa86a057ceab3e108a41e2345131647f9cfc3e66cc4189d
MATLAB
1,026
31
folderpathP = strcat(writeFolder,'/'); mainfolder = strcat('/home/yh19218/Code_IF_2020/Results/Results_Main_new/',foldername); folderpathP1 = string([mainfolder '/1_PhaseConn']); folderpathP2 = string([mainfolder '/2_PowerConn']); folderpathP3 = string([mainfolder '/3_PhaseCoup']); folderpathP4 = string([mainfolder '/...
4e7b6289ec0e000d3ad3069ec1839d269eb3dd8875290338c793199e3215c87c
MATLAB
1,027
22
function [phi_new] = wave_eq_2D(phi,input,gamma) %WAVE_EQ Simulate the wave equation of model using finite difference scheme % Wave equation can be written as: % phi_n % + (2/gamma)*(phi_(n+1)-phi_(n-1))/(2*dt) % + (1/gamma^2)*(phi_(n+1)+phi_(n-1)-2*phi_n)/(dt^2) % = input = r^2*Lapl...
5fad4f1fcf899357cccc61dfded5748a1d1236702627073213088302aa3f9723
MATLAB
1,028
47
function callbackexample() % Copyright 2009-2013 The MathWorks, Inc. % Create application data colorNames = { 'Red' 'Orange' 'Yellow' 'Green' 'Blue' 'Indigo' 'Violet' }; colorValues = [ 1.0 0.2 0.2 1.0 0.6 0.2 1.0 1.0 0.4 0.6 1.0 0.6 0.2 0.4 1.0 0.4 0.1 0.6 ...
f23cfb5e465913b8b67dbca8c30c04cda74cf3bf68ac3d5a985e74db8953a8fc
MATLAB
1,028
51
function [samples] = mf_sample(mu) kappa = eps+sqrt(sum(mu.^2)); mu = mu./ repmat(kappa,[size(mu,1) 1]); kappa = kappa(:)'; kappa(kappa>200) = 200; d = size(mu,1); n = size(mu,2); iso = kappa < (d-1)/2; kappa(iso) = (d-1)/2; b = (d-1)./( 2*kappa + sqrt((4*kappa.^2 - (d-1)^2))); x0 = (1 - b)./(1 + b); c = kap...
6b3bfd71199f8d401d74939b9fb14a08bb4951786d51ea40d213052d29edf37e
MATLAB
1,029
19
% ------------------------------------------------------------------------- % SUBFUNCTION which selects the appropriate artifact detection method based % on the selected config options % ------------------------------------------------------------------------- function [ autoart ] = artifact_detect(cfgT, data_in) ...
decda437809d5b5a4dacc33bbd36e9d421196b0d1d1750071e714c143c436823
MATLAB
1,029
39
function [widths,lefts,rights] = halfheightWidths(alldata,frames,dataname) % Half-height widths widths = []; lefts = []; rights = []; for f = frames for d = 1:length(alldata) % Left side data = alldata(d).gaussianfluor(f,1:8); % First, shift so peak falls at column 4 [m,i...
e3177204c8a3dfcd04982dc856f04e3419873160edfada6246229b70609eacf2
MATLAB
1,031
28
% warndlg2() - same as warndlg for eeglab() % % Author: Arnaud Delorme, CNL / Salk Institute, 12 August 2002 % % See also: inputdlg2(), questdlg2() % Copyright (C) Arnaud Delorme, CNL / Salk Institute, arno@salk.edu % % This program is free software; you can redistribute it and/or modify % it under the terms of the GN...
512293b70255b81466f26bd26f83ff4e4bfd0493fe85d657aa99d613d6d97f06
MATLAB
1,032
29
function X = calculate_X(Tlist,hyper_params) % Calculate covariate bases at the time of presynaptic spike. % % INPUT % Tlist = pre (Tlist{1}) and post (Tlist{2}) synaptic spike times (s) % hyper_params.XTimeSpan = number of seconds with which to divide session % % OUTPUT % X = covariate matrix in basis space (rows = ...
762f94c078f64f111b92a5686e0c4153c0a4509bb2bf064046db4496269b81b1
MATLAB
1,032
33
function [xx_s,xx_f,yy_s,yy_f,zz_s,zz_f,xx_us,xx_uf,yy_us,yy_uf,zz_us,zz_uf] = construct_grid(grid_size,mot_uf,d1,d2,d3,min_patch_size) xx_s = 1:grid_size(1):d1; yy_s = 1:grid_size(2):d2; zz_s = 1:grid_size(3):d3; xx_f = [xx_s(2:end)-1,d1]; yy_f = [yy_s(2:end)-1,d2]; zz_f = [zz_s(2:end)-1,d3]; if xx_f(end)-xx_s(end)...
b6a2a85c0a8d8572cd07fb796a215e926db3156a9871b7eba9ae499b5a43bf20
MATLAB
1,032
43
function [vals inds] = minMag(x,dim) % utility to find value closest to zero % function vals = minMag(x,[dim]) % eln 101104 if isempty(x) vals = []; inds = []; return; end if exist('dim','var') [~,inds] = min(abs(x),[],dim); if isvector(inds) siz = size(x); siz2 = siz; siz2(dim) = []; inds2 =...
702a84f6b22bd3e6312eba03d4a8549cc788b73b7442c13db5b4092fdd1a5b09
MATLAB
1,033
31
function movF = MovGaussFilter(mov, G, subsample) % filtered % G = fspecial('gaussian',[4 4],2); datatype = class(mov); if strcmp(datatype, 'uint8') if subsample == 0 movF = zeros(size(mov), 'uint8'); for f=1:size(mov,3) movF(:,:,f) = uint8(imfilter(mov(:,:,f),G,'same')); end ...
9678204046c0b895ddb7eba426f8fe68759f6b8ad5cb01bdfd4c88e082577ded
MATLAB
1,033
35
%% Joint Entropy Demo 1 % This demo goes through calculating the joint entropy for 3 discrete time % series. % Data Type: Discrete % Number of Variables: 3 % Information Analysis: Joint Entropy % Trial Based or Single Trial: Single Trial % Significance Testing: N/A % Delays: Off % Generate the data nData = 100; data...
df4f2c1c750ee2ca40aaef7a72bf127ce2e4a16d3df0d7a0000ebb10abf9613d
MATLAB
1,033
37
function plotsig(C,sig,t,f,c) % Function to plot C where it is higher than a threshold sig % useful for plotting coherence % Usage: plotsig(C,sig,t,f) % Inputs: % C: input array t x f - also works for a single vector % sig: significance level % t: t axis grid for plot % f: f axis grid for plot. % c: color to use (defau...
9565ea8f6747657c84ede81a02dfb554fcfa855d85ca9e1edaded586e35a03fd
MATLAB
1,034
44
function formatsvnrevision(v1, v2) disp('Getting revision information...'); system(sprintf('svn log --verbose -r%d:%d > tmprev.txt', v1, v2)); oldpwd = pwd; newpwd = fileparts(which('eeglab.m')); cd(newpwd); fid = fopen('tmprev.txt', 'r'); state = 1; while ~feof(fid) txt = fgetl(fid); if length(txt) > 4 && ...
d3368a3b600d6579e15324f8840ca01a51edac12b331edb0a0078cdd730fe2f8
MATLAB
1,034
22
function tifFileList = FISSAoutput2tifFileList(FISSAoutput,tifFileList,fissaScaleFactor) tifListFields = fieldnames(tifFileList); for k = 1:length(tifListFields) if ~isempty(tifFileList.(tifListFields{k})) %get first row from each trial in FISSAoutput for each cell %first row corresponds to...
0da351eed3512327d5a2eba4087593ebbf80416bf64a1fad38f6321f92166292
MATLAB
1,035
35
function varargout = size( x, dim ) % Disciplined convex/geometric programming information for SIZE: % SIZE imposes no convexity restrictions on its first argument. % The second argument, if supplied, must be a positive integer. s = x.size_; if nargin > 1, if nargout > 1, error( 'Too many ou...
47d63026b4846e202d17a7b26884d0794eaf908033c0d8500f716d2304819ded
MATLAB
1,035
33
function rid_time_score = CBIG_compute_time(q, q_full) % rid_time_score = CBIG_compute_time(q, q_full) % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ridList_q_full = cell2mat(q_full(:, 1)); ind_sc_bl = ismember(q_full(:, 2), 'sc'); if sum(ind_sc_bl) == 0 % bl conv...
b260cf4feb78c1c2309fb1614eebc2094175d570241d8d69dce16c203ed0e97a
MATLAB
1,035
29
function cvx_optval = log_prod( X, dim ) %LOG_PROD Logarithm of the product of a vector. % For a vector X, LOG_PROD(X) returns % LOG(PROD(X)) % if all of the elements of X are positive, and -Inf otherwise. Note that % LOG(PROD(X)) = SUM(LOG(X)), % so this is simply a synonym for SUM_LOG(X). % % F...
008f659891e76f728ebc368be0c88daef607b9281886385b0f1a55dc19519ae2
MATLAB
1,036
30
function ea_Cmap(varargin) % creates a map both connected and correlated ("combined" map in Horn % 2017 AoN). % ea_Cmap(fis,regressor,outputname,mask,sk,corrtype) % sk can be 'k','s','sk' % for smoothing and normalization options. Mask only necessary if % choosing 'k' option. regressor=...
0ac37d41ead9b4f15e0957dd9a9eac6f1294b61cb6af30e92d61b76531b5002f
MATLAB
1,037
44
%minmax - Show min and max values for any number of variables. % % USAGE % % minmax(x,y,...) % % x,y,... variables % % Copyright (C) 2012 by Michaël Zugaro % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the...
e14b8e2ffaa6dc1487be7b6f590e2d9598ca0bcd0d131e86e753dd796cb30df8
MATLAB
1,037
24
function [extrema,inds] = minmax(X) %MINMAX Simultaneous overall smallest and largest components. % Y = MINMAX(X) returns the minimum and maximum values, of the array X % such that Y(1) = MIN(X) and Y(2) = MAX(X). For N-D arrays X, % MINMAX(X) is equivalent to MINMAX(X(:)). % % [Y,I] = MINMAX(X) als...
e2320bbe78f0759809be522cfa5d5cffc976058c07653ca4e349a7773a641cb3
MATLAB
1,037
28
% Example 8.7: Floorplan generation test script % Section 8.8.1/2, Boyd & Vandenberghe "Convex Optimization" % Joelle Skaf 12/04/05 % % Rectangles aligned with the axes need to be place in the smallest % possible bounding box. No overlap is allowed. Each rectangle to be placed % can be reconfigured, within some limits....
24594866521453c03ad3d92fa9124ed0efb4f5aeafce498f0368b5b96d79bcab
MATLAB
1,038
25
function [bgCorrected] = backgroundSubtract(ROInames,fluordata) % First, run combineFluordata() if necessary. This function assumes that % in the data it is working on, the second ROI is the background. It also % assumes that the data are raw values and NOT dF/F. dF/F is not useful % here, because background with o...
86dcf2cc51cfc4951e7464c72ce964b83907c429ac17e131107b5581f0285eff
MATLAB
1,038
36
function tf = cvx_use_sparse( sz, nz, isr ) %CVX_USE_SPARSE Sparse/dense matrix efficiency test. % CVX_USE_SPARSE(SZ,NZ,ISR) is an internal function used by CVX to determine % if a matrix of size SZ with NZ nonzeros would require less memory to store % in sparse form or dense form. The matrix is assumed...
96fffd0c82f249ab79c1aad4b4d0a356e6173d083e7d32463b7acbec112e3c89
MATLAB
1,038
30
function CFA_ReOrient_Single(Imagedir,ROIdir) coivox = ones(4,1); %center of intensity % hdr = spm_vol([Imagedir,',1']); %load header % img = spm_read_vols(hdr); %load image data [hdr,imgr] = Dynamic_read_dir_NIFTI(Imagedir); img = reshape(imgr,hdr.dim); img = img - min(img(:)); img(isnan(img)) = 0; sumTotal = sum(img...
9ff1ff4528a47b5e649ee55df0701c978a26bde4ce7a1465763208e6b7bc9e62
MATLAB
1,038
26
% Model the success probability of successive trials of a monkey % performing a task. % % The 'y' variable is a vector of 0/1, with 1 denoting success on % the trial; 0 failure. The fitting procedure uses logistic % regression within sliding windows (specified by the 'family','binomial' % arguments). % % Choosi...
cd01b4300a7a2addb7eceb5e1f1bfb4a5d650b7f6e032eb636dac572628653a1
MATLAB
1,038
46
function BaslerTrackPerFrame(movname) % % tspdata=load([fbasename '.tsp']); % tspdata = tspdata(:,1); % % if size(tspdata,2)>1 % warning('tsp has data in it! Are You sure you want to continue?') % % keyboard % end % % nFramesTsp = size(tspdata,1); % tspnew = [tspdata -1*ones(size(tspdata,1),6)]; ...
176bb2792591fe1a90885399577ed451f33fac10aaab83382679a77d0d558b4c
MATLAB
1,039
44
function [ xR, x ] = cvx_bcompress( x, mode, num_sorted ) narginchk(1,3); if nargin < 3 || isempty( num_sorted ), num_sorted = 0; end if nargin < 2 || isempty( mode ), mode = 0; else switch mode, case 'full', mode = 0; case 'magnitude', mode = 1; case 'none', mode = 2; ...