sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
7207862ef423b91fc8edc915318cf93d75161e39c16a7d629a9e36ef141ed878 | MATLAB | 1,841 | 62 | function [betas, stats] = CBIG_fitGLM(subInfoFile, GMICVFile, q)
% [betas, stats] = CBIG_fitGLM(subInfoFile, GMICVFile, q)
% All these info is baseline info
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
[RID_dx, RID_ICVoverGM, ~, RID_age, RID_gender, RID_edu] = get... |
795d7d546087ff46927929932a6bef11b3a4b3c9f14d0ebf12c1929653e93ec6 | MATLAB | 1,842 | 63 | function Y = SurfStatReadData1( filename )
%Reads data (e.g. thickness) from a single .txt or FreeSurfer file.
%
% Usage: Y = SurfStatReadTxt( filename );
%
% filename = .txt or FS file name, either new version binary or ASCII.
%
% Y = n x v vector of data, v=#vertices.
[pathstr,name,ext] = fileparts(file... |
b669251ffaf881095d277b1d45beba14af29592d567c47fede5a7985364837d3 | MATLAB | 1,843 | 58 | function t=tquant(n, p)
%TQUANT Quantiles of Student's t distribution
%
% TQUANT(n, p) is the p-quantile of a t distributed random variable
% with n degrees of freedom; that is, TQUANT(n, p) is the value below
% which 100p percent of the t distribution with n degrees of freedom
% lies.
% Modified 15-Apr-00
% ... |
d51c757bb13176a183550d0883796cfe6e99dca5a047adcada0993314f712546 | MATLAB | 1,843 | 69 | %%*****************************************************************
%% compute lower and upper bounds for the exact primal
%% optimal value.
%%
%% LB <= true optimal dual value = true optimal primal value <= UB.
%%
%%*****************************************************************
function [LB,UB] = SDPvalBo... |
0418c9df539d6a56f520d63932ac132ebcf8d6c469ab3da0f7a4905409036030 | MATLAB | 1,844 | 57 | function y = cumsum( x, dim )
%Disciplined convex/geometric programming information for SUM:
% CUMSUM(X) and CUMSUM(X,DIM) are vectorized forms of addition. So
% when CUMSUM is used in a DCP or DGP, elements in each subvector
% must satisfy the corresponding combination rules for addition (see
% PLUS). For e... |
db93e187f755a327e63b55201588c9dc9001c88c8259d52d720f38395ef0e4cd | MATLAB | 1,844 | 68 | function cvx_optpnt = simplex( sx, dim ) %#ok
%SIMPLEX The unit simplex.
% SIMPLEX(N), where N is a positive integer, creates a column vector
% variable of length N whose elements are constrained to be nonnegative
% and whose sum is constrained to be one. That is, given the declaration
% variable x(n... |
dde7944c3acb8554f22332aa920e92aa6a1502fb4d78bd1d12548412391c9d15 | MATLAB | 1,846 | 57 | % it would be nice to write something like this for the new file format....?
% function SNR = GetSNR(iClust,varargin)
% % GetSNR(iClust)
% %
% % INPUTS
% % iClust
% %
% % OUTPUTS
% %
% % SNR - signal to noise ratio of each channel for the cluster
% % Calculated for each channel as the value of the peak (or v... |
0df129a1396656063cd3c1af55a2729601c8589ef312a955b3f69589edfd29be | MATLAB | 1,847 | 52 | %%**********************************************************************
%% NTscaling: Compute NT scaling matrix
%%
%% compute SVD of Xchol*Zchol via eigenvalue decompostion of
%% Zchol * X * Zchol' = V * diag(sv2) * V'.
%% compute W satisfying W*Z*W = X.
%% W = G'*G, where G = diag(sqrt(sv)) * (invZchol*V)'
%... |
cb616c4a2bfc01288219f9b90d6e68c8cabbe00d30089f771a25e1bde3c0e75e | MATLAB | 1,847 | 67 | % Demonstration of hierarchical model fits
%
% SF 2014
clear all
HMMpath = '~/Documents/HMM';
addpath(HMMpath);
addpath('~/Dropbox/Utils/graphics/export_fig/')
Ntrials = 400;
Nsub = 100;
c = 0;
c1 = [-1.5 -1 -0.5];
c2 = [0.5 1 1.5];
group_d = 2;
group_mratio = 0.8;
type1_sigma = 0.2;
rho = 0.6;
type2_sigma = 0.2;
f... |
630b266dc3389b178a75db7d51cb7282f919d856d1d8485df588aa67ba481516 | MATLAB | 1,848 | 83 | function gzippedniis = LaBGAScore_clean_gzip_all_nii(varargin)
%
% gzips .nii files in input folder recursively
% optional specification of label to limit zipping to for example beta.nii
% files
%
% INPUTS
% 1. input folder
% specify absolute path to folder in which you want to gzip recursively
% if not specified, ... |
8d1ce1a1ee7d08d153ed0afa0c14d3ad3dd155d7ef54220265a4cca29c48107f | MATLAB | 1,848 | 45 | function mris_SD_make_template(hemi, input_surface, atlas_name, varargin)
% mris_SD_make_template(<hemi>, <input_surface>, <atlas_name>, <subject>, <subject> ...)
%
% This function goes into the directory specified by the environmental
% variable SUBJECTS_DIR and read in the <hemi> <input_surface> of the list of <subj... |
4e6fa69f2a00ef225b5c88dd4e02adbe5f03084363d37a5f3a8de36ae7c4c9d3 | MATLAB | 1,849 | 74 | function [ind,tf] = ThresholdBandDetect(A, lower_thresh, upper_thresh, min_sep, min_length)
% ind = ThresholdBandDetect(A, lower_thresh, upper_thresh, min_sep, min_length);
% [ind, epochs] = ThresholdBandDetect(A, lower_thresh, upper_thresh, min_sep, min_length);
%
% Searches for continuous epochs for which A is under ... |
ece72c65347ce44565aa129ef05d7efe779b934829306315fc1cfc28d5df3be7 | MATLAB | 1,849 | 63 | function ea_methods(options, parsestr, refs)
% Show method text and dump it to patient directory if possible
%
% options can either be a struct or a string with the patient directory.
h = dbstack;
try
callingfunction = h(2).name;
catch
callingfunction = 'base';
end
% escape '\' in file paths for Windows
if is... |
0a62adb328f427e2ba62c52185a166067a70d75d3f74c545ce1f0b2af7673774 | MATLAB | 1,850 | 55 | function [is_planar ksubgraph EI]=boyer_myrvold_planarity_test(A,varargin)
% BOYER_MYRVOLD_PLANARITY_TEST Test a graph for planarity
%
% is_planar = boyer_myrvold_planaity_test(A) yields 1 if A is a planar
% graph or 0 otherwise. A planar graph can be drawn on the xy plane with
% no edge crossings.
%
% [is_planar K] =... |
3c2b025b8763eaccef8a83a5b6787150d4f03fa02bb478c8e856fe8555d57073 | MATLAB | 1,850 | 55 | function CFA_ReOrient_Twomode(T1dir,Otherdir,ROIdir)
%%
coivox = ones(4,1); %center of intensity
% hdr = spm_vol([Imagedir,',1']); %load header
% img = spm_read_vols(hdr); %load image data
[hdr,imgr] = Dynamic_read_dir_NIFTI(T1dir);
img = reshape(imgr,hdr.dim);
img = img - min(img(:));
img(isnan(img)) = 0;
sumTotal = ... |
a7206cbae771626d4d771e57549d78d8d4b3dc9da3e45cdbb999fe8d25763896 | MATLAB | 1,850 | 66 | function results = fitWholeBrainDispersion(hr)
ds.maps = compMesoParams(hr);
ds.hr = hr;
dirs = load('dwidirections');
ds.dirs256 = [dirs.dirs256 -dirs.dirs256];
clear dirs;
modelstruc = evalin('base','modelstruc');
proto.ten = hr.user.bTensor;
proto.b = squeeze(round((prot... |
593c83cc31f1a3e0db5c0e422040fbe7050d726e3592fc181a9961cb8fd9c544 | MATLAB | 1,851 | 77 | function outcoords = ea_fsl_img2imgcoord(varargin)
% Wrapper for FSL img2imgcoord
% Input coords should have N*3 size
incoords = varargin{1};
src = varargin{2};
dest = varargin{3};
transform = varargin{4};
% Apply warp field or affine transform
if strcmp(varargin{5}, 'linear')
type = ' -xfm';
elseif strcmp(vararg... |
86f5d63e3891a2c94aaf2a52dd3099f2372f96bd5a2cd98929718a53297b34bb | MATLAB | 1,851 | 82 | function dts = plot_isi_dist(self, cel)
% Plots interspike interval histogram on current axis
ts = self.cel_ts;
if iscell(ts)
tmp_ts = cell(length(unique(self.b_epoch_group)), 1); % make cell array of ISIs
ind = 1;
for i = unique(self.b_epoch_group)'
... |
d5c56e0386e104c6c86e55cb7afb089f5a1cec6bd456603fc75d53f9f67eb5ff | MATLAB | 1,851 | 52 | function mypath = install
%INSTALL Set search paths, and download and install dependencies.
%
% IOSR.INSTALL downloads and installs the toolbox dependencies. The
% function also adds the required paths to the Matlab search path.
%
% MYPATH = IOSR.INSTALL returns the old Matlab search path MYPATH.
% Copyright... |
9e1f3f9d4b95352fea3cb464c00441b574d8ca197e5285a023082478d4d60492 | MATLAB | 1,852 | 42 | function CBIG_ASDf_factorDistribution_wrapper(inputDir, outputDir)
% CBIG_ASDf_factorDistribution_wrapper(inputDir, outputDir)
%
% Wrapper function to visualize factor distribution for all ASD participants
% in ABIDE-II together, as well as in each site for both K = 2 and 3.
%
% Input:
% - inputDir:
% Ab... |
c0cae4ddd15bf9fd29a3ddb3f6249b722581fd6a659484a78d2c05a95e26e1e8 | MATLAB | 1,852 | 63 | function multiplot(xx, yy, er, xxlabel, ttlabel, figiniID)
if isempty(xxlabel)
xlabelon = 0;
else
xlabelon = 1;
end
N = size(yy,2);
if N<=20
h1 = figure(figiniID+1);
subc = round(sqrt(N));
subr = ceil(N/subc);
for i = 1:N
subplot(subr, subc, i)
if isempty(er)
plot(xx... |
05b9dd9b48b92910be9923fe4f24c0c7aee4ba53e91c06342557205d7080d14e | MATLAB | 1,853 | 38 | % CVX: Matrix structure definitions and utilities.
% CVX provides a keyword-based method for definiting matrices
% with one or more types of structure; e.g.
% variable X(n,n) symmetric toeplitz tridiagonal;
% CVX automatically computes an efficient basis for the requested
% structure. The files in th... |
6bddb57836c06ce629fdaf5433b309d5994a95b2ad3ae8bb299058d20bb97b76 | MATLAB | 1,853 | 50 | % XMLTree: XML Toolbox for MATLAB and GNU Octave
% Version 2.1 01-Apr-2021
%
% XML file I/O.
% xmltree - Constructor (XML parser).
% save - Save an XMLTree in a file.
%
% XML Tree manipulation methods.
% add - Add a node in a tree.
% attributes - Handle attributes of a node.
% branch ... |
9aa182cf48d871d34b5d94b937a8774471f3be4ad566d8b9738b9f6de26ac805 | MATLAB | 1,853 | 51 | function CBIG_MMLDA_triangle_plot(bary_coor, colors, vertex_label, out_name)
% CBIG_MMLDA_triangle_plot(bary_coor, colors, vertex_label, out_name)
%
% Generate triangle plot and save it.
%
% Input:
% - bary_coor : N x 3 matrix, N is number of subjects. Barycentric coordinates.
% - colors : N x 1 char arr... |
018cbd7c3b2c82b292d1ba31d6032bd42245fe55bae3c4808cbeb519a343554d | MATLAB | 1,854 | 71 | function [xnew, Vnew, loglik, VVnew] = kalman_update(A, C, Q, R, y, x, V, varargin)
% KALMAN_UPDATE Do a one step update of the Kalman filter
% [xnew, Vnew, loglik] = kalman_update(A, C, Q, R, y, x, V, ...)
%
% INPUTS:
% A - the system matrix
% C - the observation matrix
% Q - the system covariance
% R - the observat... |
1a8feb7e0b41a085c7a106071153136452eb1ed1d0198702afc5d6f0e2bc504e | MATLAB | 1,854 | 50 | function [BMD,sigma_biomass_est] = GetBiomassStd(BMD_raw,params)
% This file is a part of the MDSINE program.
%
% MDSINE: Microbial Dynamical Systems INference Engine
% Infers dynamical systems models from microbiome time-series datasets, and
% predicts biologically relevant behaviors of the ecosystems.
% Copyright (C)... |
2af66fc4bb8c9b8bbf8db246efe1022dfda9113a150b13d89cf32a5569feecd8 | MATLAB | 1,854 | 68 | function [h,p, chi2stat,df] = ea_prop_test(X , N, correct)
% [h,p, chi2stat,df] = prop_test(X , N, correct)
%
% A simple Chi-square test to compare two proportions
% It is a 2 sided test with alpha=0.05
%
% Input:
% X = vector with number of success for each sample (e.g. [20 22])
% N = vector of total counts... |
72725e9f6db97b1f3657f03eca08acb049c5b31640ffe7fc88bad80c2256009f | MATLAB | 1,854 | 47 | function DBCreateTables(database)
%DBCreateTables - Create tables in existing database.
%
% Create figure and variable tables in an existing database. If you
% have admin rights to the database server, use <a href="matlab:help DBCreate">DBCreate</a> instead.
% Otherwise ask the DBA to create an empty database with the... |
b7a1b8a45663d15043ba1b2efb67c4d623c5c2ee5d36fef1947694ee6a590e02 | MATLAB | 1,854 | 38 | % CVX: Matrix structure definitions and utilities.
% CVX provides a keyword-based method for definiting matrices
% with one or more types of structure; e.g.
% variable X(n,n) symmetric toeplitz tridiagonal;
% CVX automatically computes an efficient basis for the requested
% structure. The files in th... |
e7893e63cb905f5e5bc824f8a9984b6194b6a27ea56520c08e9c394c6d22edd8 | MATLAB | 1,854 | 59 | % written by Yiyuan Han, Essex BCI-NE Lab, 01/06/2020
% getEEGmap: mark the connections between different EEG chennels accroding
% to the connectivity matrix
% Input:
% -connMat: the matrix storing the connectivity parameters between each
% pair of channels, whose dimension should be channel x channel
% channelPos: the... |
a57146ced319917c5a73822c48d14cf84d464abffea53b34223566bdacf988bf | MATLAB | 1,855 | 48 | function [cc,rms] = computeAvgTrajectoryCorrDiet(concentration,Y_est,T_data,T_dense,T_test,otus)
% This file is a part of the MDSINE program.
%
% MDSINE: Microbial Dynamical Systems INference Engine
% Infers dynamical systems models from microbiome time-series datasets, and
% predicts biologically relevant behaviors... |
a04d61b2ffc8a59eff1a24a458978eab590de59f9b57624d65362a9b9c9923c9 | MATLAB | 1,856 | 46 | % Reorganize the data to fit the catplot function
file = readtable("/Users/yiyuan/OneDrive - University of Essex/PG Research/0A_Journal/202004_unknown Journal_Probability Score/1_Results/0_Final Results/Results_tables/AccuracyData.xls");
accuracy = table2array(file(:,1));
length = table2array(file(:,2));
feature = tabl... |
5ccfed8fb4f2017067d9a27a370dedefc1d4cc168486138518934a32fd1047b8 | MATLAB | 1,858 | 52 | function ydata = tsne_d(D, labels, no_dims, perplexity)
%TSNE_D Performs symmetric t-SNE on the pairwise Euclidean distance matrix D
%
% mappedX = tsne_d(D, labels, no_dims, perplexity)
% mappedX = tsne_d(D, labels, initial_solution, perplexity)
%
% The function performs symmetric t-SNE on the NxN pairwise Euclidea... |
d692e2fe1fda6a335e4218aa49baec72982046362a61b4f4754a71edc6e39b86 | MATLAB | 1,858 | 48 | function [cc,rms] = computeAvgTrajectoryCorrCdiff(concentration,Y_est,T_data,T_dense,T_test,otus)
% This file is a part of the MDSINE program.
%
% MDSINE: Microbial Dynamical Systems INference Engine
% Infers dynamical systems models from microbiome time-series datasets, and
% predicts biologically relevant behavior... |
e187f9b9480cdf918535c8f4ecba36319a2ff76f52e2f7eb2eaeccedc214bff4 | MATLAB | 1,858 | 43 | function Y = removeoffset(X, dim, mode, dc)
%REMOVEOFFSET Remove DC offset using various techniques.
% Y = REMOVEOFFSET(X) subtracts the mean value from the data in vector X
% and returns it in vector Y. If X is a matrix, REMOVEOFFSET removes
% the mean value from each column.
%
% Y = REMOVEOFFSET(X, DIM)... |
dbc5a852aa017d4d3039d18bcd1d73c79b4be1b0af42ab731a26f50ae46032b0 | MATLAB | 1,859 | 54 | % Comparison of vanilla and response-conditional meta-d' model fit to
% simulated data with response-conditional noise
clear all
Ntrials = 10000;
c = 0;
c1 = [-1.5 -1 -0.5];
c2 = [0.5 1 1.5];
d = 2;
noise = [1/4 3/4];
% Generate data (passing in a 2-vector of noise terms generates
% differential RC meta-d')
sim = t... |
044172f736f7633f9e02e26a4334fbcf17511cb762683b2e196759793c2f8861 | MATLAB | 1,861 | 61 | function M = decode_qform0(hdr)
% Decode qform info from NIFTI-1 headers.
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: decode_qform0.m 3131 2009-05-18 15:54:10Z guillaume $
dim = double(hdr.dim);
pixdim = double(hdr.... |
970ea71da7abcc76cc6b56cddce041dea153583de364a88f1a354ddca53dd7ab | MATLAB | 1,861 | 45 | fprintf(1,'Executing %s at %s:\n',mfilename(),datestr(now));
ver,
try,
if isempty(which('spm')),
throw(MException('SPMCheck:NotFound', 'SPM not in matlab path'));
end
[name, version] = spm('ver');
fprintf('SPM version: %s Release: %s\n',name, version);
fprintf('SPM p... |
937484d9e9a570b25852bbd3ef34a067f788a8122fd02c628c99a8ab525485d7 | MATLAB | 1,862 | 45 | function Ablk = findblks(At,Ablkjc,blk0,blk1,blkstart) %#ok
% Ablk = findblks(At,Ablkjc,blk0,blk1,blkstart)
%
% FINDBLKS Find nonzero blocks
% in A, with subscripts per column bounded bij Ablkjc([blk0,blk1]),
% block partitioned by blkstart.
% If blk0 < 1 (blk1 > size(Ablkjc,2)) then start (stop) searching at co... |
18a1f26aaf61bb572574401f9475ac28834b70d28f3767463fab18ed97219b60 | MATLAB | 1,863 | 66 | function y = std( x, w, dim )
%STD Internal cvx version.
if ~cvx_isaffine( x ),
error( 'Disciplined convex programming error:\n VAR is convex and nonmonotonic in X, so X must be affine.', 1 ); %#ok
elseif nargin > 1 && ~cvx_isconstant( w ),
error( 'Weight vector must be constant.' );
end
try
if nar... |
4048867a3e061393d1e277a2444000f20431fdd4549ab5f63de0b58a628df8f5 | MATLAB | 1,863 | 23 | % eeg_options() - eeglab option script
%
% Note: DO NOT EDIT, instead use pop_editoptions() or the menu
% /File/Maximize memory in EEGLAB gui
% STUDY and file options (set these checkboxes if you intend to work with studies)
option_storedisk = 0 ; % If set, keep at most one dataset in memory. This allows ... |
70dab111a9e08fc93c1c69a59b8801e52784fba0e40e945dbf722d6ce61590f0 | MATLAB | 1,863 | 56 | function [fmri, vol, vol_size] = CBIG_MSHBM_read_fmri(fmri_name)
% [fmri, vol, vol_size] = CBIG_MSHBM_read_fmri(fmri_name)
% Given the name of functional MRI file (fmri_name), this function read in
% the fmri structure and the content of signals (vol) or functional
% connectivity matrix.
%
% Input:
% - fmri_name... |
ee47605c31c09eb89055d0a9bbf966e0cd650b7a61c0086f6ab68084df84d1b3 | MATLAB | 1,863 | 60 | function [map, mask] = interpMap2D(map, mask)
% Fill enclosed empty cells in a scalar map shaped like an image
% Identify empty regions (no data), find connected components, and for those
% that do NOT touch the image border, fill each pixel by averaging the nearest
% encountered non-empty neighbors along up/down/left/... |
66710f946816258ef6f88942c013324891e00b9b2458cc441ab5c2761d4a3cf3 | MATLAB | 1,864 | 59 | function [count,cycles] = CountSpikesPerCycle(spikes,phases)
%CountSpikesPerCycle - Count number of spikes per LFP cycle.
%
% Count the number of spikes per cycle in the ongoing oscillatory LFP
% (e.g. during theta).
%
% USAGE
%
% [count,cycles] = CountSpikesPerCycle(spikes,phases)
%
% spikes list of sp... |
e81e23ec903408e0123a864941965fd92d495aa440ad9e6bbaeb73b745ae5627 | MATLAB | 1,864 | 37 | % -------------------------------------------------------------------------
% FUNCTION which detects artifacts for entire trials without using a sliding window
% -------------------------------------------------------------------------
function [ autoart ] = artifact_threshold_rev(cfgT, data_in)
numOfTrl = lengt... |
542c88b97d94e8fa7dfc107c20b26980d9a177a8cb2cae495a7bc302c3239475 | MATLAB | 1,865 | 69 | function [isSessionInfo] = bz_isSessionInfo(SessionInfo)
% USAGE
% [isSessionInfo] = bz_isSessionInfo(SessionInfo)
%
% INPUT
% SessionInfo - struct with the following fields
% .channels
% .region
% .depth
% .nChannels
% .... |
86d0be3e701c1c29c55423f21301c8df067fd851a3b079f723caef69e643f3f8 | MATLAB | 1,865 | 62 | function tree = xmltree(varargin)
% XMLTREE/XMLTREE Constructor of the XMLTree class
% FORMAT tree = xmltree(varargin)
%
% varargin - XML filename or XML string
% tree - XMLTree Object
%
% tree = xmltree; % creates a minimal XML tree: '<tag/>'
% tree = xmltree('foo.xml'); % creates a tree from... |
8b81c23a3f70df1e9ed1c1be80637524a38f0a6ace764e0ddfe34caf629144b3 | MATLAB | 1,865 | 38 | % -------------------------------------------------------------------------
% FUNCTION which detects artifacts for entire trials without using a sliding window
% -------------------------------------------------------------------------
function [ autoart ] = artifact_threshold_rev(cfgT, data_in)
numOfTrl = lengt... |
65c669190bb58b7cac1a372a6d9303af7fbf9d36c0116b4196451b0be1ded6c0 | MATLAB | 1,866 | 67 | function [y,idx] = nanmin(a,dim,b)
% FORMAT: [Y,IDX] = NANMIN(A,DIM,[B])
%
% Minimum ignoring NaNs
%
% This function enhances the functionality of NANMIN as distributed in
% the MATLAB Statistics Toolbox and is meant as a replacement (hence the
% identical name).
%
% If fact NANMIN simply rearranges the... |
70db827bbfa5769c4ab17012fd78dd85d3f4d24c2173ca330919617b0cb3b44f | MATLAB | 1,866 | 67 | function [y,idx] = nanmax(a,dim,b)
% FORMAT: [Y,IDX] = NANMAX(A,DIM,[B])
%
% Maximum ignoring NaNs
%
% This function enhances the functionality of NANMAX as distributed in
% the MATLAB Statistics Toolbox and is meant as a replacement (hence the
% identical name).
%
% If fact NANMAX simply rearranges the... |
ef763e9461cf9486c5be3e2e6e761adad26193b944e68e57c89f6b34ad045a62 | MATLAB | 1,866 | 68 | function keep(varargin)
%KEEP keeps the caller workspace variables of your choice and clear the rest.
% Its usage is just like "clear" but only for variables.
%
% Xiaoning (David) Yang xyang@lanl.gov 1998
% Revision based on comments from Michael McPartland,
% michael@gaitalf.mgh.harvard.edu, ... |
99b5f04d32082b176587917b69aaa3838bef056e923a3066c9da52985e1d8a8d | MATLAB | 1,867 | 58 | % findboundaries() - Find boundaries (data discontinuities) in event
% structure of continuous EEG dataset
%
% Usage:
% >> boundaries = findboundaries(EEG.event);
%
% Inputs:
% EEG.event - EEGLAB EEG event structure
%
% Outputs:
% boundaries - scalar or vector of boundary event latencies... |
0825f15325042f46317808fce13547eb89bfd22f13a8033f27340d87f0976987 | MATLAB | 1,869 | 46 | function cvx_optpnt = rotated_complex_lorentz( sx, dim )
%ROTATED_COMPLEX_LORENTZ Rotated complex second-order cone.
% ROTATED_COMPLEX_LORENTZ is the complex version of ROTATED_LORENTZ.
% ROTATED_COMPLEX_LORENTZ(N), where N is a positive integer, creates a
% complex column variable of length N and two real s... |
18d9e1eba16d73948a7a00a017657082b5e4a51890354eece1e91e5c1e9ca653 | MATLAB | 1,869 | 55 | %%*************************************************************************
%% AXfun: compute AX(k) = <Ak,X>, k = 1:m
%%
%% AX = AXfun(blk,At,permA,X);
%%
%% Note: permA may be set to [] if no permutation is neccessary.
%%
%% SDPT3: version 3.1
%% Copyright (c) 1997 by
%% K.C. Toh, M.J. Todd, R.H. Tutuncu
%% Last Mod... |
a9d5123cbd49ffe7989b20774e11c3d8643579676163936bc7e7495c9d6f9caf | MATLAB | 1,870 | 87 | function x = cvx_c2r( x, dim, cleanup_eps )
%
% Determine expansion dimension
%
sx = size( x );
if nargin < 2,
dim = [ find( sx > 1 ), 1 ];
dim = dim( 1 );
elseif ~isnumeric( dim ) || dim <= 0 || dim ~= floor( dim ),
error( 'Second argument must be a dimension.' );
end
sx = [ sx, ones( 1, dim - length( sx... |
07b0ad97fda4f04b60d57216528ad80a406641f6b8ad220f2cfd7877568edc68 | MATLAB | 1,871 | 54 | function showbatchfeature(handles, im_mask_reg, ifspine, ifdendrite, ifshaft)
hplot = figure;
set(hplot, 'Name', handles.filename)
if handles.withmask == 1 && ~isempty(handles.im_mask)
subplot(121), imshowpair(im_mask_reg, handles.im_norm,'Scaling','joint'), title('Registered')
subplot(122),
end
if ifspine == 1... |
1728c226f5bfcc64045e4cbcbac2950512eba38c8c6ba2af7b74cab776c92790 | MATLAB | 1,871 | 48 | function [ad] = PL2AdTimeSpanBySource(filename, source, channelInSource, startTime, endTime)
% PL2AdTimeSpanBySource(filename, source, channelInSource, startTime, endTime): read a span of a/d data from a .pl2 file
% returns a/d values in millivolts
%
% examples:
%
% ad = PL2AdTimeSpanBySource(filen... |
0d365e6c7399947c6736b7b55d71d8364ad30b449a51c98abf8b70efcb335e96 | MATLAB | 1,872 | 78 | function result = cvfishnet(object,lambda,x,y,weights,offset,foldid,type,grouped,keep)
% Internal glmnet function. See also cvglmnet.
if nargin < 10 || isempty(keep)
keep = false;
end
typenames = struct('mse','Mean-Squared Error','mae','Mean Absolute Error','deviance','Poisson Deviance');
if strcmp(type, 'defaul... |
772b656d1a1fb8dbde9f02ac4a2448b5831b79d1b990c27ca00c311ba89dcd27 | MATLAB | 1,872 | 53 | function waveforms = LoadSpikeWaveforms(filename,nChannels,nSamples,list)
%LoadSpikeWaveforms - Read spike waveforms from disk.
%
% USAGE
%
% waveforms = LoadSpikeWaveforms(filename,nChannels,nSamples,list)
%
% filename spike waveform file name
% nChannels number of channels in electrode... |
6984b1186a766b0cbca58069ecd652d078535f09785dff35b8f3a1a136872460 | MATLAB | 1,873 | 75 | function [pval z] = circ_rtest(alpha, w, d)
%
% [pval, z] = circ_rtest(alpha,w)
% Computes Rayleigh test for non-uniformity of circular data.
% H0: the population is uniformly distributed around the circle
% HA: the populatoin is not distributed uniformly around the circle
% Assumption: the distribution h... |
0e26b22571b6706010d728a8a9120792b2dbba510092103a2861614db2578e47 | MATLAB | 1,875 | 56 | function [ WS , DS ] = importworddoccounts( filename , nheaderlines , str );
%% Imports text file with word-document counts into matlab format
%
%%
%
% [ WS , DS ] = importworddoccounts( filename ) reads in word counts per documents and
% produces the word and document indices |WS| and |DS| respectively. |WS(k)| ... |
9b6ee41f5241ab124f3013cc6ba934ee5d63d4c09dacef494957f8de73e6da3f | MATLAB | 1,875 | 61 | function sleepstagesOUT = dan_export_sleepstages(sleepstagesIN, values)
%%
% Authors: Dan Denis
% Date: 2021-07-14
%%
sleepstagesOUT = cell(length(sleepstagesIN.stages), 1);
for i = 1:length(sleepstagesIN.stages)
if sleepstagesIN.stages(i) == 0
if ~isempty(values{1})
sleepstagesOUT{... |
ff2455a97bb91ec9fd45bd5e0d82e3b2c333338c7e6439142dc07816d17c7de7 | MATLAB | 1,875 | 57 | function ea_create_surf_parcellation(parcname,erode,smooth)
if ~exist('erode', 'var')
erode=0;
end
if ~exist('smooth', 'var')
smooth=0;
end
labfile=ea_niigz(fullfile(ea_space,'labeling',ea_rmext(parcname)));
nii=ea_load_nii(labfile);
nii.img=round(nii.img); % make sure precision wise to map to integers
idx=u... |
8550983e00adc0f657a15a27f207bd466a31fcc1b7c5e7ebf958881d01b05251 | MATLAB | 1,876 | 75 |
%%
clc
clear all
close all
set(0,'defaultfigurecolor',[1 1 1]);% set figure background color
% set parameters
% input parameters
subjs = {'S01' 'S02' 'S03' 'S04' 'S05' 'S06' 'S07' 'S08' 'S09' 'S13' 'S15' 'S16' 'S17' 'S18' 'S19' 'S20' 'S21' 'S22' 'S32' 'S36' 'S37' 'S38' 'S39' 'S40' 'S41' 'S42' 'S43' 'S44' 'S45' 'S46... |
3786d658a970d99dd760cc9a92c61a25422e659393050b9c6449536165e628a6 | MATLAB | 1,877 | 62 | function tree = xmltreemod(varargin)
% XMLTREE/XMLTREE Constructor of the XMLTree class
% FORMAT tree = xmltree(varargin)
%
% varargin - XML filename or XML string
% tree - XMLTree Object
%
% tree = xmltree; % creates a minimal XML tree: '<tag/>'
% tree = xmltree('foo.xml'); % creates a tree f... |
b62ce4d8526c2f18f16327709b0712f2a133a4f2b259a7a9f14b8bd4f9bef8a9 | MATLAB | 1,877 | 44 | function y = huber_circ( x, DIM, varargin )
%HUBER_CIRC Huber penalty function with circular symmetry.
% For a vector X, HUBER_CIRC(X) computes the Huber penalty function
%
% HUBER_CIRC(X) = NORM(X,2)^2 if NORM(X,2)<=1,
% 2*NORM(X,2)-1 if NORM(X,2)>=1.
%
% For matrices and N-D array... |
f064a58a4d049c1a26de0ee2a40de36aa9032baa99dfe67783beef6fa0878049 | MATLAB | 1,879 | 44 | function plotbytrial(flybyfly,flies,trtyps,colorrange)
% aka Step2 from columnsbytrial
% This plots the data by trial. To run this, you need to navigate to a
% folder containing all the 'cat' files of the data you want to analyze.
% example inputs:
% flybyfly is an output of concat_dFF()
% flies = ['oct1322_f... |
ea50bd0fa68db14a72e5c81a29f8794bd0b333b942c6dc99a294b6d498fe70e0 | MATLAB | 1,880 | 36 | % Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions
%
%=========================================================================
%
% Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
% All rights reserved.
%
%Redistribution and use in source and binary forms, with or without
%modification, a... |
aa5a41a31a20fce1af6a6c22c20d2db5e7c421a8a6165ddb795223d526a5d2e9 | MATLAB | 1,881 | 68 | % extract raw LFP into one unified file of CA1
function extractLFP2_restricttime_notch(animal,probe,shank,time) %time in sec
exp_dir=get_exp(animal);
% [~, shank]=getCA1DGlocations(animal, side); %only needed for old data
if exist([exp_dir '\addbadchannels.mat'])>0
load([exp_dir '\addbad... |
69663366feea513afb66de81201d81fd675f6a8cc7f4f9f93b11313b2aeb3a1e | MATLAB | 1,882 | 53 | function [hObject, handles] = dan_move_to_event(hObject, handles)
% Jump to a specific event in the data
%%
% Authors: Dan Denis
% Date: 2021-07-14
%%
if ~isempty(handles.psg.events)
listIdx = listdlg('ListString', handles.psg.events{:,4},'SelectionMode', 'single');
eventSample = handles.psg.events{listId... |
749250d16615e076aeabf61b61f9267c9625a150851265c4ff97b807380beed9 | MATLAB | 1,882 | 59 | %%*******************************************************************
%% Prod2: compute the block diagonal matrix A*B
%%
%% C = Prod2(blk,A,B,options);
%%
%% INPUT: blk = a cell array describing the block structure of A and B
%% A,B = square matrices or column vectors.
%%
%% options = 0 if no special str... |
9f1318fefbd8690de54b3059b3f80a18c347548b3a85e947923c9ba59d877c98 | MATLAB | 1,882 | 68 | function plotmsd4(x,y,s,cc1,leg)
% Usage ... plotmsd4(x,y,s,c)
%
% Plots the vector y against vector x overlaying a shaded region
% by s using the color defined in c. The figure to plot should be
% cleared to avoid transparency problems.
%
% Ex. plotmsd4([0:0.05:20],sin(2*pi*0.15*[0:0.05:20]+pi/3),ones(1,length(... |
a408de1ede55d3c0f7aea6a7c928eea2757ca767013b8025a3aa69d2428b2a71 | MATLAB | 1,882 | 78 | function varargout = centerOfMass(A,varargin)
% CENTEROFMASS finds the center of mass of the N-dimensional input array
%
% CENTEROFMASS(A) finds the gray-level-weighted center of mass of the
% N-dimensional numerical array A. A must be real and finite. A warning
% is issued if A contains any negative values. Any ... |
8cc46765d08629cc71ec4bd75103af443db61cd22e0d4e0a8fc5a783f786804c | MATLAB | 1,883 | 56 | % parseCommand
%
% Parses out a string in the format specified below, into a structure.
%
% CommandType:ParamName1=ParamValue1;ParamName2=ParamValue2;
%
% The command string can have as many parameters in it as possible.
%
% Example:
% ExpParameters:TaskType=Disc;StimPattern=0;SRad=10.0000;PRad=30.0000;Int
... |
bdb78effbe0f2a505a372d685ec834e80f68f1f3669a6167c80f820362725766 | MATLAB | 1,883 | 70 |
function a = rocSal( salmap , mask )
% ROC area agreement between saliency map (salmap) and fixations (mask)
% == good measure of HOW WELL salmap 'predicts' fixations
%
% - mask is the same size as salmap and
% contains number of fixations at each
% map location ( 0,1,2,..etc. )
%
% - gives the ROC score of ... |
10fb957d37f4fb16622e39de6cc667a7f65683f1cd5274c9411721e813a3f64f | MATLAB | 1,884 | 71 | function E = hb_epochs(S, baseline_sec, block_sec, aux_timeseries)
%HB_EPOCHS Epoch HbO/HbR (and aux) from a preprocessed subject.
% E = nirsproc.hb_epochs(S, baseline_sec, block_sec, aux_timeseries)
%
% Inputs
% S : struct from nirsproc.preprocess (one subject)
% baseline_sec : seconds before onset to include in... |
174a7a27708c4962c36e197860aceb6fff0f6ae597f047e2288935dbb5dca26d | MATLAB | 1,884 | 47 | function outmap = cifti_diminfo_make_scalars(nummaps, namelist, metadatalist)
%function outmap = cifti_diminfo_make_scalars(nummaps, namelist, metadatalist)
% Create a new scalars diminfo struct.
%
% Only the nummaps argument is required.
% The namelist argument, if provided, may be a char vec... |
29737c9303756c576f1c7d27bd5631bd972b20306c7f871ae5336a5eaf79f8be | MATLAB | 1,886 | 54 | % XMLTree: XML Toolbox for MATLAB and GNU Octave
% Version 2.0 14-Aug-2015
%
% XML file I/O.
% xmltree - Constructor (XML parser).
% save - Save an XMLTree in a file.
%
% XML Tree manipulation methods.
% add - Add a node in a tree.
% attributes - Handle attributes of a node.
% b... |
5317d5416d2ee0b4d1a481be2273113ace9a0545e3dd94a6ea506355acd33099 | MATLAB | 1,886 | 66 | function y=unique_and_sort(x,sortopts)
% Unique() function that ignores NaNs in arrays and empty values as well as 'NA' in
% cellstrs, and sorts according to sortopts
%For unique() options
persistent old_matlab_2012
if isempty(old_matlab_2012)
old_matlab_2012=verLessThan('matlab','7.14');
end
%For iscategorical()... |
b03d4e0a0f6b67c2c654e7d5f3bed9bc6e2408781e4d3baed63bc9336a595378 | MATLAB | 1,886 | 51 | function test = bfTestInRange(x,name,maxValue)
%bfTestInRange A validation function that tests if the argument
% is scalar integer between 1 and maxValue
%
% This should be faster than ismember(x, 1:maxValue) while also producing
% more readable errors.
% OME Bio-Formats package for reading and converting biological f... |
c44166f6a26fe29b78c3c73d5f13a72d7c5503cf473d92aed08db7594f50c5f5 | MATLAB | 1,886 | 64 | % This script help produce a new 'jet'-like colormap based on other RGB reference colors
% ------- I WAS ASKED ---------------
% "is there a chance that you could add a diverging map going from blue to green to red as in jet,
% but using the red and blue from your RdBu map and the third darkest green from your RdYlGn... |
e2aa839117929c95094db3d034d888837b439a132e90c8c60a2c1663b578d0af | MATLAB | 1,886 | 37 | % Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions
%
%=========================================================================
%
% Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
% All rights reserved.
%
%Redistribution and use in source and binary forms, with or without
%modification, a... |
3a42d58e8168fb8733a6f285db48bf6adfecf08ec198d1880df46806aa9d24f9 | MATLAB | 1,887 | 61 | function [irm,ibm] = idealMasks(st,si,q,a)
%IDEALMASKS Calculate ideal time-frequency masks from STFTs
%
% IRM = IOSR.BSS.IDEALMASKS(ST,SI) calculates the ideal ratio mask (IRM)
% using target STFT ST and interferer STFT SI. ST and SI must be the same
% size; IRM is the same size as ST and SI.
%
% [IRM,IBM] =... |
c9d08752542c07a0f1b7f292ae8a1f1940c92cfb783322b3ff5f1bb1550f0971 | MATLAB | 1,887 | 44 | function GCO_SetLabelCost(Handle,LabelCost,LabelSubset)
% GCO_SetLabelCost Set costs associated with using labels.
% GCO_SetLabelCost(Handle,LabelCost) with scalar LabelCost gives the
% same cost to all labels.
% GCO_SetLabelCost(Handle,LabelCost) with 1xNumLabels LabelCost
% associates cost LabelCos... |
6ea61fd7103f992329b8756ede2a2f2acaed25292e84a0d2fe7b5444b6f70b30 | MATLAB | 1,888 | 78 | function [LRatio IsolDist ID] = plx_getClusterQuality(varargin)
% USAGE
%
% [LRatio IsolDist ID] = getClusterQuality(plxfile)
%
% INPUTS
%
% plx - filename of a *.plx file in the current working directory (should
% already be manually cluster cut)
%
% OUTPUTS
%
% LRatio - L_Ratio.m
% IsolDist - Isolat... |
8be868bf1c2ed4bd6a95e40739cfb0c8896efeaf3600f3e8390937b03e45fe6d | MATLAB | 1,888 | 40 | % Reading mySQL database
if ispc
NYU_share_path = 'Q:\Buzsakilabspace\Datasets';
elseif ismac
NYU_share_path = '/Volumes/buzsakilab/Buzsakilabspace/Datasets';
end
database_name = 'buzsakid_metadata'; % buzsakid_metadata, buzsakid_submitdataset
bz_database = bz_database_load(database_name,'BrainRegion LIKE "%Hi... |
473a914c943fd1e5dfb03b2c999618fdb1216480e59b286da9657fe135e9e04c | MATLAB | 1,889 | 35 | % Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions
%
%=========================================================================
%
% Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
% All rights reserved.
%
%Redistribution and use in source and binary forms, with or without
%modification, a... |
5e2d39e0391fc35cfab4355839dab2e179fda87541f785ebba927030b536572b | MATLAB | 1,889 | 44 | % std_pacplot() - Commandline function to plot cluster PAC
% (phase-amplitude coupling).
%
% Usage:
% >> [STUDY] = std_pacplot(STUDY, ALLEEG, key1, val1, key2, val2);
% >> [STUDY itcdata itctimes itcfreqs pgroup pcond pinter] = ...
% std_pacplot(STUDY, ALLEEG ...);
% Inputs:
% ... |
0456291f16f6de274e1da214bb98efbeef8750b05757ed16b5c58859934a4958 | MATLAB | 1,891 | 61 | % This script extracts averages for 16 networks based on rsfMRI connectivity,
% based on a paper (Schaefer et al. 2018) and Github repo from Thomas Yeo?s lab.
% It tests the average activity and, because each network can be divided into a
% left and right hemisphere part, it tests for significant lateralization as well... |
357aa8dc9499631b278e4fd5d4bc40d700dd85c1642eb095d27db311171f98ec | MATLAB | 1,891 | 51 | function [BMD,sigma_biomass_est] = LogBiomass_GetStd(BMD_raw,params)
% This file is a part of the MDSINE program.
%
% MDSINE: Microbial Dynamical Systems INference Engine
% Infers dynamical systems models from microbiome time-series datasets, and
% predicts biologically relevant behaviors of the ecosystems.
% Copyright... |
4835532a3a2ff6bf675ef12d1b37aa2932cd72095bd0ec76d0539698bc07e305 | MATLAB | 1,891 | 64 | function spatio_corr_mat = fiber_spatial_rev3(fibers,trgt_coor,sig,vcnty_thr)
% Min Jae Kim (mkim@bwh.harvard.edu)
%% Organizing Spatial Coordinates of Each Fibers
num_fibers=length(unique(fibers(:,4))); % number of fibers
fiber_idxi=cell(num_fibers,2); % data structure
for i=1:num_fibers
fiber_idxi{i,1}=i; %1st... |
8c3a98e1eecddca874a0365c61b0413eab15e2db71e0199645f1c04039dcab88 | MATLAB | 1,892 | 50 | function D=createDistanceMatrix(M,N)
% createDistanceMatrix calculates the distance matrix for two sets of points
%
% SYNOPSIS D=createDistanceMatrix(M,N)
%
% INPUT M and N are the matrices containing the set of point coordinates.
% M and N can represent point positions in 1, 2 and 3D, as follows... |
b1727091b84a3fa7a750df9a97aa6ca20aaac250deb36e5f2c92d234c58f870c | MATLAB | 1,893 | 81 | function [pval m] = circ_otest(alpha, sz, w)
%
% [pval, m] = circ_otest(alpha,sz,w)
% Computes Omnibus or Hodges-Ajne test for non-uniformity of circular data.
% H0: the population is uniformly distributed around the circle
% HA: the population is not distributed uniformly around the circle
%
% Alternati... |
df3198ba21f42d7ade95b43d42b4cfe2c3a97f34a48270a39772818eaf5c9d6e | MATLAB | 1,896 | 60 | function check_matlab_bgl(A,options)
% CHECK_MATLAB_BGL Checks the input A for various properties
%
% check_matlab_bgl(A,options) throws an input error if...
% A is not square
% if options.values and A is not double valued
% if options.sym = 1 and A is not symmetric
% if options.flow_graph = 1 and A is not a fl... |
4efe08d2594e5fc1447a85888894e655f2eb78faa97edb06de136748beac182f | MATLAB | 1,897 | 43 | function ddotX = ddot(d,X,blkstart, Xblkjc) %#ok
% ddotX = ddot(d,X,blkstart [, Xblkjc])
%
% DDOT Given N x m matrix X, creates (blkstart(end)-blkstart(1)) x m matrix
% ddotX, having entries d[i]'* xj[i] for each (Lorentz norm bound) block
% blkstart(i):blkstart(i+1)-1. If X is sparse, then Xblkjc(:,2:3) should
% ... |
c3b0c423deeda1516a254769b89b22c8d9c4b05721d27ff4feb387e8171a160e | MATLAB | 1,897 | 55 | function [postSpikeSup_ms, tauRise_ms, tauDecay_ms, refractoryPeriod_ms] = computeACGprop(thisACG, ACGbinSize, ACGduration)
%% post spike suppression
postSpikeSup = find(thisACG(500:1000) >= nanmean(thisACG(600:900))); % nanmean(ephysParams.ACG(iUnit, 900:1000)) also works.
if ~isempty(postSpikeSup)
postSpikeSup =... |
d835fb1576028a1c6a68cda30171dfc70aaafb975d1eee831767a1436b56a8aa | MATLAB | 1,897 | 63 | function [n, npw, ts, wave] = plx_waves(filename, channel, unit)
% plx_waves(filename, channel, unit): read waveform data from a .plx or .pl2 file
%
% [n, npw, ts, wave] = plx_waves(filename, channel, unit)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% channel - 1-based channel number ... |
10c60ccd76431b7ea66ec22e9b452f2b3f8621682d38f48181dc9941c670d7ad | MATLAB | 1,899 | 54 | 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 of occu... |
7ecd72593a238e7e9a669776181ffac02565ebd35233c2cf8cbc819199ab3b84 | MATLAB | 1,900 | 51 | function m=maximal_matching(A,varargin)
% MAXIMAL_MATCHING Compute a maximal matching
%
% A maximal matching is a subset of edges where each vertex is incident on
% only one edge and the size of the matching cannot be increased by adding
% an edge left in the graph.
%
% m=maximal_matching(A) returns a maximal matching ... |
f8a8ea33ae7baa888c10581df1a3fe0117626da63b6ca087490253111e924314 | MATLAB | 1,900 | 110 | function value = s_begin ( s1, s2 )
%*****************************************************************************80
%
%% S_BEGIN is TRUE if one string matches the beginning of the other.
%
% Discussion:
%
% The strings are compared, ignoring blanks and capitalization.
%
% Example:
%
% S1 S2 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.