sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3a5114e042f0ba248fe6b496e95bac7b39d992fdf718815cff8d078b9e1ef7b7
MATLAB
1,670
41
function y = fwdpr1(Lden, b) %#ok % y = fwdpr1(Lden, b) % % FWDPR1 Solves "PROD_k L(pk,betak) * y = b", where % where L(p,beta) = eye(n) + tril(p*beta',-1). % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi, dpr1fact, bwdpr1 % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Rom...
7db0957c0e953f7c2a3147f14277463c37d3660642cd3144ad045aa860649a86
MATLAB
1,670
70
function result = cvelnet(object, lambda, x, y, weights, offset, foldid, ... type, grouped, keep) % Internal glmnet function. See also cvglmnet. if nargin < 10 || isempty(keep) keep = false; end typenames = struct('deviance','Mean-Squared Error','mse','Mean-Squared Error','mae','Mean Absolute Error'); if str...
ae8a86577b45c2e8ee983551ff97423b6533fe75098878f36ec62231da41ab1d
MATLAB
1,670
40
function Ablkjc = partitA(At,blkstart) %#ok % Ablkjc = partitA(At,blkstart) % % PARTITA Partition columns of A according to the subscripts listed in blkstart. % % ******************** INTERNAL FUNCTION OF SEDUMI ******************** % % See also sedumi % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Rom...
f5d588005cf72b271238a1efff7fa768b9b9fadf2a060396034939aa377e40e2
MATLAB
1,671
75
function fit = elnet(x, is_sparse, irs, pcs, y, weights, offset, gtype, ... parm, lempty, nvars, jd, vp, cl, ne, nx, nlam, flmin, ulam, thresh, ... isd, intr, maxit, family) ybar = y' * weights/ sum(weights); nulldev = (y' - ybar).^2 * weights; ka = find(strncmp(gtype,{'covariance','naive'},length(gtype)),1); ...
6167d10a488ec38dacc3820dc865ed3904ac53bb48ed87d6b40a4c7df2c6078c
MATLAB
1,672
48
function minimametric = metric_minima_all_cifti(metric,neighdist,neighbors) if ~exist('neighbors') bufsize=16384; % Read in node neighbor file generated from caret -surface-topology-neighbors [neighbors(:,1) neighbors(:,2) neighbors(:,3) neighbors(:,4)... neighbors(:,5) neighbors(:,6) neighbors...
b43df54730feff3fedfe339c50ee3dea82c5c5373facc52f9d84ff88d70b7fc8
MATLAB
1,672
79
function y = square( x ) %SQUARE Internal cvx version. % 0 : all others % 1 : constant % 2 : real affine % 3 : monomial, posynomial narginchk(1,1); persistent remap if isempty( remap ), remap1 = cvx_remap( 'constant' ); remap2 = cvx_remap( 'affine' ) & ~remap1; remap3 = cvx_remap( 'log-valid' ) & ~remap...
80df12133ae5f72c233b010efbbcfd732e7ba0d197f12b88bf2fb693156358b4
MATLAB
1,673
64
classdef ProgressTracker < handle properties count = 0 total = 0 lastPrint startTime end methods function obj = ProgressTracker(total) obj.total = total; obj.lastPrint = tic; obj.startTime = tic; end function update(o...
8bd9f68dbe6784a3ac08f8ce375355e9db1d4cfc4df718f05d187d2df0737ba6
MATLAB
1,673
78
function [code, name, rgbv] = read_fscolorlut(fname) % [code name rgb] = read_fscolorlut(fname) % % Reads a freesurfer color lookup table. By default % reads $FREESURFER_HOME/FreeSurferColorLUT.txt. % % % read_fscolorlut.m % % Original Author: Doug Greve % CVS Revision Info: % $Author: fischl $ % $Date: 2008/04...
8dfe71503597e13c5385dfbb764802a24f45747e4fa929b5f56b9d0114dcdcff
MATLAB
1,673
39
function plotSubpopCompContoursCCF(dorsalMaps, allROIs, model, smoothSD, contConfig) % Plots contours for the likelihood values obtained from area-specific % components that have been clustered into a subpopulation % Figure allenMapSMc(dorsalMaps, [-3.6, 0, -2, 3]) % Creates figure by itself % Plot params xLimits = [...
d56d649f143427448042e2da277472aac194e13d6305da010df06d4f5adf630d
MATLAB
1,673
50
function ea_cat_seg(options) options.prefs=ea_prefs; [options,presentfiles]=ea_assignpretra(options); job.data = {[options.root,options.patientname,filesep,presentfiles{1}]}; job.nproc = 0; job.opts.tpm = {[ea_space,'TPM.nii']}; job.opts.affreg = 'mni'; job.opts.biasstr = 0.5; job.extopts.APP = 1070; job.extopts.LAS...
9d620285cf21e44d9cc8f2ff38b734e406695ce5f94f62bb9f6291ba2dd26db8
MATLAB
1,674
52
function [betas, stats] = CBIG_fitGLM_2t(subInfoFile, GMICVFile, q) % [betas, stats] = CBIG_fitGLM_2t(subInfoFile, GMICVFile, q) % What is the subtype order? % Offset by 1, the RID column % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md COR_COL = 1+1; fprintf('\n\n\n'...
a35fd250d4ded6f1918b669afa5da3cd0593e1c8fd6a15b79f3c0e55c1a1fcbc
MATLAB
1,674
56
function [stimname,preexist]=ea_detstimname(options) preexist = 0; % check if previous stimulations have been stored if ~isfield(options,'root') % called from lead group stimname = ['gs_',options.groupid]; return end stimname = cell(0); if exist([options.subj.stimDir, filesep, ea_nt(options)],'dir') stimd...
c6806f6bc099a49acd0ae3a2c3b60c7267e63d2371248926c3d98629f27ba962
MATLAB
1,674
64
function r = circ_r(alpha, w, d, dim) % r = circ_r(alpha, w, d) % Computes mean resultant vector length for circular data. % % Input: % alpha sample of angles in radians % [w number of incidences in case of binned angle data] % [d spacing of bin centers for binned data, if supplied % corr...
c68146d196af3ab2a37ba7d824cbdd5fb3a24b2567f9dc6bd40dc2f69a957719
MATLAB
1,674
56
%issamples - Test if parameter is a list of samples satisfying an optional list of tests. % % A list of samples is a vector or matrix of doubles containing at least one column % for timestamps, and optionally more for continuous variables. % % USAGE % % test = issamples(x,test1,test2,...) % % x pa...
351460514fdc77ff4cf90ddc330abcaa59ab311d9962bb994ef62c865b54d79b
MATLAB
1,675
53
% Go to main project directory before running. Uses current dir as main % project dir. % Set paths and directories canlab_simple_set_paths; %% Load DAT structure with setup info % ------------------------------------------------------------------------ savefilename = fullfile(resultsdir, 'image_names_and_setup.mat')...
dfdf4e84ae48765030b4cf3168619bb6f76bf5bcf48b010d8b760085b00793d5
MATLAB
1,675
69
%RunBatch - Run a batch job. This should *not* be called directly. % % Run a batch job. This function is called automatically by the % batch timer upon expiration of the required delay. % % USAGE % % RunBatch(timer,event,b) % % timer Matlab timer object % event Matlab timer event type % b...
2cd5ada6dd5914d3f266cdfd74752b3b8497aaad87b98e02d502b2047966985d
MATLAB
1,676
63
function v = cvx_class( x, needsign, needreal, needzero ) if nargin < 2, needsign = false; end if nargin < 3, needreal = false; end if nargin < 4, needzero = needsign; end % Classifications: % 1 - negative constant % 2 - zero % 3 - positive constant % 4 - complex constant % 5 - concave % 6 - real affi...
3248496b93abf26fe686dbd530c8b65efa33753ec6360501ba41133dbb3d1d9f
MATLAB
1,676
42
function [zhi,zlo] = quadadd(xhi,xlo,y) %#ok % [zhi,zlo] = quadadd(xhi,xlo,y) % % QUADADD Compute (zhi+zlo) = (xhi+xlo) + y. % x an z are in double-double format (quad precision) % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr...
65ea11af45ed310b97820a667aecd29fab54da68632428e92d76bf46d3bb00bd
MATLAB
1,676
35
mainfolder0 = '/Users/yiyuan/OneDrive - University of Essex/PG Research/0A_Journal/202004_unknown Journal_Probability Score/1_Results/0_Final Results/Results_Main/'; figurefolder = '/Users/yiyuan/OneDrive - University of Essex/PG Research/0A_Journal/202004_unknown Journal_Probability Score/1_Results/0_Final Results/Res...
d87889c7ff290f99a91e704a94ae69a1d568650be04f1ba4c47d7a6d21986de7
MATLAB
1,676
45
% Verify NIFTI header extension to make sure that each extension section % must be an integer multiple of 16 byte long that includes the first 8 % bytes of esize and ecode. If the length of extension section is not the % above mentioned case, edata should be padded with all 0. % % Usage: [ext, esize_total] = verif...
ff4a1fce844522b5d9c5ee4af8501369ee478fa9e9f72947cad71b07218363c9
MATLAB
1,676
47
function [pca_regs_Hb, pca_regs_OD, diag_info] = pick_pca_regs(HBO, HBD, dOD_hp, conv, n_pca, r2max) %NIRSPROC.PICK_PCA_REGS Select task-uncorrelated PCs as nuisance regressors. % [pca_regs_Hb, pca_regs_OD, diag_info] = NIRSPROC.PICK_PCA_REGS(...) % % Inputs % HBO, HBD : T×nCh HbO/HbR time series % dOD_h...
37cda8e4e0b335bb9018984a6c98aa0f54de34c27c54f13da03d9764b5613cc6
MATLAB
1,677
49
function done = ea_coregpostopct(options) % Entry function to coregister post-op CT to pre-op MRI done = 0; if ~ea_reglocked(options, options.subj.postopAnat.CT.coreg) % Setup log if options.prefs.diary ea_mkdir(fileparts(options.subj.coreg.log.logBaseName)); diary([options.subj.coreg.log.logB...
bb7c7e34c7aa81f1906688b81149674bdba987d35ca266531a859af33a14d267
MATLAB
1,677
53
%%************************************************************ %% Prod3: compute the entries of Q = A*B*C specified in %% nzlistQ. %% %% Q = Prod3(blk,A,B,C,sym,nzlistQ) %% Important: (a) A is assumed to be symmetric if nzlistQ %% has 2 columns (since mexProd2nz computes A'*B). %% (b) T...
b03e54a167661b2810782b34e55a4f6111da4d62c7dcbce82917780fe5bda863
MATLAB
1,678
48
function [out, G] = filterGauss2D(image, sigma, borderCondition) % filterGauss2D : filters an image with a 2-D Gaussian mask % % [out, G] = filterGauss2D(image, sigma, borderCondition); % % INPUT: image : 2-D input array % sigma : standard deviation of the Gaussian % ...
bb9afd80a4bd9dd271d99c0b2195de891e5dc50025a8303fba8951c3f2334ba5
MATLAB
1,678
51
function ea_show_light(resultfig,viz) % if viz = 1; turn on % if viz = 0; turn off % default viz=1; if nargin<2 viz=1; end set(0,'CurrentFigure',resultfig); prefs = ea_prefs; CamLight=light('style','infinite','Color',prefs.d3.camlightcolor); % not modifiable, infinite light. %set(cam_lamp,'Color',[1,1,1]); camli...
d8652eb72419ec8bdbc089abae73fb76ca93a75ab4cc1007a02eb9a0cdd8e632
MATLAB
1,678
34
% SOFA API - demo script % 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 EUPL (the "License") % You may not use this work except in compliance with t...
574a4be0bf641c17128dc1808f72aa29e8c78b91619c2048c5f40221cc464918
MATLAB
1,680
53
function [betas, stats] = CBIG_fitGLM_3t(subInfoFile, GMICVFile, q) % [betas, stats] = CBIG_fitGLM_3t(subInfoFile, GMICVFile, q) % What is the subtype order? % Offset by 1, the RID column % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md SUB_COL = 1+3; COR_COL = 1+1; f...
adf6f392a9f956f8e6d66e8cba0c0d3103b7cb6351e7e76a2240e6f7820dd1d8
MATLAB
1,680
46
function writeMoCorTifs(files,moCorImgData,outputPath) %prevents printing of irrelevant tif header errors warning('off','MATLAB:imagesci:tiffmexutils:libtiffWarning'); fStart = 1; for fileNo = 1:length(files) tmpImInfo = imfinfo([files(fileNo).folder filesep files(fileNo).name]); nFrames = length(tmpImI...
09ef6230f1c61faf9d09bbd89dea4bda315a521ece7a9a0c1b62dc72a93b6768
MATLAB
1,681
58
function [ probs ] = AssociationLDA4( WP , BETA , W1 , pz ) %% Function WriteTopics % % works on single samples as well as multiple samples % TAKE THE PRIOR TOPIC PROBABILITY INTO ACCOUNT if iscell( WP ) % we are dealing with multiple Gibbs samples. Need to average % predictions over these samples. Note ...
b04a96c40a774548359a305d459398740d5a477a136d9d127bb36203c9909529
MATLAB
1,683
44
function [vatlist,FilesExist] = ea_unifiedmapping_getlattice(obj) % Return list of VATs numPatient = length(obj.allpatients); vatlist = cell(numPatient,2); FilesExist = zeros(numPatient,2); % no sense to check for mirrored here disp('Check for 4-D niftis...') for sub=1:numPatient [~,subj_tag,~] = fileparts(obj.M...
91dd15f24519a21d1d339723415612eaf5723ddbcfc35917deb4fde4f486ec54
MATLAB
1,684
50
function tree = copy(tree,subuid,uid) % XMLTREE/COPY Copy Method (copy a subtree in another branch) % FORMAT tree = copy(tree,subuid,uid) % % tree - XMLTree object % subuid - UID of the subtree to copy % uid - UID of the element where the subtree must be duplicated %_______________________________...
058f6ac52133736c1bef5b7b30bb7a8c6ed5ea3e66307edb8d8747bd854ae461
MATLAB
1,685
43
function h = UIcolorshift(varargin) %UIcolorshift Creates an interactive colorbar. % UIcolorshift adds a (vertical) colorbar to the current axes. This % colorbar can be used to shift or rescale the color mapping in the % current axes. Clicking near the top of the colorbar axes % up or down (right or left...
3819e808f2b1cb5b799ff21b5881a022a4c50cea916208c00b88bd80e34062bc
MATLAB
1,685
75
% % Copyright (c) 2015, Yarpiz (www.yarpiz.com) % All rights reserved. Please read the "license.txt" for license terms. % % Project Code: YPML110 % Project Title: Implementation of DBSCAN Clustering in MATLAB % Publisher: Yarpiz (www.yarpiz.com) % % Developer: S. Mostapha Kalami Heris (Member of Yarpiz Team) ...
9697cdfd3e0361f1f945ffb3e29f22bd5b3042b424a021f96cc6c4058f5f5d04
MATLAB
1,685
58
function [res, errStr, fName]= dtdstruct_read(fName) % %function [res, errStr, fName]= dtdstruct_read(fName) % % Opens a dtdStruct from the filesystem % % fName: should contain the path and file name. if it is empty or undefined, a file selection dialog will appear % % return values: % res: contains ...
ea41c1c689790c0f84ae24522793890fca8d33b374e80cf8329d5f9d73f9427a
MATLAB
1,685
50
function model = fitGMM(X, options) % Fits a GMM to a matrix of feature vectors % X is a N x nFeatures array, each row is a single neuron's features % requires at least options.maxK + 1 neurons % Params Kmax = options.maxK; chooseK = options.chooseK; sparseLambda = options.sparseLambda; % If no pre-specified number o...
4c17b2b5835418486c548cc61a4f5e2c328615837028e1dc3b3ac866b490b865
MATLAB
1,686
57
function fcs = cfs2fcs(cfs,fs) %CFS2FCS Calculate gammatone crossover frequencies. % % FCS = IOSR.BSS.CFS2FCS(CFS,FS) calculates the crossover frequencies of a % gammatone filterbank. The output fcs is the same size as CFS, with the % last element being equal to fs/2. % % The crossover frequencies are determi...
1168adb4b06e1f7f36fccc8f58ac20abdecd601003a975ad494445b781ffce05
MATLAB
1,687
74
function [phis, cdf, phiplot, cdfplot] = circ_samplecdf(thetas, resolution) % [phis, cdf, phiplot, cdfplot] = circ_samplecdf(thetas, resolution) % % Helper function for circ_kuipertest. % Evaluates CDF of sample in thetas. % % Input: % thetas sample (in radians) % resolution resolution at which the cdf...
67170e11b394c974f73a1a91daf8108e90761cf562ccfbe14fa1c2679bdaebd6
MATLAB
1,687
69
% Optimal doping profile optimization % Boyd, Kim, Vandenberghe, and Hassibi, "A tutorial on geometric programming" % Joshi, Boyd, and Dutton, "Optimal doping profiles via geometric programming" % Written for CVX by Almir Mutapcic 02/08/06 % (a figure is generated) % % Determines the optimal doping profile that minimiz...
a6199ad86b50434cf2144df14f81e1e53d98859f31e1f064afa825c563674e45
MATLAB
1,687
78
function [n, ts] = nex_ts(filename, varname) % nex_ts(filename, varname): Read timestamps from a .nex file % % [n, ts] = nex_ts(filename, varname) % % INPUT: % filename - if empty string, will use File Open dialog % varname - variable name % OUTPUT: % n - number of timestamps % ts - array of timestamps (in seco...
3d0c3dca0018f722b9b7369077856569696af866c85157f42c6e493cba7f852e
MATLAB
1,688
66
% Figure 7.1: Logistic regression (GP version) % Section 7.1.1 % Boyd & Vandenberghe, "Convex Optimization" % Kim & Mutapcic, "Logistic regression via geometric programming" % Written for CVX by Almir Mutapcic 02/08/06 % % Solves the logistic regression problem re-formulated as a GP. % The original log regression probl...
c6ecd35eefa6698e97af9fb6611e13767e342e81b9823b8b9d30eadbe10ba646
MATLAB
1,689
49
function myPLS_plot_loadings_2D(var,var_name,signif_LC,pos_threshold,neg_threshold,save_opts) % % This function plots 2-dimensional loadings (e.g. correlation matrix) % of all significant latent components (LCs) % % Inputs: % - var : M x L matrix, M is #imaging values (when vectorized), % ...
f10be76c7653303bbebe39df80dd27d0da9e52e864824f7f23a77d0e404cdf04
MATLAB
1,689
54
function plotAreaGMMCompPDFs(allROIs, areaGMM, cmap) % Creates KDE plots for all metric value distributions separated by % components within an area-specific GMM % Check size matches nComponents = areaGMM.model.NumComponents; assert(nComponents == size(cmap,1)) % Params metricFields = {'duration', 'sharpness', 'linea...
3632e274ea35549aa9ef1eecbaa123826137d44e8500d9e02cbfaee843a888a6
MATLAB
1,690
65
function ea_surfice(script, hold) % Wrapper for Surf-Ice script call if ~exist('hold', 'var') hold = 1; % Block executions until script QUIT end % check OpenGL version % openglInfo = opengl('data'); % openglVer = strrep(regexp(openglInfo.Version, '(^[\d.]+)(?=.*)', 'match', 'once'), '.', ''); % if numel(openglVer...
836bb21dc6171945ae44cb2b88ed635e7bfa76ba9ed5f6a60f5bf0f7c111856f
MATLAB
1,690
67
%%******************************************************* %% Doptdesign: D-optimal experiment design. %% %% max log(det(sum_{i=1}^p lambda_i v_i v_i^T)) + const %% %% s.t. lambda_i >= 0, sum_{i=1}^p lambda_i = 1. %% %% Note: const = n. %% V: nxp matrix with n <= p. %% lambda: lambda_i is the fractio...
aff8c80a568b340f3bf8fe063bc7f67c74bf467531597ad8916dff89af608ef7
MATLAB
1,690
59
%islvector - Test if parameter is a (pseudo) logical vector satisfying an optional list of tests. % % USAGE % % test = islvector(x,test1,test2,...) % % x parameter to test % test1... optional list of additional tests (see examples below) % % EXAMPLES % % % Test if x is a logical vector ...
690605436ca14850c6846a915a69af1beff944076f62257ca2adf56ed7ba0a25
MATLAB
1,691
58
function [Theta] = tikhonov_MetaInfer(rp,X,F_prime) % 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 B...
2063c61e3512a958c7af1459787ab387db5106bbf4fcdd83b909d61c12163e2d
MATLAB
1,692
47
% r = getRadAvg(im) % --------------------------------------- % % Return the radial average of input square image im % % Inputs: % im Square image % % Outputs: % r Radial average % % --------------------------------------- % % A detailled description of the method can be found in : % "Descloux, A., K...
2d75d298d7bbfdbdbb45e205fd149b09d1d31d2eb25a1563ef8dc48c9ae73bb8
MATLAB
1,692
39
function [bins,binNames] = discretize(inputData,edges) %DISCRETIZE Create a categorical array by discretizing numeric data. % BINS = DISCRETIZE(A,EDGES) returns the bin numbers obtained by discretizing % the numeric array A into categories. EDGES is a numeric vector that % contains bin edges defining the categor...
d74c3234505f16f0bfcec5e1d212a1bbb930dbf73e427e2db25f792e9e766248
MATLAB
1,692
51
function [q, X, Y, Z] = domain2vec(domain, resolution) %DOMAIN2VEC matrix of column vectors for meshgrid points % [q, X, Y, Z] = domain2vec(domain, resolution) returns a matrix of % column vectors for the meshgrid point coordinates over a parallelepiped % domain with the given resolution. The individual c...
043bd5f7c541c19de2ded9946656a4e5d6551a2c1515a26fffcd6047f5fbfff5
MATLAB
1,693
90
function [vertex,face] = read_vtk(filename, verbose) % read_vtk - read data from VTK file. % % [vertex,face] = read_vtk(filename, verbose); % % 'vertex' is a 'nb.vert x 3' array specifying the position of the vertices. % 'face' is a 'nb.face x 3' array specifying the connectivity of the mesh. % % Copyright (c)...
5abebf9b11a507951a3114beccb1400b421a0fcd6700c1d57b9fccc0a8729975
MATLAB
1,693
57
function I = shift_reconstruct(Y,shifts,diffphase,us_fac,Nr,Nc,Np,method,add_value) % applies 3-d sub-pixel shifts to an input image % INPUTS: % Y: input image (double 3d tensor) in space (real) or frequency (complex) domain % shifts: shifts % diffphase: phase difference % us_fac: upsampling...
a7a68b15e7a6747e1b87ff6f34398c0bdf96ad2d289da71b724bfc399202d3a9
MATLAB
1,693
51
% [labels, start, stop] = Boris.Tabulated.load(filename) % Returns a list of events encoded with BORIS. % Output: % labels: 'behavior1', 'behavior2', ... % start: [start1, start2, ...]; % stop: [stop1, stop2, ...] % % epochs = Boris.Tabulated.load(filename) % Output: % {'behavior1', [start1, stop1, st...
a83a3c00f75e0999a3c67d88287c527560ab5ef7bccdd8a563ab76d659a2dac6
MATLAB
1,693
65
function new = DBDuplicate(old,new,varargin) %DBDuplicate - Duplicate database. % % USAGE % % name = DBDuplicate(old,new) % % old database to duplicate % new new database name (see NOTE below) % % NOTE % % Database names can include wildcards to indicate current date and time: % % ...
c16d65eeb46fa4555e4e35fd77e60598bd74cbdee373374d526e201e7baf781f
MATLAB
1,693
54
% Box volume maximization % Boyd, Kim, Vandenberghe, and Hassibi, "A Tutorial on Geometric Programming" % Written for CVX by Almir Mutapcic 02/08/06 % (a figure is generated) % % Maximizes volume of a box-shaped structure which has constraints % on its total wall area, its total floor area, and which has lower %...
c371275b2e5310e0e56d3635d3db38feef0f45777f37e1106814f052712c4222
MATLAB
1,693
46
function [H] = translate(T); % TRANSLATE returns the homogenous coordinate transformation matrix % corresponding to a translation along the x, y and z-axis % % Use as % [H] = translate(T) % where % T [tx, ty, tz] translation along each of the axes % H corresponding homogenous transformation matrix % Copyrig...
ce6dec8e58c6f4f3b1eedee7ee146a80fd9c1787770536569fc2e418716368ce
MATLAB
1,693
68
function cells = ValidCells(self) % returns matrix 'cells', an Nx2 matrix of [Tetrode Number, Cell Number] of viable cells % if f_min is set, the number of total spikes/total recording time (not given epoch set time) must be >f_min % for that cell to be included % if checkdrift~=1 && exist('checkdrift'), then the sc...
f4fcf84d4524dcabe8931a9b047b4088eb10411dea28f3bf2d4f5d9fddec0b63
MATLAB
1,693
73
% This file is a demonstration of how to call gbvs() % make some parameters params = makeGBVSParams; % could change params like this params.contrastwidth = .11; % example of itti/koch saliency map call params.useIttiKochInsteadOfGBVS = 1; outitti = gbvs('samplepics/1.jpg',params); figure; subplot(1,2,1); imshow(imr...
98507e43af29a8574dce81ebeb1086a9acc3cd9f1a96d216006a482bc80872c3
MATLAB
1,694
57
function till_save_nii(vol,img) file = vol.fname; if contains(file,'.nii.gz') for i=1:numel(vol) vol(i).fname = file(1:end-3); end if ndims(img)<4 spm_write_vol(vol,img); elseif ndims(img) == 4 nimg = size(img,4); if ~isequal(vol(:).mat) warning('4D...
e48749e69fa3737a8e409eaa04f13b59b5fc958cf9e1b8f9dc14cd5b2167db8b
MATLAB
1,694
50
function obj=facet_wrap(obj,col,varargin) % facet_grid Create subplots according to one factor, with wrap % % Example syntax (default arguments): gramm_object.facet_wrap(variable,'ncols',4,'scale','fixed') % This is similar to faced_grid except that only one variable % is given, and subplots are arranged by column, wit...
ea03a3284c5c1dcce33aaf0d573d2785465c45172728f076e00a76a8f3276d17
MATLAB
1,694
58
function [S, f] = plot_spk_spectrum(self, cel) % plots the Frequency power spectrum for spiking % % Returns % S -> spectrum % F -> frequency vector % % andrew bogaard 3 april 2010 import CMBHOME.Utils.* AddChronuxPackage; params.Fs = 40; % set params for spect function. bin in .025s bins params.f...
04ca98ccdbc0d24b732d14fa0fe1ca093bbb68c937bb7842447bcd6ba86c410b
MATLAB
1,695
42
% GIfTI Class for MATLAB % % Geometry format under the Neuroimaging Informatics Technology Initiative % (NIfTI): % http://www.nitrc.org/projects/gifti/ % http://nifti.nimh.nih.gov/ % % This MATLAB class is part of SPM: % https://www.fil.ion.ucl.ac.uk/spm/ % % It rel...
f8f0a5e06b4dad771f56616dd9b3e17967a27bad0db7029abc1ad9ec1a62c5ea
MATLAB
1,696
70
function [h mu ul ll] = circ_mtest(alpha, dir, xi, w, d) % % [pval, z] = circ_mtest(alpha, dir, w, d) % One-Sample test for the mean angle. % H0: the population has mean dir. % HA: the population has not mean dir. % % Note: This is the equvivalent to a one-sample t-test with specified % mean direction. ...
ffd25699597cb3e3dbd85f320506249154bf337e02954608dfed7937fe8d6039
MATLAB
1,696
62
% Maximum volume inscribed ellipsoid in a polyhedron % Section 8.4.1, Boyd & Vandenberghe "Convex Optimization" % Original version by Lieven Vandenberghe % Updated for CVX by Almir Mutapcic - Jan 2006 % (a figure is generated) % % We find the ellipsoid E of maximum volume that lies inside of % a polyhedra C described ...
5952aa37b891b46133bc16dfd809c6aa48017aebebde1a61d6b5b6cb023a0b2f
MATLAB
1,697
77
function dout=getSpectroEnv(data,t,wt,wr,wot,fs) % Usage ... y=getSpectroEnv(x,t,ww_twid,ww_franges,ww_tskip,fs) % % data, time (t) for data, wt (window width in time), % wr (frequency ranges), wot (window skip time), fs (sampling freq), if ~exist('fs'), fs=1/mean(diff(t)); end; if ~exist('wot'), wot=1/fs; en...
88bef8f8a88da6865d230d51a8d510668e9bace60990640c61c832aaf27d5274
MATLAB
1,697
49
function Z = zstream(action,D) % Compress/decompress stream of bytes using Deflate/Inflate % FORMAT Z = zstream('C',D) % D - data stream to compress (converted to uint8 if needed) % Z - compressed data stream (uint8 vector) % FORMAT D = zstream('D',Z) % Z - data stream to decompress (uint8 vector) ...
8c7e0072de9663a01d7f7b6751f1a2e592fbc002acf6632e03dfedd412ec5e14
MATLAB
1,697
45
function sout = cvx_power_warning( flag ) %CVX_POWER_WARNING Controls the CVX warning message for x.^p expressions. % CVX converts power functions like x.^p, for variable x and fixed p, into % solvable form using an SOCP transformation. For quadratics x.^2 and square % roots x.^(1/2), a single second-orde...
b8810a09c76060bd34c1bafe7caa091b903debd5f4d720f707fdedb4ffb77d72
MATLAB
1,697
48
% kurt() - return kurtosis of input data distribution % % Usage: % >> k=kurt(data) % % Algorithm: % Calculates kurtosis or normalized 4th moment of an input data vector % Given a matrix, returns a row vector giving the kurtosis' of the columns % (Ref: "Numerical Recipes," p. 612) % % Author: Martin Mckeown, CNL...
4b42b161af8a8348ee52be7c1e702ec7acb801cc7655bd3265931bbe0c50a537
MATLAB
1,698
32
function [tapers,eigs]=dpsschk(tapers,N,Fs) % Helper function to calculate tapers and, if precalculated tapers are supplied, % to check that they (the precalculated tapers) the same length in time as % the time series being studied. The length of the time series is specified % as the second input argument N. Thus ...
b06f43ac1abfe6eb7195c6ba7891efadd08c0b7987f60849884bdc438eca0f88
MATLAB
1,698
41
function [upcovar,upmu] = updatecov(data,covar,mu,addrow,delrow,option) % This function updates the mean and covariance matrix of the full data % after adding or removing observations. % % Input arguments: % data : the original data % covar : the covariance matrix of the data % ...
9210afdd96a08e580f748a593b47cf716f6f0829a40a1c50c5a6599f4af6fd3c
MATLAB
1,699
67
function scenario = scenario_QAr_Qb_sump(par) % r(Q,A), b(Q), p(Q+A,Q+A) scenario.name = "QAr_Qb_sump"; % define parameter set (names) scenario.parnames = {'r0','K','b0','beta','p0','H'}; % organize parameters in structure form scenario.make_par = @(p) struct( ... 'r0', p(1), ... 'K', p(2), ......
13ff70ceea67c0c8dc020f6a6564c007789e88abab5ed13731a5318d4364421e
MATLAB
1,700
42
function Ad = adendotd(dense, d, sparAd, Ablk, blkstart) %#ok % Ad = Adendotd(dense, d, sparAd, Ablk, blkstart) % % ADENDOTD Computes d[k]'*Aj[k] for Lorentz blocks that are to be factored % by dpr1fact. % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.1 by I...
24ebad8d1872f1889fe9e9d8343917cb86a6a34ff1b058a7740e8b3b8ce77791
MATLAB
1,700
49
%% Point3D - object representing a Point in 3D spaec % "no frills" Version % % 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 classdef Point3D < plotable3D & han...
9196da108a9a28d5d4836726c5e1ba8311fff7f767da42f74153322d6a4d233e
MATLAB
1,700
64
function [ks_t0, ks_t1, anim_windows_sec] = restrict_time_drift(animal, shank, ks_times, tracks, metadata_dir) %all outputs in seconds load([metadata_dir '\ChannelSetsByTrack_forSpikes_V2']); %load file containing time window information %load(['F:\Ephys Analysis\ChannelSetsByTrack_forSpikes_V2']); %removed a...
c022a640e16bb00e3d72f919b4f11c32929c1df40bb3a00a827e0d3c85b7934c
MATLAB
1,700
41
function y = qblkmul(mu,d,blkstart) %#ok % y = qblkmul(mu,d,blkstart) % % QBLKMUL yields length(y)=blkstart(end)-blkstart(1) vector with % y[k] = mu(k) * d[k]; the blocks d[k] are partitioned by blkstart. % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.1 b...
42a63c197cda5d3b9b185cb0ba0518ca1655e27a506461cb9e24abd01bf40f6a
MATLAB
1,701
43
function data_out = importvelocity(filename, dataLines) %IMPORTFILE Import data from a text file % M001HBASELINE1VELOCITY = IMPORTFILE(FILENAME) reads data from text % file FILENAME for the default selection. Returns the data as a table. % % M001HBASELINE1VELOCITY = IMPORTFILE(FILE, DATALINES) reads data for ...
8fdf47bbaec95b50d8f1e8da6fd0f3f6ccaf3f35522018bb4ed92442a1ad4ed1
MATLAB
1,701
30
%% qMetric to parquet % For now, create only one parquet files and keep matlab struct for the GUI yourQMetricFile = dir('/home/netshare/zinu/JF070/2022-06-13/ephys/site1/qMetrics/qMetric.mat'); load([yourQMetricFile.folder filesep yourQMetricFile.name]) qMetricSummary = table('Size',[length(qMetric.clusterID), 10],...
c5a9b02c17704f5e6d3445d24cec8e50b670ee3afe3df588d619b93ad264cbdb
MATLAB
1,702
58
function [R P b] = plot_velocityrate(self, cel, params) % Plots firing rate as a function of running speed (pre2016) % % root.plot_velocityrate(cel) % root.plot_velocityrate(cel, params) % % Plots the firing frequency of cell cel against animal running speed for % root.epoch (if multiple, they are all concatinated. Se...
0e2b9a7dc65f811302e39c68514aeaefafd1100880fe42f332e670b9a2144b92
MATLAB
1,703
47
function warnUnknownOptions(opts, known, pipelineName) % warnUnknownOptions Warn about opts fields the pipeline will silently ignore. % % warnUnknownOptions(opts, known, pipelineName) % % MATLAB struct field names are case-sensitive, so a misspelling such as % opts.nrepeats when the pipeline reads opts.nRepeats ...
65d5bc8b66f9d2e1c082d11cab4e547a59f85bc99dc8d675248a46d406ca7626
MATLAB
1,703
48
function [H] = scale(S); % SCALE returns the homogenous coordinate transformation matrix % corresponding to a scaling along the x, y and z-axis % % Use as % [H] = translate(S) % where % S [sx, sy, sz] scaling along each of the axes % H corresponding homogenous transformation matrix % Copyright (C) 2000-2005,...
83476e6e677b609f0f934fd3d85be87db4302f3f7b3b74a10f8979cd181ae070
MATLAB
1,703
50
%%******************************************************************* %% HKMdirfun: compute (dX,dZ), given dy, for the HKM direction. %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%*******************************************************************...
0135e6bf2dddca6026b6b63132743f56ccfd842f7669765761a4f9cba74288ec
MATLAB
1,704
55
function ea_autocrop(input, output, opts) % Crop the image to its minimum bounding box arguments input {mustBeFile} output {mustBeTextScalar} = '' % Overwrite input by default opts.mask {mustBeNumericOrLogical} = false % Do not mask the image (remove background) by default opts.margin {must...
0a398db32dfa3405dc551465e234560ae5c71289e8332db44801932dce724824
MATLAB
1,704
50
% eeg_getica() - get ICA component activation. Recompute if necessary. % % >> mergelocs = eeg_getica(EEG, comp); % % Inputs: % EEG - EEGLAB dataset structure % comp - component index % % Output: % icaact - ICA component activity % % Author: Arnaud Delorme, 2006 % Copyright (C) Arnaud Delorme, CER...
122c7dd0e9ef5865f88f81927bdbe3524e12f814a9f60b94bcb7bb7c09050bc5
MATLAB
1,704
62
function r = circ_r(alpha, w, d, dim) % r = circ_r(alpha, w, d) % Computes mean resultant vector length for circular data. % % Input: % alpha sample of angles in radians % [w number of incidences in case of binned angle data] % [d spacing of bin centers for binned data, if supplied % ...
1c764aed2d986753d4a7e637aa7fbb9dba7e244f9a52290a6a27a28c93b28543
MATLAB
1,704
48
%% Frequency band segment % fRanges{1, 1} = [1.8, 2.2]; % prediction % fRanges{2, 1} = [0.6, 4.4]; % delta % fRanges{3, 1} = [4.6, 7.6]; % theta % fRanges{4, 1} = [8.1, 13.2]; % alpha % fRanges{5, 1} = [14.1, 32.5]; % beta % fRanges{6, 1} = [34.9, 69.8]; % gamma % fBands = {'prediction', '\delta', '\theta', '\alpha', '...
8fe3248a21d47511881a087170c7e227ab678b56e8fcaaf40d47c63697fc55cc
MATLAB
1,704
50
function data=ea_readUI(UI) %readUI Attempt to read a user input. % % DATA = readUI(UI) reads a user input described in UI and returns the % relevant data. An empty array is returned if UI could not be read. % % Remark: % Attempts to read UI are made in the following order: % 1. Binary ma...
37f75b32d6c3d3544c5a3a15c1d15a05850d803d8e7bb21f372e17ca5b1654ff
MATLAB
1,705
67
function scenario = scenario_Qsumr_Qb_sump(par) % r(Q,Q+A), b(Q), p(Q+A,Q+A) scenario.name = "Qsumr_Qb_sump"; % define parameter set (names) scenario.parnames = {'r0','K','b0','beta','p0','H'}; % organize parameters in structure form scenario.make_par = @(p) struct( ... 'r0', p(1), ... 'K', p(2...
a6d86903d569f8829d428113fdf21e6052c14d20456f72e57d8af5cc239d58cd
MATLAB
1,705
65
%% RDIR Enhanced - Examples of use % % This script demonstrates how to use the different abilities of the % enhanced |rdir| function. % % Examples are based on |matlabroot| directory content. Results may vary % depending on your version of Matlab. % %% Standard use rdir([matlabroot, '\*.txt']) %% Using double wildcar...
3d4a6181ccdc291c1d87ca5bfcf63410648dcab7ffd1295f9116512fe0837631
MATLAB
1,707
50
function [data,indices] = GetSpikeFeatures(group) %GetSpikeFeatures - Get spike features. % % USAGE % % features = GetSpikeFeatures(group) % % group electrode group % % OUTPUT % % features (timestamp,group,cluster,features...) t-uples. % % NOTE % % Contrary to e.g. GetSpikes, this functio...
d3b8a39b3bfac8947151a13a2a99f9c86dff8d1d14c8b715abaa41ba66e4bd69
MATLAB
1,707
55
function cvx_optpnt = exponential( sx ) %EXPONENTIAL Exponential cone. % EXPONENTIAL, called with no arguments, creates three scalar variables X, % Y, and Z and constraints them to lie in an exponetial cone. That is, % given the declaration % variables x y z % {x,y,z} == exp_cone % constraints th...
374d41bbdeb4418b345c1d4daffcac5c049f006bee27896a91806a27f2dc89dc
MATLAB
1,708
65
function p = editParamStruct(p) fignum = figure('NumberTitle','off',... 'Menubar','none',... 'Toolbar','none',... 'Name', 'Edit Parameters'); clf; pos = get(fignum,'position'); fnames = fieldnames(p); thei = -[0...
a862eb4ac9219b74ea10626b98da73f89005222a987f8c44e7bd4c987a5bcdef
MATLAB
1,708
58
function write_off(filename, pnt, plc) % WRITE_OFF writes a set of geometrical planar forms (called piecewise linear complex, PLC) % to an ascii *.off file, which is a file format created by Princeton Shape Benchmark % % Use as % write_stl(filename, pnt, tri) % % See also READ_OFF % Copyright (C) 2010, Cristiano Mi...
52880f5311365292c7dfb8f0f23a6b526c52eb2dbae8192e9f3b43d2aa0ad503
MATLAB
1,710
62
function r = circ_r(alpha, w, d, dim) % r = circ_r(alpha, w, d) % Computes mean resultant vector length for circular data. % % Input: % alpha sample of angles in radians % [w number of incidences in case of binned angle data] % [d spacing of bin centers for binned data, if supplied % ...
16dc1f54b0113abc3367dda78109c0f3a40fe6a2c75e95323f211c89694d72d9
MATLAB
1,711
34
%% Place field rate map n_bin_maze = 100; % number of spatial bins c_L_bin = c_L_path/n_bin_maze; % bin size c_sigma = 3; % Gaussian kernel width (in bins) c_kernel_G = normpdf(-ceil(3*c_sigma):ceil(3*c_sigma),0,c_sigma) ... / sum(normpdf(-ceil(3*c_sigma):ceil(3*c_sigma)...
76bbb7be0538fca982a521d3688f9881e902b3aa7d437f20f939ab6bcd4a0135
MATLAB
1,711
40
function vatlist = ea_sweetspot_getvats(obj) % Return list of VATs numPatient = length(obj.allpatients); vatlist = cell(numPatient*2,2); modelLabel = ea_simModel2Label(obj.M.vatmodel); disp('Construct VAT list...') for sub=1:numPatient % Original VAT E-field stimFolder = [obj.allpatients{sub}, filesep, 'stim...
bf19103201eb63546cf00a89c6028aef77b0de47aaf71b35406a057f37a887f8
MATLAB
1,711
62
function [returnVar,msg] = RemoveDCfromDat(fname,nbChan) % USAGE: % RemoveDCfromDat(fbasename,nbChan) % This function removes DC from dat files by computing the average of % the first 1e6 samples (or less if file is smaller) % INPUTS: % fname: dat file name % nbChan: total number of channel...
2f0dc8cbb8e9bc32dd7bf1f0a0108ee338987349f55c7b719dd0a1b6892186ed
MATLAB
1,712
49
function Z_flip = CBIG_MMLDA_behavior_to_zscore(behavior, regressor, behavior_sign, refpara) % Z_flip = CBIG_MMLDA_behavior_to_zscore(behavior, regressor, refpara) % % Convert behavior matrix to zscore with respect to reference cohort. % 1. Regress out regressors with respect to reference. % 2. Zscore withe respect ot ...
8a3ce581f298a2e9a121734056242ca782ce87a1a1311d00a4e7e91401c72775
MATLAB
1,712
40
function vatlist = ea_unified_ss_getvats(obj) % Return list of VATs numPatient = length(obj.allpatients); vatlist = cell(numPatient*2,2); modelLabel = ea_simModel2Label(obj.M.vatmodel); disp('Construct VAT list...') for sub=1:numPatient % Original VAT E-field stimFolder = [obj.allpatients{sub}, filesep, 'sti...
48768f40eda38e1f0bf5f5de31d37a27c8277a45d60f6c10d127b9adf3beef96
MATLAB
1,713
54
function [x,phi,a,phi_knot,rho_c,p] = corrC2L(x,phi) % Find the linear correlation between a linear and circular variable as in % R. Kempter 2012, Journal of Neuroscience Methods. % % Inputs: x - the linear variable % phi - circular variable (must be in radians) % % Output: x - Same as the input l...
88df680451ab4d512f2d88cccf9249a1f605f9060c44427687f4c92b3567dc61
MATLAB
1,713
68
function scenario = scenario_sumr_sumb_sump(par) % r(Q+A,Q+A), b(Q+A), p(Q+A,Q+A) scenario.name = "sumr_sumb_sump"; % define parameter set (names) scenario.parnames = {'r0','K','b0','beta','p0','H'}; % organize parameters in structure form scenario.make_par = @(p) struct( ... 'r0', p(1), ... 'K', ...
1182a0a1844d4c9c649787b186bd4371adfccfa602ad183c347671b8bd45a97d
MATLAB
1,714
58
% SPLITBY split a string while respecting grouping % % SPLITBY(str, '.', {'"', '[]'}) splits `str` on each period which is % not enclosed in square brackets or double quotes. function parsed = splitby(str, to_split_by, to_respect) % make convenient structure out of delimiter arguments delims = cellfun(@delim_d...