sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2aaf4ec87d3a26a458fab08190bebc50955c2322be134690c0791547364dc7a4
MATLAB
2,192
67
function process_tracking(basepath,varargin) % processes dlc output and loads into animal behavior file for SNLab ephys % % Pipeline --> % 1. general_behavior_file creation -> % 2. trials_from_metadata -> % 3. maze_coords -> % 4. Restrictxy and scale coords -> % 5. saves have to general behavior file % Dependenci...
41fd12786f065ce3690aad230104c2f2842f1dfc66c2c489758902e4d3478c36
MATLAB
2,192
80
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % % findSpikes.m % part of the crabsort package % % created by Srinivas Gorur-Shandilya at 8:58 ,...
cae8d45df33edb0058d0b058c4aaf5da0e6115881082cc2ff5e814ca8170e4e8
MATLAB
2,192
70
function [newface, newfaceIdx] = clip_mesh(face) % remove dangling triangles and ears from a mesh % % [newface, newfaceIdx] = clip_mesh(face) % % face: triangulation % newface: clipped triangulation % newfaceIdx: indices of new faces in old triangulation % % partially based on compute_boundary ...
d6ca56423a9c5c3127a49ec39a41850694df504257256a9230f5c9912d85b758
MATLAB
2,192
65
function [posterior,suffStat,options] = VBA_Initialize(y,u,dim,options) % initializes approximate posterior of sDCM unknown variables % function [posterior,suffStat] = VBA_Initialize(y,u,muX0,f_fname,g_fname,options) % % This function initializes the parameters and hidden-states which have to % be estimated using the V...
341a3dcc3445cb459ae82cc70f3155b71eae6e4280416113d9fe8a609cd21f5f
MATLAB
2,193
66
function [F, dF] = nca_lin_grad(x, X, labels, no_dims, lambda) %NCA_LIN_GRAD Computes NCA gradient on the specified dataset % % [C, dC] = nca_lin_grad(x, X, labels, no_dims, lambda) % % Computes the linear Neighborhood Components Analysis (NCA) gradient % on the dataset specified through X and labels to reduce...
5791d54038c4b9e8f9d1bffea51772db293dddaff404bc11bc54c388c6a565cf
MATLAB
2,193
82
function contrasts = staircaseAdjustmentContrastTargets(pedestal, contrasts, perfs) % % function staircaseAdjustment(contrasts, discrims) % % contrast is [low-contrast(decrement) high-contrast(increment)] % discrim is [valid-discrim-targetType1(decrement) % valid-discrim-targetType2(increment)] %% pedestal can be 1 or...
698b55577c8469e92e8d53fe7094e19f5f388cf10ab62b036423088466e4e140
MATLAB
2,193
71
function [mu,curv,out] = VBA_optimCost(costFcn,init,options) % generic call function for function f(x,args) maximization % function [opt,curv,out] = VBA_optimCost(costFcn,init,options) % IN: % - costFtn: the name/handle of the function that computes the cost, % taking x and some arguments 'args'. Its I/O format sho...
77747442bcf7c8605cbd2f3308fb207645958af1802bbdaeb1b6e36598ae9d08
MATLAB
2,193
57
function id = defaultId % DEFAULTID returns a string that can serve as warning or error identifier, % for example 'FieldTip:ft_read_header:line345'. % % See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG % Copyright (C) 2017, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org...
f1036b61d5ff9d22f890b779e0adc9f2f8567ae3f66816806a0c882c8cbe8be8
MATLAB
2,193
52
% 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...
bb3081ea6a3e55c30ce545aeb1885396885dd02ae406880ad52b7aebe9389771
MATLAB
2,194
96
%% Time series as s state space model % State = (level, trend, q3, q2, q1) % % X(t+1) = A X(t) + noise(Q) % Y(t) = C X(t) + noise(R) %% % This file is from pmtk3.googlecode.com linestyles = {'-', ':', '-.'}; colors = {'k', 'r', 'b'}; %% Local level model setSeed(0); ss = 1; % state size os = 1; % observation size ...
437de03381b89f025ee94aeb584bd07612e09404a50f6b1591422ebcf2f13505
MATLAB
2,195
70
%% mvgc_pval % % p-values for sample MVGC based on theoretical asymptotic null distribution % % <matlab:open('mvgc_pval.m') code> % %% Syntax % % pval = mvgc_pval(x,p,m,N,nx,ny,nz,tstat) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % x matrix of...
fd28cb770faceb28585bb8374e5285ae0413baab40df002c8ec395d046f8a318
MATLAB
2,195
66
% create a channel map file Nchannels = 64; connected = true(Nchannels, 1); chanMap = 1:Nchannels; chanMap0ind = chanMap - 1; Nshanks = 4; ycoords = [0,-25,-40,-65,...% shank A -80, -105, -120, -145,... -160,-185,-200,-225,... -240,-265,-280,-305,... 0,-25,-40,-65,... % shank B -80, -105, -120...
9e66dee48731093254ab416c9f8af60d8cbda519f46cd4d9412da7cb8b5fa9ed
MATLAB
2,196
62
function [errcode, times, wave, mag, freq, phase] = ... wlSynth_makeOneBurst_Simple(samprate, f1, f2, a1, a2, pstart, periods) % function [errcode, times, wave, mag, freq, phase] = ... % wlSynth_makeOneBurst_Simple(samprate, f1, f2, a1, a2, pstart, periods) % % This function generates an oscillatory burst aligned ...
d03cab0d9d9fa2f79478805c0a7ea09258cef2278a0c646376f4e52f57f48309
MATLAB
2,196
68
function [dat, w] = ft_preproc_denoise(dat, refdat, hilbertflag) % FT_PREPROC_DENOISE performs a regression of the matrix dat onto % refdat, and subtracts the projected data. This is for the % purpose of removing signals generated by coils during continuous % head motion tracking, for example. % % Use as % [dat] = ...
0b1f73dd8a09a06858cd4fcbeb5fe5e98ecf936bd1ecbbe37931872ec80adbda
MATLAB
2,197
62
function eulcfg = paramInitEULApar(cfg) % Created by Xinan Chen on 09/24/2022. % This function returns parameters corresponding to the input 'data_name' and analysis type % Input: type := 's' if run for speed map; 'v' if run for flux vectors % Output: 'eulcfg' := structure containing parameters for EULA analysis ...
5cde4aad445c2bc6b2c8030d89a84f4bd4b7b82c562c95c877fae038dcc2699a
MATLAB
2,197
68
function wlPlot_plotEventXYMultiDual(cfg, matchseries, ... freqrange, durrange, amprange, figtitle, filelabel) % function wlPlot_plotEventXYMultiDual(cfg, matchseries, ... % freqrange, durrange, amprange, figtitle, filelabel) % % This function makes a scatter-plot of detected parameter values vs % ground-truth par...
846406a5a3615a4ea3261e074fec40bb3ab156b5128ad3bcda6a47f8113dc98e
MATLAB
2,197
75
%% getCommonCdfPlot % Common plotter module used in MAB's code to plot significance of % test statistic vs. distribution of shuffled test statistics. For use % within the SDO Analysis Toolkit. % Copyright (C) 2023 Trevor S. Smith % Drexel University College of Medicine % % This program is free software: yo...
8f9b5721b96f750d9056baf97482891f4c330d331d079921e6252e3314ac4548
MATLAB
2,197
75
function writenodelm_surface_medit(fn,faces,p,nodemap,verbose) % writenodelm_surface_medit(fn,faces,p,nodemap) % Writes a shell surface defined in 'faces' and 'p' to a file called 'fn' % in medit format (.mesh) so it can be viewed using medit. % Note that this routine renumbers the node numbers from 1 to N and accordin...
81e3fac7e50f6bfdd6ca1c6faac89ab5cae37e45593ee3846d7fe70168ec2dab
MATLAB
2,198
45
function q = CBIG_AuthorTopic_EM_Exp_Inference(w, paradigm, params) % q = CBIG_AuthorTopic_EM_Exp_Inference(w, paradigm, params) % % Update auxiliary parameter q in the E-step on each experiment % % Input: % - w = 1 x 3 cell array of experiment's activation foci. % w{1} = Ne x V sparse matrix w...
c22b22e04aa2cefb4d7a962d31c145be7ce6287991acea86987b75eeac6e5904
MATLAB
2,199
82
function ft_documentationreference(outdir) % FT_DOCUMENTATIONREFERENCE is a function to maintain the online reference % documentation. % % Normal users will not be calling this function, but will rather look at % http://www.fieldtriptoolbox.org/reference where the output of this function can % be found. % % See also F...
8f70180b130035bce7a32e3445e00b1d03233df8313cadf280aa5a191485987f
MATLAB
2,200
61
% motor_FindBehaviorPeriods_all.m % Sarah West % 12/6/21 % Cycles through mice, days, stacks and calls motorFindBehaviorPeriods % function. Saves the behavior periods. function [] = motor_FindBehaviorPeriods_all(parameters) % Establish base input directory dir_in_base=[parameters.dir_exper 'behavior\extract...
b2139b339cf5b373d7d6c35a7d688a763661adab4883a336f103a86e7d7118ca
MATLAB
2,200
79
function f = matrixnormalize(m,minv,maxv,mmin,mmax,chop) % function f = matrixnormalize(m,minv,maxv,mmin,mmax,chop) % % <m> is a matrix (no Infs). % <minv> is the minimum desired value. can be a scalar % or a matrix the same size as <m>. % <maxv> is the maximum desired value. can be a scalar % or a matrix the sa...
2488e24ad49f93145fd33affea0f1fde119a459862f6792354762734df7fc4a3
MATLAB
2,202
58
function Obj=SOFAconvertCIPIC2SOFA(CIPIC) % Obj=SOFAconvertCIPIC2SOFA(CIPIC) converts the HRTFs described in the structure CIPIC % (see CIPIC HRTF format) to a SOFA object. % % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences; % Licensed under the EUPL, Version 1.1 or – as soon they ...
535bdfccf1ffc86b0f27c7021abc09a08bfe173aeb32d38ae89a13d63f1af2a9
MATLAB
2,202
64
function mdlparams = gfFitDoGMonotonic(mdlparams, xvals, yy) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here %========================================================================== mdlfit = mdlparams; rmax = mdlparams.rmax/2; %======================================================...
5b106953fd3751677868f8e54719428998aae422b6d2c6a80face0249d353765
MATLAB
2,202
40
% Tensor Toolbox (Sandia National Labs) % Version 2.6 06-FEB-2015 % Tensor Toolbox for dense, sparse, and decomposed n-way arrays. % % Tensor Toolbox Classes: % Tensor - Dense tensors. % Sptensor - Sparse tensors. % Ktensor - Kruskal decomposed tensors. % TTensor - Tucker decomposed tensors. % Te...
fca66b3092f0d1f5754851e20e807def4b6676299bcec94a57db004e2767eb5f
MATLAB
2,202
75
function y = upsconv2_gpu(x,f,s,dwtARG1,dwtARG2) %UPSCONV2 Upsample and convolution. % % Y = UPSCONV2(X,{F1_R,F2_R},S,DWTATTR) returns the size-S % central portion of the one step dyadic interpolation % (upsample and convolution) of matrix X using filter F1_R % for rows and filter F2_R for columns. The upsample...
9e1024346a51a85852ad60a0dd45d508d0602410d2187427a58c698a7b2c7f74
MATLAB
2,204
73
function [D, Dsm] = distMatrixShow( D, IDX, show ) % Useful visualization of a distance matrix of clustered points. % % D is sorted into k blocks, where the ith block contains all the points in % cluster i. When D is displayed the blocks are shown explicitly. Hence % for a good clustering (under a spherical gaussian a...
2ae242d625c81154b79ff10daec206c288946fc912e572fba0e6768f9ef5e6d2
MATLAB
2,205
69
function skaggs_info= skaggs_information(varargin) % MT - adapted from Skaggs, McNaughton, Gothard % calculates skaggs information according to following formula: % info= sum_over_all_x(mean_firing_rate_at_x*log2(mean_firing_rate_at_x/overall_mean_firing_rate_of_cell)*prob_density_being_at_x) if isempty(varargin) ...
4f33c40f4cba0563e4e376fbdb8e78097ad421ec6dfe7e7927a3bc5fc8b87271
MATLAB
2,205
72
t = 1:10000; % total time frames mint = min(t); maxt = max(t); num_bins = 20; log_min = log10(mint + 1); % Avoid log(0) by adding 1 log_max = log10(maxt); bin_edges = logspace(log_min, log_max, num_bins + 1); % log space of time t = t/21; t=t'; tau68 = 107; tau70 = 285; tau73 = 550; af = '68'; path = strcat('/...
491861ac148322280febd3ba8194d2f090b3181ba9d22decd8467b3faa01c7cb
MATLAB
2,206
69
% MATLAB code provided by Seyed Mohammad Ali Rahmati % Affiliation: Biomechanics and Motor Control Lab, Department of Biological Sciences, Georgia Institute of Technology, Atlanta, GA. % % Description: % This script performs an optimization to minimize muscle fatigue for 9 combined muscles by applying using the Cost_Fu...
740d77b9d899efe5ae2e09341252fbdc028661555ee2096e1c7ab8f3abb363f4
MATLAB
2,206
70
% Exampleusing fminunc optimizer and mutual information and grid % refinement % % Example is written by D.Kroon University of Twente (OCtober 2008) clear all; close all; clc % Add all function paths addpaths % Read two greyscale images of Lena I1=im2double(imread('brain3.png')); I2=im2double(imread('brai...
04f69f7b9f7f469f29eede3ee79c20883e104d035874b6c88fd16de099701380
MATLAB
2,207
86
% TRISPHERE_SUBDIV Recursive subdivision of unit sphere triangulation. % % [V,F] = TRISPHERE_SUBDIV(N) produces a triangulation of the unit sphere % with vertices V and faces F of size at least N by recursively subdividing a % base icosahedron triangulation. The vertices of triangle I are V(:,F(:,I)). % Th...
519271a4f7123aec53500491a700479fb583ce822f24a52748d55d6a82b03fe4
MATLAB
2,208
57
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This script selects a subset of links according to the chosen networks % % and then, it organizes the adjacency matrices into links % % % % Author: ana.tr...
5221f83d7c54a94ef9f718cd1f82a3f1b927c3f5d97f4d9a40dda2cd064e993e
MATLAB
2,208
82
function [imagingTrimmed, mvmTrimmed, fs_abf, si_abf,timeStart,timeEnd] = loadMvm(data,imagingCh, mvmCh, dataType, timeStart,timeEnd); % >>> OPERATION >>> % Load abf file with imaging-on, treadmill (and LFP if applicable) data. % Option: choose specific interval of abf to isolate (e.g. to analyse only % one movie of t...
406fc25ff878b6ebc16d195a67100cd05dcaaba6000cb756d42de3b34c93ea88
MATLAB
2,209
77
function [st,res,warningstr] = syscmd(cmd0, varargin) % Run a command using Matlab built-in system() command, but with some handy % additional capabilities. % Optional args allow caller to specify what to do if the command fails. (Can % error, warn, or silently ignore.) Also has option to lightly process a JSON % res...
a88b4661a09f800598a3b3667b729fbe76a003facee7b08d1aa7126d7046307f
MATLAB
2,209
82
function C_patt = pattern_complexity(BOLD_data,window_size) % Vary k from 3 to 100 k_list = 3:100; k_num = numel(k_list); replicates = 1; % Preallocate sequence index matrix idx = nan(height(BOLD_data),k_num); for k = 1:k_num K = k_list(k); [~,centroid] = kmeans(BOLD_data,K,'distance','correlatio...
af97c209833d7cb403f7614899d8676401439243d1b155d9f1f23647305f8f45
MATLAB
2,210
73
function selectedFeatures = DISR(k, featureMatrix, classColumn) %function selectedFeatures = DISR(k, featureMatrix, classColumn) % %Computers optimal features according to DISR algorithm from %On the Use of variable "complementarity for feature selection" %by P Meyer, G Bontempi (2006) % %Computes the top k fe...
cba510a47dc4eedf5094231f473ce7a8ecc228e41bd2d8e841413bfee4feec1a
MATLAB
2,210
48
clear clc close all nb_models = 10000; stimAmp_step = [-53]; % stimAmp_diffusion = (2:0.1:2.5);%-53*(0.5:0.3:1.5); t = 0:100; Istim = get_diffusion_current(t, 1); max_Istim = max(Istim); % stimAmp_diffusion = unique(round(stimAmp_diffusion*max_Istim)); % stimAmp_diffusion = [11]; % Calibrated to achieve stimulation...
12fa5bc36d66df7a4c719ef0767cfbca77c3e61ed88f310f283e1c841407b2d3
MATLAB
2,211
63
function approxhess = getApproxHessian(problem, x, d, storedb, key) % Computes an approximation of the Hessian of the cost fun. at x along d. % % function approxhess = getApproxHessian(problem, x, d) % function approxhess = getApproxHessian(problem, x, d, storedb) % function approxhess = getApproxHessian(problem, ...
1f1d80b222ca410c9c9f86c9835e428428783ddb1af9e030340843a6f60b1609
MATLAB
2,211
61
% change to data directory % cd /home/xianchige/TL/retinotopic/zhangchi; clear all; sub_dir = '/home/amax/YZY/20220523data/sub05/session08'; % define FreeSurfer stuff fsdir = '/home/amax/YZY/20220523data/sub05/sub05';%皮层的位置 subjectid = 'sub05'; % define hemis = {'lh' 'rh'}; interptype = 'linear'; % what type of inte...
5030a74b2c93d72307c234b907ac1e0979e9d73f91bed45315a60b128b9d8a61
MATLAB
2,211
72
function run_decode(x,winsize,stepsize,prctokeep,ISCfile,folderout) disp('# preparing files') load sphoutMAT_v2 addpath(genpath('/scratch/work/eglerean/isctest/external')) mask = load_nii('/scratch/cs/networks-pm/effects_externalfactors_on_functionalconnectivity/data/mri/conn_matrix/movie/group_mask_mult.nii'); ...
91c25f024fa55a201a7663d13335160141e8d9d1e8be03de4482386b26e8901c
MATLAB
2,211
43
% align ImageArray and keep result in ImageArray_Reg function [ImageArray_Reg DeltaX DeltaY MaxValue] = LapseReg_XY(ImageArray, AlignRegion, MaxShiftX, MaxShiftY, MinCorrValue); LastImageNumber = size(ImageArray,3); BestImage = ImageArray(:,:,1); % Best Image should be first in ImageArray RegionsProps = regionp...
ab57dbeda7350643d90b9e0b09627fa5858d95aaa228aa8594d7b5005bb9d3ca
MATLAB
2,211
70
%load('JPSTHCell.mat') [numRows,~] = size(JPSTHCell); numiter = 5000; for ck = 1:numRows curJP1 = JPSTHCell{ck,7}; curJP2 = JPSTHCell{ck,8}; curSP1 = JPSTHCell{ck,9}; curSP2 = JPSTHCell{ck,10}; sigCounterJ = 0; sigCounterS = 0; curXCorr = JPSTHCell{ck,3}; curSCorr = JPSTHCell{...
930aeeab4d3a1b851e310be69620f059c1e8bff1591baed96dd63a8e2811b206
MATLAB
2,215
65
% Define a function that generates a connectivity matrix 'w' for a neural network. % The matrix represents the synaptic connections between excitatory (E) and inhibitory (I) neurons. function [w] = conn_matrix(NE, NI, g, pr_E, pr_I, pr_II, mEE, mEI, mIE, mII) % Calculate the total number of neurons in the net...
9e6fe80d6867f38e2d4810859a3d7fd26b4544b5101df13f3c2d24d38c9400b9
MATLAB
2,215
72
function run_decode(x,winsize,stepsize,prctokeep,ISCfile,folderout) disp('# preparing files') load sphoutMAT_v2 addpath(genpath('/scratch/work/eglerean/isctest/external')) mask = load_nii('/scratch/cs/networks-pm/effects_externalfactors_on_functionalconnectivity/data/mri/conn_matrix/movie/group_mask_mult.nii'); ...
b9cecf05da7647974b6ff29f30a8f8be93210fca19ec125cfd06e5092e88ef25
MATLAB
2,215
105
% this function does the actual heavy lifting in % training the NN. meant to be run on a b/g worker function trainGlobalNetwork(nerve_name, SpikeSign) % load all the data for this nerve allfiles = dir([fileparts(fileparts(which('crabsort'))) filesep 'global-network' filesep nerve_name '_' mat2str(SpikeSign) '*.mat...
0fca6c19d04dd2d0b6a62f3609db18331d5e9d0c23c5a5a5ecd3c969cbf3e6f8
MATLAB
2,216
77
function data = read_asa_msr(fn) % READ_ASA_MSR reads EEG or MEG data from an ASA data file % converting the units to uV or fT % 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: you ca...
2641fad6f6e8879e2446653af7a01f57c08286847a042cb2536be6c985534940
MATLAB
2,216
87
function [C, fH, figNames] = meg_sortChannels(expt, sessionDir, user, sortType) %% setup %% inputs if nargin == 0 % for testing expt = 'TA2'; sessionDir = 'R1187_20181119'; user = 'mcq'; sortType = 'classweights'; % alpha, threshold end % directories exptDir = meg_pathToTAMEG(expt, user); % para...
c29289de0d9eaf483b84a573deb3d05ed7a84ba4daf6094d23b0e321cf81c4f2
MATLAB
2,216
33
% data1=load('E:\5个被试原始数据\CPPDATA\GLMdata\sub01原始数据\session02\preprocess\surfacedata\surface_run01\lh.surfacedata.mat') % data2=load('E:\5个被试原始数据\CPPDATA\GLMdata\sub01原始数据\session02\preprocess\surfacedata\surface_run02\lh.surfacedata.mat') % data3=load('E:\5个被试原始数据\CPPDATA\GLMdata\sub01原始数据\session02\preprocess\surfa...
4c464f149fed4b2c10bf91a94c2b7abb09bf3ea8b824f0872fb075298d8ec118
MATLAB
2,217
63
function rgb = vals2colormap(vals, colormap, crange) % Take in a vector of N values and return and return a Nx3 matrix of RGB % values associated with a given colormap % % rgb = AFQ_vals2colormap(vals, [colormap = 'jet'], [crange]) % % Inputs: % vals = A vector of values to map to a colormap or a cell array of % ...
75d2b3ed42ebbed557842d6b08b99e222b1e0a00878fa9b6e6bf1352fdd50ca8
MATLAB
2,217
76
function run_decode_xyz(xyz,winsize,stepsize,prctokeep,ISCfile,folderout) disp('# preparing files') load sphoutMAT_v2 addpath(genpath('/scratch/work/eglerean/isctest/external')) mask = load_nii('/scratch/cs/networks-pm/effects_externalfactors_on_functionalconnectivity/data/mri/conn_matrix/movie/group_mask_mult.nii'...
c0c5d3739a59659328ea537bb5daa74ba47202b097278f9863cac61aaae3ff9b
MATLAB
2,217
64
function [y,pm0]=anaqpsk(N,Ncomp,f0); %ANAQPSK Quaternary Phase Shift Keying (QPSK) signal. % [Y,PM]=ANAQPSK(N,NCOMP,F0) returns a complex phase modulated signal % of normalized frequency F0, whose phase changes every NCOMP point according % to a discrete uniform law, between the values (0, pi/2, pi, 3*pi/2). % Such...
19af1f7702b24563323028e802bc3a207536b219adae7b6f779b66da8e9dbf61
MATLAB
2,218
48
function [S0,nTrans,nPathways] = PathwayRecursiveS0Long(PathwaySignalFirstOrder,TransFirstOrder,PathwaySignalHigherOrder,TransHigherOrder,GwaveHigherOrder,idxHigherOrder,Precision,loss,nLongPathsInit,PathwayLength,nPeriods) %% %Define number of transverse periods nTrans=zeros([nPeriods*2,1]); nPathways=zeros([nPeriods*...
2e52289da6d6878691d5d26ad7f20a75af2c5aa1ae78845be81272beddc1324b
MATLAB
2,218
88
%% ------------------------------ Initialize ------------------------------ % include all functions % clear all % addpath(genpath('src')); % parameters; % % name = 'P8_No28_Iba1-A647_DAPI_b1_h1_12'; % must be without tiff extension ! name_save = clen_name(name); mkdir(['results/' name_save]); %% -----------------...
5398332508ef7b0f86ea9510aa912c771cd621dbdaf5d5d4253ff245d1f48d21
MATLAB
2,218
45
%% Cortical Cytoarchitectonic Clustering clear;clc;cd('D:\MacaqueCortParc') x = load_untouch_nii('Res\atlas2mtr2024.nii'); a = single(x.img); %% load data load Res/MAPparams xpa xng xrtap xrtpp xfa xad xrd pial msp %data = [xpa(:) xng(:) xrtap(:) xrtpp(:) xfa(:) xad(:) xrd(:)]; % MAP/DTI data = [xpa(:) xng(:) x...
cc52bcb7451a843ff9d235154dd6acd818d68fe173f6d5e0c705965e169a11e5
MATLAB
2,218
62
function h_saveDefault3(handles, flag) % flag = 1 (default), 2 or 3 if ~exist('flag', 'var') || isempty(flag) flag = 1; end [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); pname = h_findFilePath('h_imstack3.m'); fileName = fullfile(pname, 'h_imstack3Default.m...
7a37033679e720a4ea8249725eb4cee509467fdaafd551ed63f9f9563da08b60
MATLAB
2,219
82
function [xout yout] = mkWinFuncLog(center,width,tWidth,range,wrapping) %----------------------------------------- % [xout yout] = mkWinFunc(enter,width,tWidth,range,wrapping) % % create a flat windowing function with raised % cosine transition boundaries, to evaluate in % the log domain, suitable for use with interp1...
d8e29cf49f3ff35ec6aea7c46a39995139231939fbe6f502851a55d5482537d8
MATLAB
2,219
70
function [u,v] = calc_prob_gradient(sites,L,invert_y,normalize) % sites(i).p(k) is the outgoing probability from site i to j = sites(i).neigh(k) % this function generates a vector field, u (horizontal), v (vertical), such that % % y-positive is pointing downwards (unless invert_y is set) % % % u(i) = p(k,i) - p(j,i), w...
10b70cf59dd27626a09fbd7f15941eda23fae94c9e105b5fc974c2c928d6ff30
MATLAB
2,220
50
%% ------------------------------------------------------------------------ % configuration % every line contains three fields: % 'filename' % 'legend text' % 'Marker' % 'Color' % 'MarkerFaceColor' % 'TextPosition': [x, y] % ----------------------------------------------------...
272fc1bd5a9c1f9b88b0a995772de180b94b48b7ed9024dec8b356259ec3b156
MATLAB
2,220
89
% Demonstrate effect of cell AP morphology on T wave morphology: bifid T % waves due to change in gradients in ToRORd model close all param.bcl = 800; param.model = @model_ToRORd_step_stimulus; param.verbose = false; param.stimAmp = -53; options = []; beats = 100; ignoreFirst = beats-1; celltype = 'endo'; X0 = getSt...
59cb37279f10f3563833b8c712761b1359f74ebe862334efb285a619c21a3700
MATLAB
2,220
1
function [codes_out] = TSdeclareeventcodes( ) % TSDECLAREEVENTCODES Loads current Event Codes into the global workspace % Loads the Event Codes into the global workspace, declaring global in % caller and base. % % - First checks the experiment structure for Experiment.Codes % - If codes are found, aka struct ex...
c3958772395222410b622f0c7ec472d5d9cffc2c03e28d5266fd7a470bd8ef47
MATLAB
2,220
75
function [cr,ci,pw_wins] = mcidentification(simmat,labels,ncandidates,nrepetitions) % mcidentification -- perform multiclass identification from similarity matrix % function mcidentification(simmat,labels,ncandidates) % % [Inputs] % -simmat: Similarity matrix [pred x correct] % -labels: index matrix % -ncan...
425e03ab4fdb7dff13047775d2a0e2453e390da2e7e4194ffa0ccc6841d95181
MATLAB
2,221
48
function [time_vs_session time_vs_session_all] = display_feature_dTvsdS_mean(var1,varT,varS,newfig,rev_color,showplot) color_test1 = cbrewer('seq','YlGnBu',100); % colormap for corr color_test2 = color_test1(end:-1:1,:); for mouse = 1:length(var1) clear time_vs_session_matrixes % Time from onset fir...
623fd45d7247361eebaa92bf460caacec98cbf9a5f66894cff88ace5b942faf6
MATLAB
2,222
91
function sa=prepare_sourceanalysys(clab,para); % creates a structure needed for source analaysis % usage: sa=prepare_sourceanalysys(clab,para); % % input: % clab is a list of N channel names (clab{1} ... clab{N}) % all channels have to be EEG channels and the names must % be known to this program. (load cla...
6e26b6a70d8a580748f72029e2d53214b85fb58b5cde267507132be7860fdb6f
MATLAB
2,222
65
function [X,Y,Z,hC] = modsel(label,inst) % Model selection for (lib)SVM by searching for the best param on a 2D grid % example: % % load heart_scale.mat % [X,Y,Z,hC] = modsel(heart_scale_label,heart_scale_inst); % % where X,Y,Z are the contour data and hC is the contour handle %PMTKurl http://agbs.kyb.tuebing...
aa9ad1dbecab23ac64c9414500147da9012c8f54b8418dad3a5b2d452069290a
MATLAB
2,222
43
function D = dijkstra( G , S ) % -------------------------------------------------------------------- % Mark Steyvers, Stanford University, 12/19/00 % -------------------------------------------------------------------- % % DIJKSTRA Find shortest paths in graphs % D = dijkstra( G , S ) use the full or spar...
d3f9faa6c9cdbb71b961a24bd12485e65474d781c186dcc69ae89ac271c95219
MATLAB
2,222
70
function M = dimindex(A,dim,idx) % DIMINDEX makes a selection from a multi-dimensional array where the dimension is % selected by a scalar, not by the place between the brackets. % % Use as % M = dimindex(A,dim,idx) % % The purpose of the function is shown by the following example: % % A(:,:,:,23,:,:,...) is the sam...
f1541dd51f35d8b9ec0589977c7e1a14ce81189d867fcf6850f37692c34012cc
MATLAB
2,222
63
%% Matrix Triangle Up/Down Difference % The difference in the sums of the upper and lower matrix diagonals. % If sdo is more than 2 dimensional, assume dim 1 and 2 comprise an array, % with the 3rd dimension serving as a stack iterator % % If matrix is 3D, assume dimensions 1 and 2 comprise the square matrix, % ...
f8d68d6ca828672cc88904dbbe9f7ee61fc46b974653bbc033b91949930bed17
MATLAB
2,222
102
clear all % just clearing workspace % define mean firing rate Network_opts.meanspikebin = 1; % define number of neurons Network_opts.nneurons = 20 ; % define number of bins Network_opts.nbins = 10000; % above define assembly membership % line below sets neurons 1,2,3 and 4 to be in assembly 1 Assembly_opts.assembl...
0989cff0ce865c1654f45a8fa2393736d54280f5a001f1268ed1218f88a4c776
MATLAB
2,223
76
function [f, gridx1, gridx2] = ksdensity2d(x,gridx1,gridx2,bw) % KSDENSITY2D Compute kernel density estimate in 2D. % F = KSDENSITY2D(X,GRIDX,GRIDX2,BW) computes a nonparametric estimate % of the probability density function of the sample in the N-by-2 % matrix X. F is the vector of density values evaluated at the poin...
3ababeb55e4ad7e211f266c7549a540903ed451859d405c805e8bb9ac6d2172c
MATLAB
2,223
72
function [varargout] = ptriproj(varargin) % PTRIPROJ projects a point onto the plane going through a triangle % % Use as % [proj, dist] = ptriproj(v1, v2, v3, r, flag) % where v1, v2 and v3 are three vertices of the triangle, and r is % the point that is projected onto the plane spanned by the vertices % % the opti...
4b571d1e720c4b2039a848f2aa028eedff753a39f49cb3c16dfb8476802c33e3
MATLAB
2,223
74
function [periods,quiescence] = QuietPeriods(v,velocity,duration,brief) %QuietPeriods - Find periods of immobility. % % Find periods of immobility, i.e. periods of sufficient duration % where instantaneous linear velocity remains low. Brief movements % can be ignored. % % USAGE % % [periods,quiescence] = QuietP...
6d20d600360f621f3c5f6b495649c7a79de134586b2037af381ccfafc9c911aa
MATLAB
2,223
75
function otvect = trifilt(invect, nfw, ignoreNaNs) % Modified by M. Heinz 04Jun2004 % Added an option (ignoreNaNs=1) to ignore NaNs within the window if not at center point % e.g., helps to keep from losing dynamic range on rate-level curves with NaNs at HLs % % TRIFILT filters ROW-vector invect with triangular filter...
16ad1a178db10fc19dacbc0117939ede86a87af745a017a03588e26bcb45ceaa
MATLAB
2,224
69
function varargout = mmToVoxel(XYZmm,M,varargin) % Usage: % XYZ = mmToVoxel(XYZmm,M) % [XYZ,point_index] = mmToVoxel(XYZmm,M,'valid') % % XYZ is 3 vector point list, with XYZ assumed to be in ROWS if you input a % list with 3 points. % m is SPM mat - 4 x 4 affine transform (usually .M or .mat in a structure) % (what's...
3a2ebaefd0a5eeb2ec520b974677a51d6cecab34303907b4945996c38f418e23
MATLAB
2,224
66
%% GSA_GetTotalSy_MultiOut_MultiSI: calculate the total sensitivity S of a subset of inputs % % Usage: % [Stot, eStot, pro] = GSA_GetTotalSy_MultiOut_MultiSI(pro, iset, verbose) % % Inputs: % pro project structure % iset cell array or array of inputs of the considered set, they can ...
a6792ed88fdd376dec9095192f50d751185ba5321a4a8b40c6d5a4279e606e6f
MATLAB
2,224
67
% Step 4: Keypoints and Descriptors % This is the code that calculates the keypoints and descriptors at % varying scale levels % % INPUTS: % img is the image volume % OUTPUTS: % keys: a vector of structs that contain the keypoint and descriptors at % all the various scales (blur sizes) % % Author: Daniel Goodwin dgo...
f3335f0819863723abadd6bbd9a1e2ede0de4a2feb36e2fa6606760eb463485c
MATLAB
2,224
77
function [py, gridy] = VBA_empiricalDensity (y, pr) % // VBA toolbox ////////////////////////////////////////////////////////// % % [py, gridy] = VBA_empiricalDensity (y, pr) % numerical derivation of the empirical distribution of y % % IN: % - y: n x p data matrix. The histograms are derived along the columns of % ...
6d94e88e7137a6621e68c1f1260ad3052fc3695ea295fe0e3fc7599016be2608
MATLAB
2,225
86
function varargout = dtype(varargin) % Format % For getting the value % dat = dtype(obj) % % For setting the value % obj = dtype(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id$ if nargin==2, varargout{1} = as...
f7369f61a60c024cee468102f7e2f2294e1e0c20196d550a1b605505eab1222e
MATLAB
2,225
77
function data = read_asa_msr(fn) % READ_ASA_MSR reads EEG or MEG data from an ASA data file % converting the units to uV or fT % 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: you ca...
6d90883a04b83f42ad8c5e5f2ba9a9e2ca58b67427c82647938e418b59c42471
MATLAB
2,226
73
%% % spacing needs to be very fine for the spread of the propagation to be % enough to simulate a reasonable LED distribution %% 150um weights, 150um emitter plotf = 0; params = []; params.N = 2*4096; % image size params.lambda = 0.5; params.D = 2.5e-6; params.n = 1; params.ledSize = 150e-6; params.ape...
92234a6fccdf1edd6d93f85cd7ca7fe21a301f775c38d71e3c44fe577f5f1644
MATLAB
2,226
82
%% Illustration of the bias variance trade off as we vary the L2 regularizer. % %% % This file is from pmtk3.googlecode.com function biasVarModelComplexity setSeed(0); n = 25; d = 1; lambdas = [exp(5),exp(-5)]; ndataSets = 100; showNsets = 20; %f = @(x) sin(2*pi*x); f = @(x) cos(2*pi*x); domain = (0:0.0005:1)'; fs =...
7fade561c7d48bfa8048d408df555f681a885dd38b4bf0661b1d6727ed92c4b3
MATLAB
2,227
63
function [y_interp, upsample_Fs] = sincInterp(y, Fs, cutoff_Fs, upsample_Fs, varargin) % % usage: [y_interp, upsample_Fs] = sincInterp(y, Fs, cutoff_Fs, upsample_Fs, varargin) % % INPUTS: % y - the original signal % Fs - the original sampling rate % cutoff_Fs - the cutoff frequency of the anti-aliasing filter...
8b546fb3b8dfb6da35d4299799a2869edd63220a54631d74383f1763458694cc
MATLAB
2,227
60
function reactToImageChangesInFig(target_images,h_caller,deleteFcn,refreshFcn) %reactToImageChangesInFig sets up listeners to react to image changes. % reactToImageChangesInFig(TARGET_IMAGES,H_CALLER,DELETE_FCN,REFRESH_FCN) % calls DELETE_FCN if any of TARGET_IMAGES are deleted and calls the % REFRESH_FCN if the ...
30c234a2107497ff38bf2ed87804508725e6c9fd340d8b4c96aaa0442bf2c0e6
MATLAB
2,228
59
function J = imPad( I, pad, type ) % Pad an image along its four boundaries. % % Similar to Matlab's padarray, with the following differences: % (1) limited to padding along height and width % (2) input format allows for separate padding along each dimension % (3) padding values may be negative, in which case perfor...
ae13457c913770ce9b7b6653e488f06ff9b7b8de1fd5d87ae5aa305df18f4a09
MATLAB
2,228
62
function [Kernel, features, D] = build_kernels_nostates(datadir, hmmdir, kerneldir, HMM_name, Fn, Kn) % [Kernel, features, D] = build_kernels_nostates(datadir, hmmdir, kerneldir, HMM_name, Fn, Kn) % % build kernels from HMMs using only transition parameters (no state parameters) % (wrapper for hmm_kernel) % % Input: %...
bc976574eaf330720baf4d9c5957fbac8235622ab3045fa7767828237de359f5
MATLAB
2,228
63
%% SAT - app_input:: %% getXtDAtaFromDirectory % Name: Phone Kyaw % Date: 09/19/2024 % Description: Get XT data from multiple XT files % Parameter: xt_files - A cell array containing files' path % Return Value: xt_cell - Nx2 cell array where the {1,1} contains the header % ...
bf41cf7a855ba0637524f375b71443b7a8842f3cac04c226bf78b1a09bacd48f
MATLAB
2,228
64
function [nL1, L1] = commuteResidual(L0, px0, px1, vars) arguments L0 px0 px1 vars.method {mustBeMember(vars.method, {'V3', 'V5', 'V7'})} = 'V3'; end % Take a (normalized) SDO (L0), and generate a prediction of Px1; Take the % difference between the predicted and and observed Px1 (i.e., residuals) % a...
ce98d772c8b778b8e3e9dbbe72016277a867c0c1d56cc7909dae7e5068dcedfe
MATLAB
2,228
63
function h_openDiffFileInGrp3(handles, flag, syncFlag) % flag can be 'next', 'previous', 'first', 'last' global h_img3; if ~exist('syncFlag','var')||isempty(syncFlag) syncFlag = 1; end [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); if isfield(currentStruct,'activ...
049085e9872bc85575849243d6441f4b15f1d59122f25d9e5b3d719d7d9175df
MATLAB
2,229
57
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This script selects a subset of links according to the chosen networks % % and then, it organizes the adjacency matrices into links % % % % Author: ana.tr...
05ec361814e1af777a0d879c17e32326a99f8af8674c126017b8473edc74aca1
MATLAB
2,229
100
% This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
fec472961398627400db4e8b3465e84e795835d034359fd9ac5489e4fadbd8ac
MATLAB
2,229
72
function [varargout] = ptriproj(varargin) % PTRIPROJ projects a point onto the plane going through a triangle % % Use as % [proj, dist] = ptriproj(v1, v2, v3, r, flag) % where v1, v2 and v3 are three vertices of the triangle, and r is % the point that is projected onto the plane spanned by the vertices % % the opti...
1abe02032fc1b608cf158306e4da9ab01bca501a410d104ceaaf1869cad575c4
MATLAB
2,230
113
function [hw,mu,sd,upper,lower,c]=ciestim3(x,rowcol,p,side,nan) % ciestim -- estimate confidence interval % function [hw,mu,sd,,upper,lower,c]=ciestim3(x,rowcol,p,side) % % [Input] % -x:x vector[Nx1 or 1xN] or matrix[NxD] % -rowcol:direction of calculation default=1(row) % -p:confidence level (default = 0....
71bc0006498a4b7afa64f4dfb14ac18ce63fbd2324694084886ec80f88853585
MATLAB
2,230
67
%% Demo of factor analysis in 2d % Based on http://www.mathworks.com/products/demos/statistics/factorandemo.html % PMTKneedsStatsToolbox factoran % datasets in stats toolbox are listed here % http://www.mathworks.com/access/helpdesk/help/toolbox/stats/bq9uxn4.html %% % This file is from pmtk3.googlecode.com requireSt...
7b46b473f879ff871ce2fa7866a96884b88833121f74e638cb797ca221fad0af
MATLAB
2,231
83
function [dat, volInfo, masked_vol] = iimg_mask(maskindx,dat,varargin) % Masks index image vector or filenames in dat % With img vector or filenames in maskindx % * Checks dimensions to make sure origins and vox. sizes are same % % :Usage: % :: % % [masked_indx, volInfo, masked_vol] = iimg_mask(maskindx,dat,[volInf...
c7ec4358882a6f771e49d1741e6456bdd2c0c7de7d1d19470d5f598e06c34a3e
MATLAB
2,231
92
% 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 % function [msg,...
d399a572fe1129f66367bb6ae5c5682ad61943ff4754814c10e56b2f5d037368
MATLAB
2,231
52
function [Matrix] = y_WriteMat(Data,Header,OutName) %function [Data, Header] = y_ReadMat(FileName) % Read Mat file into 1D Data and Header. For use DPABI functions % ------------------------------------------------------------------------ % Input: % FileName - the path and filename of the image file (*.img, *.hdr, *.ni...
1dc4b7fe5ffa91c8beb68a1d49d0214db64ff24fb0ce74654de16261f3c21959
MATLAB
2,233
69
% close all clear % SELECT THE MONKEY HERE: 'Monkey1' OR 'Monkey2' Monkey = ['Monkey1'] ; switch Monkey case 'Monkey1' Mon = 'monk1' ; case 'Monkey2' Mon = 'monk2' ; end load(['AllBehav_' Mon '.mat']); TSPE = nanmean(SPE); sTSPE = std(SPE,0,1)/sqrt(size(SPE,1)); TSDE = nan...
4b0ba8c211529ccc3c16503ac1b66d52b922c28aa4b5ca5afb15619cd8623809
MATLAB
2,233
55
%% Generate csv files from PET data addpath C:\Code\wjn_toolbox-master addpath C:\Code\spm12 addpath(genpath('C:\Code\leaddbs')) % Read atlas parcellation region_info = readtable('HCPex (Huang 2021).txt'); region_image = ea_load_nii('HCPex (Huang 2021).nii'); % Parcellate input images % input_images = {'D2_fallyprid...
69b18594cdacc8a85e1e56a749453d7a32f4290c2eb13d1f739e555f6fca8873
MATLAB
2,233
75
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef Waveform < matlab.mixin.Heterogeneous %WAVEFORM Container for single dimensional recorded sample data % % Channel: Source Location of the waveform % % Start: Tim...
0f3d4521a369e245e191a2ba8f8c57383c91bdce88cfaf19960cb6a08e69f725
MATLAB
2,234
63
function prov = hcp_provenance % HCP_PROVENANCE returns a structure with provenance information % Copyright (C) 2011-2014 by the Human Connectome Project, WU-Minn Consortium (1U54MH091657) % % This file is part of megconnectome. % % megconnectome is free software: you can redistribute it and/or modify % it under the ...