sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ef6757bdcef6609bf72b4d5e1fafb22ba0991a2a7248e3c4b5c8bf5607fd14cf | MATLAB | 1,566 | 38 | function x = vec(X)
% x = vec(X)
%
% Y = VEC(x) Given an m x n matrix x, this produces the vector Y of length
% m*n that contains the columns of the matrix x, stacked below each other.
%
% See also mat.
% This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko
% Copyright (C) 2005 McMaster University, H... |
29b3cda7ddcf2b4eb14e603bd50fbb6c2287dd427f32bc75635db59c936f9426 | MATLAB | 1,567 | 51 | function [list, isdir] = ea_regexpdir(rootdir, expstr, recursive, type, listHidden)
% Wrapper for regexpdir (need to clear the persistent variable)
arguments
rootdir {mustBeTextScalar}
expstr {mustBeTextScalar}
recursive {mustBeNumericOrLogical} = true % Recursive search by default
type ... |
7c399459245e6397b1ed512840c9e07ccc37af6ebf13a47fc1d3535931c5ca22 | MATLAB | 1,567 | 73 | function fit = fishnet(x,is_sparse,irs,pcs,y,weights,offset,parm,nobs,nvars,...
jd,vp,cl,ne,nx,nlam,flmin,ulam,thresh,isd,intr,maxit,family)
if any(y < 0)
error('negative responses encountered; not permitted for Poisson family');
end
if isempty(offset)
offset = y * 0;
is_offset = false;
else
is_o... |
d4659b8c1595cdd747dad0c0409ba10e4e1546ec9134fba09b50a3b61ff9d7e1 | MATLAB | 1,567 | 42 | function handles = dan_index_epochs(handles)
%%
% Authors: Dan Denis
% Date: 2021-07-14
%%
% Initialize
plotParam = handles.plotParam;
plotParam.epochSampleIdx = [];
% If user enters an epoch length > than length of the data
if str2double(get(handles.epoch_length, 'String')) > handles.psg.hdr.samples
plotPa... |
5ee2e828c0ff8ffccd8e21427520114ff40426fdc39689682a0f9493bd22cf22 | MATLAB | 1,568 | 38 | function fibers = OSS_DBS_Damaged2Activated(settings,fibers,idx,sideidx)
%% determine mean active contact
amplitudes = settings.Phi_vector(sideidx,:);
amplitudes = (abs(amplitudes)./sum(abs(amplitudes),"all",'omitnan'))';
contacts = settings.contactLocation{sideidx};
meanactive = sum(contacts.*amplitudes,1,'omitnan');... |
7f5e23f73c0eb370a1cc3742ccaba258d6fcfc47bb2bbf8f264c2c4b9f331209 | MATLAB | 1,568 | 57 | function ea_conformspaceto(spacefn,toreslicefn,interp,mask,newfn,headermod,force)
% set headermod to 1 by default
if ~exist('headermod', 'var')
headermod = 1;
end
if ~exist('force','var')
force=0;
end
sphdr = ea_open_vol(spacefn);
tohdr = ea_open_vol(toreslicefn);
if ~isequal(sphdr.mat,tohdr.mat) || force % ... |
946372da9d1984c8ad6fec0c9ba722cbbbd8728ff0642e5fa61e58cb43f3223a | MATLAB | 1,569 | 54 | function varargout=ea_explorer_stats_1samplettest(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
%... |
cb65b2d49fcf9974c7645f9bfec40e5d9b175a233ac01c4c45fb68a8bc824742 | MATLAB | 1,569 | 71 | function MakeClassicFet(basename,basePath)
%get basic input params if not there
if ~exist('basename','var')
[~,basename] = fileparts(cd);
end
if ~exist('dirname','var')
basePath = cd;
end
cd(basePath)
% if already .fets, move them to a new folder called "PreviousFets"
d = dir(fullfile(basePath,[basename '.fe... |
25d91112869e50342eac4d7944550e867b460188da460e56b9a4fabe84862bbc | MATLAB | 1,570 | 45 | function hLabel = ylabelLowHighPkRespRatio(colors,varargin)
ylabel('')
%Positions of elements
% posNum = [-0.25 0.5 0.5];
% posBar = [-0.225 0.5 0.5];
% posDen = [-0.175 0.5 0.5];
posNum = [-0.27 0.5 0.5];
posBar = [-0.235 0.5 0.5];
posDen = [-0.18 0.5 0.5];
% posNum = [1.145 0.5 0.5];
% posBar = [1.115 0... |
ac373318baa5256fcfa3713e510a00f9b1ca8e4d9225f75e9f738eb60c224dd0 | MATLAB | 1,570 | 48 | function old_default = set_matlab_bgl_default(varargin)
% SET_MATLAB_BGL_DEFAULT Sets a default option for the Matlab BGL interface
%
% old_default = set_matlab_bgl_default(options) or
% old_default = set_matlab_bgl_default(...) for key-value pair version
% options.istrans: the input matrices are already transposed [{0... |
bce4e08e2532c261ea22daabcf97f713eb1946069d89f37c73179387dd442675 | MATLAB | 1,570 | 48 | function varargout=ea_explorer_stats_signedranktest(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 ... |
78c0b8d20bf5b6a711644087f8fe85d32dbddc67f6201e74b29257c8f0a74308 | MATLAB | 1,571 | 40 | function y = givensrot(gjc,g,x,K) %#ok
% y = givensrot(gjc,g,x,K)
%
% GIVENSROT
%
% ********** 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) 2001... |
0c56ac3bdf12e6b3fedfe5844a98ec33dc875e6d36211da5564c9b25aa5709a4 | MATLAB | 1,572 | 61 | function [ ints1,ints2,ints1idx,ints2idx ] = FindIntsNextToInts(ints1,ints2,tol)
%[ints1,ints2,ints1idx,ints2idx] = FindIntsNextToInts(ints1,ints2,tol)
%returns only the intervals from the sets ints1 and ints2 such that an
%interval from ints1 is directly preceeding an interval from ints2, with
%the option of allowi... |
5e603bd3e82e37f65a626f93006c28166c07a32bd36ce1468c733a8a3db52f6f | MATLAB | 1,573 | 47 | function orientation = FlyOrient(subset_frame, threshold)
%FLYORIENT
% Usage:
% orientation = FlyOrient(subset_frame, threshold)
%
% This function takes in a subset frame around the fly (calculated by
% FindFly) and discards the 3D data by placing points where the pixel intensity
% is larger than the ... |
a7b4d1f20bdba11bce5bd4736d2b9d7cbbdfaecfed7af52fe32eaafeb9d5bc5a | MATLAB | 1,573 | 53 | function CBIG_ASDf_plotKmeans(C, file_name, scalelim)
% CBIG_ASDf_plotKmeans(C, file_name, scalelim)
%
% Plot k-means cluster centroids.
%
% Input:
% - C:
% Cluster centroids obtained from k-means algorithm, number of
% clusters x number of unique ROI-ROI pairs
% - file_name:
% Fi... |
03c781f85c9cf2fbb7776f22fd84460cbb5a69fb6b607f0ed849ad7c1629a628 | MATLAB | 1,574 | 47 | function pSizes = calcPixelSizes( pTotal, mSizes, pMinima, pPadding, pSpacing )
%calcPixelSizes Calculate child sizes in pixels
%
% pSizes = uix.calcPixelSizes(total,mSizes,minSizes,padding,spacing)
% computes child sizes (in pixels) given total available size (in pixels),
% child sizes (in pixels and/or relative),... |
17eb0dd8ef29cee6d561536b8ce8d8d5e49fac7b7087c992e84f8b02ab01f673 | MATLAB | 1,574 | 40 | function [S,settings,activeSources] = ea_check_stimSources(options,S,settings)
% Check which sources are active and insert blank stimulation for unilateral cases.
% By Butenko and Li, konstantinmgtu@gmail.com
arguments
options % Lead-DBS options for electrode reconstruction and stimulation
S % Le... |
82304de69295bb904d900ae71b782e1a6e2d874d19eb716c68a6fce338dd8984 | MATLAB | 1,574 | 32 | function [tscounts, wfcounts, evcounts] = plx_info(filename, fullread)
import CMBHOME.PLX2Mat.*
% plx_info(filename, fullread) -- read and display .plx file info
%
% [tscounts, wfcounts, evcounts] = plx_info(filename, fullread)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% fullread - if 0, r... |
9d6dbd2b200a95523eafe0d47f693212f54e62fe9f113637dd6e7388d0a5fc8d | MATLAB | 1,574 | 41 | function [lat,pol]=sph2hor(azi,ele)
%SPH2HOR transform spherical to horizontal-polar coordinates.
% [lat,pol]=sph2hor(azi,ele)
%
% Input:
% azi ... azimuth (in degrees)
% ele ... elevation (in degrees)
%
% Output:
% lat ... lateral angle (-90 <= lat <= 90)
% pol ... polar angl... |
fc3087db3cc26ff0a05d500d33112f7936bdf3d14428d911d09b7a24ae7321c6 | MATLAB | 1,574 | 57 | function [S s] = circ_var(alpha, w, d, dim)
% s = circ_var(alpha, w, d, dim)
% Computes circular variance for circular data
% (equ. 26.17/18, Zar).
%
% Input:
% alpha sample of angles in radians
% [w number of incidences in case of binned angle data]
% [d spacing of bin centers for bin... |
4336da541b8c6dd23451af3dc922f6ef721a2d0fcd77886603d1bd50b4227cb8 | MATLAB | 1,575 | 54 | function quickcheckfits(headpath,fileexpnum)
cd('extracted2')
savefilename=strcat(fileexpnum,'_analysis2');
load(savefilename);
cd(headpath);
%add some errorchecking for indices you want to remove or something
%[sortednames,data]=cleantrials(data,fileexpnum,filelist,imskip,expskip);
filelist=dir;
filenames={filelist... |
e131a499605c9da1f36683c53182295e6b2f35bede87661280c2f30fa5e93169 | MATLAB | 1,576 | 36 | function [rawFile] = manageDataCompression(ephysRawDir, decompressDataLocal)
% JF, Decompress raw ephys data if it is in .cbin format
% ------
% Inputs
% ------
% ephysRawDir: dir() structure of the path to your raw .bin, .cbin or .dat file
% decompressDataLocal: character array defining the path where decompressed
% ... |
509973613ae00dad505655e49d1b8abea396b5065e3f3667add9577e1f9aba9c | MATLAB | 1,577 | 39 | function GCO_SetSmoothCost(Handle,SmoothCost)
% GCO_SetSmoothCost Set the smooth cost of neighboring sites.
% GCO_SetSmoothCost(Handle,SmoothCost) with a NumLabels-by-NumLabels
% integer matrix makes SmoothCost(k,l) the unweighted cost
% of assigning labels k and l to any neighboring sites.
% For ... |
a6979e11ac8241d968f3d2d55ea269bc6f51f397ae6d7ea29ce907f30dbc66ae | MATLAB | 1,577 | 45 | % 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)
if... |
cb47780ea608ebaa0bb3c7fb492655d40ec7dc41373589700a5f075b12852fe2 | MATLAB | 1,577 | 37 | function z = rel_entr( x, y )
%REL_ENTR Scalar relative entropy.
% REL_ENTR(X,Y) returns an array of the same size as X+Y with the
% relative entropy function applied to each element:
% { X.*LOG(X./Y) if X > 0 & Y > 0,
% REL_ENTR(X,Y) = { 0 if X == 0 & Y >= 0,
% ... |
f7a635e9bfe0603c21cd7d4aa7f5d81dc091c7bb4245b371474ab6d72d16606c | MATLAB | 1,577 | 47 | function [XtrS, XteS, sc] = applyScaling(Xtr, Xte, mode)
% applyScaling Leakage-free feature scaling fit on the training fold.
%
% [XtrS, XteS] = applyScaling(Xtr, Xte, mode)
% [XtrS, XteS, sc] = applyScaling(Xtr, Xte, mode)
%
% Computes the scaling constants from Xtr alone and applies them to both Xtr
% a... |
658c09008dc229a62d1f091ae4ae71c3e773f7c92fbd9c0707f85823b1b0f4ee | MATLAB | 1,578 | 56 | function ea_alter_reflection(resultfig,factor,reset)
% assuming all patches have same properties, slightly alter them
if ~exist('resultfig','var')
resultfig=gcf;
end
if ~exist('factor','var')
factor=1;
end
allpatches = findall(resultfig,'Type','patch');
if reset
origpatchlighting=getappdata(resultfig,'or... |
98f3d2e078b446d6bb584baa86c3673d35386379af609aeb55f85eaa704c276d | MATLAB | 1,578 | 57 | %isdscalar - Test if parameter is a scalar (double) satisfying an optional list of tests.
%
% USAGE
%
% test = isdscalar(x,test1,test2,...)
%
% x parameter to test
% test1... optional list of additional tests
%
% EXAMPLES
%
% % Test if x is a scalar (double)
% isdscalar(x)
%
% % T... |
1e7a3a2980ef5e44f91fbff6d2804906dcbd050bd88d2cdde1c9e8d2b4cd0a8e | MATLAB | 1,579 | 42 | function k = xml_findstr(s,p,i,n)
%XML_FINDSTR Find one string within another
% K = XML_FINDSTR(TEXT,PATTERN) returns the starting indices of any
% occurrences of the string PATTERN in the string TEXT.
%
% K = XML_FINDSTR(TEXT,PATTERN,INDICE) returns the starting indices
% equal or greater than INDICE o... |
d84e344b62c4c5e8ad6aa334d328d7c84523d2fe095814a8e9063753908cca54 | MATLAB | 1,579 | 50 | function [angle_occupancy, theta] = DirectionalOccupancy(self, binsize, Continuize)
% Computes head direction occupancy
%
% Returns O, the directional occupancy of animal in Session root. If
% root.epoch is one epoch, O is a column vector. If root.epoch is more than
% one epoch, O is a matrix of column vectors of size ... |
cb64ed9035de59d72ee5ea7fe41abe5126746b71cab591486a4531eee2a0b29a | MATLAB | 1,580 | 57 | %isdscalar - Test if parameter is a scalar (double) satisfying an optional list of tests.
%
% USAGE
%
% test = isdscalar(x,test1,test2,...)
%
% x parameter to test
% test1... optional list of additional tests
%
% EXAMPLES
%
% % Test if x is a scalar (double)
% isdscalar(x)
%
% % T... |
d25288d67e3877701adbf33a87a29b36da1d758dedd5f28901005dbfe209202b | MATLAB | 1,581 | 38 | function CBIG_MSHBM_example_single_subject(out_dir)
% CBIG_MSHBM_example_single_subject(out_dir)
%
% This function will call a simplified wrapper to run a single subject parcellation using MSHBM. This example use
% HCP trained group priors in fsaverage6 space.
% Results of the parcellation will be saved in the specif... |
78550022680ff62633f136d2fd5900bf8a532e491b76d630e5749338da14f647 | MATLAB | 1,584 | 54 | function [f,header]=readPrairie(fname,imno,header)
% Usage ... [f]=readPrairie(fname,imno,header)
do_files=0;
if strcmp(fname(end-3:end),'.tif')|strcmp(fname(end-3:end),'.TIF'),
do_files=1;
end;
if do_files,
if length(imno)==2, imno=[imno(1):imno(2)]; end;
for mm=1:length(imno),
tmpname=sprintf... |
2947c64f39bc4d0cc93aa8f23bfbe6b8d012434579b9b4b31fbe434ceb176be9 | MATLAB | 1,585 | 57 | function [res, errStr]= maskstruct_write(mStruct, fileName, diagFlag)
%
% function [res, errStr]= ftrstruct_write(maskStruct, fName)
%
% writes a maskStruct to the harddisk
%
% maskStruct: should contain a valid maskStruct Ver2
% fileName: should contain the path and file name. if it is empty or undefined, a file... |
54420fcf7a6708214bd5cac357dc063d62046e8fa28ff5d4268214074cdfbbde | MATLAB | 1,585 | 53 | function W = AngularVelocity(X,smooth)
%AngularVelocity - Compute instantaneous angular velocity.
%
% Compute angular velocity for a time-varying vector X. This is computed as
% the vector product of X and its derivative DX: W(t) = X(t) ^ DX(t)
%
% USAGE
%
% omega = AngularVelocity(X,smooth)
%
% X ... |
c072e85c74fd4a0f99ec8b3d889e6d71c9f1249e2ce7750dfefa1949ecb41e65 | MATLAB | 1,585 | 88 | function rebuildFibers(ftrname,minlen,maxlen)
ftr = ftrstruct_read(ftrname);
display('building fibers')
ftr = recomputeFibs(ftr,minlen,maxlen);
[path name ext] = fileparts(ftrname);
newfile = fullfile(path,[name(1:end-4) '_' num2str(minlen) '_' num2str(maxlen) '_FTR.mat']);
ftrstruct_write(ftr, newfile);
function... |
8c364b09326597c185bd8295e074f284ecdc8b05143744465b825c33dfed6802 | MATLAB | 1,586 | 57 | function R = ThetaSkipping(self, cel, supress_plot)
% Calculates the ratio of the difference between 1st and 2nd peaks in autocorrelogram
%
% See PAGE 996 in Sachin S. Deshmukh, D. Yoganarasimha, Horatiu Voicu and James J. Knierim
% J Neurophysiol 104:994-1006, 2010
%
% R = root.ThetaSkipping(cel);
import CMBHOME.... |
9c29b6d5bd8afb1ac53faa380d1072fe25e5ebc61a74d6a6a9ffb8fc87dd145a | MATLAB | 1,586 | 70 | function y = sigmoid(x,c,a)
% sigmoid evaluates a simple sigmoid function along x:
%
% ______1________
% y = -a(x-c)
% 1 + e^
%
%% Syntax
%
% y = sigmoid(x)
% y = sigmoid(x,c)
% y = sigmoid(x,c,a)
%
%% Description
%
% y = sigmoid(x) generates a sigmoid function along x.
%
% y = sigm... |
da94bd592e65578377888c59fd08ae970b6f5fe0ed08e48536d52d5d68ae16f5 | MATLAB | 1,586 | 50 | function [ dist ] = distmatrix( P1,P2,n )
%DISTMATRIX Distance matrix between each point of vectors P1 and P2.
% n is the norm from 1 to a reasonable number (not inf included).
if nargin == 2
n = 2;
end
if nargin > 3
error('This function just accepts 2 input vectors, and the norm order.')
elseif isnumeric(n)
... |
b0e018240686f16076f009f13687407d08679eab9bf07129135cf8de5cfe3897 | MATLAB | 1,587 | 69 | function [h,p,f] = FisherTest(samples1,samples2,alpha)
%FisherTest - Test if two groups of samples have equal variances.
%
% Fisher's test is used to test if two groups of samples have equal variances.
%
% USAGE
%
% [h,p,f] = FisherTest(samples1,samples2,alpha)
%
% samples1 first group
% samples2 ... |
01cc316f620952233c4216c75ed2968948c12f9c17f7420ea865b3ccb1e43471 | MATLAB | 1,588 | 56 | function [ rho,p,s,b ] = kempter_lincirc( x,theta,varargin )
% ANGLEREG - Linear-circular correlation
% Performes a linear-circular correlation (Kempter et al, 2012)
%
% [ RHO,P,S,B ] = kempter_lincirc(X,THETA)
% [ RHO,P,S,B ] = kempter_lincirc(X,THETA,S,B)
%
% ARGUMENTS
% * X: A vector of linear values
% *... |
50a289381ce1d82273c203ddc21d9b380495b6272733f80d2d6222fdc8cb3a17 | MATLAB | 1,588 | 64 | function scenario = scenario_Qsumr_Qb_constp(par)
% r(Q,Q+A), b(Q), p constant
scenario.name = "Qsumr_Qb_constp";
% define parameter set (names)
scenario.parnames = {'r0','K','b0','beta','p0'};
% organize parameters in structure form
scenario.make_par = @(p) struct( ...
'r0', p(1), ...
'K', p(2... |
7bcfc92f075f35290cfae799019fb1ff05f567277ef20bf0683f01718d7b96a2 | MATLAB | 1,588 | 61 | function ea_delete(object, opts)
% Enhanced file/folder deletion function
arguments
object % Files/folders to be deleted
opts.warn {mustBeNumericOrLogical} = 0 % Show warning or not
opts.recycle {mustBeMember(opts.recycle, {'', 'off', 'on'})} = '' % Use recycle or not
end
% Update the recycle status
previ... |
3d72658301cb56549f9f98ae559ca42c1eccffefbd859f658618489fed9a4ec5 | MATLAB | 1,590 | 48 | % subsasgn() - define index assignment for eegdata objects
%
% 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 Fr... |
907cc387c279f6e55636bbf20bb1cb393a7c38c4136d4a506943a8922a14f69d | MATLAB | 1,590 | 48 | function [node,elem,face]=s2m(v,f,keepratio,maxvol,method,regions,holes)
%
% [node,elem,face]=s2m(v,f,keepratio,maxvol,method)
% [node,elem,face]=s2m(v,f,keepratio,maxvol,'tetgen',regions,holes)
%
% volumetric mesh generation from a closed surface, shortcut for surf2mesh
%
% author: Qianqian Fang (fangq <at> nmr.mgh.ha... |
afdff1236a92955f5fda5ec4329ee5aeb93ed80f34d3102b2300039c5bdb1269 | MATLAB | 1,590 | 48 | function palm_vestwrite(filename,M)
% Write an FSL "vest" file, e.g. design matrix,
% t-contrasts or f-contrasts.
%
% palm_vestwrite(filename,M);
%
% filename : File name.
% M : Matrix.
%
% _____________________________________
% Anderson M. Winkler
% FMRIB / University of Oxford
% Aug/2013
% http://brainder.org... |
06286e18a62d0985feaf8b970a6a03ede4badfec4e89d9df30b0b811db58bd82 | MATLAB | 1,591 | 49 | function bbstruct=ea_viz2brainbrowser(varargin)
% Export function to brainbrowser made at OHBM Hackathon 2014 together with Tarek
% Sherif.
vizstruct=varargin{1};
if nargin==2
jtype=varargin{2};
bbstruct.type=jtype;
end
bbstruct.vertices=[];
bbstruct.normals=[];
bbstruct.colors=[];
offset=-1; % since indices ... |
0a7e6c57f5ef548611217002aa59f532d2a609020f86cfa881b60539e606ad81 | MATLAB | 1,592 | 62 | function n = fun_otsu_criterion(data, threshold)
% Otsu's criterion of between-class variance. use to empirically determine
% optimum thresholdhold for sleep spindle detection. Find the thresholdhold (e.g. data
% * the signal median) that madataimizes between-class variance (spindle,
% non-spindle)
%
% Required inputs:... |
33715a488f0443cfa5f8c7ac33f2b37148159203e48a79b12ab1731b23d207c4 | MATLAB | 1,592 | 33 | function CBIG_MSHBM_check_example_results(out_dir)
% CBIG_MSHBM_check_example_results(out_dir)
% This function checks if the generated example results are identical with
% the reference files.
%
% Input:
% - out_dir: The output directory path saving results of example scripts (i.e. CBIG_MSHBM_example_wrapper.m)
%
%... |
7e21d592f5eaa077572ebf5cc1156d05711399ae8405997ebe20c5ad8cb00bc1 | MATLAB | 1,593 | 39 | % 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:
% http://www.fil.ion.ucl.ac.uk/spm/
%
% It reli... |
b0a95c5a3feffd000f983bfee1d7894eac4bba06b1a115432e625ef694bd5dd5 | MATLAB | 1,593 | 55 | function [nmi clust_ent] = compute_nmi (T, H)
N = length(T);
classes = unique(T);
clusters = unique(H);
num_class = length(classes);
num_clust = length(clusters);
%%compute number of points in each class
for j=1:num_class
index_class = (T(:)==classes(j));
D(j) = sum(ind... |
51cb247ff507238e1f7e3fe5254d6a425457bb6b0943bb3f25e9a8e2db797a02 | MATLAB | 1,595 | 53 | % parsetxt() - parse text input into cell array
%
% Usage: >> cellarray = parsetxt( txt, delims );
%
% Inputs:
% txt - input text
% delims - optional char array of delimiters (default: [' ' ',' 9]);
%
% Note: commas, and simple quotes are ignored
%
% Author: Arnaud Delorme, CNL / Salk Institute, 18 April 2002... |
694c9112dd5dba3e2f0a830ceff4c5ad8d4e7ba2494b090bb08d7cc4db164eb0 | MATLAB | 1,595 | 67 | function handles = dan_initialize_struct(handles, clearData, clearMontage)
% Create empty data & montage structs
%%
% Authors: Dan Denis
% Date: 2021-07-14
%%
if clearData == 1
psg.data = [];
psg.hdr = [];
psg.chans = [];
psg.stages = [];
psg.events = [];
psg.ar = [];
... |
0a03e1a0c285bbc065caaf008a81efb5e821d8c17ce31d8fd77289636e7be59e | MATLAB | 1,597 | 49 | % Sparse covariance estimation for Gaussian variables
% Joëlle Skaf - 04/24/08
% (a figure is generated)
%
% Suppose y \in\reals^n is a Gaussian random variable with zero mean and
% covariance matrix R = \Expect(yy^T), with sparse inverse S = R^{-1}
% (S_ij = 0 means that y_i and y_j are conditionally independent).... |
3382a8fdc8127db9819eb6decf9151f0bc0929e96bd1a19419f27c61e8d78647 | MATLAB | 1,597 | 88 | %SEEscript Processes Tetrode Data and creates a CMBhome file.
% Detailed explanation goes here
%
%Import files from directory.
%
%NOTE: If a CMBobject already exists in the directory the original will be
%imported into the work space. The second CMBobject will be created in the
%directory, and can be loaded into the ... |
c93f469484e911923c0954f7bd2da514b95fcaf8b92cf78bba570ef0a10f7085 | MATLAB | 1,597 | 39 | %% Load thermal stimulation data from BMRK3
canlab_help_set_up_pain_prediction_walkthrough
%% Extract high heat trials and low heat trials - subtract
thermal_contrast=image_obj;
thermal_contrast.dat=image_obj.dat(:,6:6:end)-image_obj.dat(:,1:6:end);
thermal_contrast.Y=image_obj.Y(6:6:end)-image_obj.Y(1:6:end);
%% Com... |
442752923ab2b39502df24f104417f000eec94d854017c9a935e97b6681e75ae | MATLAB | 1,598 | 49 | %FindInInterval - Find values that fall in a given interval.
%
% The equivalent Matlab code is trivial
%
% i = find(values(:,1)>=interval(1)&values(:,1)<=interval(2));
% indices = [i(1),i(end)];
%
% but becomes extremely slow when dealing with very large lists.
% This function can dramatically speed up thi... |
711c410bb766e261d9c78f89d21fc6051f920c0122bb8032e3fe92f50212c929 | MATLAB | 1,598 | 68 | function plotcoherence(animal,probetype)
exp_dir=get_exp(animal);
if strcmp(probetype,'ECHIP512')==1
numchans=512; %
numshanks=8;
load('F:\Ephys Analysis\VLSE neuro 4-4 - HPC2\probe_data\ECHIP512.mat');
elseif strcmp(probetype,'ECHIP512_3xTg1-2')==1
numshanks=8;
numchans=512;
load('... |
247990bdde107e97892b6b8bd20a8cdc14defe14dcc732383373f51f94f585f6 | MATLAB | 1,599 | 45 | function data=extractdatapt(data,t,offset)
% Extract segements of spike times between t(1) and t(2)
% Usage: data=extractdatapt(data,t,offset)
%
% Input:
% data: structural array of spike times for each channel/trial or a single
% array of spike times
% t : time as a 2d vector [t(1) t(2)]
% offset: 0/1 ... |
2daf3c871e015938580b9a0b3f8d32190af4d0e3b411a2532eefda243f63dc0d | MATLAB | 1,599 | 40 | function newmap = saturate(cmap)
%SATURATE Add saturation markers to a colormap.
% SATURATE with no arguments modifies the color map of the current
% figure to emphasize minimal and maximal values. The actual change
% is chosen heuristically to contrast with the current color map. By
% default, the m... |
67e0f69cbb6f63101cc9eb64ee81491fc770b740adc6c369ecdcb68a933454a9 | MATLAB | 1,599 | 65 | function [openedge,elemid]=surfedge(f,varargin)
%
% [openedge,elemid]=surfedge(f)
%
% find the edge of an open surface or surface of a volume
%
% author: Qianqian Fang, <q.fang at neu.edu>
% date: 2007/11/21
%
% input:
% f: input, surface face element list, dimension (be,3)
%
% output:
% openedge: list of edg... |
76f5c324932cb0fe517781e8030fa36c1ac6ffaabe9d3f9ceb956e7b62da9793 | MATLAB | 1,599 | 40 | function y = vecsym(x,K) %#ok
% y = vecsym(x,K)
%
% VECSYM For the PSD submatrices, we let Yk = (Xk+Xk')/2
%
% ********** 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... |
c6b35284bc36dca89564cf49e7a92c63cfa7e46b90c6d4e72dd73ee0f99df924 | MATLAB | 1,600 | 65 | function scenario = scenario_sumr_constb_sump(par)
% r(Q+A,Q+A), b constant, p(Q+A,Q+A)
scenario.name = "sumr_constb_sump";
% define parameter set (names)
scenario.parnames = {'r0','K','b0','p0','H'};
% organize parameters in structure form
scenario.make_par = @(p) struct( ...
'r0', p(1), ...
'K',... |
05515d5adad0363ca02b3a2f727c7599a868363050a9242a1a2a5f8f7f36317e | MATLAB | 1,601 | 44 | function [n, adchans] = plx_ad_chanmap(filename)
% plx_ad_chanmap(filename): return map of raw continuous channel numbers for each channel
% for the specified .plx or .pl2 file
%
% [n, adchans] = plx_ad_chanmap(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
%
% OUTPU... |
6641329a340b3587f9e3bf93cb8a392e665d3dfd56118dbbd75659cb1368bee4 | MATLAB | 1,601 | 54 | function [ mdl, Yhat, rsq ] = fit_poly(x,y,m)
% fit_poly returns the fitted model, the curve estimation and the R^2 to
% the data. It accepts polynomials from first order up until computer
% memory and precision allows.
% [MODEL, Y_ESTIMATE, R^2] = fit_poly( X, Y, POLY_ORDER)
[x, y] = check_orientation(x,y);
if isnume... |
bc0a1e32d4f1a2dca1f417d9dfffd4598d99432afc807f2a1b9869ef6f68a8cc | MATLAB | 1,601 | 66 | function scenario = scenario_QAr_Ab_constp(par)
% r(Q,A), b(A), p constant
scenario.name = "QAr_Ab_constp";
% define parameter set (names)
scenario.parnames = {'r0','K','b0','beta','p0'};
% organize parameters in structure form
scenario.make_par = @(p) struct( ...
'r0', p(1), ...
'K', p(2), ...... |
c5f30276288c10332961b25d0699baf29c080fbdb98ec3b21be65324c3cfb85a | MATLAB | 1,601 | 66 | function scenario = scenario_QAr_Qb_constp(par)
% r(Q,A), b(Q), p constant
scenario.name = "QAr_Qb_constp";
% define parameter set (names)
scenario.parnames = {'r0','K','b0','beta','p0'};
% organize parameters in structure form
scenario.make_par = @(p) struct( ...
'r0', p(1), ...
'K', p(2), ...... |
1958c5bd090049edf1fd4974e687d66b46c3a0f3bf45a6ae5dc57577e21060f1 | MATLAB | 1,602 | 69 | function [mp rho_p mu_p] = circ_moment(alpha, w, p, cent, dim)
% [mp cbar sbar] = circ_moment(alpha, w, p, cent, dim)
% Calculates the complex p-th centred or non-centred moment
% of the angular data in angle.
%
% Input:
% alpha sample of angles
% [w weightings in case of binned angle data]
... |
e7db9645d4ee14990c60f907bedc3fb2b8bf2157446b1abda28e40a4a37781ac | MATLAB | 1,602 | 35 | function cvx_optval = sum_smallest( x, varargin )
%SUM_SMALLEST Sum of the smallest k elements of a vector.
% For a real vector X and an integer k between 1 and length(X) inclusive,
% y = SUM_SMALLEST(X,k) is the sum of the k smallest elements of X; e.g.,
% temp = sort( x )
% y = sum( temp( 1 : k ) )
%... |
09177478816348ee65a06a5b07434ddebabcb28d7a37a8fb859793af042857c5 | MATLAB | 1,603 | 56 | function [d pred] = dijkstra_sp(A,u,varargin)
% DIJKSTRA_SP Compute the weighted single source shortest path problem.
%
% Dijkstra's algorithm for the single source shortest path problem only
% works on graphs without negative edge weights.
%
% This method works on weighted directed graphs without negative edge
% weigh... |
bbc88cdcd2526f6048d0c5be8b9fbe8dad8e139b6f6ac1da6f74d260edf08d74 | MATLAB | 1,604 | 67 | function [mra mrl r t ul ll] = Rose(xin,be,ifPlot,ifSmooth)
% [mra mrl r t ul ll] = rose2(alpha,binEdges,ifPlot,ifSmooth)
if ~exist('be','var')
be = [];
end
if isempty(be)
be = linspace(0,2*pi,16);
end
if ~exist('ifSmooth','var')
ifSmooth = 0;
end
xin(isnan... |
4780d336deab218559f16a6970bcea4f692a173f1f30dfe2fe4d66fe2e4bef61 | MATLAB | 1,606 | 53 | function [d pred] = bellman_ford_sp(A,u,varargin)
% BELLMAN_FORD_SP Compute the weighted single source shortest path problem.
%
% The Bellman-Ford algorithm for the single source shortest path problem
% works on graphs with negative edge weights.
%
% See the shortest_paths function for calling information. This func... |
1c016711ae72bbe9f0d1e5bf20c7b0bf76ba62de4fdc774c424797d21fd304ff | MATLAB | 1,607 | 60 | function DBRemove(database)
%DBRemove - Remove database.
%
% Actual removal will require confirmation from the user.
%
% USAGE
%
% DBRemove(database)
%
% database database name
%
% SEE
%
% See also DBRemove, DBRemoveFigures, DBRemoveVariables.
%
% Copyright (C) 2007-2013 by Michaël Zugaro
%
% This p... |
1ee2b3903b688f6b089970b3572f77e59949e87af49cd4f001ad4da6889ce004 | MATLAB | 1,607 | 66 | function scenario = scenario_Qsumr_Ab_constp(par)
% r(Q,Q+A), b(A), p constant
scenario.name = "Qsumr_Ab_constp";
% define parameter set (names)
scenario.parnames = {'r0','K','b0','beta','p0'};
% organize parameters in structure form
scenario.make_par = @(p) struct( ...
'r0', p(1), ...
'K', p(2... |
aee901b185904af34e9ae2f6212cb06b69a9b62c56e60bf433fb05d1710d57e7 | MATLAB | 1,607 | 55 | function [no,el,fc,nodemap]=sortmesh(origin,node,elem,ecol,face,fcol)
%
% [no,el,fc]=sortmesh(origin,node,elem,face)
%
% sort nodes and elements in a mesh so that the indexed
% nodes and elements are closer to each order
% (this may reduce cache-miss in a calculation)
%
% author: Qianqian Fang, <q.fang at neu.edu>
% da... |
ead4951118fdc6e6640a61265bfe7f05927eb0d0089815814088445df757b2c0 | MATLAB | 1,607 | 40 | %% Mutual Information Demo 2
% This demo goes through calculating the mutual information for three
% continuous time series.
% Data Type: Continuous
% Number of Variables: 3
% Information Analysis: Mutual Information
% Trial Based or Single Trial: Single Trial
% Significance Testing: On
% Delays: Off
% We will gener... |
f60556a15466a0e69e89075e3d5d0c4537831e441da726b3942ec21a3b301012 | MATLAB | 1,607 | 76 | function [oisii2]=getTrigLoc(data,tw,ts,thr,nthr)
% Usage ... [ii]=getTrigLoc(data,timeLook,sampling_time,thr,nthr)
%
% data is the analog trigger data, timeLook is the time-sample distance
% between triggers, thr is the threshold for the trigger
do_verbose=0;
if nargin<5, nthr=[]; end;
if nargin<4, thr=0.1;... |
18849b7b1abeef23f7db0cfdc05f9a90b2c0da0078cc70cf952a4865d810c02f | MATLAB | 1,608 | 62 | function [varargout] = plotmd(ax, x, varargin)
%PLOTMD multi-dimensional plot of 2/3D column vectors
% PLOTMD(AX, X, VARARGIN) plots the points in matrix X in the axes with
% handle AX using the plot formatting options in VARARGIN. X must be
% a matrix whose columns are the 2D or 3D vectors to plot.
%
%... |
7d32b7dafab0e67813440a8c357308e4313d38681e4011b92a338e41ccf822b8 | MATLAB | 1,608 | 61 | % this function recompiles all .c scripts to create the apropriate .mex* files on your local machine
%NOTE: current directory must be the buzcode base directory
buzpath = pwd;
addpath(genpath('externalPackages'))
%ISSUE here with catalina... this fixed it:
%https://www.mathworks.com/matlabcentral/answers/512901-mex-... |
4a646e209e0d3d5a1a416a74cff78a949aeee911d97d0ef23746f3b3ea657ec6 | MATLAB | 1,609 | 64 | function scenario = scenario_constr_sumb_sump(par)
% r constant, b(Q+A), p(Q+A,Q+A)
scenario.name = "constr_sumb_sump";
% define parameter set (names)
scenario.parnames = {'r0','b0','beta','p0','H'};
% organize parameters in structure form
scenario.make_par = @(p) struct( ...
'r0', p(1), ...
'b0',... |
ecae229e1488f19185f85a7b9a8c65559fdb5b352436009285631168d1737ab0 | MATLAB | 1,610 | 68 | % shuffle() - shuffle a given dimension in an array
%
% Usage: >> Y = shuffle(X)
% >> [Y = shuffle(X, DIM)
%
% Inputs:
% X - input array
% DIM - dimension index (default is firt non-singleton dimention)
%
% Outputs:
% Y - shuffled array
% I - forward indices (Y = X(I) if 1D)
% J - reverse indic... |
f47d88cdd4735ac9ce83a2b494eead3cd8749adb62a959e8772968a5932939c1 | MATLAB | 1,610 | 46 | function yy=positionMask2d_wrap(mainParms,subParms,mainIm)
% Usage ... yy=positionMask2d_wrap(mainParms,subParms,mainIm)
%
% mainParms = [FOVx FOVy x0 y0]
% subParms = [nx ny FOVx's FOVy's x0's y0's]
if isstruct(mainParms),
if nargin==2, nref=subParms; tmpxy0=[0 0]; end;
if nargin==3, nref=subParms; tmpxy0=mainIm;... |
1d01b4300223d9eba7021f76ec752e94f8a912388f0fdc41039756d25eb7461c | MATLAB | 1,611 | 54 | % imagesctc() - DEPRECATED. never completed or documented.
% imagesctc() - imagesc in true color. Can help plot different
% colormap on the same window.
%
% Usage: same as imagesctc
%
% Exemple:
% figure;
% colormap(jet);
% subplot(1,2,1); imagesctc(rand(10,10));
% colorm... |
66349dddde2c03234a7a1f4756897376fc991c03d3f261214b5a5d374917827e | MATLAB | 1,612 | 68 | function [meantheta,R,sigma,confangle,kappa]=anglemean(theta);
% calculates the mean of angles
%
% [meantheta,anglestrength,sigma,confangle,kappa]=anglemean(theta);
%
% anglestrength: can be thought of as the inverse variance. [varies between 0 and one]
% sigma: circular standard deviation
% confangle: a... |
86dd5dde4cfcc3fa3cb39c7ebd296f97a09c25a2d487e4b335e08294c25ed7ec | MATLAB | 1,612 | 43 | % fieldtripchan2eeglab() - convert Fieldtrip channel location structure
% to EEGLAB channel location structure
%
% Usage:
% >> chanlocs = fieldtripchan2eeglab( fieldlocs );
%
% Inputs:
% fieldlocs - Fieldtrip channel structure. See help readlocs()
%
% Outputs:
% chanlocs - EEGLAB channel... |
2bfc149356462f3a45a0cadcab54741fcdf8a6918b4bcfb8288481de8f189da8 | MATLAB | 1,613 | 53 | function [nvar, names, types] = nex_info(filename)
% nex_info(filename) -- read and display .nex file info
%
% [nvar, names, types] = nex_info(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% OUTPUT:
% nvar - number of variables in the file
% names - [nvar 64] array of varia... |
3b74f1e0c8165efac4f39a64d220ab24f9e5d26f23fec33a4fe2e68cc4301774 | MATLAB | 1,613 | 66 | function scenario = scenario_sumr_sumb_constp(par)
% r(Q+A,Q+A), b(Q+A), p constant
scenario.name = "sumr_sumb_constp";
% define parameter set (names)
scenario.parnames = {'r0','K','b0','beta','p0'};
% organize parameters in structure form
scenario.make_par = @(p) struct( ...
'r0', p(1), ...
'K', ... |
46aaa36cb39e4b1ce3f0d72142ede6c154027022b73f362dda54cfb0a0cea943 | MATLAB | 1,613 | 63 | function sizeTree = folderSizeTree(directory)
%FOLDERSIZETREE - Calculate total size of sub-folders recursively
%
% usage: sizeTree = folderSizeTree(directory)
% The function scans all subfolders of given "directory", and returns
% a list of all subfolders and their size.
% The size of a folder is the sum of all its fi... |
bae4555060690abc0eff251c807cd67d75da1727a06ece4adf13aeaf1eb16519 | MATLAB | 1,613 | 45 | function CBIG_selectBETResults(BETOutFolderPattern)
% CBIG_selectBETResults(BETOutFolderPattern)
%
% This function selects the best (equivalently, the latest) BET result for
% each image. For example, if Image 6 is present in BET rounds 1, 2 and 3,
% then we should take the round 3 result as its final BET result.
%
% ... |
693999de022bae6eaaf04b3baf47a4165b590842b309dda52a20423f980ef2e0 | MATLAB | 1,614 | 48 | %%*******************************************************************
%% NTdirfun: compute (dX,dZ), given dy, for the NT direction.
%%
%% SDPT3: version 3.1
%% Copyright (c) 1997 by
%% K.C. Toh, M.J. Todd, R.H. Tutuncu
%% Last Modified: 16 Sep 2004
%%*******************************************************************
... |
80b2462da856c61be102269b46c67de2158c14e9844e0702370eb3c5c171856a | MATLAB | 1,614 | 49 | function [tc2, finalBaseline_out] = F_Preprocess_v2(tc, fps, ifdisp, w1, w2)
%{
F_Preprocess Calculates baseline-corrected calcium fluorescence traces
using suite2p method and taking suite2p data container as input.
input
tc: raw trace
fps = imaging fps
output
tc - baseline-corrected fluorescence
REMOVES RAW FLUORESC... |
547210ee89f094c3d7cbc11aba096c760caf56748398e3e36f3638daf0742a84 | MATLAB | 1,615 | 37 | function [ad] = PL2AdTimeSpan(filename, channel, startTime, endTime)
% PL2AdTimeSpan(filename, channel, startTime, endTime): read a span of a/d data from a .pl2 file
% returns a/d values in millivolts
%
% examples:
%
% ad = PL2AdTimeSpan(filename, channel, startTime, endTime)
% ad = PL2AdTimeSpan(... |
602c622aa5adee65aab82022adf711493e9755726ade80404c365809085fbcfa | MATLAB | 1,615 | 44 | function [out, G] = filterGauss1D(signal, 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
% ... |
813d520a5edc03d9d91ff1bcc7bd7faa84b075908021ca46a6e6ae42ef0596ba | MATLAB | 1,615 | 40 | function Dummy = isMatlabVer(varargin)
% isMatlabVer - Compare Matlab version to specified number
% Match = isMatlabVer(Relop, N)
% INPUT:
% Relop: Comparison operator as string: '<', '<=', '>', '>=', '=='.
% N: Number to compare with as DOUBLE vector with 1 to 4 elements.
%
% OUTPUT:
% Match: Locical scalar,... |
51f39d93b32a5ac461aceae76cb61ef4c902e3555249588b5102600e104cdac5 | MATLAB | 1,616 | 48 | function spikeWidth = calculateSpikeWidth(samplingRate, kilosortVersion)
% CALCULATESPIKEWIDTH Calculate spike width based on sampling rate and Kilosort version
%
% This function provides flexible spike width calculation to support
% different sampling rates (not just 30kHz).
%
% Inputs:
% samplingRate - Sampling ... |
1356d3ae9aeaf23a2e3eb26485d2ba540650883984494bc8ddbe7b88c14985b2 | MATLAB | 1,617 | 45 | %% PEAK AMP (bar graphs)
load stimAllTrials
%idx=find(tt>=1&tt<2)
tstart=1;
tstop=2;
% rr1a_micromeans=nanmean(all_rr1a_microns(tt>=tstart&tt<tstop,:));
% rr1a_microsem=nanstd(rr1a_micromeans)/sqrt(size(rr1a_micromeans,2));
rr1a_percentmeans=nanmean(all_rr1a_percent(tt>=tstart&tt<tstop,:));
rr1a_percentsem=nanstd(rr1... |
46b3ffb4491008cb62f8adb95f5d454ff0ef893bace7f5edb6853416aa73a5c6 | MATLAB | 1,617 | 48 | function map = PhaseCurve(samples,phases,varargin)
%PhaseCurve - Compute spatial phase curve.
%
% Compute phase curve, as well as occupancy and count curves.
%
% USAGE
%
% curve = PhaseCurve(samples,phases,<options>)
%
% samples e.g. angles or linear positions across time
% phases phases in r... |
b62b64b18b2bbd994b28d8079cc808c2dd12534c88e98725f0aad0c98d4f086f | MATLAB | 1,618 | 50 | %%***************************************************************
%% randmaxdet: generate random determinant maximization
%% problem.
%% min <C1,X1> + <C2,X2> - log(det(X2))
%% A1(X1) + A2(X2) = b, X1 psd, X2 pd
%%
%% [blk,At,C,b,OPTIONS] = randmaxdet(n,p,m);
%% n = dimension of SDP variable X1
%% p =... |
bb26fc610d0e7f9f6fb5037f803277a1bcf0653818761c979815993bb0ee53eb | MATLAB | 1,618 | 69 | function savebinstl(node,elem,fname,solidname)
%
% savebinstl(node,elem,fname,solidname)
%
% save a tetrahedral mesh to a binary STL (Standard Tessellation Language) file
%
% author: Qianqian Fang, <q.fang at neu.edu>
% date: 2012/02/14
%
% input:
% node: input, surface node list, dimension Nx3
% elem: input,... |
09836a7cd7362d8adec3090d6ed8801ae5dab7ed94175d3819248004b8f1a527 | MATLAB | 1,619 | 48 | classdef KTFigure
properties (Hidden, SetAccess = private, GetAccess = private)
figureHandle
end
methods (Hidden)
function obj = KTFigure
obj.figureHandle = figure;
set(obj.figureHandle, 'Visible', 'off');
end
function screenSize = getScreenSi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.