sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e5404d819972ed22f793a9ee24730880940e9036b7986f48c5bd5290dda56814
MATLAB
1,262
51
function y = nansum(x,dim) % FORMAT: Y = NANSUM(X,DIM) % % Sum of values ignoring NaNs % % This function enhances the functionality of NANSUM as distributed in % the MATLAB Statistics Toolbox and is meant as a replacement (hence the % identical name). % % NANSUM(X,DIM) calculates the mean along any di...
33f2cac255b6954e16f974654ef834f139d77617c93c4d9fc8ff624144b12d90
MATLAB
1,263
40
% segment_calc_script tmp=dir; nfiles=length(tmp); names=cell(nfiles,1); for j=1:nfiles, names(j)=cellstr(tmp(j).name); end; wavnames=regexp(names,'.*wav$','match'); ind=~cellfun('isempty',wavnames); wavnames=wavnames(ind); segnames=regexp(names,'.*wav.seg.txt$','match'); ind=~cellfun('isempty',segnames); segnames=se...
6f8dde774b7711c20dccb9f39a24f0f5e5c6cc5d923225b44a8c5c26eac27d53
MATLAB
1,263
50
clear; clc; close all; addpath(genpath('../functions/')); SUBINFO_FILE = '../../subInfo/rid_sex_mDoB_yDoB_mExam_yExam_ageExam_dx_icv_bl.csv'; GMICV_FILE = '../../vbm_810bl/gmVolAndICV/rid_gmVol_icv_bl.csv'; %!!!!!! 1 for a+ CN, 2 for a+ MCI, 3 for AD dx = 1; K = 3; table = []; % Baseline age Q = 1; table = [table...
d1b4a241671cd392904d09f2175240c7e5d705f0322b143cfe77282f12338f6a
MATLAB
1,263
42
function plotPETH(hax, peth, tPts) % peth is row of peths struct array with fields means and sems % assumed to have 15 time series, if this isn't the case the colormap will % be wrong cmap = cmapTargs(); means = peth.means * 1000/10; % Convert to "events" per second from "events" per bin, bins are 10 ms sems = peth.sem...
fd87c0b39e243a687c65dda7b5aaefda0534eef5eac8f1b6df753c6a8a470527
MATLAB
1,263
31
function [cfeature_dff, cfeature_trace, feature_title]... = loadcustomfeature(variablename, variableinfo, datafilepath, datafilename) variableinfo2 = whos('-file', fullfile(datafilepath, datafilename)); cfeature_dff = []; cfeature_trace = []; feature_title = []; featurenum = 1; if ~isempty(variablename) f...
2cda53674cdea84a3186f9766c8fd2254ba7ce8104a4dc7f63da647f5c830268
MATLAB
1,264
33
function MouseClick(e, src) obj = findobj('tag','EventExplorerMaster'); FO = guidata(obj); %Get the info about the click with respect to figure, axes mousepoint = get(gcf, 'CurrentPoint'); clicktype = get(gcf, 'SelectionType'); clickcoords = get(gca, 'CurrentPoint');clickcoords = clickcoords(...
a365021be25c85a389a3cae659c0c5dc7c485198bcaeb535f3e4151eb81df9a7
MATLAB
1,264
39
% celltomat() - convert cell array to matrix % % Usage: >> M = celltomat( C ); % % Author: Arnaud Delorme, CNL / Salk Institute, Jan 25 2002 % % Note: This function overloads the neuralnet toolbox function CELLTOMAT, % but does not have all its capacities. Delete this version if you have % the toolbox. % Copyright (C...
ab4285edb8b8cd61ec6d15c8b74a1799000627c610be397b5e9574292663192b
MATLAB
1,264
37
function myPLS_plot_nulldistrib_Sp(S,Sp_vect,signif_LC,save_opts) % This function plots the null distribution of singular values obtained % with permutation testing % % Inputs: % - S : L x L matrix, singular values (diagonal matrix) % - Sp_vect : matrix with permuted singular values % - signif_LC : si...
07010aff320e3d387943fedbae4b444b158ed6abc9cb4401290142167b116b0b
MATLAB
1,266
26
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...
195f8ee3bba4afb496ade4d19e6fd881ffd13bfd2ac19db7eda19e14d546e9b5
MATLAB
1,266
47
function H = hankel(c,r) %Disciplined convex/geometric programming information for HANKEL: % HANKEL imposes no convexity restrictions on its arguments. Instead % of using the HANKEL function, however, consider creating a matrix % variable using the 'hankel' or 'upper_hankel' keyword; e.g. % variable X(5,5)...
a821d8dc3ba967fbdc2b8a56205be62cc65262f1b676bcc07f7df3821dd50d9b
MATLAB
1,266
45
function events = LoadEvents(filename) %LoadEvents - Read events from file. % % USAGE % % events = LoadEvents(filename) % % filename event file name % Copyright (C) 2004-2011 by Michaël Zugaro % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU Ge...
b8ec3c9fd8af27fa2d157720d2753eb6a11e2f6ffdd6fa197421c56766c867cf
MATLAB
1,266
32
function encoderHandle = encoderInit(serialNumber,initPosition) % function: encoderHandle = encoderInit(serialNumber,initPosition) % serialNumber: phidget device encoder device serial number % initPosition: initial position for all the stepper motors % Return: encoderHandle timeDelay = 5; encoderHandle = libpoi...
ce1b16eaa895a52c3424ba2bc97bf05ec02fe467adaa3d23b524c034f03ae429
MATLAB
1,266
35
function varargout=ea_calc_distance(varargin) % Example: % [normfactor,dist_mm,dist_vox]=calc_distance(priordist,trajectory,mat,nii) % priordist is the distance in real-life in mm % trajectory is the vector on which the electrodes lie % mat is the transformation matrix that has been used to change the % distances. % __...
59c12ae0cb37ebb2e5d7343ade81fa95e9f2418a8f392b91c71cd01f52504543
MATLAB
1,267
40
function o = cat(dr,varargin) % Concatenate file_array objects. The result is a non-simple object % that can no longer be reshaped. % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: cat.m 4136 2010-12-09 22:22:28Z guillaume $...
e455889e2877c30280f19e61f2271c871be0e889048efcaee3d0a569e96a0d9d
MATLAB
1,268
25
function [azi,ele]=nav2sph(azi,ele) %NAV2SPH Coordinate Transform. % [azi,ele] = nav2sph(azi,ele) vonverts navigational coordinates to % spherical coordinates. % % Input: % azi ... azimuth (-180 <= azi <= 180) % ele ... elevation (-90 <= ele <= 90) % % Output: % azi ... azimuth (0 <= azi <...
46f7c183bed6391aa160e71951ec77dd57f80a2369dd9c43864cbeceaa75a653
MATLAB
1,269
45
% Figure 6.9: An optimal tradeoff curve % Section 6.3.3 % Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX Joelle Skaf - 09/29/05 % (a figure is generated) % % Plots the optimal trade-off curve between ||Dx||_2 and ||x-x_cor||_2 by % solving the following problem for differe...
caec651590726e727ee3e460024bf19f1bc45755911d5a0300b8ba1119f43f42
MATLAB
1,269
26
function a = le( x, y ) % Disciplined convex programming information for LE (<=): % 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 a...
5002f2ac4e182cf1c6dd93294da7db8998aa255fef11682305716122959da4da
MATLAB
1,270
21
function fibcmap = ea_explorer_createcolormap(obj,gradientLevel) cmapShiftRatio = 0; shiftedCmapStart = round(gradientLevel*cmapShiftRatio)+1; shiftedCmapEnd = gradientLevel-round(gradientLevel*cmapShiftRatio); shiftedCmapLeftEnd = gradientLevel/2-round(gradientLevel/2*cmapShiftRatio); shiftedCmapRightStart = round(gra...
5c31fa8a2adb0fca12c0c5f154b9eb957f0898a4f38903dd1f03f8e6cc327848
MATLAB
1,270
46
% GAUSSKERNEL create a 2D gaussian. % % K = GAUSSKERNEL(SIGMAX,SIGMAY,N,M) % % K the kernel % SIGMAX, SIGMAY std in each dimension % N,M kernel dimensions % 27-feb-03 ES function K = gausskernel(sigmaX...
7fd22c49ed84f23063b8f7ba7c15bf98317ddc7811dc0c013e50fe64341404ac
MATLAB
1,270
43
function value = get(tree,uid,parameter) % XMLTREE/GET Get Method (get object properties) % FORMAT value = get(tree,uid,parameter) % % tree - XMLTree object % uid - array of uid's % parameter - property name % value - property value %______________________________________________________________...
d272040316852ba0b09cdd89ee89d98d722e96c03e449ebe671279717e033fc0
MATLAB
1,270
64
function [boxedX,Bx,By]=boxpdf(X) % Forces the pdf of data to have a boxed distribution using a data adaptive lookup table. % % [boxedX,Bx,By]=boxpdf(X) % % boxedX=N(X) where N is an data adaptive monotonically increasing function. % boxedX vary between zero and one. % % Bx,By describes the lookup table % ...
b989a481143fcc61f8c8686b7b205dc628bc167c1a596367da0b67d134a5c17d
MATLAB
1,271
38
function lfac = palm_factorial(N) % Computes the log(factorial(0:N)), so dealing with % precision issues. % % lfac = palm_factorial(N) % % _____________________________________ % Anderson M. Winkler % FMRIB / University of Oxford % Dec/2012 % http://brainder.org % - - - - - - - - - - - - - - - - - - - - - - - - - - - ...
dff10e9fd15605506ea08199c156c489052934cb26c2291b8b21ec6d3c9dbde0
MATLAB
1,271
38
function r = laprnd(varargin) %LAPRND Pseudorandom numbers drawn from the Laplace distribution % % R = IOSR.STATISTICS.LAPRND(N) returns an N-by-N matrix containing % pseudorandom values drawn from the Laplace distribution with mean = 0 % and standard deviation = 1. % % IOSR.STATISTICS.LAPRND(M,N) or IOSR.S...
539616ffd0a9283069d588d782677406951bb33114c4a24dd8bad0288adf2e4a
MATLAB
1,272
22
function SANDIinput = TrainMachineLearningModel_forGUI(SANDIinput, fig_ax) %%%%%%%%%%%%%%%%%%%%%%%%%%% USER DEFINED INFO %%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Define the parameters to build the training set. This can (and should) change according to the acquisition! % UB stands for upper bound. Model parameters values wil...
5cec23b98bfa615f7abdbde9e634ed468bdffc110132ecb1f185a63eb586fcba
MATLAB
1,272
69
function med = circ_median(alpha,dim) % % med = circ_median(alpha) % Computes the median direction for circular data. % % Input: % alpha sample of angles in radians % [dim compute along this dimension, default is 1, must % be either 1 or 2 for circ_median] % % Output: % mu mean direction ...
97050f2e22d4203b2cebcc32ef1d3b484ebc762ca8c80f6addc00fb0f3c2852d
MATLAB
1,272
58
function [xr2,yr]=calcRadius2(proj,parms2fit,xg0,penalty) % Usage ... xr=calcRadius2(proj,parms2fit,xg0,penalty) % % fit y y=proj; if nargin<4, penalty=[]; end; if nargin<3, xg0=[]; end; if nargin<2, parms2fit=[]; end; if isempty(xg0), rad0=length(y)/2; xg0=[length(y)*0.3 rad0 -0.5*(max(y)-min(y)) 0.95*max(y) ...
cbfa2c91cb84f969bc33031c9bfbd4db8332174a56f71cc54b7caebd7cc6b793
MATLAB
1,272
36
function X = random_graph_layout(G,box) % RANDOM_GRAPH_LAYOUT Layout the vertices of a graph randomly % % X = random_graph_layout(G) generate a random layout of the graph in the % unit box [0,0],[1,1] with vertex points generated at random. % % X = random_graph_layout(G,box) gives the coordinates of the layout box % [...
f8f1c00ecfe9cf78522e04033cf4fd26f07e5dd7a76e91a4cf3e190f21677692
MATLAB
1,272
42
function [ sessionInfo,success ] = bz_tagChannel( basePath,channums,tag,varargin ) %[ sessionInfo,success ] = bz_tagChannel( basePath,channums,tag ) tag the channels in channums with %the tag (string). %Will be saved in the sessionInfo as sessionInfo.channelTags.tag % %(options) % 'noPrompts' % 'overwrite' (def...
7044287bc85475ce0cea0021f335220b05395539e9288662b9b3c61a6866750e
MATLAB
1,273
24
function L = Laplacian_2D(phi) %LAPLACIAN Calculate the Discrete Laplacian of the current phi variable % For each (i,j) element of phi: % Laplacian(phi(i)) = % (phi(i+1,j)+phi(i-1,j)+phi(i,j+1),phi(i,j-1)-4*phi(i,j))/dx^2 %L = zeros(size(phi)); % L(2:end-1,2:end-1) = (phi(3:end,2:end-1) + phi(1:end-2,2:end-1) + ...
17af5721ea824241f118184ef088aaad1a91e1d39e2bfbc32d7d7a6fc77db9b9
MATLAB
1,274
37
% 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 if (~isdeployed) ...
51d041869e00d6d7eb9b7f2c63465aa83c6f751689e88316b9ff19f19d05ba9c
MATLAB
1,275
26
%% applyFSLTransformToPolyCoeffs - transform polynomial coefficient matrix in world coordinats of sourceRefImage to % world coordinates in targetRefImage applying a FSL (FLIRT) transformation matrix % % Parameters: coeffs - Nx3 matrix, coeffs(end,:) is the bias term (x^0) % fslTransMat - FSL transformation m...
58d91aa893b56b49ea1319a42b4e02bb721fa4e992a505173c75d033eaf1459a
MATLAB
1,275
37
% 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 if (~isdeployed) ...
60a9af863b8453ae51f8416b67acea5b2285529d7820013c99b1cdb5e659714b
MATLAB
1,275
33
function ClincFreq_Norm2MNI_CT_clinc(indat,inroi,outdir,outname,voxelsize,pth) %% Need to rebuild try [patdat,namdat,extdat] = fileparts(indat); % [patroi,namroi,extroi] = fileparts(inroi); load([pth,filesep,'norm2ct.mat']); % load([pth,filesep,'Norm2CT_est.mat']); pathspm = which('spm.m'); [patspm,namspm,extspm] = fil...
7f00bf72eb24e72b711ef4aec58a3efb93a5c0cfdf178eef5fcda38195a2c864
MATLAB
1,275
46
% rcepsminphase() - Convert FIR filter coefficient to minimum phase % % Usage: % >> b = minphaserceps(b); % % Inputs: % b - FIR filter coefficients % % Outputs: % bMinPhase - minimum phase FIR filter coefficients % % Author: Andreas Widmann, University of Leipzig, 2013 % % References: % [1] Smith III, O. J. (20...
e16d34ca4fa48c7b1d632c804cbea9a6a1f7c19a8e417a9c2a5a80309b7320ed
MATLAB
1,275
35
function parameterFile = ea_save_ossdbs_settings(options,S,settings,outputPaths) % Save simulation parameters in oss-dbs_parameters.mat and do a clean-up. % By Butenko and Li, konstantinmgtu@gmail.com arguments options % Lead-DBS options for electrode reconstruction and stimulation S % Lead-DBS s...
55d9b6ea393278011f6efb7d82a13798ba2e8f7eb445ba876272a8b8c0142fa1
MATLAB
1,276
39
function variablesel = featuresel(variableinfo, handles, disptext) mainfig_pos = get(handles.mainfigure, 'Position'); variablesel = []; pos = mainfig_pos; pos(1) = pos(1)+100; pos(2) = pos(2)+100; pos(3) = 300; pos(4) = 300; hplot = dialog('Position', pos, 'Name', 'Select variable'); ...
a77a668f38b5814a2ec7523d21618e45ac308e34fde08d57784cb2a7641f058b
MATLAB
1,276
32
function plotSubpopROIsCCF(dorsalMaps, allROIs) % Plots the ROI centroids colored by subpops % Figure allenMapSMc(dorsalMaps, [-3.6, 0, -2, 3]) % Creates figure by itself set(gca, 'Color', 'none') % Set sizes % Paper ready figure/axis formatting panelWidth = 1.699*1.2; panelHeight = 2.2*1.2; % This is the only way to...
ddd4e5b46a8e6cbbb79cb06b820c5b17f031127ce9a38ef0cfcb214b5f8d345e
MATLAB
1,276
49
% publish which files? str.maxWidth = 700; str.maxHeight = 500; str.evalCode = false; str.figureSnapMethod = 'print'; % publish( 'exampleLDA1' , str ); % publish( 'exampleLDA2' , str ); % publish( 'exampleVIZ1' , str ); % publish( 'exampleVIZ2' , str ); % publish( 'exampleimages1' , str ); % publish( ...
e04f35a962e9b8bc2fa4e66a2d8db2c15aa957be949e446699e79300b83ded5d
MATLAB
1,276
35
%%************************************************************************* %% linsysolvefun: Solve H*x = b %% %% x = linsysolvefun(L,b) %% where L contains the triangular factors of H. %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%***************...
a1d69e3a7507c9f92dd83942dccb4c51ecaa32feee8250af4c230da1dee9bc7f
MATLAB
1,278
47
function obj=geom_count(obj,varargin) %geom_count Display data as points which size vary with with %count % % Parameters: % 'scale': set the scaling factor between count and area % 'point_color': set how the points are colored 'edge', 'face', % 'all' p=inputParser; my_addParameter(p,'scale',20); my_addParameter(p,'poi...
f05b1adce73a1bc3c63293ce67fb503f7898ca31a6ccb66aa5d77c0c9662d5f4
MATLAB
1,278
40
function ea_synthstrip(input, output, opts) % Wrapper to run SynthStrip arguments input {mustBeTextScalar} output {mustBeTextScalar} opts.mask {mustBeTextScalar} opts.csf {mustBeNumericOrLogical} = true end % Check Conda environment condaenv = ea_conda_env('SynthStrip'); if ~condaenv.is_created ea_...
e0ba1621fc4eed863042dcc5080ef037bf7bb921a7f03790826db196aac5a874
MATLAB
1,279
44
function cmapOut = evalColormap(values, cmap) % Map a vector of values through a user supplied colormap % % cmapOut = evalColormap(values, cmap) % % Inputs: % values - Numeric vector of length N % customCmap - M×3 colormap array (e.g. 256×3) going from blue to red % % Output: % cmapOut - N×3 ...
325b609c63cb2996dd231ba2a9dd05c5b3817c56862bb52f2b8bd48b22b8a5fe
MATLAB
1,280
59
function [pval, f] = circ_ktest(alpha1, alpha2) % [pval, f] = circ_ktest(alpha1, alpha2) % % A parametric two-sample test to determine whether two concentration % parameters are different. % % H0: The two concentration parameters are equal. % HA: The two concentration parameters are different. % % Input: % a...
49779d9d5075fbe2dd0a31566bab2ea9c6e254e07b2b3f5320fabe0672c5db6e
MATLAB
1,280
28
function ea_createscrfmask(options) % Create refining basal ganglia masks for brain shift correction masks = {options.subj.brainshift.anat.secondstepmask options.subj.brainshift.anat.thirdstepmask}; if ~all(isfile(masks)) || options.overwriteapproved disp('Registering subcortical mask (Schoenecker 2008) to su...
7fe397fa0a3d17dd859845b135957bcffd9df7585210dffb5f5a0c7c420cdd5f
MATLAB
1,280
47
function tempname=mwpath(fname) % % tempname=meshtemppath(fname) % % get full temp-file name by prepend working-directory and current session name % % author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu) % % input: % fname: input, a file name string % % output: % tempname: output, full file name located in the ...
d4b77321287b92344a216214a3f4d154ab817f1e00f7912dae7e8db2aec62200
MATLAB
1,281
34
%% Generate trajectories y_pos = cell(n_tr,1); i_tr = 0; while i_tr < n_tr % Random walk + directional drift x_pos = cumsum(c_dL_rw * randn(1,n_step)) + c_dL_dir*(1:n_step); i_c_L_path0 = [0, find(x_pos < 0)]; i_c_L_path = find(x_pos > c_L_path); if ~isempty(i_c_L_path) i_tr = i_tr ...
f49c2c6c3635f2efdff9a12e4fb90bee9bffdbae17f12cb93941ab594eed9426
MATLAB
1,283
46
function [tuningCurve dim occ] = Tuning(self,variableName,root,varargin) % Parameters: % dim - Vector of edges for each for the bins % % numBins- If dim is not defined then creates numBins from the minimum of % var to max of var (linearly spaced) % % continuizeEpochs - (0) If 1 then take data from al...
2d4fd1684b57e64090a101496b3d2fa06a81390682096e878821cf0cee779718
MATLAB
1,284
38
clear; clc; close all; addpath(genpath('../functions/')); SUBINFO_FILE = '../../subInfo/rid_sex_mDoB_yDoB_mExam_yExam_ageExam_dx_icv_bl.csv'; GMICV_FILE = '../../vbm_810bl/gmVolAndICV/rid_gmVol_icv_bl.csv'; [rid_dx, ~, ~, ~, ~, ~] = get_data(SUBINFO_FILE, GMICV_FILE, 3); rid_AD = rid_dx(rid_dx(:, 2)==3, 1); rid_MCI...
d512800897acb58985518d29f750aa5f2f35db2bedc59568fa6f5e3c6e436085
MATLAB
1,285
39
function handles = registration_init(handles) handles.savingflag = 0; handles.savepath = ''; % set input data type if handles.datatype == 1 set(handles.moviedata_check, 'Value', 1) set(handles.imageseq_check, 'Value', 0) elseif handles.datatype == 2 set(handles.moviedata_check, 'Value', 0) set(handles....
4d99ada078a2a58f8dc487ea0b2426b34cdcd4e1e91efc6c03bb02e8d9dec687
MATLAB
1,286
36
% 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 Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md if (~isdep...
7b53b9822fe8de1c999c3a013b974978bd3c1aa4d50091032e88c399128f6673
MATLAB
1,287
48
function [varargout] = setpapersize(psize) % Usage ... setpapersize OR setpapersize([W H]) % % Sizes are in inches, if no input is provided it will set it to the % figure's screen size. % Note: it is best to print to a PostScript file of some sort since % printing to a .pdf file may give problems since the new p...
88fa2b375ced0ad9cf6eb374b7be4847661c81eb4d341580e745101783cb9d66
MATLAB
1,288
30
function ClincFreq_Norm2MNI_withT1_clinc(indat,inroi,indatT1,outdir,outname,voxelsize,pth) [patdat,namdat,extdat] = fileparts(indat); % [patroi,namroi,extroi] = fileparts(inroi); [patdatT1,namdatT1,extdatT1] = fileparts(indatT1); %% [patdat,namdat,extdat] = fileparts(indat); % [patroi,namroi,extroi] = fileparts(inroi)...
d3e5306dc0e9e76f4aa4a0f9058bbc1c99efbe73529b2bc6a2289943fc0eb3e4
MATLAB
1,288
59
function [Fet, nFeatures] = LoadFeatures(FileName,varargin); % [Fet, nFeatures] = LoadFet(FileName, BufSize, CluSubset) % % A simple matlab function to load a .fet file [BufSize, CluSubset] = DefaultArgs(varargin,{inf, []}); Fp = fopen(FileName, 'r'); if Fp==-1 error(['Could not open file ' FileName]); end nFe...
3f32ee6d728f96e8027090ae2b0b7b34f1420c907c9cb3d530dd2b05001bea3c
MATLAB
1,289
54
function ea_largestcomponent_nii(fname,cnum) % helper function that reduces the nifti components to the largest % component. nii=ea_load_nii(fname); nii.img(isnan(nii.img))=0; nii.img=logical(nii.img); C=bwconncomp(nii.img); ls=cellfun(@length,C.PixelIdxList,'Uniformoutput',0); ls=cell2mat(ls); [~,ix]=sort(ls); [pt...
b42b01e163490611ee10915a74677b5fbdd24684f3f8f80885f19ad361f377f9
MATLAB
1,289
39
function varargout=ea_explorer_stats_ranksumtest(varargin) % Function to estimate a certain mass univariate test (see below) as used % in explorer apps. % - Expects valsin as V x N matrix where % V is the number of % voxels/streamlines/etc and % ...
c7a5ecb689e6a62b01253cf3ffcfa34f96bbbdc0eef83dde092d5e04ad5fe9e0
MATLAB
1,289
52
function arm = CBIG_MMLDA_get_arm(ARM_file, rid) % arm = CBIG_MMLDA_get_arm(ARM_file, rid) % % Get ARM value and combine it with diagnosis to determine whether it's LMCI, % EMCI or SMC. % % ARM: % 1=NL (ADNI1 1.5T only) % 2=LMCI (ADNI1 1.5T only) % 3=AD (ADNI1 1.5T only) % 4=NL (ADNI1 PET+1.5T) % 5=LMCI (ADNI1 PET+1.5...
e8ab8625d84481b3f603c814466099c67f40b8d00260497268e6e199ebaf4679
MATLAB
1,290
41
% DENDHIER: Recursive algorithm to find links and distance coordinates on a % dendrogram, given the topology matrix. % % Usage: [links,topology,node] = dendhier(links,topology,node) % % links = 4-col matrix of descendants, ancestors, descendant % distances, and ancest...
472d5f96c6a86c75b467e3cf715b96878d14e3cd3d7d08cfa3d1e41f6639df7c
MATLAB
1,291
34
function axonStateFolder = ea_sourceIndex4AxonStates(outputPaths, side, source_index) % Add source index to each Axon_state file % IMPORTANT:this is a special case for multisource prob. PAM % By Butenko, konstantinmgtu@gmail.com arguments outputPaths % various paths to conform with lead-dbs BIDS structure...
e7a24c5ba4c395bade53eb1aea0c8fec15a36b42aaa525c268ab84c5dc87d281
MATLAB
1,291
38
function plot_matrix(X,t,f,plt,Xerr) % Function to plot a time-frequency matrix X. Time and frequency axes are in t and f. % If error bars are specified in Xerr, % it also plots them. Xerr contains upper and lower confidence intervals % on X. % Usage: plot_matrix(X,t,f,plt,Xerr) % Inputs: % X: input vector as a funct...
f7167ab17154e3c56182423332c3d61a34c2df44cbbd775ba91ecd28f856594e
MATLAB
1,291
45
classdef Box < uix.Container & uix.mixin.Container %uix.Box Box and grid base class % % uix.Box is a base class for containers with spacing between % contents. % Copyright 2009-2015 The MathWorks, Inc. % $Revision: 1165 $ $Date: 2015-12-06 03:09:17 -0500 (Sun, 06 Dec 2015) $ p...
0bb3763c315e27b98418b60e739d84d4951fdffb7e4d281a88cce96672bb87c6
MATLAB
1,292
45
% Spectral factorization using Kolmogorov 1939 approach. % (code follows pp. 232-233, Signal Analysis, by A. Papoulis) % % Computes the minimum-phase impulse response which satisfies % given auto-correlation. % % Input: % r: top-half of the auto-correlation coefficients % starts from 0th element to end of the au...
197d50af8334b1570ed2c07e89d4a86f0ebdfce56c6d01946de9b434924d960f
MATLAB
1,292
38
% Runs batch analyses and publishes HTML report with figures and stats to % results/published_output in local study-specific analysis directory. % Run this from the main base directory (basedir) close all clear all % ------------------------------------------------------------------------ % Set paths based...
1e225019f8f672dafc169c67ce421dd84bb7725e99cca694568dfdba54bc0c19
MATLAB
1,292
37
function cvx_optval = det_rootn( X ) %DET_ROOTN nth-root of the determinant of an SPD matrix. % For a square matrix X, DET_ROOTN(X) returns % POW(DET(X),1/(size(X,1)) % if X is symmetric (real) or Hermitian (complex) and positive semidefinite, % and -Inf otherwise. % % This function can be used in many c...
bd5c1282c47916e0a3df33a712494c585bef670085a18a1ac0e569f8771f2fc0
MATLAB
1,292
32
function perm = ordmmdmex(adjncy) %#ok % perm = ordmmdmex(adjncy) % % Computes multiple-minimum-degree permutation, for sparse % Cholesky. Adjncy is a sparse symmetric matrix; its diagonal % is irrelevant. % % Invokes SPARSPAK-A Release III. % % ********** INTERNAL FUNCTION OF CHOLTOOL ********** % This f...
798b2b502962db9f0aba8e741966a9eb42e6dae16df049ed9e6404ff20038905
MATLAB
1,293
48
% Figure 8.8: Simplest linear discrimination % Boyd & Vandenberghe "Convex Optimization" % 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,...,y_M}. a and b can be obtained by solving a % feasibility problem: % ...
0960ef657a8833d0ad7a42020b4fbc28cb6603adfde27939f533eb7db85395fe
MATLAB
1,294
34
function Cphi = Convolution(hetparam,phi,dt) %CONVOLUTION Calculates the Convolution term % for the jth shortcut, C is calculated as % C(r,t) = sum_(all points r') (cj/|Rji||Rjf|) I(r in Rjf) I(r' in Rji) phi(r',t - tauj) dx^2 % - (cj/|Rji||Rjf|) I(r' in Rjf) I(r in Rji) phi(r,t) dx^2 % We can calculate thi...
9492297d647e461709bc88c91333fa4617cb9428775c567c6f7580cb3a1d4501
MATLAB
1,294
39
function result = maxNormalizeStdGBVS(data) % maxNormalizeStd - normalization based on local maxima. % result = maxNormalizeStd(data) % Normalize data by multiplying it with % (max(data) - avg(localMaxima))^2 as described in; % L. Itti, C. Koch, E. Niebur, A Model of Saliency-Based % Visual Attention for ...
bdbd2ba1cc72b682d5efdc0762680abddad3ab2ffeb868904c74094d9a9e61c1
MATLAB
1,294
45
function [v,data,namelist] = Dynamic_read_dir_NIFTI(sub_dir,filter_str) if nargin==1 filter_str = ''; end flag = 0; [fpath,name,ext] = fileparts(sub_dir); if strcmp(ext,'.nii')||strcmp(ext,'.img')||strcmp(ext,'.hdr') if strcmp(ext,'.hdr') niiname.name = [name,'.img']; else niiname.name = [na...
c8af811da4bf37e19f161e1af252169663943f7e7fd807ed448629993d9330be
MATLAB
1,295
45
function [pt,p0,v0,t,idx]=surfinterior(node,face) % % [pt,p0,v0,t,idx]=surfinterior(node,face) % % identify a point that is enclosed by the (closed) surface % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % node: a list of node coordinates (nn x 3) % face: a surface mesh triangle list (ne x 3) % % output:...
8939d997422622dc3029047890f3dadbfcc94bb7d7e7c405d0582c82cdf498d4
MATLAB
1,296
40
function absd=getada(A,K,d,DAt) %Computes the Newton system %incorporates getada1,2,3 % INPUT: % ADA: only the sparsity pattern is used, not the values % A: The coefficient matrix, actually A', with the dense columns (actually rows) removed % K: The structure of the cone % d: The scaling elements % DAt: The sca...
17ad2f4c57407efc536bb8a099292178e6fe79462e4e41ac09e722aadf340439
MATLAB
1,297
57
%% print_LEAR_matrix.m % % % *USAGE* % % Small demo script that builds and displays a Linear Exponential % AutoRegressive (LEAR)-style correlation matrix, in which off-diagonal % entries decay exponentially with distance from the diagonal % (base_corr ^ abs(i-j)) % % % *OPTIONS* % % * base_corr base correlation ...
b41ee3576faf65717baa126db70310e83acde4d53df8cb2017362e0d8b701011
MATLAB
1,297
38
function h = mplot(t, matrix, varargin) %MPLOT Plot rows of a data matrix. % MPLOT(MATRIX) makes a line plot of the rows of an (M x N) matrix using % a single line object. For large M, these plots are drawn more quickly % than PLOT(MATRIX') since only one object is created and that object % does no...
a7095a7d063b7ece61bf559e05dc61b6e41463488f5ee71a922c30c3a1925506
MATLAB
1,298
47
%%**************************************************************** %% orthbasis: Compute an orthonomal basis from %% the power basis {I,A,A^2, .... ,A^m} %% via an Arnoldi-type iteration. %% %% [Q,H,C] = orthbasis(A,m); %% %% Output: Q = a cell array containing the orthonormal basis %% ...
871297d789eeea78ca5ab0c965e4dc37a12143e547dc712b6b2251064e4b7772
MATLAB
1,299
38
function timeDelay = calcTimeDelay(NSx1, NSx2) % % timeDelay = calcTimeDelay(NSx1, NSx2) % % This function calculates the time difference between the end of the % first NSx file and the beginning of the second NSx file. % % NSx1: The first NSx file passed to the function. This input is % opt...
49dfba3debc1d0bc5a3c3a476c3ae60750e3c47c40320cfe911d3a456e3cf2a7
MATLAB
1,301
43
addpath bva-io-master/ addpath (genpath('eeglab2022.1/')); eeglab load("dataset_ds005284.mat"); folder = 'EvokedPotentialPlots'; htmlGray = [128 128 128]/255; for i = 1:length(data) disp (num2str(i)) EEG = data{i}; EEG = pop_resample(EEG, 1000); allTypes = unique({data{1}.event.type}); for t = 1:l...
93727578bdb991e365936840066281cba859d85e672fa6219dc7cf931a94a858
MATLAB
1,302
37
function ispresent = ea_refreshscrf(options,handles) ispresent = isfile(options.subj.brainshift.transform.instore); if ispresent stack = dbstack; if ismember('ea_compute_scrf', {stack.name}) ... || ~all(isfile(struct2cell(options.subj.brainshift.checkreg))) % Always regenerate checkreg fig...
85885337f1ab549d64e533eded5ba999dc4b5233dfeb50d7a6c80d180633d761
MATLAB
1,303
40
addpath('/home/yh19218/Code_IF_2020/Connectivity Measure Toolbox/'); addpath('/usr/local/eeglab/') load('validParticipants.mat') load('electrodes.mat') load('bandReference.mat') bands = [0.5 4;4 7.5;8 12;12.5 16] ; mainfolderlist = {'1_1s';'2_2s5';'3_5s';'4_10s'}; % Read the data for fileIndex = 1:4 foldername = mainf...
cc34c5dc21835eaea3ef98383a2bc5566d83742355d7cba860d784f4e4724261
MATLAB
1,303
56
function [node,elem,face]=readtetgen(fstub) % % [node,elem,face]=readtetgen(fstub) % % read tetgen output files % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2007/11/21 % % input: % fstub: file name stub % % output: % node: node coordinates of the tetgen mesh % elem: tetrahedra element list of the tet...
e4629051cf3200c1d7f8135fe224228a436a5905eeb73707e149e0439a44ab15
MATLAB
1,303
58
%% Test the readNPY function with given data dtypes = {'uint8','uint16','uint32','uint64','int8','int16','int32','int64','float32','float64'}; figure; for d = 1:length(dtypes) data = readNPY(['data/sine_' dtypes{d} '.npy']); subplot(length(dtypes),1,d) plot(data) title(dtypes{d}); end...
27484ff26c2628473f7baf096123aa2bb9f2e218acfa10a238e85cc9eba4e7bb
MATLAB
1,304
40
% nan_std() - std, not considering NaN values % % Usage: std across the first dimension % Author: Arnaud Delorme, CNL / Salk Institute, Sept 2003 % Copyright (C) 2003 Arnaud Delorme, Salk Institute, arno@salk.edu % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU ...
1866f79a42fc1d5612a57ee567e51be1972abe10b94ae4e7b148c83fbe97d70b
MATLAB
1,305
50
function plot_trajectory(self, cel, varargin) p = inputParser; p.addRequired('self') p.addRequired('cel', @isnumeric) p.addParamValue('show_scale', 1, @isnumeric) p.addParamValue('ScatterParams', {'.r', 'SizeData', 25}, @iscell); p.parse(self, cel, varargin{:}); self = p.Results.self; cel = p.Results.cel; show_sca...
13715a757b71ff1a0dac39d8e22bcc874a3420ae60907eab6b23d66f19bd6d42
MATLAB
1,308
40
%% Plot daytime of videodetections as polarhistogram % last edited by David Wolf, 30.11.2023 % %% load data clear; save_dir = 'W:\group_entwbio\data\Shared\NoSeMaze\000_social\code for figures\figures'; % times_detected is a cell array of dimensions: group x day x animal load(fullfile('W:\group_entwbio\data\Shared\No...
22d9ab8abcd42dc62b11822d160039849bd834918646e36a411aa609aa9c1077
MATLAB
1,308
29
%% Using the surface() method for 3-D cutaways % % The surface() method with the 'cutaway' option lets you render blobs % on a number of pre-set choices for 3-D cutaway surfaces. % % The anatomical image used by default is adapted from the 7T high-resolution % atlas of Keuken, Forstmann et al. % References: % Keuke...
508e1e22588f5d22fe4d845766229738f39ee3725e63d215581c64986698214f
MATLAB
1,308
29
function [] = CBIG_gwMRF_generate_example_results(output_folder) % This function generates the final results for the example provided in % Alex's gwMRF stable project. Note that There will be some warnings from % the optimizer: "Warning: Neighbours array should be upper-triangular; % entries below the diagnonal will...
71259f3f6737f46aa921fb919a04ae66b6667c472289c419c25faffb3a27f4c1
MATLAB
1,308
39
%% Figure 2 main YOURDATAPATH = ''; % Load kinematics and events data fileList = searchFilesRecursive(YOURDATAPATH, 'infoFOVs.mat'); load(fullfile(fileList.folder, fileList.name)) fileList = searchFilesRecursive(YOURDATAPATH, 'kinematics_all.mat'); load(fullfile(fileList.folder, fileList.name)) fileList = searchFilesR...
df517c402a6009a768f96510a6d40f9e44d2eaef672db2530557965831576418
MATLAB
1,308
47
function ea_fsl_apply_coregistration(varargin) % Wrapper to apply FSL flirt affine transformation fixedimage = varargin{1}; movingimage = varargin{2}; outputimage = varargin{3}; volumedir = [fileparts(ea_niifileparts(movingimage)), filesep]; if nargin >= 4 affine = varargin{4}; else % determine the affine ma...
78892da03654358c3fa25680b76b099626d20cd4a00b891a3a6b13e6ba753d79
MATLAB
1,309
40
function newnonl( prob, ncones, arg ) %#ok narginchk(2,3); global cvx___ cones = cvx___.cones; if nargin == 3, ncones = struct( 'type', ncones, 'indices', arg ); end for k = 1 : length( ncones ), ncone = ncones(k); if any( cvx___.reserved( ncone.indices( : ) ) ), error( 'Variables placed i...
7af7973ae4902045b8c9c934a65517abfc41a592602fd6f4817bba86d235cc58
MATLAB
1,309
50
% Figure 6.24: Fitting a convex function to given data % Section 6.5.5 % Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX by Argyris Zymnis - 11/27/2005 % % Here we find the convex function f that best fits % some given data in the least squares sense. % To do this we solve ...
ad462a316fdd195b4e5a274fe55f4190f84a4e75689c78c947db8a268ef4096f
MATLAB
1,309
31
function data_out = Trinh_makecontinaveragedData(data_in, conditions,refrainonsets,triallength,prestim) %% Function for segmenting the data and appending them into continous data stream % segments the condtitions and appends them to make continous data streams % insert the trial info for the needed conditions % Tri...
be1ab55757aa77d3e0230f13178ef11a06028b7f014974e8be6379d1a9c760ca
MATLAB
1,309
36
function Y = CORE_resetintegrator(X,R) %CORE_RESETINTEGRATOR Core computational routine for RESETINTEGRATOR. % Y = CORE_RESETINTEGRATOR(X,R) takes length N vectors X and R, where X % is of type double and R is of type LOGICAL and returns a length N % vector Y such that Y(j) = / Y(j-1) + X(j), if R(j) == 1 % ...
c51cb0796c61bc249d9db49f3cbd22f4e9a952df4d8d2d963787894a0c0e419f
MATLAB
1,309
29
function varargout=ea_coregpostopct_ants(options) % Wrapper function for ANTs registration of post-op CT % __________________________________________________________________________________ % Copyright (C) 2015 Charite University Medicine Berlin, Movement Disorders Unit % Andreas Horn if ischar(options) % return name ...
d302b77295e6ad7e881057c1cf49a4e3df73d4ceac74880fab6240cefef1a4c2
MATLAB
1,309
49
function [polft,ft] = detrend_profile(m,x,y) %DETREND_PROFILE Returns the polynomial fit and the fit parameters for the %given $x$ and $y$ % Uses the pseudo-inverse matrix to compute the fit. % Avoiding undeterminations (NaN) in the computations. x(y==-Inf)=[]; x(y==Inf)=[]; y(y==-Inf)=[]; y(y==Inf)=[]; if length(x) =...
2dabae353f62dff43eb550d8211deb76499286cb33fa5403cf1c37bd8db34023
MATLAB
1,310
52
clc clear all close all set(0,'defaultfigurecolor',[1 1 1]);% set figure background color %% set parameters % input parameters atlas = 'glasser360'; file_readname = 'MitoData_HCPMMP1.1D'; MitoNames = {'CI' 'CII' 'CIV' 'MitoD' 'MRC' 'TRC'}; % basic parameters Data_dir = '/Users/guofanhua/Desktop/gfh/work/StandardBrain...
1cb908970037ecd2da99a2bf9427ba34d394a662d725613257317dae23bee34a
MATLAB
1,311
51
function doseed2map_weighted(varargin) % sample batch that will generate a connectivity map using any *_seed.nii % file as seed and the HCP_MGH_30fold group connectome as data basis. root=varargin{1}; if nargin>1 maxdist=varargin{2}; else maxdist=[]; % use voxel size later. end if ischar(maxdist) maxdist...
550439ac30e85e001a230226645ca991c2955122ac1430a81e8c24f9281d2696
MATLAB
1,311
42
% mattocell() - convert matrix to cell array % % Usage: >> C = mattocell( M ); % % Author: Arnaud Delorme, CNL / Salk Institute, Jan 25 2002 % % Note: this function overload the nnet toolbox function mattocell, % but does not have all its capacities. You can delete the current % function if you have the toolbox. % ...
9987f7d8f664f427fb16f0cf3525cc8fe0fc4e9d67e524039e7f365a08388850
MATLAB
1,311
46
function [self, success] = RunningEpochs(self, lower_threshold, upper_threshold, speed_dur) % Sets lower and upper thresholds for running speed & sets epochs accordingy import CMBHOME.Utils.* success = 0; if upper_threshold <= 0, success = 1; return; end if iscell(self.vel) % scale veloci...
acff7c1477580299373807ee591eeadb47366536323e94b272283ce5db469044
MATLAB
1,311
67
%% figure S5 load('figureS5_data') %% A set(0, 'DefaultAxesFontName', 'Arial'); set(0, 'DefaultAxesFontSize', 11); set(0, 'DefaultTextFontName', 'Arial'); stimColor = [0.2, 0.2, 0.2]; % anColorLight = [0.1176 0.2275 0.8039, 0.4]; awColorLight = [0.8980, 0.1255 , 0.0824, 0.4]; figure('Co...
afdc0a1a9d6cee55fe2a84353291d3111da6dc1c34ff68ab64b3eefe172d0778
MATLAB
1,311
37
% std_uniformsetinds() - Check uniform channel distribution accross datasets % % Usage: % >> boolval = std_uniformsetinds(STUDY); % Inputs: % STUDY - EEGLAB STUDY % % Outputs: % boolval - [0|1] 1 if uniform % % Authors: Arnaud Delorme, SCCN/UCSD, CERCO/CNRS, 2010- % Copyright (C) Arna...
d258b17e0edb67f6169fa5136ba0b30c7a16d7cdad5b73d271e6414541bb620e
MATLAB
1,311
34
function ea_coreg_fa(options,usebrainmask) % Coregister FA image to anatomical anchor image. % Will export FA image from DTI if it doesn't exist yet. % % USAGE: % % ea_coreg_fa(options,usebrainmask) % % INPUTS: % options: LeadDBS options % usebrainmask: bool, masking the coregistered image or no...
d522b41a2717edd01008ef84e5df32be7f9e6057a8da19a2852080906ec34912
MATLAB
1,311
45
% Example 8.4: One free point localization % Section 8.7.1, Boyd & Vandenberghe "Convex Optimization" % Joelle Skaf - 10/23/05 % % K fixed points (u1,v1),..., (uK,vK) in R^2 are given and the goal is to place % one additional point (u,v) such that: % 1) the L1-norm is minimized, i.e. % minimize sum_{i=1}^K...