sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5829da46df8e6626ef03988af996956d68e11cff205f4a9228814c82a2337db0
MATLAB
1,985
72
%% PCA Yeast Demo % The microarray data for this example is from DeRisi, JL, Iyer, VR, and % Brown, PO.; "Exploring the metabolic and genetic control of gene % expression on a genomic scale"; Science, 1997, Oct 24;278(5338):680-6, % PMID: 9381177. The authors used DNA microarrays to study temporal gene % expression of ...
894254d634f3caac153864c107efaba3aed5e1ef243518778f1acdf72e2133c1
MATLAB
1,985
82
function CBIG_MFMem_rfMRI_run_1000_simulation_trainingGrp_resHigh(save_dir_input) %-------------------------------------------------------------------------- % CBIG_MFMem_rfMRI_run_1000_simulation_trainingGrp_resHigh() % % Input parameters: % save_dir_input: Output file directory % % This function will run 1000 ...
e3b24f664853e13743854aedb64ecc9066189b249538d43a9cca189db37ebbf8
MATLAB
1,985
61
function bnd = read_asa_bnd(fn) % READ_ASA_BND reads an ASA boundary triangulation file % converting the units of the vertices to mm % Copyright (C) 2002, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: y...
eaa37fa728653efa319f04be3ad9f69ff68f9449cf2d2dd2be457a5e4f9c95c3
MATLAB
1,985
67
%% autocov_to_cpsd % % Calculate cross-power spectral density from autocovariance sequence % % <matlab:open('autocov_to_cpsd.m') code> % %% Syntax % % [S,fres] = autocov_to_cpsd(G,fres) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % G autocovari...
728113a0f6fbb13aa58c3bea5b42aff343b79b021b7fe929ea4dc5c14bb6ccc5
MATLAB
1,986
68
function [J,grad] = costFunction(theta, X, y, lambda) %COSTFUNCTION Compute cost and gradient for logistic regression % J = COSTFUNCTION(theta, X, y) computes the cost of using theta as the % parameter for logistic regression and the gradient of the cost % w.r.t. to the parameters. % from : https://github.com/m...
d7164c5317e028f109b7e737260e2a733abc88029666b3efe6d7b35343283c51
MATLAB
1,986
62
%% covariance matrix shrinkage Demo % %% % This file is from pmtk3.googlecode.com setSeed(0); d = 50; %Sigma = randpd(d); condnumber = 10; a = randn(d,1); [Sigma] = covcond(condnumber,a); % create matrix with specified condnum evalsTrue = sort(eig(Sigma),'descend'); mu = zeros(1,d); f = [2 1 1/2]; % fraction of d con...
d828d7813c865f57d81f51e6da7b24825439cfd18655abf018a2def98516d4ba
MATLAB
1,987
72
function PlotEventData(trodeFile, t0, timeWin, varargin) fig = []; titleBase = ''; returnData = false; makePlot = true; dataType = 'int16'; hsdInfo = dir(trodeFile); hsdHeader = getHsdHeader_ver4( trodeFile ); Fs = hsdHeader.sampling_rate; dataOffset = hsdHeader.dataOffset; numWires = hsdHeader.num_chan...
75eac55a00efc825549776052be307b021b3e31a9cda59ffa92bbb6e7eda2614
MATLAB
1,988
53
function confMatrixShow( CM, types, pvPairs, nDigits, showCnts ) % Used to display a confusion matrix. % % See confMatrix for general format and info on confusion matricies. This % function normalizes the CM before displaying, hence all values range in % [0,1] and rows sum to 1. % % USAGE % confMatrixShow( CM, [types]...
a189a5453a56628c179fd5f1c12679df91dcb31926aa4931104ee5100547480e
MATLAB
1,988
50
function mscmd_detect(timeseries_path,detect_out_path,opts) %MSCMD_DETECT - Detect super-threshold events in a raw/preprocessed dataset % %This is a wrapper to a command-line call to mountainsort. The %functionality is similar to that of ms_detect. % % Syntax: mscmd_detect(input_path,output_path,opts) % % Inputs: % ...
7f941c813d8e7cb6d61ea7521a2ee78960fd88c72ab6cb4857f685c49ef3b64b
MATLAB
1,989
63
function [Samp, Sph, EjeX, EjeF] = spectrogram_hilbert_lan( SIG, FE, FRANGE, TRANGE) % [Rho, Phi, EjeX, EjeF] = spectrogram_hilbert_lan( SIG, FE, FRANGE, TRANGE, WinSig, ResHz, step) % uses a hibert transform to compute the amplitud and phase values, of a matrix of signals 'SIG'. % The smaller dimension of 'SIG' is c...
c908e02e363bc3112b77cf5014b75d488cd3e318a2703ac175759ce849629bb1
MATLAB
1,990
64
function [pi h] = fdr2(p, q); % FDR false discovery rate % % Use as % h = fdr(p, q) % % This implements % Genovese CR, Lazar NA, Nichols T. % Thresholding of statistical maps in functional neuroimaging using the false discovery rate. % Neuroimage. 2002 Apr;15(4):870-8. % Copyright (C) 2005, Robert Oostenveld ...
a2de66b0cfbb6e54521033cce5a9a49c727e21d5b95dd8f9a9ee97adfa80b944
MATLAB
1,991
60
function fxt = triRMSmov(xt, nPoints) % Hybrid Triangular-weighted RMS Filter % % Define a window +/- nPoints/2 the reference point. Square all values % within the window, and weight these via a triangular weighting vector, % with a peak on the original time value. Take the root of the mean of the % weighted-squares. ...
578117f5a551ac075d316e0b28c9017c2270326efa510d64c70565ecb8711af9
MATLAB
1,992
81
classdef SparseLabelArray % size % size() of array % type % Either 'nan', 'ts', or 'log'. Corresponding base element: nan, % % -inf, false % idx % [nval] linear indices % val % [nval] values at idx. In case of type=='log' this is a scalar methods (Static) function s = create(x,ty) ...
6a927e9b02bc70ac0e3da0d42ba89b332d3646352971c671af513f837935db38
MATLAB
1,992
49
% NonRigidReg_MasterScript % Basic workflow for general projects in lab % Pre-1st-script image processing % (1) Prepare the pre and post image, run TurboReg on ImageJ (post to pre; % "scaled rotation" mode) to rigidly register the images. % (2) Output file is a 2-channel image. Remove the 2nd channel. % (3) Use "Merg...
bcb934e10ba98bfa5cd493c82d6763c2ae63bc7cf403f45ea1c80d88dab441ec
MATLAB
1,992
56
function [tm,D2]=momftfr(tfr,tmin,tmax,time); %MOMFTFR Frequency moments of a time-frequency representation. % [TM,D2]=MOMFTFR(TFR,TMIN,TMAX,TIME) computes the frequeny % moments of a time-frequency representation. % % TFR : time-frequency representation ([Nrow,Ncol]size(TFR)). % TMIN : smallest column element ...
fffd8af3ded4961855a20dd9b847621a66a6cb19aea792cfd2d6cbde9d572cda
MATLAB
1,992
30
clear;clc;close all ROOTPATH = strcat(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 4), "Data\Processed Data\"); cd(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 2)) protStr = "Active duration"; temp = NoveltySU.utils.dirItem(strcat(ROOTPATH, protStr), "spkData.mat"); popRes_behav = cell2mat(cellfu...
44235cb99733507409a91546af252a18542d39767bc0f87842a00d7197099ee1
MATLAB
1,993
65
function [alignedImage] = alignImages(refImage,targetImage,nSelections) %% >>> OPERATION >>> % Align target image to reference image based on left click selection. If % target image is a movie (3d array), the mean across the 3rd dimension % (time) is taken. % >>> INPUTS >>> % NAME TYPE, DEFAULT DES...
480b8f61e1fde314a8f3e7b805f5f74dcc1d7f1e01a9f0f2a33b32135961100c
MATLAB
1,993
74
function meg_Fig4d_ITPCbyITI_slopes_bar % function meg_Fig4d_ITPCbyITI_slopes_bar % load groupITPC_ITI % and run kt_ITPCbyITI for the model fits by jitter %% Load data load('figData/ITPC_byITI.mat') %% Settings plotSubjects = 0; saveFigs = 1; annotateStats = 1; figFormat = 'svg'; % Figure directory [figDir,dat...
092cdf922a30403c4d4b1142dbcffe4a717978615025134940be6392ee112db0
MATLAB
1,994
59
%% get_pxt_core % For use within the SDO Analysis Toolkit. % Direct kernel method for getting state probability distributions; % --> preprocessed data from getting the distributions from state; % % Should be effective for the 'multicomp' variant of the getPxt Script % Copyright (C) 2023 Trevor S. Smith % ...
788c5786db75c9a33efc956196ea7dd1de2411ff15e544b060f0163cb5de2656
MATLAB
1,994
70
% AUTHORSHIP % Primary Developer: Stephen Meehan <swmeehan@stanford.edu> % Math Lead & Secondary Developer: Connor Meehan <connor.gw.meehan@gmail.com> % Bioinformatics Lead: Wayne Moore <wmoore@stanford.edu> % Provided by the Herzenberg Lab at Stanford University % License: BSD 3 clause % classdef Suh...
f4d32338825cc17002b8b5df72267d70b464f70675e826f0f6efe08460dfbb44
MATLAB
1,994
74
%% RSA EEG-behavior script for: %% The transformation of sensory to perceptual braille letter representations %% in the visually deprived brain % Marleen Haupt and Monika Graumann % 22.02.2024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % RDMs are located in output folder % (as a default setting or ...
813ef516472cc9ce5c87b477e7f692da06f26aefcceef056c28b3bd12d9e121f
MATLAB
1,995
73
function newwave = wlStats_makePhaseShuffledWave( oldwave ) % function newwave = wlStats_makePhaseShuffledWave( oldwave ) % % This scrambles the phases of all components of a wave, smearing out % position-related information while keeping the power spectrum the same. % % This is intended to be used for surrogate testi...
01d8f96578ab6ad41271a0818f6128dd965406a1bef02f5b66b383b109a1a74b
MATLAB
1,996
64
function [classes, names, cmap] = annot2classes(lh_annot, rh_annot, hemi_split) % converts the labels in a freesurfer annotation file into a vector % where the classes correspond to the order in the color look up table % % input: % lh_annot filename of left annotation file % rh_annot filename of righ...
37df8cebb6625dbb8d0809003d5c660617b7e07178625ae2ced7defcfee8bb8c
MATLAB
1,996
58
%% Fit a Gaussian Mixture Model using over-relaxed EM % We use synthetic data sampled from a GMM % PMTKauthor Krishna Nand Keshava Murthy %% % This file is from pmtk3.googlecode.com ntrials = 2; for trial = 1:ntrials setSeed(trial); D = 15; N = 5000; Clusters = 10; mu = rand(D,Clusters); mixweight...
3931462ca671ca247f1a657365a723d8aaf056914db9a171affc4a5b42bafec0
MATLAB
1,997
62
function [lf] = eeg_infinite_monopole(rd, elc, vol) % EEG_HALFSPACE_MONOPOLE calculate the halfspace medium leadfield % on positions pnt for a monopole at position rd and conductivity cond % The halfspace solution requires a plane dividing a conductive zone of % conductivity cond, from a non coductive zone (cond = 0) ...
dc36faffc1952d807ca400c58dd0c95437b1157b6fcd167efe043fab216fa0cf
MATLAB
1,997
65
%% mvgc_cval % % Critical values for sample MVGC based on theoretical asymptotic null distribution % % <matlab:open('mvgc_cval.m') code> % %% Syntax % % x = mvgc_cval(alpha,p,m,N,nx,ny,nz,tstat) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % alpha v...
1064d0eca26a71d0d4eb760720b6d4436da57cbc3bf173b50d99e9fcb6ac667e
MATLAB
1,998
55
function [maxIntensity, sliderSteps] = h_getMaxIntensity3(handles) global h_img3; % find the maximum intensity setting for both h_imstack2 and h_imstack2a as specified in handles. [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); if isfield(currentStruct.image.data, 'maxIntens...
840d0702c91d546dabd7b41b3c0f784419d82f2f4f49e113167bdb38abc14de2
MATLAB
1,998
70
%% Reproduce fig 4.11 of "Elements of statistical learning" 2e % %% % This file is from pmtk3.googlecode.com loadData('vowelTrain'); % from http://www-stat.stanford.edu/~tibs/ElemStatLearn/datasets/vowel.train [N,D] = size(Xtrain); C = max(ytrain); % PCA projection to 2d [B,Z] = pcaPmtk(Xtrain, 2); muC = zeros(C,D);...
9d61f3b72dcacb6124d0b7a697e4f4c7195b6e1905eca03c2d207a332a4a1ca4
MATLAB
1,998
39
function [devianceResiduals,deviance,samples_deviance,samples_devianceResiduals] = getDeviance(result,Nsamples) %function [devianceResiduals,deviance,samples_deviance,samples_devianceResiduals] = getDeviance(result,Nsamples) % This function calculates the observed deviance from the model. % % If you ask for more than ...
e137234da41082b55c565a395a6eafc7bd1fa653113daaba3361c4cbea395229
MATLAB
1,998
57
function plot_epochs(params,EEG) % Recording IDs s_ids = cellfun(@(x) regexp(x,'.*(?=_eeg.set)','match','lineanchors'),{EEG.filename}); nEpochs = cellfun(@length,{EEG.epoch}); % Plot in batches of x recordings x = 30; nRec = length(EEG); nBatches = ceil(nRec/x); clear EEG; for iBatch=1:nBatches % Subset of ...
5a4df884fd21f81a690ae76c3c53b94bbd23eedd073c4cdd7ff0d05b48a9b6e0
MATLAB
1,999
75
classdef ShellLiteral < apt.ShellToken % apt.ShellLiteral - String literal token for shell commands % % Represents a literal string token in a shell command that doesn't % require path translation or locale conversion. properties value % char array containing the literal string end methods ...
9bdf2991f63c39680a5190e709ccdfeced57371c24aaef356a8f607cbb0c5006
MATLAB
1,999
75
%% plot_spw % % Plot spectral pairwise quantities on a grid % % <matlab:open('plot_spw.m') code> % %% Syntax % % plot_spw(P,fs) % %% Arguments % % _input_ % % P matrix of spectral pairwise quantities % fs sample rate in Hz (default: normalised freq as per routine 'sfreqs') % frange ...
e3485732d542b3bee00771a68599ed73a1d62f7050a11abddff2d1872ff7565d
MATLAB
1,999
57
function ccg_output = analyze_ccgs(data) % INPUT: % data: trials x time x cells %flag.start_time_index = find(tc>500,1,'first'); %flag.end_time_index = find(tc<1400,1,'last'); %1400 flag.jit_window = 25; flag.min_lag = -100; flag.max_lag = 100; % convert spike train to 'has at least 1 spike in bin' data.spiketrain...
a889447ee2c736b52d648cf99ee521a9f0462d25267337a77c72a68ff964905e
MATLAB
2,000
76
%% Gauss Imputation Demo % %% % This file is from pmtk3.googlecode.com function gaussImputationDemoOld() setSeed(0); d = 10; mu = randn(d,1); Sigma = randpd(d); pcMissing = 0.5; % Training data is larger than test data, and is missing data at random [XfullTrain, XmissTrain] = mkData(mu, Sigma, 100, true, pcMissing)...
cd6e8ae194ab6ddc175d8f143ebfe96237218716fd18580e307adff9b58d713a
MATLAB
2,001
63
loadParameters; INPUT_DIRECTORY = params.deconvolutionImagesDir; OUTPUT_DIRECTORY = params.colorCorrectionImagesDir; files = dir(fullfile(INPUT_DIRECTORY,'*.tif')); chanmap = {'ch00','ch01','ch02','ch03'}; EXPERIMENT_NAME = params.FILE_BASENAME; % sample pattern % N-4_P_ will be round 0 % N-3_P_ will be round 1 % ...
b39b5b022e8d2cb24ec6f88f6c53f7cf607ee3e44c03d97aff9fe857379fc261
MATLAB
2,002
62
function [converted] = convertEnc2Cm(data,velocityFlag, radius, stack_number) % Reads in .log file (give path as string), separates file into trials % then returns a structure with the fields, trialNum, position, velocity % and time, where position has been converted to cm. % Conversion formula is dista...
e32032e0142b5cdd2a6225074cd4f5260117b8086950ba0b5c28d4c0767eeba3
MATLAB
2,002
66
%% Plot CV error vs error vs gamma and C for an SVM, plus 1d slices % Similar to Figure 12.6 in "The elements of statistical learning" 2e % by Hastie, Tibshirani, Friedman, % We also show the 2D % surface similar to figure 7 in % http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf. % PMTKslow %% %% Load Data % T...
e9991a1d1dfa3db5d3d5321ba54687f21aeee3b937857ec4766bce0b43c9017b
MATLAB
2,002
72
function [ ] = ecog_topo_plot(topo_param,topo_vector) cmapstruct = topo_param.cmapstruct; cortex = topo_param.cortex; tala = topo_param.tala; viewstruct = topo_param.viewstruct; ix = topo_param.ix; n_ch = length(tala.electrodes); right_hemi = topo_param.right_hemi; topo_param.tala.activations = topo_vector; ...
04ceb3d4651d0fdce3dd6c4f861644f91464309a679f744ab0d46731df326862
MATLAB
2,003
59
function contrast_meta_batch(stud_dir, subj_file, GLM_name, con_vec, con_img) % _ % Contrast meta batch for analysis of the FADE data set % stud_dir - study directory in data/analyses are located % subj_file - an XLS file containing subject IDs and covariates % GLM_name - a string indicating the GLM of in...
c6834ee1b68479c3c45ab7a12b9ed80dbb16872b9b7c72bff6590d270e4b1f2f
MATLAB
2,003
61
function bnd = read_asa_bnd(fn) % READ_ASA_BND reads an ASA boundary triangulation file % converting the units of the vertices to mm % Copyright (C) 2002, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: y...
02370f3c2d221f04593d9f0a6cb5e5abc948744989fede47aeed93563d28d79e
MATLAB
2,004
49
function[slope,intercept] = subsamplingMMD(datasource,datatarget,indexsource,indextarget,itertime) %% Inputs: datasource and datatarget are related to the one dimension measurement of interest; indexsource and indextarget give the subgroup index, which need to have same range; itertime provides iteration times 'B' for ...
29f619c599c37fe4d8c9abcdb1627fdb754e616b57b0184932cca88ff4275427
MATLAB
2,004
45
function VertConn = tess_vertconn_bs(Vertices, Faces) % TESS_VERTCONN: Computes vertices connectivity. % % INPUT: % - Vertices : Mx3 double matrix % - Faces : Nx3 double matrix % OUTPUT: % - VertConn: Connectivity sparse matrix with dimension nVertices x nVertices. % It has 1 at (i,j)...
4de78a23b84b842cb0eefb6e103408e39be4f6e188b4f1068803926b22b16e31
MATLAB
2,004
89
% this function does the actual heavy lifting in % training the NN. meant to be run on a b/g worker function NNtrainOnParallelWorker(network_data) arguments network_data (1,1) struct end X = network_data.X; Y = network_data.Y; % split into training and validation R = rand(size(X,2),1)>.5; X_train = X(:,R);...
3b85d49c9c7d0d36c1a87c00df8973db45aefd00fd895c8b0af06d7b16d36234
MATLAB
2,005
41
clear all %% %Define Parameters [opt] = ParameterOptions(); %% %Define Parameters for Oscillating gradients - Consistent with Aggarwal et al. opt.nOscillations=3; % Number of oscillations per TR opt.Waveform='Sine'; % Type of Oscillating Gradient. Choose from Rect (conventional rectangular gradient), Rect_Sym (sy...
3d5380aad02c86efcaa24482e7dec578fc9f54d54c7c8f4b2e355949e83e425c
MATLAB
2,005
53
function [fx] = f_VBvolatile0(x,P,u,in) % computes Laplace-VB update rule of HGF learner % [fx] = f_VBvolatile0(x,P,u,in) % This is the one-step Markovian update rule for the posterior sufficient % statistics of a volatile environment, as derived in [Mathys et al. 2010]. % Note: HGF stands for "Hierarchical Gaussian Fi...
439e810f056872968d1177bafb116471cc658c46f3235acb6fcdd8895be524b1
MATLAB
2,005
48
% The binning-tool serves to compute histograms (1D) and conditional % expectations. The label on the x-axis is binned, various properties % such as point count per bin (histogram), the mean of another label % (regression 1Var->1Var), means of 2 other % variables (regression 1Var->2Var), can...
4f60c8465b56e8a8751c87dc7ddb790d0a5572822f3c1818373f09d71729e376
MATLAB
2,006
70
function [drNdrTdrNdr] = get_drNdrTdrNdr(M,nt,dt,par,x) %% Created by Xinan Chen in Nov 2021 %% This function returns (d(rho(:,end))/d(r))^T * d(rho(:,end))/d(r) * a vector x % x... vector length(prod(n)*nt,1) % rho(:,0) -----------> rho(:,1) --------------> rho(:,2) % u(:,1) u(:,2) %...
5b640fa5d16d63daef07bc76944ffedbc49baa0f9be3707f9dfdd13bbbfdd455
MATLAB
2,006
58
% ListStacks.m % 9/8/21 % Sarah West % Takes a vector of numbers and returns them as character strings in the % format of the stack number name the user uses. function [stackList]=ListStacks(numberVector, digitNumber) % Inputs: % number_vector-- a vector of integers corrsponding to the stack numbers % the user want...
f085b1c52bc52c42574740ebb273f4f2256930b5f589df7296ed433ea3d16bc6
MATLAB
2,006
41
function [fitted_art, post_idx_nextPeak] = fit_ecgTemplate(cnt, pca_template, ch, aPeak_idx, peak_range, pre_range, post_range, baseline_range, midP, fitted_art, post_idx_previousPeak, n_samples_fit) % select window of template template = double( pca_template( midP-peak_range : midP+peak_range, : ) ); % select window...
1ae6b71e59e9fa769bbd5a49a19338b18b828ff093e72b128e99eaf94273611a
MATLAB
2,007
85
function [res, count] = fiff_transform_eeg_chs(chs,trans) % % [res, count] = fiff_transform_eeg_chs(chs,trans) % % Move to another coordinate system in EEG channel channel info % Count gives the number of channels transformed % % NOTE: Only the eeg_loc field is modified by this routine, not % loc which remains to refle...
382e60962e597721ea6f66884721352ac2ec238b65a445d24f5101e91b7085ae
MATLAB
2,007
64
%% Convert EEGLAB files into Fieldtrip structure % For Cluster-based permutation testing % 2024 by Antonin Fourcade function NVR_12_eeglab2fieldrip(cropstyle, mov_cond, path_data) %% 1.Set Variables %clc %clear all %1.1 Set different paths: % input paths: path_data_eeg = [path_data 'EEG/']; path_in_eeg_LA = [path_dat...
bc32d03dcbaf62a1acd5aed149444adba109fc40c5e74cf041fccaa6e942125c
MATLAB
2,007
61
function [Feven,Fodd] = filterGabor2d( r, sig, lam, theta, omega, show ) % Creates an even/odd pair of 2D Gabor filters. % % Creates a pair of Gabor filters (one odd one even) at the specified % orientation. For Thomas' ECCV98 filters, use sig=sqrt(2), lam=4. Note % that originally this function computed a quadratic m...
f6192f0bf21b13111cfd8732eb53cd2460269279fba04c3122bcb9b82464f6f1
MATLAB
2,008
60
function [bouts, lens] = detect_binarybouts_v2(binary_vector) % DETECT_BINARYBOUTS serves to detect the start and end indices of binary events from vectors of zeros % and ones as well as calculate the lens of these events. Importantly, it % corrects for any spurious additional t_starts and t_ends that correspond % ...
33eaf5e7bb2df9322772a75f4ab44ee421146ff3a72a1f344c4b67adb5fa51f4
MATLAB
2,009
75
function View_ROI_Modules(IM,Anat,ROIxyz,params) % % This function generates a plot of ROI Sortings for % various kden, scanning through the kden chosen. %% Set up paramters Modules=IM.key(:,2); Cmap=IM.cMap; ROI.Nfaces=50; Nroi=size(Modules,1); Params.Cmap=Cmap; Params.Scale=length(Cmap);Params.OL=1;Para...
dbf32b17b3f2313ce29323b31c626d1a5b028007e9c9625d106d5b34a62540eb
MATLAB
2,009
52
classdef TrackFPS methods (Static) function [t_predinnr, t_predothr, t_read_tot, t_overothr] = ... computeTimes(t_over, t_read, t_pred, t_pred_inner) % Inputs % t_over: (scalar) overall time % t_read: (array of ngt) read times, per im. first typically way long % t_pred: (ar...
0c82f114ca61ad4ec915ffc28deb9d82df21207f8c3f46b38d4307a277ba8af6
MATLAB
2,010
88
% [y,npadl,npadu] = padgrab(x,padv,l1,u1,l2,u2,...) %function [y,npadl,npadu] = padgrab(x,padv,varargin) %BJA: hard-coded for 6 args to get rid of slow varargin cell array and slow padarray() function [y,npadl,npadu] = padgrab2(x,padv,l1,u1,l2,u2) % parse arguments usagestring = 'Usage: padgrab2(x,padv,l1,u1,l2,u2,......
141963569f57594a585cdd8b95b82dd159de58805d2c0cacc2f747bb4f90a2e0
MATLAB
2,010
72
function Y = clfLdaFwd( clf, X ) % Apply the Linear Discriminant Analysis (LDA) classifier to data X. % % USAGE % Y = clfLdaFwd( clf, X ) % % INPUTS % clf - trained model % X - nxp data array % % OUTPUTS % Y - nx1 vector of labels predicted according to the model % % EXAMPLE % % See also CLFLDA, CLF...
2be419989af1b33abbb9e2dc6535dfcc803d147e26369a5b98933c6fb6c61e45
MATLAB
2,010
60
%% Collapsing and scaling tensors % The tensor and sptensor classes support that notion of collapsing and % scaling dimensions. %% Examples of collapsing a tensor X = tenrand([4 3 2]) %<-- Generate some data. %% Y = collapse(X,[2 3]) %<-- Sum of entries in each mode-1 slice. %% Y = collapse(X,-1) %<-- Same as above. %...
bee66432b695836f663fc75ecb5eefbb52a547bb218b9a503d321217f0f6b736
MATLAB
2,010
56
% Author: Birgit Nierula % nierula@cbs.mpg.de %% SpinCCsep_01_prepro_1_automatic_Rpeakdetection srmr_nr = 2; ana_dir = '/data/pt_02151/'; cfg_path = [ana_dir 'analysis/manuscript_sep/scripts/cfg_srmr2/']; % here is important info for the analysis % Add paths addpath('/data/pt_02068/toolboxes/eeglab14_1_2b/') addpath...
dabecdb8fac4cb6399843ef941134b782d5a897e88fc22a01f5a051f0c5049c4
MATLAB
2,010
76
function newevents = wlProc_calcEventSNRs(data, samprate, oldevents) % function newevents = wlProc_calcEventSNRs(data, samprate, oldevents) % % This function calculates the approximate signal-to-noise ratios of a list % of detected events. The event waveform is reconstructed from its extracted % paramters, and the pow...
ee6900a4b12b592b7171d4031880f7cba2368ecc1ddbc0d2388ea7cc7131d796
MATLAB
2,010
71
function [drNdrTdrNdu] = get_drNdrTdrNdu(M,nt,dt,par,x) %% Created by Xinan Chen in Nov 2021 %% This function returns (d(rho(:,end))/d(r))^T * d(rho(:,end))/d(u) * a vector x % x... vector length(prod(n)*nt*dim,1) % rho(:,0) -----------> rho(:,1) --------------> rho(:,2) % u(:,1) u(:,...
a198d659e892dd1d5e9979dd0efe99817f48ff149bb9e52c19b9d88a97b05e3c
MATLAB
2,011
69
function [drNduTdrNdr] = get_drNduTdrNdr(M,nt,dt,par,x) %% Created by Xinan Chen in Nov 2021 %% This function returns (d(rho(:,end))/d(u))^T * d(rho(:,end))/d(r) * a vector x % x... vector length(prod(n)*nt,1) % rho(:,0) -----------> rho(:,1) --------------> rho(:,2) % u(:,1) u(:,2) %...
ca8a25387a515ad2a67427b01de2d2f806a471249f153710801c456d066e7384
MATLAB
2,012
54
classdef AdjMatrixFromFile < adjmatrix.AdjMatrix % handle makes this class being passed as reference instead of value % creates adjacency matrix from the specified text file properties (Access = protected) FileName; Delimiter; NHeader; end methods function this = Adj...
946b3205d312c0fd1c2762ca0c7715119cb8d24bad7ac0f1dabe06aabd892a8d
MATLAB
2,013
68
%% Global Default Options GlobalOpts.Subject='p1';%'p1','p3'; GlobalOpts.TaskName='FaceScratch3'; % used for folders and file names GlobalOpts.TaskFileName='FaceScratch3'; % To use with LoadConvertedData % Analyses phases and windows for trial response and temporally resovled % response (TR) GlobalOpts.Pha...
339367143de64f5b7b003c69d913eb4cbe1f7fbe67426b235ff7eaa81208966a
MATLAB
2,014
68
function [varargout] = ltrisect(varargin) % LTRISECT intersects a line with a plane spanned by three vertices % % Use as % [sect] = ltrisect(v1, v2, v3, l1, l2) % where v1, v2 and v3 are three vertices spanning the plane, and l1 and l2 % are two points on the line % Copyright (C) 2002-2009, Robert Oostenveld % % Th...
436f6a31c515d26f9d470e40eba9618b49fd0206944e0a609165ea0a9c9c0b30
MATLAB
2,015
57
function [dat] = read_bucn_nirsdata(filename, hdr, begsample, endsample, chanindx) % READ_BUCN_NIRSDATA reads ASCII-formatted NIRS data acquired with the % UCL-BIRKBECK machine and postprocessed by the Paris group. The first line % contains the channel labels and the rest of the file contains per line a % time sample....
52568658725441db6d58380ffb17335c013283266a4d3feff1088b34d3e9e3c7
MATLAB
2,015
41
classdef CBIG_MSHBM_unit_test < matlab.unittest.TestCase % Written by Ru(by) Kong and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md methods (Test) function test_example(testCase) % create output folder CBIG_CODE_DIR = getenv('CBIG_CODE_DIR'); ...
7f3b8a9d5298f028b91bea1a22d247d0883421ccfad82f0a3350854c51ac628a
MATLAB
2,015
62
%% Compares 3d Tracking output to non-tracking outputs addpath ~bransonk/behavioranalysis/code/Jdetect/Jdetect/filehandling; addpath ~bransonk/behavioranalysis/code/Jdetect/Jdetect/misc; addpath /groups/branson/bransonlab/projects/flyHeadTracking/code/ addpath ~bransonk/tracking/code/Ctrax/matlab/netlab infile = '~/...
931e8b2a2233514ad580953b7421cd6bdea31d4dfa90a73e7e53b0a6ca21406d
MATLAB
2,015
57
function [obj] = internal_TL_analysis(... BOLD_fMRI_unsmoothed_data, ... BOLD_fMRI_Smoothed_data, ... runMotionParameters, ... FreeSurfer_segmentation_Atlas_path, ... FreeSurfer_Thalamic_Segmentation, ... participant_TL_task_log_path, ... subjectID, ... TR...
00763f9bf48a25f246b052ec8b549a99c51dc87b614707457cc6bae5f66cefbb
MATLAB
2,016
70
function spkDat = AlignClusterMeans(spkDat, varargin) [wL, nChan, ~] = size(spkDat.waves); pk = spkDat.peakLoc; wP = spkDat.wavePad; wL = wL - 2*wP; chanList = 1:nChan; clustList = setdiff(unique(spkDat.id), 0); shift = -8*spkDat.upsample : 8*spkDat.upsample; if ~isempty(spkDat.alignWin) win = spkDat.alignWin; els...
14a56a37aae15d2b74ecd8d564bfa73d421537e18ac1f3331c9256a8db36b955
MATLAB
2,017
95
function [x,f,funEvals] = minConf_Sep(funObj1,funObj2,x,funProj,options) if nargin < 5 options = []; end [verbose,optTol,maxIter,memory] = myProcessOptions(options,'verbose',1,'optTol',1e-6,'maxIter',500,'memory',10); if verbose fprintf('%10s %10s %10s %15s %15s\n','Iteration','FunEvals','Projections','Step Leng...
79ee33667637446741cb49b354240cf377be30d70f3ee1161d31f03aed089ac8
MATLAB
2,017
46
clear; basefolder = fileparts(fileparts(fileparts(mfilename('fullpath')))); codefolder = [basefolder,'/code']; addpath(genpath(codefolder)); config1_path = [basefolder, '/tests/fixtures/config.json']; config2_path = [basefolder, '/tests/fixtures/config2.json']; config3_path = [basefolder, '/tests/fixtures/config3.jso...
9f1895ce9254612d384ef70a52c3656ad65f69c7e2e638997f3aa911f162e77b
MATLAB
2,017
57
% SIGNIFICANT_SPAN identifies longest timespan that exceeds significance % if one exists % significantSpan.m % % Copyright 2008 Vanderbilt University. All rights reserved. % John Haitas, Jeremiah Cohen, and Jeff Schall % % This file is part of JPSTH Toolbox. % % JPSTH Toolbox is free software: you can redistribute...
c22d2a41032f03191ac225df4a93ab501b924f38dd3b13dbf2ec207606f6a091
MATLAB
2,017
84
function [CC,CCmda]=ms_cross_correlograms(times,labels,max_dt) %MS_CROSS_CORRELOGRAMS - The slow way to generate cross correlogram data. %Better to use mscmd_cross_correlograms % %MountainView can be used to view cross-correlograms. It requires the %cross-correlograms to be prepared with a particular format, provided i...
df94a8665f8cc456905d0417dd5ec1feb78db4c0055ad96a4bc558ab94f6c130
MATLAB
2,017
52
function [lineOut, fillOut] = stdshade(amatrix,alpha,acolor,F,smth) % usage: stdshading(amatrix,alpha,acolor,F,smth) % plot mean and sem/std coming from a matrix of data, at which each row is an % observation. sem/std is shown as shading. % - acolor defines the used color (default is red) % - F assignes the used x axi...
6dc3564c74c5620d6ed30c212fbc699ee442d0d286d8d25f789c752af908858d
MATLAB
2,018
107
%% Metropolis Hastings Logistic Regression Demo % Example from Johnson and Albert p87 % %% % This file is from pmtk3.googlecode.com function [X, y, ws] = logregSatMhDemo(doPlot) if nargin < 1, doPlot = 1; end [X,y] = satDataLoad; model = logregBinaryFitL2IRLS(X, y, 1e-8, false); w = model.w; C = model.C; % MH set...
753dfd8cec9c141576725027b711cdb21dfeeb7ddaa92063d89349af02912570
MATLAB
2,018
81
% Demo for partially observable oscillatory system. % This demo inverts a model of a linear oscillatory system, which is % observed through a nonlinear sigmoid function. clear variables close all % Choose basic settings for simulations n_t = 2e2; delta_t = 2e-1; % integration time step (Euler method) f_fname ...
b7d33ebb2c09e7b4fb90d912a132b9e84efb19dd097cb04b4d74d9d7d80dbb6e
MATLAB
2,018
63
%% Script for processing all tomograms in a directory with membflt % Author: Antonio Martinez-Sanchez %% Clear workspace close all clear all %% Input/Output directories din = '/fs/pool/pool-lucic2/antonio/tomograms/julio/t364'; dout = '/fs/pool/pool-lucic2/antonio/tomograms/julio/seg'; %% Input parameters s = 10; %...
d5b2cef949d281bd58e8837499502277f414493c758b258dcedfcf20a4263a17
MATLAB
2,018
82
function [ha] = plotVolterra(hf,mw,vw) nu = size(mw,2); if nu==6 str={'choice=1 * feedback',... 'choice=0 * feedback',... 'opponent=1 * feedback',... 'opponent=0 * feedback',... 'choice=1 * [CST]',... 'opponent=1 * [CST]'}; n = nu/2+1; for i=1:nu h...
e704feaca8d1dc49b618cf4dcf23b38bb8ee715ca20e2672bf2034a552571244
MATLAB
2,018
73
%% Test of code/mapper/mapper.m % Setup base path clear; basefolder = fileparts(fileparts(mfilename('fullpath'))); codefolder = [basefolder,'/code']; toolsfolder = [basefolder,'/tests/tools']; addpath(genpath(codefolder)); addpath(genpath(toolsfolder)); % Load Data data = readNPY([basefolder, '/tests/fixtures/exampl...
f836ece35716b676c0b9964e5f88c49b76e77c7990b2fabed352551b59570fe1
MATLAB
2,018
71
function dt = AlignTest(spkDat, varargin) % aligns the waveforms in each cluster to the average waveform for that % cluster spkDat.waves = double(spkDat.waves); [wL, nChan, ~] = size(spkDat.waves); chanList = 1:nChan; clustList = setdiff(unique(spkDat.id), 0); shift = [-0.2 0.2]; pk = spkDat.peakLoc; wP = spkDat.wave...
c5e6680f7151d9c25ff360c349a650aa87b430158c71f94eb905a42c43bab1ba
MATLAB
2,019
41
function generateAuthorReport() %% Generate the html contributing author report % PMTKneedsMatlab % This file is from pmtk3.googlecode.com dest = fullfile(pmtk3Root(), 'docs', 'authors'); outputFile = fullfile(dest, 'fileAuthors.html'); excludedAuthors = tokenize(getConfigValue('PMTKauthors'), ','); ...
189833897e91026734591e6be05896194b2178b371650fe8579b01378dcd8aa8
MATLAB
2,020
68
function [varargout] = ltrisect(varargin) % LTRISECT intersects a line with a plane spanned by three vertices % % Use as % [sect] = ltrisect(v1, v2, v3, l1, l2) % where v1, v2 and v3 are three vertices spanning the plane, and l1 and l2 % are two points on the line % Copyright (C) 2002-2009, Robert Oostenveld % % Th...
9c67e5e9fc409cd6dc01a71949279e954f984377cbf74a6f6f9eb8a8744fc403
MATLAB
2,020
65
%% Clear Current Location datRoot = '/Volumes/LaCie/Farries recordings/'; rat = 'IM1261'; sesList = dir([datRoot rat '/20*']); sesList = arrayfun(@(x) x.name, sesList, 'UniformOutput', false); sorted = cellfun(@(s) exist([datRoot rat filesep s filesep 'unitDat.mat']), sesList) == 2; behav = cellfun(@(s) exist([datRoot...
b2d18d594f16e714ed76abbe2d79029deb1b1bcb4e793e6408ea17c5e5913c30
MATLAB
2,020
81
function o = niftistruc % Create a data structure describing NIFTI headers % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id$ persistent org; if ~isempty(org), o = org; return; end; t = struct('conv',{ @char , @uint8 ...
f142c9fa9797a409e25a061c1e9a7cdd0e538dcdc1b323deb830541562a1df70
MATLAB
2,020
54
function [varargout] = iscolumn(varargin) % ISCOLUMNN is a drop-in replacement for the same function that was % introduced in MATLAB R2010b. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % see https://github.com/fieldtrip/fieldtrip/issues...
5e3b4318662eaf07eab098bd8823a83a7a068d405dacdd1504f9b8cc349b9816
MATLAB
2,021
67
function writenodelm_solidmesh_vtk(fn,e,p,soldata,nnpe) % Writes a solid mesh defined in e and p to 'fn' % 'soldata' is the nodal solution for every point in p: % soldata{1} = Name of fields/solutions % soldata{2} = a numnodes by d matrix where d is number of fields % defined in soldata{1,:} % % Written by Hamid...
071472e4bef62f9936408eb16a91928bfc149b0470e8865675c14f8ab25384e6
MATLAB
2,022
51
% function MapMontage (Montage) % % This routine roughly maps the 2-D locations of an EEG montage (down view, % nose on top, circle approximates Fpz-T7-Oz-T8 plane). % % Usage: MapMontage (Montage); % % Input argument: Montage cell structure returned by the CSD toolbox % Ext...
4b0830d1552192c810842c86c6e814284921e2022d318af3ef4e2909379b6b33
MATLAB
2,022
60
function loc_list_save_png(data,map,c_lim) path = uigetdir(pwd); if path~=0 answer = inputdlg({'Pixel Size:','Resolution:'},'Input',[1 50],{'116','20'}); if isempty(answer)~=1 pixel_size = str2double(answer{1}); resolution = str2double(answer{2}); f=waitbar(0,'Saving Image...'); ...
b76cf8a9ffa7fbe3924577ce84756af5a2109834959bb64bb95801f7dd69f9d0
MATLAB
2,022
59
function unit = ft_estimate_units(size) % FT_ESTIMATE_UNITS tries to determine the units of a geometrical object by % looking at its size and by relating this to the approximate size of the % human head according to the following table: % from 0.050 to 0.500 -> meter % from 0.500 to 5.000 -> decimeter % fr...
298175bdd0a22d6dde4897139cad24a236241fbf6942afef3d9642c0defd56ce
MATLAB
2,023
60
function F = filmStrip( I, overlap, delta, border ) % Used to display R stacks of T images as a "filmstrip". % % See examples below to see what is meant by "filmstrip". % % USAGE % F = filmStrip( I, overlap, delta, border ) % % INPUTS % I - MxNxTxR or MxNx1xTxR or MxNx3xTxR array % (of bw or co...
366f845a9373ff72744eda809e9ec5432de07cd04ac635c9c687891d6765e83b
MATLAB
2,023
51
function [Epri, Ppri] = bemf3_inc_field_electric_gauss(strdipolePplus, strdipolePminus, strdipolesig, strdipoleCurrent, P, t) % Computes potential and electric field from the dipole distribution via the FMM % on traingles using Gaussian quadrature(s) % % Copyright SNM 2018-2020 M = size(t, 1); % Gaussi...
aea7a6e459e97f8bed4b84ecc3f82c30b67742c8ce0cdbc733b4d311f49a66f7
MATLAB
2,023
45
% compute_stats_PCA inclPC2 = 100; allExpl = nan(8, inclPC2); for sess = 1 : 8 clear outPCA suff = '_mean_stp50'; load(fullfile(saveLoc, ['pca' suff '_S' num2str(sess)]), 'outPCA'); numPCs(sess) = length(outPCA.explainedD); nn = min(numPCs(sess), inclPC2); allExpl(sess, 1 : nn) = outPCA.e...
64b30b03df6e86011a014df51660096a339084a4dce49a86539216d0968573f0
MATLAB
2,024
66
function y = VBA_nanvar(x,dim,flag) % FORMAT: Y = VBA_NANVAR(X,DIM,FLAG) % % Variance ignoring NaNs % % This function enhances the functionality of NANVAR as distributed in % the MATLAB Statistics Toolbox and is meant as a replacement (hence the % identical name). % % NANVAR(X,DIM) calculates the stan...
fb66733ef8f3c0c616d4746da63c733504fc3cf68f45fec44a8c431861431e05
MATLAB
2,024
51
function [varargout] = newline(varargin) % NEWLINE Create newline character % C = newline creates the character representing a newline. % newline is equivalent to char(10) or sprintf('\n'). % % This is a compatibility function that should only be added to the path on % MATLAB versions prior to R2016b. %%%%%%%%%%%...
3778df9bbdd34e0f447e5f69d92c40afeecc3003584c1eb975e9663fd0c35684
MATLAB
2,025
76
function [eigs, neigs_uns, Vs, Us] = get_linear_stability(net, n_x0_1, do_return_eigvecs) % A function to automate the linear stability analysis around the point n_x0_1. % % INPUTS % net - the matlab structure of the network being analyzed. % % n_x0_1 - the point around which the linear stability analysis is done. % %...
83b1c5b727e1dea32afbd86e99773bcf6ccf55ff476b18c0291abbbc397c5075
MATLAB
2,025
62
function [posterior, out] = demo_logisticRegression() % // VBA toolbox ////////////////////////////////////////////////////////// % [posterior, out] = demo_logisticRegression() % % this function exemplifies the use of the logistic model to perform a % regression on binary data % Specify the logistic model % ==========...
c6341c4f1defa7aeb218e10a4801989e270aa2154f21348b11b5c692ef8c2105
MATLAB
2,027
62
function thresholds = determine_intensity_threshold_5xFAD(params,roi,synchannels) %calculates correlation and volume overlap between different AB channels folder = params.parentfolder; %Extract parameters xystep = params.xystep; zstep = params.zstep; nchannels = length(synchannels); for im1 = 1:nchannels %nested loo...
8adc4b96b1d153cfeedad6e3ca79f638e86f9118b6fc9690c6f1e18686758e6d
MATLAB
2,028
64
%% Visualize EM Lower Bounds % %% % This file is from pmtk3.googlecode.com function emLogLikelihoodMax f1 = @(x) log(gaussProb(x,0,0.25.^2)')+1; f2 = @(x) log(gaussProb(x,1,0.2.^2)')+20; f3 = @(x) 5*sin(2*(x-0.5)) + ... f1(0.5*x) + ... f2(0.5*x) ...
949eefe437c4f1f25e1dee75427535f7ecbfc43f1c0a8735f61631e59b8339e4
MATLAB
2,028
59
function create_channelmap(basepath,varargin) % create a channel map file based on the .xml file. Original script from % kilosort 1 wrapper. Modified to not use channels that user set as 'skip' % in the .xml file. Modified further to accomodate probe geometry. % % Assumes xml file is named after raw data folder b...