sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8d88533d921b96418ffc8dcc79840f1ea96aa265acaad80bb8b747d4bf661b9e
MATLAB
1,455
38
function [strucMatrix_ctx, strucLabels_ctx, strucMatrix_sctx, strucLabels_sctx] = load_sc(parcellation) % % Usage: % [strucMatrix_ctx, strucLabels_ctx, strucMatrix_sctx, strucLabels_sctx] = load_fc(parcellation) % % Description: % Load structural connectivity data (author: @saratheriver) % % Inputs: % parcellati...
e4a2e366e983df4118fe586e33629979a5460fdebf6854af6e826a6027f418f0
MATLAB
1,455
40
function [ params ] = data_analyze( e,s,b,TYPE ) %DATA_ANALYZE Summary of this function goes here % Detailed explanation goes here globalsConditions; close all; optionsMinsearch = optimset('MaxFunEvals',50000, 'MaxIter',50000, 'TolFun',1e-12, 'TolX',1e-12); pInit = [0 0.5]; pLow = [-360 -1]; pHigh = [360 2]; angle = ...
fd885b4977cc600fba4c906f2ef6f0398738b09135c8846b507f76309c89351c
MATLAB
1,455
42
function plotAllTraces(data,typerange,figtitle,Ylimits,colorset) % This takes the dF/F calculated data from calc_dFF() and plots the mean % (bold) and the individual traces (thin dashed lines) for each trial type % in the dataset. figtitle should reflect the dataset you're plotting. % typerange is the range of tr...
672fa65e0a650e5b16a632eaf92319ba3157332754adcb46329bb32e867b2753
MATLAB
1,456
43
function tree = flush(tree,uid) % XMLTREE/FLUSH Flush (Clear a subtree given its UID) % % tree - XMLTree object % uid - array of UID's of subtrees to be cleared % Default is root %__________________________________________________________________________ % % Clear a subtree given its UID...
718ca3f5a2e1526c1779edd716da8c8cf308c9bc109bde67aa8f920f67c22105
MATLAB
1,456
55
function [infoEPI,infoMag1,infoMag2,infoPh] = Read_JsonHeader(p,subnr,sessnr,scannr) %% Retrieve file names from sessions folder % FieldMaps fname = cell(0,0); d = dir(char(fullfile(p.sessionDIR,p.sessNames{sessnr,subnr}))); listname = {d(~startsWith({d.name}, '.')).name}; [~,idx] = find(contains(listname,'gre_field')...
7be008a9743dabd4838d655069f69f5a3bbf07fa226e089f4610980456d27195
MATLAB
1,457
46
function [ElecType,ElecIdxLin] = LeG_calcGrayWhite(app,ElecFullIdx) %Calculates gray/white class for an electrode given the index location %"ElecFullIdx". ElecFullIdx is a matrix of index values specifying the %volume of the electrode. % %Tyler Davis %20190629 Thresh = app.graywhite.threshold; %0.1 DefaultT...
c0965fd52f74581e23ae4cc078fa79dcdffa5b2f1ecd1ab3341816d617075979
MATLAB
1,457
51
function Rdosl_exact = cal_RATIO_dosl_exact(R1a, R2a, R1b, MPF, R, T2b, T1d, dw, w1) M0b = MPF; M0a = 1-M0b; fb = M0b/M0a; kba = R*M0a; kab = kba*fb; D = 1/sqrt(15)/T2b; N_scale = 5; R1rho = zeros(2,2); for i = 1:2 if i == 1 curr_dw = dw; ...
ed8eee185e1f9c6beb9ca1c4c84bab18a84fc60b8c367e7ecd9fdbb9c52f75d3
MATLAB
1,458
46
function S = LeG_removeSubSurf(S) %method to remove small surfaces enclosed within a main surrounding %surface % %20210206 %TD sv = S.vertices; sf = S.faces; minpts = size(sv,2)+1; pd = pdist2(sv,sv,'euclidean','smallest',minpts+1); epsln = ceil(prctile(pd(end,:),99)); idx = dbscan(sv,epsln,minpts); ...
0dbe464b20a47ed303d33c457a5a1d230ecbd8322758d87a6cc5a905263b937a
MATLAB
1,459
59
function [ s,b ] = anglereg( x, theta, tolerance, maxiter ) % ANGLEREG - Linear-circular regression % Performes a linear-circular regression (Kempter et al, 2012) % % [ S,B ] = ANGLEREG(X,THETA) % [ S,B ] = ANGLEREG(X,THETA,TOLERANCE) % [ S,B ] = ANGLEREG(X,THETA,TOLERANCE,MAXITER) % % ARGUMENTS % * X: A ve...
458a58031161337aa8686464086ea3fbcd0764be45f23bb33c344e398b619a92
MATLAB
1,459
44
%%******************************************************************* %% HSDNTdirfun: compute (dX,dZ), given dy, 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 %%******************************************************************...
7199a5efcea1375e42a3b3bae754f78694bfa85c90c52b05e7ff295f5d60eb76
MATLAB
1,459
51
function p = PlotHVLines(positions,direction,varargin) %PlotHVLines - Plot vertical (resp. horizontal) lines at listed x (resp. y). % % USAGE % % p = PlotHVLines(positions,direction,options) % % positions list of abscissae/ordinates % direction optional direction: 'h' or 'v' (default = 'v') % <o...
736e49af8b36a3d7c487325b65b52206fa9175bfbd5d73e5c83de23eac021abf
MATLAB
1,459
61
function [res, errStr]= dtdstruct_write(dtdStruct, fileName) % % function [res, errStr]= dtdstruct_write(dtdStruct, fileName) % % writes a dtdStruct to the harddisk % % dtdStruct: should contain a valid dtdStruct % fileName: should contain the path and file name. if it is empty or undefined, a file selection di...
89821766bdd54d2c46ee9cf3a32b665e1c602455ae046f36d3137c97f56290b5
MATLAB
1,459
55
% Example 6.2: Robust regression using the Huber penalty % Section 6.1.2, Figure 6.5 % Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX by Joelle Skaf - 09/07/05 % % Compares the solution of regular Least-squares: % minimize sum(y_i - alpha - beta*t_i)^2 % to th...
b159bc078259607836a43281d2ab7378e6c425b2109e52311e69456b9d44beaf
MATLAB
1,459
34
% SOFA API - demo script % load headphone IRs from a SOFA file from the ARI headphones database % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUP...
e3af7a9001a1de26d39c676c899c08d4709bc3142fda2193367c37c18cfe9767
MATLAB
1,459
18
% Chapter 4: Convex optimization problems % % chebyshev_center_2D.m - Section 4.3.1: Compute and display the Chebyshev center of a 2D polyhedron % chebyshev_center.m - Section 4.3.1: Compute the Chebyshev center of a polyhedron % cantilever_beam_rec.m - Section 4.5.4: Design of a cantilever beam...
59f55de53dbba89d95ad86d5b88a62f538da83577fab1d1fc366012ff16b68dd
MATLAB
1,460
53
%glinspace - Gamma-corrected linearly spaced vector. % % USAGE % % x = glinspace(d1,d2,gamma,n) % % d1 start value % d2 stop value % gamma gamma value % n number of values % % SEE ALSO % % See also glinspace. % % Copyright (C) 2013 by Michaël Zugaro % %...
70daa954d1eae1cce5480336cb8a09fb6f21c28e34c198367c27a011bccf3b4a
MATLAB
1,460
40
function [n,dspchans] = plx_chanmap(filename) % plx_chanmap(filename): return map of raw DSP channel numbers for each channel % % [n,dspchans] = plx_chanmap(filename) % % INPUT: % filename - if empty string, will use File Open dialog % % OUTPUT: % n - number of spike channels % dspchans - 1 x n array o...
e78f35eee34b7b6510fb49d0adb81ccd1927b98397cbfe7f0561a5383594082c
MATLAB
1,460
53
% Section 5.2.5: Mixed strategies for matrix games (LP formulation) % Boyd & Vandenberghe, "Convex Optimization" % Joëlle Skaf - 08/24/05 % % Player 1 wishes to choose u to minimize his expected payoff u'Pv, while % player 2 wishes to choose v to maximize u'Pv, where P is the payoff % matrix, u and v are the probabilit...
0f928122ea062d7247dcd5707a0349c86021b2a5af76767f9ac2e24f597186a4
MATLAB
1,461
44
function map_to_gii(node_gii_file_L, node_gii_file_R, V, outfile_L, outfile_R) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % DESCRIPTION: % Map vector of values to gifti % % USAGE: % map_to_gii(pl_file, pr_file, outdir, subid) % % Inputs: node_gii_file_L, left nodes gifti file (...
df6d9a33ac0d0ac1ce8dfb9f8facb725de5283bd665bf72b80f8c8a9a903dcac
MATLAB
1,461
21
%% Cleartune Parameters obj.cleartune.results = abj.cleartuneresults;% copy of results for auto tuning functions obj.cleartune.efields = abj.cleartuneefields;% efields used to calc results obj.cleartune.injected = abj.cleartuneinjected;% status to report file has injected values obj.cleartune.optim = abj.CleartuneOpti...
67966d0450c33b64eece5e12287093eb765513d2d3b7b8eb2fa088a960493e25
MATLAB
1,462
45
%The goal of this function is to the time windows that have been manually selected as good/usable for %a given animal and that match the tracks of interest. %Also will collect info about which channel sets are best to use for each %of those time windows (Value of 1, 2, 3 will indicate which of the %three spreadshee...
6a17b71db5fe7107c7ac0bfe757292aa76fcce32b2b594bc05a722ae02bb7934
MATLAB
1,462
50
% File Array Object % % file_array - create a file_array % horzcat - horizontal concatenation % vertcat - vertical concatenation % size - size of array % length - length of longest dimension % subsref - subscripted reference % end - last index in an indexing express...
9d1e5914d54bc6f5ccfc835d9b96a9006f293e0b463b1c7fde33743b22874b03
MATLAB
1,462
44
function [xcm_u, ycm_u] = get_unwrap_xy(xcm, ycm) % GET_UNWRAP_XY Unwrap center-of-mass trajectories across periodic % boundary crossings, so trajectories are continuous instead of jumping % by a box length whenever a particle crosses the periodic boundary. % % [xcm_u, ycm_u] = GET_UNWRAP_XY(xcm, ycm) takes trajecto...
eb8caae6a8464a03d59aa6ad6e139a930ea7bc96a4efdf0b402c28723ba7c542
MATLAB
1,462
38
function [nCoords, nDim, nVTMode, c] = plx_vt_interpret(ts, sv); import CMBHOME.PLX2Mat.* % plx_vt_interpret - interpret CinePlex video tracking data % % [nCoords, nDim, nVTMode, c] = plx_vt_interpret(ts, sv); % % Input: % ts - array of timestamps (in seconds) (see plx_event_ts.m) % sv - array of strobed event valu...
fcac8600983a827648b9f0f3a8eeb50ff1f77bd7b965d7c08584b49ee829b27d
MATLAB
1,462
70
function genFDfromFTR(dtdname,ftrname,oversampling,selection,outname) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % genFDfromFTR(dtdname,ftrname,oversampling,selection,outname) % % generates fiber densities (colored and uncolred) and endpoint densities % % dtdname - na...
77fb9106393e1d5a34b50dbf29b0c652a9dcddff04b02d25ace6f04f96789c8c
MATLAB
1,463
41
function params = parseArgs(params, input) % This function takes in a structure, params, that defines a set of default % parameter values, named according to its fieldnames. Input is either a % structure with corresponding field name and user defined values or a set % of property/value pairs, as formatted by varargin. ...
204110264dbeba268f37793e3a2753cfd312aca83ccb850113bc27760a138848
MATLAB
1,464
49
function subtree = branch(tree,uid) % XMLTREE/BRANCH Branch Method % FORMAT uid = parent(tree,uid) % % tree - XMLTree object % uid - UID of the root element of the subtree % subtree - XMLTree object (a subtree from tree) % % Return a subtree from a tree. % % See also XMLTREE if uid > length(tree) || ... n...
48d232293bd525a21cac74d48bbf6d820ff2d86b4f7aad8b3466f7f20c94163b
MATLAB
1,464
58
% Nonnegative matrix factorization % Argyris Zymnis, Joelle Skaf, Stephen Boyd % % We are given a matrix A in R^{m*n} % and are interested in solving the problem: % % minimize ||A - Y*X||_F % subject to Y >= 0, X >= 0 % % where Y in R{m*k} and X in R{k*n}. % This script generates a random matrix A and obt...
8e2cd56a75d842eee2721df424078ce8f21ddc9ab2ea95c1336d0156019776e1
MATLAB
1,465
50
function deletId = call_deletefeature(handles, rois) assignin('base', 'handles', handles); assignin('base', 'rois', rois); im_norm = handles.im_norm; roimap = max(bsxfun(@times, rois, reshape(1:size(rois,3),1,1,size(rois,3))),[],3); roimap2 = roimap; roimap2(roimap2>1) = 1; % roimap2 = roimap2+im_norm; scrsz = handle...
8ef621714dcd94b375bcb50f5147ddf1466300e31b28bd361c1b171438d39826
MATLAB
1,465
45
function plotBestBordersMapCCF(dorsalMaps, allROIs, metricFields, randomBorders, smoothSDPts, smoothSDImg, cmapInfo) % Creates a binned and smooth map of cell metric values from the fields in % metricField, then computes the spatial gradient of each map, combines % them via the quadratic mean, and plots as an RGB image...
23b522f9d926bbeea9db3eb983d20500760a4264ec7010e5b330aae2abdf269a
MATLAB
1,467
33
function [xmn,xmx,mni,mxi] = CORE_minmax(x) %CORE_MINMAX Core computational routine for MINMAX. % [XMN,XMX,MNI,MXI] = CORE_MINMAX(X) returns scalars such that % XMN = X(MNI) = min(X) and XMX = X(MXI) = max(X). Ties in indices are % broken in favor of the lowest magnitude index. % % NaN values are igno...
3453afd548ae6e72545e6c24c3cddfcdf40794da2ef11efac066a27d6685d369
MATLAB
1,467
49
function subtree = branch(tree,uid) % XMLTREE/BRANCH Branch Method % FORMAT uid = parent(tree,uid) % % tree - XMLTree object % uid - UID of the root element of the subtree % subtree - XMLTree object (a subtree from tree) % % Return a subtree from a tree. % % See also XMLTREE if uid > length(tree) || ... n...
44218effb23739bfdc2e22b5c377a69649a955ffedb0f78b21eb906aa91683b3
MATLAB
1,467
45
% errordlg2() - Makes a popup dialog box with the specified message and (optional) % title. % % Usage: % errordlg2(Prompt, Title); % % Example: % errordlg2('Explanation of error','title of error'); % % Input: % Prompt - A text string explaning why the user is seeing this error message. % Title ...
84d8ef568cd3eed44e02abddddefacaf6bae8f88c1716764905c56772b700974
MATLAB
1,468
45
function ea_load_group(handles, groupdir) ea_busyaction('on', handles.leadfigure, 'group'); groupdir = erase(groupdir, filesep + textBoundary("end")); set(handles.groupdir_choosebox, 'String', groupdir); set(handles.groupdir_choosebox, 'TooltipString', groupdir); analysisFile = ea_getGroupAnalysisFile(groupdir); if ...
b055d38bb82dae4cd0972769eec5c01fd3ef3a8f0314709f7ab2fbea2154f6b2
MATLAB
1,468
42
% rspfunc() - sub-function used by rsget() % % Usage: res = rspfunc(pval, l, rval) % % Input: % pval - p-value to optimize % l - [l1 l2 l3 l4] l-values for Ramberg-Schmeiser distribution % rval - expected r-value % % Output: % res - residual % % Author: Arnaud Delorme, SCCN, 2003 % % See also: rsget() % % R...
bf8bd31d09870f5062df83b9ca888cfdb6fd5f602c312bb099211358de086ae1
MATLAB
1,468
17
% CVX: Definitions of common convex sets. % complex_lorentz - Complex second-order cone. {(x,y): norm(x)<=y} % convex_poly_coeffs - Coefficients of convex degree-n polynomials. {p: p(x) convex} % exp_cone - The exponential cone. {...
994438a46a929564b050c4534b7ef72e4dd22c6cdbc5aa34b54d6d1a037798ad
MATLAB
1,469
36
function saveash5(data, path_to_file, options) % save the variable stored in data in a h5 file named path_to_file (includes the % path to the directory). The file is saved with the same class as data. % options.groupname: the name of the group (default: /mov) % options.append: append to existing file if it exists...
c3062b6df941bef0f5d7810aee0c4c5f773e56a4f0e6952a26795a634a4e0458
MATLAB
1,469
39
function [framestamp, stampinfo, handles]= loadfilesub(variableinfo, framestampvariable,... stampinfovariable,k, filename, filepath, dirtemp, datafilename, handles) framestamp = []; stampinfo = []; if ismember(framestampvariable, variableinfo) a = load(dirtemp, framestampvariable); fram...
f9586c2cdd4eab050ea00abddad1b6720cc7dfe5d33e8936f30a665215a841b1
MATLAB
1,469
17
% CVX: Definitions of common convex sets. % complex_lorentz - Complex second-order cone. {(x,y): norm(x)<=y} % convex_poly_coeffs - Coefficients of convex degree-n polynomials. {p: p(x) convex} % exp_cone - The exponential cone. {...
0f51f7a1dbae2c2436adf7febbb0442d0e9aeb191783d161a2b474931c5cfe08
MATLAB
1,470
47
% gettempfolder() - return the temporary folder % % Usage: >> folder = gettempfolder; % % Output: a string containing the folder if a temporary folder can be found. % Empty if the folder cannot be found. % % Author: Arnaud Delorme, SCCN, UCSD, 2012 % % Copyright (C) Arnaud Delorme % This program is free softw...
15ee4aaec5488b93f3f20863f02fbe0959f422068bef863b2f2f7df03d84cd19
MATLAB
1,470
37
function raster = rasterize(events, Fs, T) %RASTERIZE Converts a list of events into a binary time series. % RASTER = RASTERIZE(EVENTS) takes a vector EVENTS containing a list of % indices and returns a binary vector RASTER with ones in locations % given by EVENTS. E.g., RASTERIZE([1 5]) => [1 0 0 0 1]. ...
7ede0b37d4d43793c8a842e7f31dd1fe203b994db4c034443655e85b249c767f
MATLAB
1,470
52
function [varsel] = SelVar(handles, mainfig_pos) varsel = []; scrsz = handles.scrsz; pos = mainfig_pos; pos(1) = pos(1)+100; pos(3) = pos(3)-300; stampinfo = handles.stampinfo{1}; varNames = stampinfo.Properties.VariableNames; hplot = figure(25); clf('reset') set(hplot, 'NumberTitl...
a60acfb3cf9a846812d0f949456501aa9bb1fe24c1574d6b15b75e118d242957
MATLAB
1,471
50
%%********************************************************* %% Atyfun: compute sum_{k=1}^m yk*Ak. %% %% Q = Atyfun(blk,At,permA,isspAy,y); %% %% Note: permA and isspAy may be set to []. %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%**************...
3b51f695b5d7cac8a5952aa360e217960be0042f91f475232cfa54971492f263
MATLAB
1,472
33
function eventInt = bz_eventIntervals(events,intervals) %EVENTINT Separate given buzcode event struct by given time intervals % events - buzcode event structure containing pulses and % intervals - set of time intervals % Requires: first field of events struct must be timestamps % Jacob Kerr, 2020 loadStru...
90a13816aa74cc1684039bd7412129d1fc826896deb304c6ae29e3e73cfea6d5
MATLAB
1,472
57
function [s s0] = circ_std(alpha, w, d, dim) % s = circ_std(alpha, w, d, dim) % Computes circular standard deviation for circular data % (equ. 26.20, Zar). % % Input: % alpha sample of angles in radians % [w weightings in case of binned angle data] % [d spacing of bin centers for binne...
941d2479c2296d3fdda3937b7c446a03ed3c91e5666f999986c355cf4cee09a4
MATLAB
1,473
46
% readtxtfile() - Read text file into a Matlab variable % % Usage: >> str = readtxtfile( filename ); % % Input: % filename - [string] name of the file. % % Output: % str - [string] content of the file. % % Author: Arnaud Delorme, SCCN / INC / UCSD, August 2009 % Copyright (C) Arnaud Delorme, August 2009 % % This p...
e79301469bf44169b0b6dc886021d2c8ae9279cedcb0ecdf5aefb5c055c8ab79
MATLAB
1,473
32
function ssg_databrowse3d(spikes, assigns, show) % SSG_DATABROWSE3D Feature projection GUI in 3D (work in progress). % SSG_DATABROWSE(SPIKES) creates a 3-D databrowse figure. Call with a % spike sorting object SPIKES and an optional assignments vector whose length % corresponds to the number of waveforms ...
94f776cbfe17a1675909bf5330340649981f5eb02787ffc3ac07048dad3c8d52
MATLAB
1,474
29
plugin_find_master_script_directory %% Summary of dataset % Load and print summary of study from study_info.json and contrast info % ------------------------------------------------------------------------- scriptname = which(fullfile('Second_level_analysis_template_scripts', 'b_reload_saved_matfiles')); run(scriptna...
1accc084fef34d049e72b8e15d55355ac2c287569505153a1c791fd00a36990c
MATLAB
1,475
61
function x = reshape( x, varargin ) % Disciplined convex/geometric programming information for RESHAPE: % RESHAPE imposes no convexity restrictions on its arguments. % % Check size arguments % switch nargin, case {0,1}, error( 'Not enough input arguments.' ); case 2, [ temp, sz ] = cv...
a4fe8ddc522d940e97757e955e8db2a31fce713baed0ce78fafd22347f58d6e3
MATLAB
1,475
50
% Figure 8.9: Robust linear discrimination problem % Section 8.6.1, Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX by Joelle Skaf - 10/16/05 % (a figure is generated) % % The goal is to find a function f(x) = a'*x - b that classifies the points % {x_1,...,x_N} and {y_1,......
aa374e4b5ed6732c454d5ac6be51e0f387a03ff4d20ac275e87f5189ea801843
MATLAB
1,475
31
% std_readitc() - load ITC measures for data channels or % for all components of a specified cluster. % Usage: % >> [STUDY, itcdata, times, freqs] = ... % std_readitc(STUDY, ALLEEG, varargin); % % Note: this function is a helper function that contains a call to the % std_re...
fa7c3c5bc27abb81b647194cb3e26abe25935575de0a776e39d482ca778792d7
MATLAB
1,475
51
function ea_spm_apply_coregistration(varargin) % Wrapper to apply SPM coregistration transformation fixedimage = varargin{1}; movingimage = varargin{2}; outputimage = varargin{3}; directory = fileparts(ea_niifileparts(movingimage)); if nargin >= 4 affine = varargin{4}; else % determine the affine matrix to b...
03dea9d78ad6b77e50398e69a8bc808d3d85574461114a2bfa828b7b0ebb6a3e
MATLAB
1,476
75
function r8mat_transpose_print_some ( m, n, a, ilo, jlo, ihi, jhi, title ) %*****************************************************************************80 % %% R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT, transposed. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % %...
e9b6d3423b3f060a7d962c8fb8d87f94dc52b8a4bc9c4afd80b6198c5d578f3c
MATLAB
1,476
54
% inputs: b, Y, X1 in glmfit_multilevel format, varargin "plots" b = stats.beta'; % remove random intercepts per person - not interested in this variance Yc = cellfun(@(x) scale(x, 1), Y, 'UniformOutput', false); Ycat = cat(1, Yc{:}); Xcat = cat(1, X1{:}); nobs = size(Xcat, 1); Xcat = [ones(nobs, 1) Xcat]; mode...
f486f639aabc06762dfe5088e60e8179f533f2ea14653da7ba51f30316be2410
MATLAB
1,476
66
function [fibdensRGB fibdens epdens] = ftr2FDmaps(ftr,sz,sel,M) if not(isempty(sel)), idx = ftr.fiber{sel}.curveID; else idx = 1:length(ftr.curveSegCell); end; idx = idx(cellfun(@length,ftr.curveSegCell(idx))>1); vox = ftr.vox; nc = cellfun(@(x) ip(x,M*3),ftr.curveSegCell(idx),'UniformOutput',false); nd ...
9e77d861e1098ae9be691c841df13678de1a31374f73ef7ccd08e666c78aabb8
MATLAB
1,477
37
function [ndcounts, inds] = histnd(data, bins) %HISTND N-Dimensional histogram % [NDCOUNTS, INDS] = HISTND(DATA, BINS); % The DATA matrix is treated as a collection of D-dimensional row % vectors and the entire range of the data is divided into BINS evenly % spaced segments (default: 10) in and the d...
27d73e2f1245e3e1cce18ef178878a154b2d59076d03281267cb1763c990740b
MATLAB
1,478
68
function varargout = plot(varargin) % plot method for GIfTI objects %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: plot.m 7513 2019-01-15 15:17:29Z guillaume $ % if ishandle(varargin{1}) % h = figur...
de26e6c5e6f5d0f62d4b3eefe6e638308f03cccc128b908248622aad7de4dc4b
MATLAB
1,478
50
function [whichnormmethod,template]=ea_whichnormmethod(directory,whatmethod) if ~strcmp(directory(end),filesep) directory=[directory,filesep]; end whichnormmethod=''; % default exit empty. if ~exist('whatmethod','var') whatmethod='normmethod'; end options = ea_getptopts(directory); switch whatmethod case...
4d2c5dd88be58d71bffccca18dd94623ed910da0c23bc18345e017efb80df2fa
MATLAB
1,480
41
function sleepstagesOUT = dreem2danalyzer(sleepstagesIN) % Convert a DREEM score file to a danalyzer score file. %% % Authors: Dan Denis % Date: 2024-12-09 %% sleepstagesOUT.stages = zeros(height(sleepstagesIN), 1); for i = 1:height(sleepstagesIN) if strcmpi(sleepstagesIN.SleepStage(i), 'SLEEP-S0') ...
c531f3ada284194ab8044c94d55bcff513a818b6d9f669b9cc6b6ca8a19b42f4
MATLAB
1,482
39
% covary() - For vectors, covary(X) returns the variance of X. % For matrices, covary(X)is a row vector containing the % variance of each column of X. % % Notes: % covary(X) normalizes by N-1 where N is the sequence length. % This makes covary(X) the best unbiased estimate of th...
249915a800b4660b85ff5a08abd8ce39037698a2a4e86a0db299365f211e5bc7
MATLAB
1,483
52
function outpoints = tal2icbm_fsl(inpoints) % % This function converts coordinates from Talairach space to MNI % space (normalized using the FSL software package) using the % tal2icbm transform developed and validated by Jack Lancaster % at the Research Imaging Center in San Antonio, Texas. % % http://www3.interscien...
3f9b14c7c9ee6e4722ce93fc9fdf18e4595533168d5e323bd42a5f8901f6c624
MATLAB
1,483
39
function ea_thomas_menu(handles) % Run THOMAS 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}); % Ch...
3aebba04fed204724eeced504e6ce2aa05f5c05db2c30005be9d5d15a58add67
MATLAB
1,484
40
function [ i, j, v ] = find( x ) %Disciplined convex/geometric programming information for FIND: % When used in CVX models, FIND cannot deduce the numeric value of a % CVX variable. So it returns the indices of elements that are % "structurally" nonzero; i.e., that are not *identically* zero. % This is ...
72e278409222bf368af7df0ee6eda9374146c16a73ef4cbdb7d3cbcb6bc684c5
MATLAB
1,484
55
function [ ] = ColorbarWithAxis(cbounds,label,varargin) %ColorbarWithAxis(cbounds,label) adds a colorbar to a imageplot and labels %axis and bounds with > and <. % %TO DO % change inputs to 'parms' with inputParser % add 3std functionality % %DLevenstein 2016 %% inputParse for input options parms = inputParser; add...
8aa82b76ae9dd49c0611af058825abcba3916daa9748a548b9c83fd75a5d1771
MATLAB
1,485
52
function outpoints = tal2icbm_spm(inpoints) % % This function converts coordinates from Talairach space to MNI % space (normalized using the SPM software package) using the % tal2icbm transform developed and validated by Jack Lancaster % at the Research Imaging Center in San Antonio, Texas. % % http://www3.interscien...
fa2307e16fe926be29dc4a96a51ec070d03d342fc741dcf218313728b5860eb8
MATLAB
1,485
41
function hdr = make_nifti2_hdr() hdr = struct(); hdr.sizeof_hdr = int32(540); hdr.magic = ['n+2' 0 13 10 26 10]; %should write reset this anyway? hdr.datatype = int16(16); %default to float32 hdr.bitpix = int16(32); hdr.dim = ones(1, 8, 'int64'); hdr.intent_p1 = 0.0; hdr.intent_p2 = 0.0;...
7ffd8e19c4aa007c4e252e0d57c6a505ef21c42768e0e76909449848a8ea7d98
MATLAB
1,486
55
function splot_trajectory(self, cel, varargin) % Plots scaled trajectory % % Plots animal trajectory for root.epochs (if multiple, they are all % plotted on top of one another), along with spikes overlayed in red dots. % % andrew 3 april 2010 p = inputParser; p.addRequired('self') p.addRequired('cel', @isnumeric) p.a...
84c2a156532ae59d547bc85077b79789c0bf8cffa7d47d1c3a641b094dd3ff4b
MATLAB
1,486
47
function edu = CBIG_get_edu(rid_of_interest) % edu = CBIG_get_edu(rid_of_interest) % Fetch education years from .csv files % % Input: % - rid_of_interest: the RID's of subjects of interest % % Output: % - edu: 1st col is RID, 2nd col is (dummy) VISCODE, 3rd is (dummy) EXAMDATE, 4th is year % % Written by CBIG u...
0c86a7f4c8a1c4d7fe6de1fa0e9cbb7c9de91bc2e41d7b93fa10386c761d0994
MATLAB
1,487
72
function [imall,mycmap]=im_overlay4(im1,im2,ncolors,thesecolors) % function [y,cmap]=im_overlay4(im1,im2,ncolors,thesecolors) % % im1: background gray-scale image (not-scaled) % im2: foreground jet-scale image (indexed and min ignored) verbose_flag=0; if nargin<3, %ncolors=ceil(max(im2(:))); ncolors=256...
3a59f9132c0499eb3ad6653e08764a75c41c8e8cf0a511195b912cc50fd28d17
MATLAB
1,487
41
function hdr = make_nifti2_hdr() hdr = struct(); hdr.sizeof_hdr = int32(540); hdr.magic = ['n+2' char([0 13 10 26 10])]; %write resets this anyway hdr.datatype = int16(16); %default to float32 hdr.bitpix = int16(32); hdr.dim = ones(1, 8, 'int64'); hdr.intent_p1 = 0.0; hdr.intent_p2 = 0.0...
964cf9122b5b7a26a63b1d1c77d54b4da51fa0209c1763937b837c84014c8549
MATLAB
1,487
44
mainfolderlist = {'1_1s';'2_2s5';'3_5s';'4_10s'}; mainfolder = '/Users/yiyuan/OneDrive - University of Essex/PG Research/0A_Journal/202004_unknown Journal_Probability Score/1_Results/0_Final Results/Results_Main/'; resultfolder = '/Users/yiyuan/OneDrive - University of Essex/PG Research/0A_Journal/202004_unknown Journa...
f8028179462c4a8287693a6b12bc82ae929b11af9864945ccbe538a3471c2b91
MATLAB
1,487
53
function NSxPowerSpectrum(NSx, channelNumber, colorCode) % NSxPowerSpectrum % % Plots a power spectrum of a given channel. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Use NSxPowerSpectrum % % Use settingsManager(NSx, channelNumber, colorCode) % % NSx: The NSx file conta...
30b30602fbe705e0813913c1a4538aa9151b9d7b67bd74da1d161e2db23eba1a
MATLAB
1,488
17
% Filter design % <a href="http://stanford.edu/~boyd/papers/magdes.html">FIR Filter Design via Spectral Factorization and Convex Optimization</a> % <a href="http://stanford.edu/class/ee364">EE364</a> lecture, <a href="http://stanford.edu/class/ee364/lectures/filters.pdf">Filter design and equalization</a> % % fir_cheb...
4e92bce4f3367ea9c310ee86a2a51484e2f23aae94ddf7b2bcbc674f760fddb4
MATLAB
1,488
52
% This example calls cgalmesher to mesh a segmented % brain volume. The segmentation was done by FreeSurfer % and there are 41 different types of tissues. Each tissue % type is labeled by a unique integer. fprintf(1,'loading segmented brain image...\n'); for i=1:256 brain(:,:,i)=imread('brain_seg.tif',i); end brain=...
c2acc630c390ad2beb8d71dcd24293f1ba47bcd6ed28cab86d4e690908d69432
MATLAB
1,488
36
%% control_set_after_use.m % % POSITIVE CONTROL for clean/set_after_use.py. Not a runnable analysis. % % This file reproduces the failure that motivated the checker: the option is % guarded near the top, CONSUMED a few lines later, and only THEN set to the % value the author intended. Nothing errors. The output directo...
5b46391190ed97f20eb86b3768533b592e1e8efb265fe89315102257b336e230
MATLAB
1,490
42
function datToNPY(inFilename, outFilename, dataType, shape, varargin) % function datToNPY(inFilename, outFilename, shape, dataType, [fortranOrder, littleEndian]) % % make a NPY file from a flat binary file, given that you know the shape, % dataType, ordering, and endianness of the flat binary file. % % The point he...
e65ce2d418abf23abfca8d2a20171a809edf13ddd25a14c791d10114fb7ec99b
MATLAB
1,490
37
function CB_subzoom(handle, event) %CB_MYFUNC Callback for UImyfunc. hei_zoom = 0.85; % fractional height in zoomed state wid_zoom = 0.85; % fractional width in zoomed state %%%%%%%%%%%%%%%%%%%%%%%%%%%%% Access Data %%%%%%%%%%%%%%%%%%%%%%%%%%%% % First we get the target axes & its context menu -- these are ...
f2a17d2e10e801ce66dcfc5685d07fb11f82cbc17130f1b47ef11c7e9d299eef
MATLAB
1,490
67
function varargout = plot(varargin) % plot method for GIfTI objects %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: plot.m 5888 2014-02-19 19:54:12Z guillaume $ % if ishandle(varargin{1}) % ...
425d914bdcd0c6daa13003cf6aa7426ef71a32a1b2b4aaaf36295b6d5c6df812
MATLAB
1,491
35
function CBIG_ArealMSHBM_example_wrapper(out_dir) % CBIG_ArealMSHBM_example_wrapper(out_dir) % % This script will run the test step in Example 4 to generate individual-level parcellation % using gMSHBM. The other examples will be skipped since etimating group priors require % multi-cpus which cannot be run without mul...
6f076b3e9398be42fcdb4c781f2e1e5c662cba0f39051def1a91a90b03bd0800
MATLAB
1,491
53
function [varargout] = quivermd(ax, x, v, varargin) %QUIVERMD multi-dimensional quiver % QUIVERMD(AX, X, V, VARARGIN) plots the column vectors in matrix V % at the points with coordinates the column vectors in matrix X % within axes object AX using plot formatting options in VARARGIN. % % usage: % H ...
8537fcea46bfb6829c1c66decb19dc33d5cc70667d2b6acf9e69dd054e6702fd
MATLAB
1,491
35
function [Params, lh_labels, rh_labels] = CBIG_MSHBM_example_wrapper(out_dir) % [Params, lh_labels, rh_labels] = CBIG_MSHBM_example_wrapper(out_dir) % % This function will run examples sequentially % % Written by Ru(by) Kong and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md CBI...
cc7f9415f773e1f073ed6b9502661f72e8dfdfbb149d8b8098c440b3f172e49c
MATLAB
1,491
26
% EEGLAB Toolbox to process EEG data % Version 14.0.0 % % eeglab() - Matlab graphic user interface environment for % electrophysiological data analysis incorporating the ICA/EEG toolbox % (Makeig et al.) developed at CNL / The Salk Institute, 1997-2001. % Released 11/2002- as EEGLAB (Delorme, Makeig, et al.) a...
02a030745c4258a6ecaa17725e048f2de564eae1c70d049526e5a5cbb0738646
MATLAB
1,493
27
function a = lt( x, y ) % Disciplined convex programming information for LT (<): % The left-hand side of a less-than constraint must be convex. The % right-hand side must be concave. Of course, real constant and % affine expressions are both convex and concave and can be used on % either side as...
310241ab59b80792632287c48904c5b60d4e45558fb1dff6e52f1736c9c662e8
MATLAB
1,493
55
function [normal,normalf] = compute_normal(vertex,face) % compute_normal - compute the normal of a triangulation % % [normal,normalf] = compute_normal(vertex,face); % % normal(i,:) is the normal at vertex i. % normalf(j,:) is the normal at face j. % % Copyright (c) 2004 Gabriel Peyr� [vertex,face] ...
61900b332a6190a68e00860d0d14dbcf71bd2035bdce0dc36915679fac564d12
MATLAB
1,494
61
if(ispc) check_dir = 'dir'; else check_dir = 'ls'; end curr_path = pwd; addpath(pwd); [status, y] = system([check_dir ' AnalysisTools']); if(status == 0) addpath(fullfile(curr_path, 'AnalysisTools')); end [status, y] = system([check_dir ' AtlasSharpnessAndLabelMatch']); if(status == 0) addpath(fullfi...
fbfdfc83130f8b4410e1055e59eb0ae3918dabef7b2942c1d9f3b56092f894ec
MATLAB
1,494
48
function [newDB] = bz_updateSQLFromFiles(nyuSharePath) % USAGE % [newDB] = bz_updateSQLFromFiles() % % INPUTS % % % % % % INPUTS % % % % DESCRIPTION % This function takes a directory path as input (from /Datasets/ folder) % and searches for recording session folders to add to the SQL database % % david tingley, 2018 ...
f196127f4fea198502d5646c372dc95571e89220092c038b12c2fbf6036dcb5e
MATLAB
1,495
57
function [res, errStr]= maskstruct_init(mrStruct) % function [res, errStr]= maskstruct_init(mrStruct) % % Creates a valid and empty maskStruct % % return values % res: the empty maskStruct % errStr: If an error occured, errStr is identify the error % % % Bjoern W. Kreher % 12/07 % % UNIX res= []; errS...
574da05c9961409d6fb96948d99e5b717350049ae22221c9b5d7031410fa0d8a
MATLAB
1,496
55
function features = LoadSpikeFeatures(filename,rate) %LoadSpikeFeatures - Load spike features from file. % % USAGE % % features = LoadSpikeFeatures(filename,rate) % % filename spike file name (either .clu, .res or .fet) % rate sampling rate % % OUTPUT % % The output is a list of...
ba4b65233c3c5e75629381f9252a02f3b2cdc401792e31f1a7987c198d6c3353
MATLAB
1,496
47
function R = myPLS_cov(X,Y,grouping,grouped_PLS) % This function generates a cross-covariance matrix (stacked) for the PLS % analysis % % Inputs: % - X : N x M matrix, N is #subjects, M is #imaging variables % - Y : N x B matrix, B is #behaviors % - grouping : N x 1 vector, subject g...
c4c1ad609da9ad234331204f212e1b8aa3fa31e3d220260a6191c87245db1e58
MATLAB
1,496
46
% Section 11.8.4: Network rate optimization % Boyd & Vandenberghe "Convex Optimization" % Argyrios Zymnis - 05/03/08 % % We consider a network with n flows and L links. Each flow i, % moves along a fixed predetermined path (i.e. a subset of the links) % and has an associated rate x_i. Each link j has an associated cap...
b6d28a4597c91b37cc9f2e5f2c3c431bae416ca90cdf9d92037c3bfd4d7dff3c
MATLAB
1,497
45
function cleanx = CleanData(x, rnge, choice, epsilon); %CLEANDATA % Usage: % cleanx = CleanData(x, rnge, choice, epsilon); % % This function will take in a data set x, a specific portion of that data, % rnge, and look for any points below (choice = 'below') or above ( % (choice = 'above') the threshold e...
0e84c3bf5212cf95f86d9a0051a29c648ff6a980d6bcecd7501bd59d5347ed87
MATLAB
1,498
36
%% Figure 9 supp 1 % RUN fig9_analysis, then return here fig9_analysis % Load PETHs to plot fileList = searchFilesRecursive(YOURDATAPATH, 'PETHs.mat'); load(fullfile(fileList.folder, fileList.name)) % Most-likely ROIs for each subpopulation, 2 from each area areas = {'M2', 'M1', 'S1-fl', 'S1-hl', 'S1-tr'}; ROIinfo = ...
16eec0e0e5352aa363545fc7e5e7a3023ef5acecf5a774657b9600d25743a54f
MATLAB
1,498
45
function all_boot_orders = myPLS_get_boot_orders(nBootstraps,grouping,grouped_boot) % This function computes bootstrapping sampling orders for bootstrapping % with resampling. Note that if groups are considered for resampling, % groups can be not ordered. % % Inputs: % - nBootstraps : #bootstrap samples % - grou...
1ae302d06f02432a835dfcc35bc54161a91c6d66145e9749f6c6fde5be93c909
MATLAB
1,498
62
function scenario = scenario_sumr_constb_constp(par) % r(Q+A,Q+A), b constant, p constant scenario.name = "sumr_constb_constp"; % define parameter set (names) scenario.parnames = {'r0','K','b0','p0'}; % organize parameters in structure form scenario.make_par = @(p) struct( ... 'r0', p(1), ... 'K',...
96aa4455999d334f067536ec9c8736000b2750537dee579d0b9e777793405820
MATLAB
1,498
76
function i4mat_transpose_print_some ( m, n, a, ilo, jlo, ihi, jhi, title ) %*****************************************************************************80 % %% I4MAT_TRANSPOSE_PRINT_SOME prints some of an I4MAT, transposed. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % %...
205971f5d7fc612b8e9689d66d508a7eda4ddedc55efafdc527092444cf944d1
MATLAB
1,499
42
function a = file_array(varargin) % Function for creating file_array objects. % FORMAT a = file_array(fname,dim,dtype,offset,scl_slope,scl_inter,permission) % a - file_array object % fname - filename % dim - dimensions (default = [0 0] ) % dtype - datatype (default = 'uint8-le') % offset ...
2b744109c8370c0022dde3f3fac953064a8ab23748e18834aaded707c0de904f
MATLAB
1,499
43
function [params] = readParameterFile(fname) % 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 relevant behaviors of the ecosystems. % Copyright (C) 2015 Vanni Bucc...
6512b62f96a2e4c5cd70e90faf3b24ccfd277ca18ef58d5a8966fa0dcb5dbe81
MATLAB
1,499
56
function baseline = CBIG_hypoTest_acrossStages(betas, stats) % baseline = CBIG_hypoTest_acrossStages(betas, stats) % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md fprintf('\n\n****************** Combine Factors, Across Stages ******************\n\n'); baseline = ze...
26751d6b6a98f6d7126bc9545be4eade42fe540f16d22af8ecb2bb9d190cc3ce
MATLAB
1,501
38
function [time_projection] = assembly_activity(AssemblyTemplates,SpikeCount) % Activities = assembly_activity(Patterns,Activitymatrix): computes the % time course of the activity of assembly patterns defined in Patterns in % the spike matrix Activitymatrix with single bin resolution. % % Description of inputs: ...
4fc079144ce07f111f86f441902409f7e8bf43029c58f53df99acbb5872946ee
MATLAB
1,501
30
% std_readerpimage() - load ERPimage measures for data channels or % for all components of a specified cluster. % Usage: % >> [STUDY, erpimagedata, times, trials, events] = std_readerpimage(STUDY, ALLEEG, varargin); % % Note: this function is a helper function that contains a call to the % st...