sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3648577a780090abc0995163bee6872bbb0c9baf19b3ff629cb54db5a577e99c
MATLAB
1,714
50
%% Figure 2 supplemental 1 YOURDATAPATH = ''; % Load kinematics fileList = searchFilesRecursive(YOURDATAPATH, 'kinematics_all.mat'); load(fullfile(fileList.folder, fileList.name)) %% Panel A: % Plot finger centroid traces for all mice plotParams.plotTargets = false; plotParams.traceAlpha = 1; plotParams.traceLineWidt...
7c429e96b49f0fe3adec112db5f33cfd41bd2208a6d9cae8e5b0f0c73d92958d
MATLAB
1,714
36
% SOFA API - demo script % Load HRTF in ARI format and save as SOFA format % 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") % ...
806859464ab28ae9d9ffe55326c4a52acd35fcfabdc2e28605f36348ea498bd1
MATLAB
1,714
54
function [xran sine] = sinefit_columnardata(data) % This takes a timepoint of columnar imaging data % example data: % data = flybyfly.one{2}{2}(11:18,:); % example script: % d = flybyfly.ten{1}{1}(3:10,:); % [x2 s2] = sinefit_columnardata(d); % [m2 pos2] = getBumpPos(x2,s2); % figure; scatter([1:length(pos2)]...
972be1cfe01bf8ba026230631f58453d5e5a4cf8a283b13db015d14d5eed4c8d
MATLAB
1,716
59
%isimatrix - Test if parameter is a matrix of integers (>= 2 columns). % % USAGE % % test = isimatrix(x,test1,test2,...) % % x parameter to test % test1... optional list of additional tests % % EXAMPLES % % % Test if x is a matrix of doubles % isimatrix(x) % % % Test if x is a mat...
b99429d5758619304f22330182577d130dbc6ac86bc58eed7cebd9737c553dc0
MATLAB
1,716
51
% eeg_epoch2continuous() - convert epoched dataset to continuous dataset % with data epochs separated by boundary events. % Usage: % >> EEGOUT = eeg_epoch2continuous(EEGIN); % % Inputs: % EEGIN - a loaded epoched EEG dataset structure. % % Inputs: % EEGOUT - a continuous EEG data...
d1ad9d10d11f22483f4d51eb0bd23939e03f9ae11e9ae841375d97bb8c71c4b7
MATLAB
1,716
55
%%************************************************************* %% Asum: compute the matrix %% %% Ay = Asum(blk,A,y) %% %% input: A = a CELL ARRAY with m columns. %% y = mx1 vector. %% permAy = a permutation of [1:m] coding the order to %% sum the matrices y(k)*Ak, k = 1,...m...
dc22d7b15527e1518405d3e97a82c9df794915dc8200c3e55dbc9732b43f1d07
MATLAB
1,716
47
function [path P] = path_from_pred(pred,d,varargin) % PATH_FROM_PRED Convert a predecessor array into a path to a vertex. % % path = path_from_pred(pred,d) returns the list of vertices on the path % from a source vertex to a vertex d. The predecessor array is a row % vector such that % pred(i) = 0 if vertex i is ...
dbb0710efd8a5f18fef1dbe8a39b1c0f5cf43c8ec1303891a911c71f1175dd7c
MATLAB
1,718
37
function tifFileList = updateTifFileList(animalName,params,tifFileList) % updateTifFileList takes experiment data compiling params and updates % tifFileList with fissa, scaled fissa, and check for corresponding paths %confirm tif folder in tifFileList agrees with animal directory if ~all(contains({tifFileList.ma...
cd4a0b5aeee028300b494c34a8e3da9d3b84432e88905b843e11384908b339cd
MATLAB
1,719
71
ext_path = pwd; ext_default_path = fullfile(ext_path, 'default_packages'); if(strcmp(mexext, 'mexmaci64')) path_to_add = fullfile(ext_default_path, 'matlab_bgl_mac64'); else path_to_add = fullfile(ext_default_path, 'matlab_bgl'); end if(exist(path_to_add, 'dir')) addpath(path_to_add); end path_to_add = fullfile...
0add17c7deb3548c491aa533552e16c5d2d708ecb55a0d053880801ca3c59d99
MATLAB
1,721
54
% convolve() - convolve two matrices (normalize by the sum of convolved % elements to compensate for border effects). % % Usage: % >> r = convolve( a, b ); % % Inputs: % a - first input vector % b - second input vector % % Outputs: % r - result of the convolution % % Aut...
0edcc4e076a449779c9bde806345fb113c8d45171b9986ac841021349966be24
MATLAB
1,722
50
% Plots and identifies the various colorbrewer tables available. % Is called by cbrewer.m when no arguments are given. % % Author: Charles Robert % email: tannoudji@hotmail.com % Date: 14.10.2011 load('colorbrewer.mat') ctypes={'div', 'seq', 'qual'}; ctypes_title={'Diverging', 'Sequential', 'Qualitative'}; cnames{1...
c0f734219d27e98b86499f8cf007d0e7799ad42c9b8a352b7fbd399a6fc60f64
MATLAB
1,724
68
function v = cvx_classify( x ) % Classifications: % 1 - negative constant % 2 - zero % 3 - positive constant % 4 - complex constant % 5 - concave % 6 - real affine % 7 - convex % 8 - complex affine % 9 - log concave % 10 - log affine % 11 - log convex monomial % 12 - log convex posynomial % 13 ...
20e43ba30013eefdbca46124d9741a4e93086590993973dbfb1d3cdbf38966a3
MATLAB
1,725
54
function ClincFreq_VLSM(INDIR,OutVLSM,SetUpPara,Para,dbmask,ParaVLSM,COVVLSM) [V,D,namelist] = Dynamic_read_dir_NIFTI_sparse(INDIR); D(isnan(D)) = 0; D(isinf(D)) = 0; D = D>0; Dvol = sum(D)'; Dvole = sum(D,2); IgV = Para.IgP; indexs = find(Dvole>=(size(D,2)*IgV/100)); if ~isempty(indexs) for i = 1:size(ParaVLSM,1) ...
7dcd987271292ed291c826bcda8e1d128039b1b06567eb6764309f6dcf66a119
MATLAB
1,725
42
function x = qframeit(lab,frmq,K) % x = qframeit(lab,frmq,K) % % *********************** INTERNAL FUNCTION OF SEDUMI ******************* % % See also sedumi % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1) % % Copyright (C) ...
9076343d0bc39fb84fe602e28242c4d20a0628f0203da00eb456c76007fa96d3
MATLAB
1,725
46
function apref = ea_antspreset_legacy_quick(cmd) if ischar(cmd) % 'query' mode, return the name of the preset apref = 'Legacy: "Quick"'; return end normsettings = cmd; % cmd is the 'normsettings' struct switch normsettings.ants_metric case 'Mutual Information' apref.metric='MI'; apref.metr...
a0cc51f3ff8c8eb88cb99f5c51bfbb1ffa93139854b6aecdb3ba2e5959c34523
MATLAB
1,725
45
function epigraph( varargin ) %EPIGRAPH Declares an epigraph variable. % EPIGRAPH VARIABLE x % where x is a valid MATLAB variable name, declares a scalar % variable for the current cvx problem, and specifies it as % the objective of a minimization. There is no need to declare % a separate MINIMIZE command. %...
9f166b66318fbcf0b9731cde24817a660b034f53d7ebbb67d197263d68b1b2d7
MATLAB
1,726
47
% this function detects potential malware in the current folder and subfolders % % Author: A. Delorme, Cotober 2013 function detectmalware(currentFolder); if nargin < 1 currentFolder = pwd; end; folderContent = dir(currentFolder); folderContent = { folderContent.name }; malwareStrings = { 'eval(' 'evalin(' 'eva...
01712c0949dadb09f9dbdc94838b766b6123d7e7adc5c38802389bd5ed8ca0aa
MATLAB
1,728
67
function varargout=savebnm(fname,varargin); % a compact binary format for saving a matrix. (using float) % % % savebnm(fname,M1[,M2,M3,...]); % % Can save multidimensional matrices containing: Nans,Imaginary numbers and Inf % % see loadbnm % % Aslak Grinsted 2004 april % % ------------------------------...
233f2095ff0288cee6f5f2cc0126c5f532395a5003930427cca62115226282ef
MATLAB
1,728
55
function plot_vector(X,f,plt,Xerr,c,w) % Function to plot a frequency dependent vector X. If error bars are specified in Xerr, % it also plots them. Xerr can either contain upper and lower confidence intervals % on X, or simply a theoretical confidence level (for the coherence). Used % to plot the spectrum and coheren...
63a3d7727a0a5686c3b08cb6c24ad27e97c8b13d2f3483e2a3ed27dc66ad0f3b
MATLAB
1,728
54
function ea_discfibers_roi_nimage_sel(obj) % subroutine to load in rois and create an N-image for Lead-DBS % fiberfiltering projects. if isempty(obj.roidata) ea_discfibers_roi_collect(obj); end tdir=ea_getleadtempdir; for side=1:size(obj.roidata.nii,2) cnt=1; for v=obj.patientselection obj.roidat...
a5ee1e750c2d1efc4e462e4b2311e05acaaadd6aa15edc35439e6ec5baa7db8d
MATLAB
1,728
48
function [X p ei ej] = chrobak_payne_straight_line_drawing(A,varargin) % CHROBAK_PAYNE_STRAIGHT_LINE_DRAWING Draw planar graphs with straight lines % % X = chrobak_payne_straight_line_drawing(A) generates coordinates for each % vertex such that a planar graph A can be drawn without any edge % crossings. This function ...
d4cc2396a1461318d94b05381a725ef84ba942567666d4c5d5d8c671dc1fb1d2
MATLAB
1,728
37
classdef CBIG_Yeo2011_unit_test < matlab.unittest.TestCase % Written by XUE Aihuiping and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md methods (Test) function test_example(testCase) CBIG_CODE_DIR = getenv('CBIG_CODE_DIR'); load(fullfile(CBIG_CO...
4bd50e252dfbed7d5ffc1650500d39ac9734ce3af0823b550c8784cddddfadd6
MATLAB
1,730
60
function [PL]=phaselockunitLV(spikes_ch,fLFP) %this version takes in spike times and LFP at 1k Hz % baseline_power=(norm(fLFP)^2)/length(fLFP); %if you want a threshold %find troughs of fLFP hLFP=hilbert(fLFP); aLFP=angle(hLFP); [pks, pLFP]=findpeaks(aLFP); %pLFP is index of troughs (10...
519d97261f7f929b10027596eee640b08b8aace63c54069d79e756f698247d78
MATLAB
1,730
64
function [h,p,T] = BartlettTest(data,alpha) %BartlettTest - Test if k groups of samples have equal variances (homogeneity of variances). % % This test assumes that all populations follow a Gaussian distribution. % % USAGE % % [h,p,t] = BartlettTest(data,alpha) % % data Nx2 matrix of (observation,grou...
577c3789e2d554aecbe1d773475471014db92329430a3f4891d6e98afc3020e1
MATLAB
1,730
56
function [output, firstIndexPoint] = read_4d_hs( filename, outfile) %read_hs_file Reads in BTI-Headshape files % filename: file with the headshape informations % outfile: if present, a ctf ".shape" file is written % output: if present, a 3xN matrix containing the headshape-points % % (C) 2007 by Thomas Hartman...
48822009a90aea1c63345519b69704c65fe82c7b6619a16a4a35a1e8675dcebd
MATLAB
1,731
53
function [auc, rocCurve] = normalizedAUC(params, split) % normalizedAUC(params) % % ---------------------------------------------------------------------- % Matlab tools for "Predicting human gaze beyond pixels," Journal of Vision, 2014 % Juan Xu, Ming Jiang, Shuo Wang, Mohan Kankanhalli, Qi Zhao % % Copyright (c) 2014...
5b706558dd1a98eac5a23a1e65f0e1f3a14d0bf89c75276f1d657dcbf0658d61
MATLAB
1,731
39
function [xunitv, yunitv] = ea_calcxy(head, tail, y) % Calculate the unit vectors of x and y markers of the lead % % head and tail coordinates should be accurate. The rotation/orientation of % the y marker in the x-y plane is more important than the absolute % coordinate (it will be recalculated/adjusted). Here input y...
daf60f37fa7ce4610d4c98dd0c64cf74c13269bfda14c3511a1c0c5ed84a3ece
MATLAB
1,732
47
function handles = Call_loadbin(loadmovieflag, Mem_max, w, f_wait, handles) tic if loadmovieflag binfilelist = handles.RegPara.savename; if ~iscell(binfilelist) binfilelist = {binfilelist}; handles.RegPara.savename = {binfilelist}; end grad = handles.movieinputgrad; Ly = handles.size...
138c2cffa0eda6262e9614c18646dac08f64f2b6d22e436729d091e9a3ee4eaf
MATLAB
1,733
68
function descriptions = GetEventTypes(selection) %GetEventTypes - Get event types (= unique descriptions). % % USAGE % % descriptions = GetEventTypes(selection) % % selection optional patterns of event descriptions; see examples below % % EXAMPLES % % % Get all event descriptions % descriptions = Ge...
98c77373f7b0939216df2215513d9f9e64a8cf8a9a8ecbca5e02675ebc82f186
MATLAB
1,733
60
function ea_resample_image_by_spacing(inputimage, spacing, dosmooth, addvox, nninterp, outputimage, dimension) % Resample image by spacing, wrapper for ANTs ResampleImageBySpacing % % spacing: output image spacing, 1*3 vector % dosmooth: smoooth output image, default = 0 % addvox: pad each dimension by addvox, defa...
644ef6886d54bec673f9f2d2f15f8ac545dc917f73f394b794a9dd60434161d1
MATLAB
1,734
72
function F_stdshade(amatrix,alpha,acolor,F,smth,width) % Adapted from Simon Musall's script(2010/4/23) % https://www.mathworks.com/matlabcentral/fileexchange/29534-stdshade % % usage: stdshading(amatrix,alpha,acolor,F,smth,width) % - alpha defines transparency of the shading (default is no shading and black mean l...
7922b62a475e969a26b08ec7c2b8dccb2fac2f09564b541770bea830429c9fac
MATLAB
1,734
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 whic...
bdccd09eb0fdc6dfba36f25ccd8fe28358c47b984055cd6f5c9d5f637d41b11a
MATLAB
1,734
75
function [x,yp_out,xi_mid,yi_mid]=calcRadius3b_up(proj,mii) % Usage ... x=calcRadius3b_up(proj) if (nargin<2), mii=[]; end; xp=[1:length(proj)]; yp=proj; xi=[1:0.01:length(proj)]; ypi=interp1(xp,yp,xi,'spline'); % get overall max [max_p,max_pi]=max(ypi); % look into the left side of the max min1=min(ypi(1:max_pi));...
d336978a67f8be60959f880790e48b0f3e9932187ea63404ea8081dde0676220
MATLAB
1,734
43
function [biomass,biomass_high,biomass_low] = estBiomassFromSplineSamples(S_sample,T,BO,biomassScaleFactor) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome time-series datasets, and % predicts biologically relevan...
d57bcb1eef96861dcbfabf103a3cc813f8e4b803ef4baf82a1a20b24d26ee7d1
MATLAB
1,735
57
function [r,rs]=calcRadius6(im,rmask_struc,inv_flag,fit_flag) % Usage ... [r,rs]=calcRadius6(im,rmask_struc,inv_flag,fit_flag) if ~exist('fit_flag'), fit_flag=''; end; if ~exist('inv_flag'), inv_flag=''; end; if isempty(fit_flag), fit_flag=0; end; if isempty(inv_flag), inv_flag=0; end; check_flag=1; if iscell(im), ...
1db09793c10399b9a027e39ccfd58f2e0993f9f392c091af8b8c4ee2360004d4
MATLAB
1,737
69
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 dir...
189239aca1538aebcdb8c4491517264ba43ce30102c5ebc5d8f8ff9212f2dcb0
MATLAB
1,738
63
% [r, udata, sdata] = getMultiplicity(data) returns the occurrences/Multiplicity of the elements of 'data' % % Inputs: % data : n-dimensional input array % % Outputs: % rep : # of occurrences for each element of 'data' % udata : sorted 1-D array of unique values in 'data' % sdata : sorte...
cb69fce7ef4cbbd00da2ce64517e1cfe8d96ae47642746e3e6ec4c0cc93b19a4
MATLAB
1,739
48
function v=edge_weight_vector(As,A,varargin) % EDGE_WEIGHT_VECTOR Returns input for the edge_weight option for a weighted % matrix % % Given a structural and weighted matrix pair (As,A), this function returns % input for the edge_weight option. The structural matrix As can have % arbitrary non-zero values, but the non...
eb16dec0941616578f8bd2931998551721be19543dbba9801ad01051cbae973b
MATLAB
1,739
54
function ea_listatlassets(options,handles,mninative,oldatlas) % mninative==1: MNI space, ==2: native space if ~exist('oldatlas','var') oldatlas=''; end % dir 'atlases' folder atlases = dir(ea_space(options,'atlases')); atlases = {atlases(cell2mat({atlases.isdir})).name}; % only keep folders atlases = atlases(c...
133effd69c2b2694f459ca91c96280eb0daaf38121347b04b083c857c2d19fdc
MATLAB
1,741
55
% do Bayesian inference on Honda dataset load honda_data_processed_all.mat; doBayesianInference('params_perturb/','output_perturb/',T,intervene_matrix,perturbations,densities,species_names,total_biomass,experimentBlocks); % example of computing trajectories % load processed data and MCMC samples load output_pe...
097c7a0f504b50387dfd5082ab88e3abf3641aa289dfe75a6e836578982ba852
MATLAB
1,742
52
function ea_synthsr(input, output, opts) % Wrapper to run SynthSR arguments input {mustBeTextScalar} output {mustBeTextScalar} opts.ct {mustBeNumericOrLogical} = false % For CT scans in Hounsfield scale opts.sharpening {mustBeNumericOrLogical} = true % Unsharp masking by default opts.flipping {mustB...
26e89fce8c14b69505676989f84b6e7a623d209463c38a8051b25c1b88151fe7
MATLAB
1,742
56
function [adfreq, n, ts, fn] = plx_ad_gap_info(filename, channel) % plx_ad_gap_info(filename, channel): read a/d info from a .plx or .pl2 file % % [adfreq, n, ts, fn] = plx_ad_gap_info(filename, channel) % % INPUT: % filename - if empty string, will use File Open dialog % channel - 0-based channel number or ...
2ad20f30fad1dcd5105952cb8db19c947ec8624d0f5dd6ef0b71913474f9560b
MATLAB
1,742
44
function integer( varargin ) %INTEGER Declares an integer variable. % INTEGER VARIABLE x % where x is a valid MATLAB variable name, declares a scalar variable for % the current CVX problem, and constraints it so that it can assume only % integral values. % % INTEGER VARIABLE x(SZ), where SZ is a size vector,...
3a59f98c8c8dfea18311150c69edd45e64bda4671422a3c6c37313498e52515e
MATLAB
1,743
51
% Euclidean projection on a halfspace % Sec. 8.1.1, Boyd & Vandenberghe "Convex Optimization" % Joelle Skaf - 10/04/05 % % The projection of x0 on a halfspace C = {x | a'*x <= b} is given by % minimize || x - x0 ||^2 % s.t. a'*x <= b % It is also given by P_C(x0) = x0 + (b - a'*x0)*a/||a||^2 ...
4ede5a16e427a7bcaea2eea996d1b3dcc4d2022e14df487d316de424da98b2a7
MATLAB
1,743
64
function ea_discfibers_showroi(obj) % Function to draw seeds/roi/VTAs (from E-fields) in Lead-DBS % fiberfiltering explorer if ~obj.roivisible if ~isempty(obj.roidata) try for side=1:length(obj.roidata.nimage) try delete(obj.roidrawobject{side}.toggleH); end tr...
102e6e843b440337f8c265699fff46bfade46c30dcf2355e8286e8ded40ffede
MATLAB
1,744
72
function [fid, pnt, label] = read_ctf_pos(filename) % READ_CTF_POS reads Polhemus file created with the CTF digitizer application % % Use as % [fid, pnt, label] = read_ctf_pos(filename) % Input: % filename - Polhemus ASCII file containing digitized points % % Output: % fid - fiducial locations of fiducial...
ee4476fad3a7ab7c52aeff7be0a70ba3748392e0d279ba6deaa190d31ab19e2c
MATLAB
1,744
58
function [occupancy, xdim, ydim] = Occupancy(self, xdim, ydim, mergeepochs, dim) % Returns occupancy matrix of time spent in 2D spatial bins % % Returns occupancy matrix of time spent in bins of dimension 3x3cm^2 be % default. occupancy = root.Occupancy(xdim, ydim) where will return a matrix of % dimensions xdim by yd...
021247fe4f140c1d4a64c8ad7e43fc444d5238a40ead715e8b6dc2c8bea164d3
MATLAB
1,745
36
% written by Yiyuan Han, Essex BCI-NE Lab, 23/06/2020 % The Final Experiment %% Load data %load('/Users/yiyuan/OneDrive - University of Essex/RobustDataset.mat') %% %%%%%%%%%%%%%% Classification Performance %%%%%%%%%%%%%%% % mainfolder = '/Users/yiyuan/OneDrive - University of Essex/PG Research/0A_Journal/202004_unk...
907093894e444d17076564e0f72d0f9eb97e30c19f74d293e4f60baf03e2a6d3
MATLAB
1,745
54
% Floor planning with an optimal trade-off curve. % Boyd, Kim, Vandenberghe, and Hassibi, "A Tutorial on Geometric Programming" % Written for CVX by Almir Mutapcic 02/08/06 % (a figure is generated) % % Solves the problem of configuring and placing rectangles such % that they do not overlap and that they minimize the a...
ae248742b553351fc131e35da1a704f1adff9c007a2ba4c18f7cab574b4d764d
MATLAB
1,745
45
function ax = UIsubzoom(ax) %UIsubzoom Adds a context menu for zooming subplots to full figure. % UIsubzoom creates a context menu for the current axes that allows the % user to move the current axes to a zoomed position filling (most of) % the parent figure. Unchecking the zoom option restores axes to th...
e79b86ff6a9a56a7c51d421d3c2100e09a10387634fb78d2c74723a77e0bcb10
MATLAB
1,745
55
function ea_setpath(options) % Set or unset MATLAB search path for Lead-DBS % % When set the path, some subfolders (e.g. mambaforge) will be ignored. % When unset the path, only Lead-DBS root folder will be kept, subfolders % will be removed. arguments options.unset {mustBeNumericOrLogical} = false end leaddbsRoo...
3c8c56ca41150a23a3e3ddbcf94e7281b20169e7453bf3e52e54f7b9cf2cde5a
MATLAB
1,746
60
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % demo script to convert a closed surface to a binary image %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% preparation % user must add the path of iso2mesh to matlab path list % addpath('../'); %% load the samp...
aa9ca0db20596b240606cad99d4462c5211a646bd964b90d9f1a8c8053871ae3
MATLAB
1,746
52
function ea_gencheckregpair(moving,fixed,outfn, options) % function that uses FSL SLICER tool to create a checkreg figure. arguments moving {mustBeFile} % registered moving image fixed {mustBeFile} % fixed image, edge will be generated based on it outfn {mustBeTextScalar} % output png file path options....
cc427b29ff4a04751dac058072507d08c9db5300e249455cc4eebd0164865260
MATLAB
1,746
55
function [fig, varargout] = draw_volume_bluewhitered(volume_to_plot, data_to_plot, camera_view, markersize) % draw_volume_bluewhitered.m % % Draw data on 3D volume using blue-white-red colormap for % negative-zero-positive values % % Inputs: volume_to_plot : volume of mask in nifti format (3D array) % data_to_p...
fdb8f88973e4aaed5ba9dc24153af59e4af13219343967f7affccfa94ba18e37
MATLAB
1,746
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 ve...
1d5acb7a1d0c1f3e8e6ca69d06822a43f430e20e51a9caaa2ab44c8bd659e78c
MATLAB
1,747
53
function IsolDist = IsolationDistance(Fet, ClusterSpikes, m) % IsolDist = IsolationDistance(Fet, ClusterSpikes, m) % % Isolation Distance % Measure of cluster quality %add % Inputs: Fet: N by D array of feature vectors (N spikes, D dimensional feature space) % ClusterSpikes: Index into Fet which ...
233944d4ef55bb6657432e0db78f9ed96797375a02f0241b60b04728e6002c4b
MATLAB
1,747
62
% Figure 6.19: Polynomial fitting % Section 6.5.3 % Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX by Joelle Skaf - 10/03/05 % (a figure is generated) % % Given data u_1,...,u_m and v_1,...,v_m in R, the goal is to fit to the % data a polynomial of the form % p(u) = x_1 + ...
cdb7d12bdbd0a658c5ed17a643da0b2c5e61770ff1f57e975a01c989843b1876
MATLAB
1,747
45
function call_plotsometrace(handles) mainfig_pos = get(handles.mainfigure, 'Position'); clear trace_stamp_pool trace_num_all ttlabel_pool for k = 1:length(handles.datafilename) handles = loadtrace(handles, k); framestamp = handles.framestamp{1}; stampinfo = handles.stampinfo{1}; if handles.plotRawdff ==...
be0b73d3844a0bf5c8b3cb5fed343c86726b16400f22c6589b22163549c1e626
MATLAB
1,748
55
function [node,face,elem]=meshunitsphere(tsize,maxvol) % % [node,face,elem]=meshunitsphere(tsize,maxvol) % % create the surface and/or volumetric mesh of a unit sphere % centered at [0 0 0] and radius 1 % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % tsize: maximum size of the surface triangles (from 0 ...
1844352b0c5b765fc100904a97b8e0b1bee6c12dcccd3f23fa0a46759e503f66
MATLAB
1,749
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: ups...
625ea8989786de326346a09901ecad2bf8fca8e0e8c03cd1ccf71ab3ec99cb94
MATLAB
1,749
40
% 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...
a3e4068e371d57d466eaaebeab196a86f0cc2ab1b128ab86da9c94cb9978412d
MATLAB
1,749
45
function param = loadParameters_wave_func %% loadParameters_wave_func.m % % Contains all the parameters of the wave model and the % computational parameters for the simulations/calculations. It is % necessary to make an instance of the function before you can use the % parameters. % % Example: % >> param = loadP...
cb57becd973343880ec71937c6643a6af3afea7f14111b5c9f810df75fa1bfed
MATLAB
1,749
69
function scenario = scenario_r1sumr_sumb_constp(par) % r(Q+A,Q+A), b(Q+A), p constant % r has form (r1+r0(Q+A))/(K + Q+A) scenario.name = "r1sumr_sumb_constp"; % define parameter set (names) scenario.parnames = {'r1','r0','K','b0','beta','p0'}; % organize parameters in structure form scenario.make_par = @(p) s...
509d67a2564c79d9277580e0aa2a74a47954909311ac1b2f4bad17b2fd4294a2
MATLAB
1,750
92
function dt = DistanceTransform(b) %DistanceTransform - Compute distance transform of a binary matrix (distance to nearest 1 value). % % This function assigns to every point (x,y) in a binary matrix B the distance % to the nearest point in B with value 1. It uses the Euclidean metric for % computing distances. The ...
59c70f99fecfad24f73ea577d3106e8ef65523c3fc5457a8fcee2279c71e30be
MATLAB
1,750
55
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 su...
bddd4b8500ed1b6ecf4cc72f71450135f3109d3a6f8c1d5b3b91126734061c39
MATLAB
1,750
45
% How to use these scripts: % To set up and prep the analysis, you'll need a "main project directory" % and several subdirectories with standard names: "data", "scripts", "results" % % Image data (.nii/.img) should be in the "data" directory. % Create a "scripts" directory and put a copy of the script % "canlab_simple_...
1834f51cb665e2f597a9314d0208c6e24a018a849297c4428e5721869b222499
MATLAB
1,751
53
% size() - size of memory mapped underlying array % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008 % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % 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 Free Softwa...
228a06795bb000f02cba532d32372a9bd95b43758957a009488e978c1ea275b0
MATLAB
1,751
36
%% PaCER/EXAMPLE_4.m - Demonstrate display atlas data with PaCER reconstructions from CT's previouly transformed to atlas space % % Andreas Husch % Centre Hospitalier de Luxembourg (CHL) / Luxembourg Centre for Systems % Biomedicine (LCSB), University of Luxembourg % mail@andreashusch.de / husch.andreas@chl.lu % 2017 ...
72e5699cd88f402281b947fba0d63e81018ce7e5995f439271ee717484b69e42
MATLAB
1,751
64
clear all; close all headpath = ['/Users/kathmn01/Dropbox (NYU Langone Health)/nagellab/Nick/data/all flies/']; cd(headpath) allflies_filenames %% % subpath = '/Users/kathmn01/Dropbox (NYU Langone Health)/nagellab/Nick/exploratory figs/lin filt/'; savepath = '/Users/kathmn01/Dropbox (NYU Langone Health)/nagellab/Ni...
0942be2307295fe21645b9b065bb8417f3129cc5568a9a4d6fd3d6d60b016ae9
MATLAB
1,752
50
function computeTurnBouts(allflies,angvelthresh) angvelthresh = 10; for u = 1:length(allflies) % allflies(u).angvel = 100 * diff(allflies(u).camH); turnindsR = []; turnindsL = []; turnindsR = find(allflies(u).angvel>angvelthresh); turnindsL = find(allflies(u).angvel<-angvelthresh); ...
30e4f641942f114b01bb07b2ca401c21a48ded978ee0bd9ab1affb2a99b27c8b
MATLAB
1,752
48
% std_savedat() - save measure for computed data % % Usage: std_savedat( filename, structure); % % Authors: Arnaud Delorme, SCCN, INC, UCSD, 2006- % Copyright (C) Arnaud Delorme, SCCN, INC, UCSD, October 11, 2004, arno@sccn.ucsd.edu % % This program is free software; you can redistribute it and/or modify % it under t...
6829e0dbe62ecc73221e416748382b672381e5d8bed5fa9e095f0cd5ef70cc21
MATLAB
1,754
63
function A = EllipseDirectFit(XY) % Direct ellipse fit, proposed in article % A. W. Fitzgibbon, M. Pilu, R. B. Fisher % "Direct Least Squares Fitting of Ellipses" % IEEE Trans. PAMI, Vol. 21, pages 476-480 (1999) % % Our code is based on a numerically stable version % of this fit published by R. Halir and...
e05269b9cf66d8eb8b5094fe93b4c1d662915abfa858da3a5dcfb7073812248c
MATLAB
1,754
59
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Hello World - The "getting started" example of iso2mesh %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % In this example, we illustrate the basic mesh density and precision % controls in iso2mesh. %% the first step is to...
8073bdb8b81f7be3f450e30f428363fa35e7886999b0d7c38f7bbe88b2e05b81
MATLAB
1,755
73
%% Example 1 of running basic topic model (LDA) % % This example shows how to run the LDA Gibbs sampler on a small dataset to % extract a set of topics and shows the most likely words per topic. It % also writes the results to a file %% % Choose the dataset dataset = 1; % 1 = psych review abstracts 2 = NIPS pa...
d77cc5c88b91a7e9d37807117b34a2466d28ce25c53dbe52fed6f8855e233101
MATLAB
1,755
45
% pop_dipfit_manual() - interactively do dipole fit of selected ICA components % Function deprecated. Use pop_dipfit_nonlinear() % instead % Usage: % >> OUTEEG = pop_dipfit_manual( INEEG ) % % Inputs: % INEEG input dataset % % Outputs: % OUTEEG output dataset...
dc2fa1f7f22576d3329ae0ce4139f9d29e4d7d120f4e0b1e08ff6e1ba3b2ea0e
MATLAB
1,755
64
function ea_explorer_showroi(obj) % Function to draw seeds/roi/VTAs (from E-fields) in Lead-DBS % fiberfiltering explorer if ~obj.visualization.roivisible if ~isempty(obj.roidata) try for side=1:length(obj.roidata.nimage) try delete(obj.roidrawobject{side}.toggleH); end ...
7a2f379a8c9a548f9c7de3466f681db0e67672345554d496d789e5121d3941d8
MATLAB
1,757
62
% imP = im2pol(imC) % --------------------------------------- % % Transform an image from carthesian to polar coordinate % % Inputs: % imC Input image in carthesian coordinate % % Outputs: % imP Output image in polar coordinate % % --------------------------------------- % % A detailled description of...
92fa5b485c74c758575ad441375a491841846dceebca9eb17cd70668ae2ec75a
MATLAB
1,757
61
function [d dt pred] = bfs(A,u,varargin) % BFS Compute the breadth first search order. % % [d dt pred] = bfs(A,u) returns the distance to each vertex (d) and the % discover time (dt) in a breadth first search starting from vertex u. % d(i) = dt(i) = -1 if vertex i is not reachable from vertex u. % pred is the pred...
01e034e881faca733e234d3fc9b104503eb3819fbb6c0933f19aea0a6f8bfc41
MATLAB
1,759
79
function plotGaussian3D(mu, Sigma, nStd, color, plotAxes) % plotGaussian3D % % Plots a 3D Gaussian ellipsoid and optionally a point cloud. % % INPUTS: % mu - 3x1 mean vector % Sigma - 3x3 covariance matrix % nStd - Number of standard deviations for ellipsoid (default = 2) % X - (optional) Nx3 point clou...
c5b56e2caf01585ac4bc614490c07ed265003202a524b03358eb826161f759ea
MATLAB
1,759
68
function savemphtxt(node, face, elem, filename) % % savemphtxt(node, face, elem, filename) % % save tetrahedron mesh to comsol file (.mphtxt) % % author: Donghyeon Kim (danielkim<at> gist.ac.kr) % date: 2011/09/29 % % input: % node: input, node list, dimension (nn,3) % face: input, surface face ele...
62201a47a4b2c24b317ce6ef67c1e5df4ae3cb14120a2efb7d5d203fb63eb56e
MATLAB
1,760
42
function ADA = getada2(ADA, DAt,Aord, K) %#ok % ADA = getada2(ADA, DAt,Aord, K) % % GETADA2 Compute ADA += DAt.q'*DAt.q % IMPORTANT: Updated ADA only on triu(ADA(Aord.qperm,Aord.qperm)). % Remaining entries are not affected. % % ******************** INTERNAL FUNCTION OF SEDUMI ******************** % % See also s...
165bab41dc3ae37eb395aaef0bce00d5b0bb04c9806195bb852e87704331b08a
MATLAB
1,761
51
% At startup, matlab will find a file startup.m assumed to be located in directory specified by % the environmental variable MATLABPATH (see http://www.mathworks.com/help/matlab/ref/startup.html). % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md % Modified by Mervyn L...
7edfda6a19a810e6ca384f9ed78a79dda7bbc19fe65048fb8e821942937c8bc4
MATLAB
1,762
51
function waveStruct = ReadDotNum(fname) % waves = ReadDotNum('C:\Users\Holger\Desktop\Test data Ehren\CRE45\140513_1432_pedestalCircleTrack.2') packetLength = 216; %Given in DacqUSBFileFormats.PDF %open raw event file and error check fid = fopen(fname,'r','ieee-be'); %file formats PDF specifies big-endian if (fid ==...
ad279a64d99968b521e96c94bd9b07d7f48de88ef1be6ae798acf86ca3a8b326
MATLAB
1,762
58
function SaveFig(chPath, hFIG, cFIGNAME, chOption) % Synopsis: % SaveFig(chPath, hFIG, cFIGNAME, chOption) % % Utility to save figures. Save figures in the handle vector hFIG in the folder % provided by chPath under the names provided in the cell array cFIGNAME; By % default a .png and .pdf files are saved. This ca...
22749f6d1658e32656b8a4c2deaf8ce98461fd27b3b1c894bcad9fb2779c4232
MATLAB
1,763
55
% Figure 8.10: Approximate linear discrimination via linear programming % 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 non- % separab...
36682e60b1426c9c3e642f89cae0e4e792810bea6bf40bb5cefd5c1dff1bbbd9
MATLAB
1,763
63
function [ints,keepints,containingints,inint] = RestrictInts(ints,restrictints) %[ints,keepints,containingints] = RestrictInts(ints,restrictingints) %restricts intervals to those only appearing in restrictingints. %Can also return indices of restricting ints that contain ints % %INPUTS % ints [Ni x 2] in...
0a415361db97a36edf0b1ac24779ba9bdd7505433b56e18379f528dbd106883c
MATLAB
1,764
60
% Vf = fuseVolW_multi(Vx, Vy, Vz, wl, range, N) % % This function uses fuseVolW to run the wavelet-based 3D image fusion % eight times, each time shifting the volume in one, two, or three of the % dimensions by (by default) one voxel, and averaging the results. range is % the possible shifts in each direction (def...
f5b5081f601682d5716c824bb31add9b3bf47a551259997f2ae0e5358db990b0
MATLAB
1,764
55
function output = ea_strjoin(input, separator) %STRJOIN Concatenate an array into a single string. % % S = strjoin(C) % S = strjoin(C, separator) % % Description % % S = strjoin(C) takes an array C and returns a string S which concatenates % array elements with comma. C can be a cell array of strings, a charact...
007da87b604325a5142824f041a33b8388ecd561f98dc4c11d49d158b665bac3
MATLAB
1,765
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 timestamp...
9376d1b64f2913656a69eb7aeb66511845fa0c1f9d41a501da980902b96d89d7
MATLAB
1,765
61
%% Optimization of a simple (Rosenbrock) function rosen = @(x) (1-x(1)).^2 + 105*(x(2)-x(1).^2).^2; % With no constraints, operation simply passes through % directly to fminsearch. The solution should be [1 1] xsol = fminsearchcon(rosen,[3 3]) %% Only lower bound constraints xsol = fminsearchcon(rosen,[3 3],[2 2]) %...
1534b8917462b24c803e180dcec2eea23da02c75b180cd419380c096caee1a49
MATLAB
1,766
59
function [comps,comp_sizes] = get_components(adj) %GET_COMPONENTS connected components % % [comps,comp_sizes] = get_components(adj); % % Returns the components of an undirected graph specified by the binary and % undirected adjacency matrix adj. Components and their constitutent nodes are % assigned the s...
8adb1469a72934d4e658e7581c048a1b31e9db53b5096b0a4104147742f38232
MATLAB
1,766
43
function h = draw_violin_manu(ax, data, x_pos, face_color, face_alpha, edge_color, width_scaler) % データの最小値と最大値を取得 min_val = min(data); max_val = max(data); % ksdensityでカーネル密度推定を計算 default_bandwidth = 1.2 * min(std(data), iqr(data)/1.34) * numel(data)^(-0.2); [f, xi] = ksdensity(data, ......
c9fa843befd691214580a807c611a363d0e664b32cb0f20a32c535004a31ee6e
MATLAB
1,767
83
function rval=rtest_1() n = 49; [A,b] = testmat(n,2); x0 = [1:n]'/(n+1); y0 = [1:n]'/(n+1); x = repmat(x0,1,n); y = repmat(y0',n,1); xy = [x(:),y(:)]; rval = 0; try T = mst(A); T = T + diag(diag(A)); rval = 1; catch lasterr end; try A(1,2)= -1; A(2,1)= -1; T = prim_mst(A); rval ...
d442da9dc61faacd49a53b4396d89d3bb146fac0f6cd2fec46784e3d5b85d18a
MATLAB
1,767
45
function [] = ea_defaultview_transition(v,togglestates) % transition between current view and defaultview H = findall(0,'type','figure'); resultfig = H(~cellfun(@isempty,strfind({H(:).Name},{'Electrode-Scene'}))); resultfig = resultfig(1); % take the first if there are many. togglestates_init = getappdata(resultfig,'...
f596b07cf716bc18e65448a2accb4a9edb2d70c2212aab00f998a0706e2d9ad4
MATLAB
1,767
49
function [eventsTable, recStart] = dan_convert_vmrk_events(eventsString, srate) % This function converts a BrainVision .vmrk file into the correct format % for danalyzer events %% % Authors: Dan Denis % Date: 2021-07-14 %% [eventsPath, eventsName, eventsExt] = fileparts(eventsString); vmrkStruct = readbvconf(ev...
5205d346b6e986d57d5d68a6d029ba5667a2c9a90426ec0c1f2cfdb829c9ce1e
MATLAB
1,768
46
function apref = ea_antspreset_legacy_fine(cmd) if ischar(cmd) % 'query' mode, return the name of the preset apref = 'Legacy: "Fine"'; return end normsettings = cmd; % cmd is the 'normsettings' struct switch normsettings.ants_metric case 'Mutual Information' apref.metric='MI'; apref.metric...
6ea291a898455b3b90c934a1343b1c856c993e9a31ec10518a0bf69c55255ced
MATLAB
1,769
44
%% Load data for Fig. 1h load('data_fig1h.mat'); %% Calculate amplitude spectrogram for Fig. 1h ts = data_fig1h.lfp; sniffonset_conds = { data_fig1h.sniffonsets }; para = []; para.freq = logspace( log10( 1), log10( 200), 100); % center frequencies for filtering para.bandwidth = logspace( log10( 2), log10( 30), 100); %...
3353789f87e0bf266ccf1a5546c796bdf119b345f4a7220f83916a260e22d244
MATLAB
1,770
58
function saveMethodsText(param, savePath, varargin) % bc.qm.saveMethodsText - Save methods text and BibTeX to files. % % Writes a .txt file containing the methods paragraph and formatted % references, and a .bib file containing BibTeX entries. % % ------ % Inputs % ------ % param : struct % The BombCell parameter str...
f37e25e0037098028eee7d16cb28cc2b12fea60e32a4e6c646debbd5bb21fecc
MATLAB
1,770
65
function img=surf2volz(node,face,xi,yi,zi) % % img=surf2volz(node,face,xi,yi,zi) % % convert a triangular surface to a shell of voxels in a 3D image % along the z-axis % % author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu) % % input: % node: node list of the triangular surface, 3 columns for x/y/z % face: triangl...
f1998afaae15d939b247c796f0b0ad2f5147ac232f7302b0172f5fe1442d0b84
MATLAB
1,771
46
function apref = ea_antspreset_legacy_default(cmd) if ischar(cmd) % 'query' mode, return the name of the preset apref = 'Legacy: "Default"'; return end normsettings = cmd; % cmd is the 'normsettings' struct switch normsettings.ants_metric case 'Mutual Information' apref.metric='MI'; apref....