sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d90f6b315dc9e7afa769961eadfef717f0f113388fe1f6b75ef327c32b4b1b9b
MATLAB
2,152
80
function [linear_score,out]=line_fitting(decoded_event) FIGURES_ON=0; [position_bins,time_bins]=size(decoded_event); time_bins2 = min([time_bins position_bins]); max_value=max([time_bins2 position_bins]); slope=(2/max_value):(2/max_value):.999; slope=[slope 1 fliplr(1./slope)]; if FIGURES_ON figure end for s=1...
bbad21b75c65724f5e27c948509865edf11c2349d12641b08dd18a4e5e615f6c
MATLAB
2,154
62
%%% Computes the extrinsic parameters for all the active calibration images check_active_images; N_points_views = zeros(1,n_ima); for kk = 1:n_ima, if exist(['x_' num2str(kk)]), eval(['x_kk = x_' num2str(kk) ';']); eval(['X_kk = X_' num2str(kk) ';']); if (isnan(x_k...
057b3e9cd5359ccb6ef0269944c6495ff629b9274b8a24b2f83f8f7e10d5788c
MATLAB
2,155
69
%% empirical_confint % % Confidence intervals for sample statistics based on estimated empirical null distribution % % <matlab:open('empirical_confint.m') code> % %% Syntax % % [xup,xlo] = empirical_confint(alpha,X,ptails,ksmooth) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structure...
3bdec3ba6977eae204a4d19c2778adb39f99f364fe8a28327d6ca679c3b2afc3
MATLAB
2,155
43
dataset = 'defcon_rct_46pp.txt'; % Fixed variables v = generate_main_variables(); % Run fitting function [bvc_loglik,fr_loglik, fd_loglik, uniform_loglik, bvc_prob, fr_prob, fd_prob, bvc_logprob, fr_logprob, fd_logprob] = fit_bvc_and_other_models(v, dataset); df = readtable(dataset); uniform_logprob = repmat(log(1/...
4e21ea2aa3bee8dac26a2a4d97010d6b970b544f87f618a8a966bfb603225909
MATLAB
2,155
88
%% Detect small calcium transients Tr = traces; disp('Detecting SCEs...') [NCell,Nz] = size(Tr); % Savitzky-Golay filter Tr = sgolayfilt(Tr',3,5)'; % figure % for i = 1:NCell % plot(time,traces(i,:)+i-1) % hold on % end % Detect Calcium Transients using a sliding window TrRest = Tr(:,mvm.restEpochsIndex);...
698ff1cf79921960e2f384a3ea1e6198eaea4b5811b200b76ee8ca03fcb34d81
MATLAB
2,155
96
% Infer 1d function from observing its average value over various intervals function gauss_infer_1d_function_from_avg() Bs = [1, 5, 10, 20]; % bucket width sigmas = [1e-3, 1e-1]; for i=1:length(Bs) for j=1:length(sigmas) B = Bs(i); sigma = sigmas(j); run_demo(B,sigma) end end function r...
347d1ce7c50236b41c0dfea74078bf332a14ae21abe61e922f81be5a1b230049
MATLAB
2,156
31
psthPara.binsize = 10; psthPara.binstep = 10; % ms tIndex = ([trialAll.stdNum] >= sIndex & [trialAll.correct] & [trialAll.oddballType] == "DEV")|([trialAll.stdNum] >= sIndex-1 & [trialAll.correct] & [trialAll.oddballType] == "STD"); trials = trialAll(tIndex); trialsSPK = trialsSpike(tIndex); % spike spkStd(sInde...
5db4abf07bb5310fb3b686dea734f909fe362cb6f4a870aa7ce589a53a9b0108
MATLAB
2,156
51
function [permutedVector] = randPermContiguous(inputVector) %Generates a random permutation of a binary vector, maintaining sizes of clusters of 1's. %That is, if the input vector is [ 0 1 1 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 ...], %the output will have one cluster of three 1's, one cluster of two 1's, %a...
a702ecd6b88265b55cad7e56b46495ee6a2056b5107243ae7d4e7e0a44d36318
MATLAB
2,156
64
function M=movcw4at(N,Np); %MOVCW4AT Four atoms rotating, analyzed by the Choi-Williams distribution. % M=MOVCW4AT(N,Np) generates the movie frames illustrating the passage % from the spectrogram to the WVD using different smoothing gaussian % windows in the smoothed pseudo-WVD. % % N : number of points of the analyz...
fce8b3713cbfe795486d94a1890f0c80f2d1df2e47217b97d3cae94a5ad99b2c
MATLAB
2,156
84
function anytoavi(inmoviename,outmoviename,varargin) % function anytoavi(inmoviename,outmoviename[,'firstframe',1][,'endframe',nframes]) % pairs in [] are optional and the default value are as shown above. [readframe,nframes,fid] = get_readframe_fcn(inmoviename); [firstframe,endframe,aviparams] = myparse(varargin,'fir...
3b26d55ee697639264beb2be4cde8f0633493dca64c57b4f71200bb3383abddf
MATLAB
2,157
77
function [] = transformQuiver(imgPair) %% Figure out axis convention % x = [10:10:50]; % y = [10:10:30]; % [x,y] = meshgrid(x,y); % figure; % quiver(x,y,2*ones(size(x)),ones(size(x)),0) % set(gca,'YDir','reverse'); %% real stuff %decimate transform field spacing = 20; mytform = imgPair.moving.F; sizeTform = size(myt...
41eecef888004df96098b6f43a6be15d12ad58c837a6e83379d7e97f2d6c63d2
MATLAB
2,157
70
function t = subsasgn(t,s,b) %SUBSASGN Subscripted assignment for sptenmat. % % Examples % X = sptenmat(sptenrand([3 4 2],10),1); % X(1:2,1:2) = ones(2,2); <-- Calls SUBSASGN % % See also SPTENMAT, SPTENMAT/SUBSREF. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor ...
6ecafcece13be72d00f100039097bf3b641ee7c28ca106842e5c3d0f79826fc9
MATLAB
2,157
64
function [opts, args] = hcp_getopt(varargin) % HCP_GETOPT parses the command line to the megconnectome executable % application, separating the options that start with -- from the file % names of the scripts to be executed. % % Use as % megconnectome.exe --option1 arg1 --option2 arg2 scriptA.m scriptB.m % splits the...
b0e7f8983cb4904167157541f3f638e59dc87f8dfe2c368f625c9d5d8fa3ecdd
MATLAB
2,157
64
function [opts, args] = hcp_getopt(varargin) % HCP_GETOPT parses the command line to the megconnectome executable % application, separating the options that start with -- from the file % names of the scripts to be executed. % % Use as % megconnectome.exe --option1 arg1 --option2 arg2 scriptA.m scriptB.m % splits the...
fa9a7f919998a28caa5f25ef7ef24c891d63de27e38389bc61ffa156a3f2abeb
MATLAB
2,157
42
%% Create a new dataset with all subjects averaged across mov-nomov % If a SJ do not have a mov condition, take only nomov % BEFOREHAND: Load mov and nomov datasets ('12_eeglab2fieldrip') and rename % *_mov and *_nomov, respectively % output paths: path_data_eeg = 'D:/NeVRo/new_HEP_data_filtHP_0_3Hz/'; path_out_eeg ...
4465a234d728c7f02a22e59d6d1f752d1a6aa1150fd8a765ca9a902e11ee4dc9
MATLAB
2,158
46
clear clc close all nb_models = 1000; 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 of...
3b2e6e7907aa34136f1088d151ce5e28b5fdd8d09c69f8a2d00c1d1955b5a1be
MATLAB
2,159
72
function Plot_Bump_Examples(DarkData, ttt, Seg) % Plot 40s examples of the bump for specified trials and segments PlotWindow=40; % seconds Time = DarkData.TwoP_Times(ttt,:); Time = Time - Time(1); % Get indices for this segment starttemp = (Seg-1)*PlotWindow; stoptemp = starttemp + PlotWindow; logica ...
6513631fdd907a696e1abbe111ebfcfd12f80604c8959c9f31a211dc067e93b1
MATLAB
2,159
51
% makeBarcode3DPlots function makeBarcode3DPlots(transcriptsDir,groupList,saveDir) loadParameters; load('groundtruth_codes.mat'); f = figure; f.Position=[1000 100 900 900]; xlabel('X'); ylabel('Y'); zlabel('Z'); whitebg('black'); for i = 1:length(groupList) disp(['group=',groupL...
825ffb515ad6a48ca94b2b354b1454866d9dbf0be297980613326b8d91ef7adf
MATLAB
2,159
77
% % Author: Javier Lopez-Calderon % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2009 %b8d3721ed219e65100184c6b95db209bb8d3721ed219e65100184c6b95db209b % % ERPLAB Toolbox % Copyright © 2007 The Regents of the University of California % Created by Javier Lopez-Calderon and Steven Luck % Ce...
a4a0c87f14156b4a353f49e26efe5bb80675f08f21db36f1a2552dbb1b4382e4
MATLAB
2,159
73
function [model, bestParam, mu, se] = ... fitCvPath(fitPathFn, predictPathFn, lossFn, X, y, extractPathFn, varargin) %% Fit regularization path and use cross validation to pick the best point % % Inputs: % models = fitPathFn(Xtrain, ytrain) % This should return models.lambdas % yhat = predictFn(models, Xtest): yha...
e4f05b4f023e38e53375cfa294b014242a3bf70d1f4dbe4161dc88c5ab2c6844
MATLAB
2,159
81
function [hEllipse,X,Y] = ellipsearcdrawpatch(theta0,theta1,a,b,x0,y0,phi,lineStyle) %ELLIPSEDRAW can draw an arbitrary ellipse with given parameters. % The properties of that ellipse plot can be customized % by setting the ellipse handle. % % hEllipse = ellipsearcdraw(theta0,theta1,a,b,x0,y0,phi,lineStyle)...
06f2cbbd7c898fc2d000921bf6fc4739cac5309592da8e53ca10561451fc030e
MATLAB
2,160
49
% Demo for aggregate channel features object detector on Caltech dataset. % % See also acfReadme.m % % Piotr's Computer Vision Matlab Toolbox Version 3.40 % Copyright 2014 Piotr Dollar. [pdollar-at-gmail.com] % Licensed under the Simplified BSD License [see external/bsd.txt] %% extract training and testing image...
3918e8adcf2302ce987041366e6878f6487882717efdc5a511bf1b4ddeab0043
MATLAB
2,160
54
% Support Function which forms of the basis of analysis between a % ppDataCell and xtDataCell %_______________________________________ % Copyright (C) 2024 Trevor S. Smith % Drexel University College of Medicine % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU G...
eda881eacbe35a0c44c7ada8566ca9a43cdad3b56fdab37505206ddf3adf00a3
MATLAB
2,160
58
clear close all clc %% Load atlas % path to MRI template - must include hdr and img files atlas = niftiread('/Users/jstrohl/Documents/20230908 Pipelines for neural data analysis/Dependencies/ATLAS-MICE 2/2011-10-30_MRI-template3.hdr', ... '/Users/jstrohl/Documents/20230908 Pipelines for neural data analysis/D...
f25525736d329c8039986e5869acae1298f8fd5f5d44e8eb9a965654da4276fa
MATLAB
2,160
90
% Sampling from an Ising model using Gibbs % Based on code by Brani Vidakovic % http://www2.isye.gatech.edu/~brani/isyebayes/programs.html function gibbsDemoIsing() pixelX = 100; pixelY = 100; %{ temps = [5 2.5 0.1]; seeds = 1; Xsamp = zeros(pixelX, pixelY, length(seeds), length(temps)); for t=1:length(temps) ...
8007a887b0d2379b6b932ea3be576d5a28bf2956adf9c6a8d50ce453a7ff80eb
MATLAB
2,161
69
function mscmd_bandpass_filter(input_path,output_path,opts) %MSCMD_BANDPASS_FILTER - Bandpass filter using smooth roll-offs in Fourier space % %The is the mountainsort version of ms_filter % % Syntax: mscmd_bandpass_filter(input_path,output_path,opts) % % Inputs: % input_path - mda file of MxN input timeseries data...
a65fcc56a0af49e2efa4253e8c6e05bc2ed10cc29e9a8fca87a8baf928a70309
MATLAB
2,161
88
function z = lt(x,y) %LT Less than for sptensors. % % See also SPTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the terms of Cont...
1ad5cd0f140e916ee151a963be85632b370c9486f15bc0df1ea86efe97c07eae
MATLAB
2,162
67
function [muPost, SigmaPost, logZ, lambda] = varInferLogisticGaussMissing(y, W, b, muPrior, SigmaPriorInv, computeLoglik) % Just like varInferLogisticGauss except y(t) may be NaN % This file is from pmtk3.googlecode.com maxIter = 3; %[maxIter, computeLoglik] = process_options(varargin, ... % 'maxIter', 3, 'computeLo...
4bcb2a887c127ab753c901673329c867a133485eb6ea8ab9fc9fdaecf4aec3b6
MATLAB
2,162
72
function [Samp, Sph] = waveletSpectro(SIG, FE, FRANGE, ResHz, step) % [Samp, Sph] = waveletSpectro( SIG, FE, FRANGE, FRANGE,ResHz, step) % [Fft] = waveletSpectro( SIG, FE, FRANGE, FRANGE,ResHz, step) % uses a FFT transform to compute the spectral power and phase values, of a matrix of signals 'SIG'. % The smaller dimen...
7f22df31a3a968a7cb2f7b83fdb22e3f427798fcdafbad34f651604a8c69e22b
MATLAB
2,163
69
function [m,dfe,ci,sd,n,t,p] = limo_ttest(type,data1,data2,alphav) % [m,dfe,ci,sd,n,t,p] = limo_ttest(type,data1,data2,alpha) % implement the one-sample t-test, paired t-test (type = 1) % and the two samples t-test (type = 2). The ttest is performed on the last % non-singleton dimension, which can be subjects or tria...
971821da34ad6aefbe117ce67d1ce5e0d27bf57e9e8c2e80727413e0b63fa377
MATLAB
2,164
64
classdef handle_light < handle % handle class hiding some methods to not lose overview in list of % methods of a class %--------------------------------------------------------------------- % license %--------------------------------------------------------------------- % Copyright 2015 Id...
aca42ddc5d576194f2c267ad16f5effa61ce69dd698aa1aa5df112dc9bb55dbd
MATLAB
2,164
62
function I = localSum( I, dims, shape, op ) % Fast routine for box, max and min filtering. % % Same effect as calling 'C=convn( I, ones(dims), shape)', except more % efficient. Computes local sums by using running sums. To get sum in % non-overlapping windows, use shape='block'. Equivalent to doing localSum, % and then...
c81f168dc187c764bd8daeb21baea20a00b0a8ec072b8fd85d7763c7c0547834
MATLAB
2,164
88
function [f,G] = tt_cp_fg(Z,A,Znormsqr) %TT_CP_FG Computes function and gradient of the CP function. % % [F,G] = TT_CP_FG(Z,A) calculates F = (1/2) ||Z - ktensor(A)||^2 where % Z is an N-way tensor and A is a ktensor or a cell array with N % factor matrices. It also calculates the gradient of the CP fit % funct...
5ca8cf1fb7b250603e1015f5885497eb60da72abfc397a8c1a49758083e96ffe
MATLAB
2,165
64
function [O_trans,Spacing]=MakeDiffeomorphic(O_trans,Spacing,sizeI) % This function MakeDiffeomorphic will make the b-spline grid diffeomorphic % thus will regularize the grid to have a Jacobian larger then zero % for the whole b-spline grid. % % [Grid,Spacing]=point_registration_diffeomorphic(Grid,Spacing,sizeI) ...
b7b9f825db73d71fc1973f4991096041e3d78083e58f90c7fa8124d330a9c994
MATLAB
2,165
51
function [s, cfg] = ft_statfun_diff(cfg, dat, design) % FT_STATFUN_DIFF computes the difference of the mean in two conditions. Although it % can be used for statistical testing, it is not very usefull since it will have % rather limited sensitivity. % % The purpose of this function is to show you an example on how to...
d48fa8dd5491f0acb06c5a2e6c8955b2eed040ac00b2ad5c63d5819d8e54a507
MATLAB
2,165
77
function [C,H] = vol3d( M, ax, c ) % VOL3D Measures the size of connected objects along 2D slices % INPUT: % M - Binary input tomogram % ax: Reference axis (1->x, 2->y, otherwise->z) % c: 2D connectivity, either 4 or 8 % OUTPUT: % C: Tomograms with components classfied by their volume % ...
251162a752ad6fc2bf9996a66e07e4a733faea7102e39322399f0f4ff140ce3e
MATLAB
2,166
53
areatxt{1} = 'lip'; areatxt{2} = 'fef'; timevector = -0.05:0.001:0.2; rgb = [0.1 0.4 0.5; 0.7, 0.4, 0.7]; labels = [{'Singleton distr in RF'}; {'Non-singleton distr in RF'}]; for iArea = 1: 2 figtitle = upper(areatxt{iArea}); xlimToPlot = [-0.05 .2]; figure('Name', figtitle , 'NumberTitle', 'off'...
6950fbe455f9332542cdd2dd1f5717cfa14fe02e99efe75200028868f3814ade
MATLAB
2,166
61
function CM = confMatrix( IDXtrue, IDXpred, ntypes ) % Generates a confusion matrix according to true and predicted data labels. % % CM(i,j) denotes the number of elements of class i that were given label % j. In other words, each row i contains the predictions for elements whos % actual class was i. If IDXpred is pe...
8e6496de9c241baf9301e145a3a5d0cf5a1e0b83723a88eea22dcc1fbfa523bf
MATLAB
2,168
109
function tests = mex_semaphoreTest tests = functiontests(localfunctions); end function setup(testCase) semaphore('/t','unlink'); end function teardown(testCase) semaphore('/t','unlink'); end % normal test cases function testOpen(testCase) ret = semaphore('/t','open',3); verifyEqual(testCase,ret,...
a42a2da1178a4e4a2e1ae2d85d6ac67cb8475a7033f5e922b6b96980a728660d
MATLAB
2,168
58
function [parameters] = ncomponents_std_correlate(parameters) MessageToUser('Running ', parameters); if ~isfield(parameters, 'ncomponents_concatenated') parameters.ncomponents_concatenated = []; parameters.sigmas_concatenated = []; end % Get the list of mice not to...
95f4c62dd9a6db07c115200cacc43b75765b87f2a05bb8915a8c5797622179b8
MATLAB
2,169
42
function [y,u,f_fname,g_fname,dim,options,in] = VBA_getDefaults() % outputs default input to VBA_NLStateSpaceModel.m % function [y,u,f_fname,g_fname,dim,options,in] = VBA_getDefaults() % % This function provides the defaults inputs to the main % VBA_NLStateSpaceModel.m routine. See VBA_check.m routine. %------- ...
0a8d334c2e70068e6fa6b923cf8c6c38d30004ee4bd82d9be115f546a84c4918
MATLAB
2,170
55
function onesample_t(out_dirs,scans,covariates) for ii=1:length(out_dirs) %model specification matlabbatch=[]; matlabbatch{1}.spm.stats.factorial_design.dir = out_dirs(ii); matlabbatch{1}.spm.stats.factorial_design.des.t1.scans = scans{ii}; if ~isempty(covariates) for jj=1:length(covariates...
156fbba2ff5296eb0ec69dea36cacfa16fd2dfc170695997716b875b72763960
MATLAB
2,170
76
%% fMRI analysis script for: %% The transformation of sensory to perceptual braille letter representations %% in the visually deprived brain % Marleen Haupt and Monika Graumann % 22.02.2024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Preprocessed fMRI data has to be downloaded to data folder %%%%%...
1957051e75ecce115414323970f220932c2513c029caf12bcec890e29995724e
MATLAB
2,170
66
function [ddydphi, d2gdx2, logL, dy, dy2, vy]= VBA_get_dL (gx, dG_dPhi, y, type, Qy, sigmaHat) % // VBA toolbox ////////////////////////////////////////////////////////// % % [ddydphi, d2gdx2, logL, dy, dy2, vy]= VBA_get_dL (gx, dG_dPhi, y, type, Qy, sigmaHat) % Compute usefull intermediate values describing the misfit...
6ec9c75b38c5638658d00648b7e1e3fb5c1251585570779f76544656a0978ecf
MATLAB
2,170
62
%%% Computes the extrinsic parameters for all the active calibration images check_active_images; N_points_views = zeros(1,n_ima); for kk = 1:n_ima, if exist(['x_' num2str(kk)]), eval(['x_kk = x_' num2str(kk) ';']); eval(['X_kk = X_' num2str(kk) ';']); if (isnan(x_k...
3f88edaa83ee613f7346ed88f4abecf63112939fbe087343f89090a24b555a44
MATLAB
2,172
108
function results=VBA_bDCM_lesion(posterior,out) %% Get normal profile %% test lesions of each area nx = size(out.options.inF.A,1); out.options.verbose = 0; out.options.displayWin = 0; out.options.multisession.expanded = 1; out.dim = VBA_check_struct(out.options.dim, ... , 'u',size(out.u,1) ,... 'n_t...
0a43187f1ea05cf1ccb3ccb83015bd2fa093cb4667a158770fe33653c457a9fc
MATLAB
2,173
57
function [FRorig, FR] = getDataForDPCA(AllTrialData,timeWindow,Phase,varargin) [varargin,SmoothingKernel]=Utilities.ProcVarargin(varargin,'SmoothingKernel',.55); [varargin,meanThresh]=Utilities.ProcVarargin(varargin,'meanThresh',1.5); [varargin,TaskLabel]=Utilities.ProcVarargin(varargin,'TaskLabel','XBodySpec'); ...
599a949313a35ebfe5e59b67ad79b5480a04b36cbb5ac6d80ed05423a54c5d45
MATLAB
2,173
88
function [perf_matrix_loc,perf_matrix_frq] = compute_model_psychometrics(model) unpackStruct(model) n_units=length(wO); facto=0.9; %model_tau = 100ms easiest=4; %evidence strength for easiest trial ntrials=10; %number of trials per condition gi=linspace(-easiest,easiest,6); for i=1:length(gi) for j=1:leng...
ca8c2c6c6f49266f93e8aa5704b6549f0fa31a30d5d28fbcad34debf4ee34db2
MATLAB
2,173
49
%this function will return a threshold value for a minimum number of spots %at a single pixel that have been filtered the same way that the maps have %to determine a lower limit for RF selection function Threshold=SpotThresholdFinder(NumEvents,NumRecordings,FilterSize,FilterSigma) SpotTestImage=zeros(20,20); ...
d8c8e8c3ad24cd3ca92893e1a76e6809b737c15f267d001814b6882565c3b90d
MATLAB
2,173
61
function [num,dims]=dimnum(dimord, dim) % This function returns the number of the given dimention 'dim' in the dimord string. % % Syntax: [num,dims]=dimnum(dimord, dim) % % e.g. when dimord='rpt_chancmb_freq_time' and dim='time', dimnum returns num=4 % and dims contains {'rpt','chancmb','freq','tim'}. % e.g. when...
e10caac910db6e724f343bb969eadd349af65c093142208fd48452223ff71faf
MATLAB
2,173
57
function [varargout] = isfolder(varargin) %ISFOLDER Determine if the input path points to a folder % TF = ISFOLDER(PATH) returns true if PATH points to a folder and false otherwise. % % This is a compatibility function that should only be added to the path on % MATLAB versions prior to R2017b. %%%%%%%%%%%%%%%%%%%%%...
6e4f51829ccd27941640b21e702ff60aea9d5012b5a69df6b073e238fb8e6d4a
MATLAB
2,174
84
% By Ariel Zylberberg %% do_save_flag = 1; [t, TIN, TOUT, EC, EI, CHOICE, RT, COH, SESSION] = get_and_prep_data(); save(fullfile(saveLoc, 'data_for_corr_analysis'), 't', 'TIN', 'TOUT', 'EC', 'EI', 'CHOICE', 'RT', 'SESSION') %% X = {EC-EI,EC, EI, EC,TOUT,cumsum(EC-EI,2)}; Y = {TIN, TIN, TIN, EI,TIN, TIN}; XLABEL = ...
7ef4414b0c7b3ddf4ac517e8bb9cc70aadbf5671039cccf23378babce56acf6a
MATLAB
2,174
59
% Author: Birgit Nierula (Feb, 2020) % nierula@cbs.mpg.de %% SRMR_01: automatic R-peak detection % This script was run after the sript SRMR1_00_importData.m and % 1) performs an automatic R-peak detection on the ECG channel ana_dir = '/data/pt_02068/'; cfg_path = [ana_dir 'analysis/manuscript_sep/scripts/cfg_srmr1/...
bb74e0a35cdfd77181059b90fe0755801132e2a6be0283a794a1fe66ab195e67
MATLAB
2,175
73
%% cpsd_to_autocov % % Calculate autocovariance sequence from cross-power spectral density % % <matlab:open('cpsd_to_autocov.m') code> % %% Syntax % % [G,q] = cpsd_to_autocov(S,q) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % S cross-power spec...
474ae8e93c96a91d553a48e2ea2de5e9a8dc53d62004bebd741279f41df55098
MATLAB
2,176
81
function [Model Info parm W] = testjob(xdata, ydata, xtest, ytest) % --- training method ID method_id = 2; % 1: linear_sparse_space % 2: linear_sparse_space_vec % 3: linear_sparse_stepwise % 4: linear_sparse_stepwise_vec % --- Basic Learning Parameters parm.Ntrain = 100; % # of total training iteration ...
72a16d65150a9344d6b1d87628f667b9cb7b909750b8079a7d81420082d55c24
MATLAB
2,176
55
function [h,p] = plotDistribution(logprobFn, varargin) %% Plot a density function in 2d % handle = plot(logprobFn, 'name1', val1, 'name2', val2, ...) % % '-xrange' - [xmin xmax] for 1d or [xmin xmax ymin ymax] for 2d % '-useLog' - true to plot log density, default false % '-plotArgs' - args to pass to ...
d4ebbaf657f61df7df8883658e40595fc64d8de670978bc6f79035e24e34efcf
MATLAB
2,176
75
function plotContours(fov,cell_n,centroids,centroid_color,background_type,background_color) %% >>> OPERATION >>> % Plot contours of selected cells for defined field of view % >>> INPUT VARIABLES >>> % NAME TYPE, DEFAULT DESCRIPTION % fov double field of view (image or mov...
e27abe3d20101d54c5d6308d4643f60741150469a60310bf8c75cfa2ef2bdca5
MATLAB
2,176
70
%% Fit an HMM and an equivalent DGM, making sure the results agree % %% sample data % % Note, unlike hmmFit, dgmTrain does not use cell arrays, % instead it takes an NaN-padded matrix of size % nobs-by-d-max(seqLength). You can use the localEv2HmmObs % and hm...
0671f950bab2dfa8a0d1e3a2103ba262948b77af4158a6e0eddbb35087c01fb9
MATLAB
2,177
50
%% ------------------------------------------------------------------------ % configuration % every line contains three fields: % 'filename' % 'legend text' % 'Marker' % 'Color' % 'MarkerFaceColor' % 'TextPosition': [x, y] % ----------------------------------------------------...
7c078cd531b35e04c8a8b9c3668e8a1ad5ba8c649dcc8faa04c5fd8e0f2584ce
MATLAB
2,177
44
for k = 1:length(Y) clf; y = Y(k); % Display NIFTI slice I = round(y/d1d2d3(2) + N1N2N3(2)/2); S = squeeze(VT1(end:-1:1, I, :))'; % choose the Y cross-section S = S(:, :); image([-DimensionX/2 +DimensionX/2], [-DimensionZ/2 +DimensionZ/2], S, 'CDataMapping', 'scaled'); colorm...
b4888bbf85b9b6b95d0b7f4cc3ed80b2c2b7499f9af31d7bc4a55baa71c3bdd1
MATLAB
2,177
90
function [Xc,Xp] = Compute3D(xc,xp,R,T,fc,fp,cc,cp,kc,kp,alpha_c,alpha_p); % [Xc,Xp] = Compute3D(xc,xp,R,T,fc,fp,cc,cp,kc,kp,alpha_c,alpha_p); % % Reconstruction of the 3D structure of the striped object. % % Xc : The 3D coordinates of the points in the camera reference frame % Xp : The 3D coordinates of the poi...
f84881679c4db3e7d26e7c8850df50ce7e2d9ea11f8008b8920ef8a41042e734
MATLAB
2,177
66
function keyPressCallback(self,~,value) if self.verbosity > 9 disp(mfilename) end if strcmp(value.Key,'escape') self.channel_to_work_with = []; elseif strcmp(value.Key ,'uparrow') && any(strcmp(value.Modifier,'shift')) self.jumpToOutlier('up') elseif strcmp(value.Key ,'downarrow') && any(strcmp(value.Modifier,'shi...
291a5986c6fdcb18902ba4b93d087b1c0fe9df3a329541f0d8edee4dccf899f2
MATLAB
2,178
62
function [FitDetails]=LinearPoly3DFitting(TempXData,TempYData,TempZData) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear FitDetails FitDetails.XRange=[min(TempXData(:)):max(TempXData(:))/1000:max(TempXData(:))]; FitDetails.YRange=[min(TempYData(:)):max(TempYData(:))/1000:max(TempYData(:)...
8d61cdfb3d7962bf24cdcb33b82b02676a5dabf9964fd9a179e3c75f6b68ebde
MATLAB
2,178
52
% SOFA API - demo script % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not use this work except in compliance with the ...
90a6a87828263676bf6e276f6587d391194ed354b65c597b5516261341ba3e0b
MATLAB
2,178
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...
d49a09fae4995f7f64b3e587e6d3df9b6fb50dae87ec79023037ac29f83f92a4
MATLAB
2,178
87
%% diagonal filter %// Apply a zero-order filter ('filtfilt' to each matrix diagonal of a % (SDO) matrix, smoothing motifs for interpretation. % Optionally maintains linearity of SDO matrix using post-hoc conform. % % Input matrix is 'sheared' to align diagonals to rows, then filtered using % 'filtfilt' to apply...
986cac9233a9bedf1fce8f556168f68f49007ed5b4f980cf97f0cd1548ec1bcf
MATLAB
2,179
61
function [spikenums_shuffled,syncEvents_shuffled,SCEthresh] = circshiftRaster (spikenums,number_of_surrogates,plotting); %% >>> OPERATION >>> % Reshuffles spike raster to generate: % - surrogate spike raster (same size as original raster) % - surrogates for synchronous events (n surrogates x n data points 2D array) %...
c79239a533ae4ceeaa13b725f6486873e2306e412091017e1ea617fd647d9b86
MATLAB
2,179
80
%% Kalman Filter Tracking Demo: move point in 2d plane % State = (x y xdot ydot). We only observe (x y). % % X(t+1) = F X(t) + noise(Q) % Y(t) = H X(t) + noise(R) %% % This file is from pmtk3.googlecode.com ss = 4; % state size os = 2; % observation size F = [1 0 1 0; 0 1 0 1; 0 0 1 0; 0 0 0 1]; H = [1 0 0 0; 0 1...
fc72448f3e62f9f8f41eae446b92b38c2cb8eca2e40fb78406ca55b7bff8a4f9
MATLAB
2,179
64
% Main script for the state switching MR practice (October 2017) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% enter subject ID & task variant %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% prompt = {'Enter subject ID:','Enter paradigm (dynamic/words/visual):'}; dlg_title = 'StateSwitch Input'; num_lines = 1; defaultans = {'00...
af921dbb93f02597a2d2a548810cf301b0ec93a2f799ffb86c79397bf231a05f
MATLAB
2,180
79
% :Usage: % :: % % function XYZout = mm2voxel(XYZ, M, [uniqueness options]) % % :Inputs: % % **M:** % VOL must contain M or mat field, which is mat file matrix in SPM % % **XYZ:** % can be either 3 rows or 3 columns % by transforming to x y z in ROWS, coords in COLUMNS % so if you ha...
c9886c83a0e5fdd13e3bbf0fcdfe419d4add71923bcf73ff4c765fbfd537b1d7
MATLAB
2,180
67
%resnet 18 for feature extraction 26/3/2020 %acuracy 90.39 data set of 10 printer %acuracy 90.51 with new imagedatastore of datasets of 10 printer clc close all clear %images=testreaddata(); %D:\Doaa_PHD\PHD2020\DataSets\ck\CK48.......D:\Doaa_PHD\PHD2020\DataSets\jaffedbase - Copy images=imageDatastore('...
c2ade794ba7166665f43ac50263f7b79fd77dd51e3830e67c36cafe61115e037
MATLAB
2,181
58
function [data,timestamps,info]=read_neuralynx_file(filename, varargin) if exist('raw')==7 filename=strcat(['raw/' filename]); end data=[]; timestamps=[]; info=[]; if exist(filename)==2 [~,~,filetype] = fileparts(filename); if ~any(strcmp(filetype,{'.ncs','.nvt','.ntt','.nev'})) error('File extens...
d7c3ecc416fcb7985dcb06fe97eecfa7511d3988169cc2aa2304d8360c014573
MATLAB
2,181
50
function phi = phi_comp_probs(type_of_dist, type_of_phi, Z, probs, options) % Compute phi from probability distributions % % INPUTS: % type_of_dist: % 'Gauss': Gaussian distribution % 'dis': discrete probability distribution % type_of_phi: % 'SI': phi_H, stoch...
f1f7b43a6978899121bede60fadc5075b11b38a3d9cc5112029011d74107b638
MATLAB
2,181
59
% Purpose: Convert lh_labels and rh_labels to gifti shape files for later WB % visualization % Inputs: lh_labels and rh_labels from generate_network_overlap.m and template gifti % files in appropriate resolution. % Outputs: .shape.gii files containing AI values. % % Note: Template .shape.gii files can be created using...
3acad8ccbc39913efc849bceb349f7257a38810c9351ebb74869e2c7381c8920
MATLAB
2,182
84
% Load the dataset into MATLAB load('dataset.mat'); load Multivariate_NTs.mat % Specify the response variable and predictor variables colnames = {'beta_fmap','A4B2', 'CB1', 'DA', 'GABAa','H3', 'M1', 'mGluR5', 'MU', 'NAT', 'NMDAR','5HT'}; [~, colidx] = ismember(colnames, data.Properties.VariableNames); response = datas...
66e7dd11fd027cf80c5a1e7646e80d6b2b21abda7e7f41866666adf9146ebdbc
MATLAB
2,182
69
%% SAT - app_input :: %% getAppPpCellFromPpCell % Name: Phone Kyaw % Date: 09/10/2024 %_______________________________________ % Copyright (C) 2024 Phone Kyaw % Drexel University College of Medicine % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Publi...
88943841de0db7e7ff4e222778591e04cb28675edb4da90fcc647d0d96393788
MATLAB
2,182
60
% Combining the data from 30 simulation trials % This has to be run on a high-performance computing cluster. % NB: modify the path to the folder, name of the files to read from and % name of the file to save according to needs (lines 16-23) % Load data where the spike counts have been saved (option.saveSpkCounts=1) % ...
052c0ae99d2721a49a71bd193287c77f5ee260f58a2a00a145766d938678a9d7
MATLAB
2,183
58
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef BlockVectorHeaderExtension < Entry %BlockVectorHeaderExtension: Contains additional metadata about a loaded % Block vector set. % % ExtensionVersionMajor: Latest and greate...
3104567fab7e86ec051c140588b0a4b73ded2d84f0a9d97b577e595dad87b73b
MATLAB
2,183
85
function [varargout] = getargs(argcell, tags, def) %GETARGS Scan varargin cell and match a list of tags % % [varargout] = getargs(argcell, tags, def) % % This function allows one to use numbers of [parameter, value] pairs % in function calls. It parses the varargin cell that is used in % another function call. What ...
9d381f4c44a7f11e00a6406f5dddc1eab5afbbbf7265ebae59ab2ceddb8c0e86
MATLAB
2,183
46
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 o...
4de0b16947b46d51bb577d5122be323a0766f8f0e9437f107a4b64fe8d4000d1
MATLAB
2,184
72
function [varargout] = plinproj(varargin) % PLINPROJ projects a point onto a line or linepiece % % Use as % [proj, dist] = plinproj(l1, l2, r, flag) % where l1 and l2 are the begin and endpoint of the linepiece, and r is % the point that is projected onto the line % % the optional flag can be: % 0 (default) proj...
990292c7703e513e4db4d159b0960b8a4aa581d2b588eea490c0d8cea3238b51
MATLAB
2,184
56
TRANSCRIPT_OBJ_FILE = ‘’; %put in the _transcriptobjects.mat output in the 6_base-calling directory XY_SIZE = [2048,2048]; %How big (by pixels) is a single image from microscope READ_SIZE = 8; %how big dots do you want to make? %Load transcript_objects into the memory: load(TRANSCRIPT_OBJ_FILE); %Get the list of all...
d28ebc76f5fb5a4954bacd39c5d3d0878bbc9bab5bacf2d06934fa51c101b366
MATLAB
2,184
44
for k = 1:length(X) clf; x = X(k); % Display NIFTI slice I = round(-x/d1d2d3(1) + N1N2N3(1)/2); % minus here! S = squeeze(VT(I, :, :))'; % choose the X cross-section S = S(:, :); image([-DimensionY/2 +DimensionY/2], [-DimensionZ/2 +DimensionZ/2], S, 'CDataMapping', 'scaled'); ...
f4b02e42f16678d5e9506a09c868797420651585c7bed196d38d761da3710a57
MATLAB
2,184
62
% this funciton takes an input signal and num_images, plots them, % gets the user to select the points between light onset and light offset, and then % replaces the trace between these points straight line. this improves curve fitting % for detrending correction. fit the curve to this output and then subtract % the cu...
094730148f8f2570d2efce3350e5b0d8a40a6d83dc5413b54f981b7ee5995970
MATLAB
2,185
55
%----------------------------------------------------------------------------------------- % Correlation of firing rate of odor-modulated amygdala neurons % with reference valence ratings % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 4e % Author: Marcel Kehl % Li...
f048d1e8707f0aeacf68328d869172132a3ae5e47afcf7d9aef559eb093edaf6
MATLAB
2,185
70
%% Demonstrate training a chain-structured CRF % Based on % http://www.cs.ubc.ca/~schmidtm/Software/UGM/trainCRF.html % This file is from pmtk3.googlecode.com %% Get data setSeed(0); load rain.mat % X is 1059*28 y = X+1; % Convert from {0,1} to {1,2} representation [nInstances,nNodes] = size(y); % test using a sub...
4af521daa97325eb65608fec61317f7b247270c304ebf8e910109cee90460ce5
MATLAB
2,186
100
%% LLA and LQA approximation - fig 1 of Zou & Li 2008 % %% % This file is from pmtk3.googlecode.com function scadPlot() z = -10:0.01:10; a = 3.7; lambda = 2; if 0 % Reproduce fig 1c of Fan & Li 2001 p = penalty(z, a, lambda); figure; plot(z, p, 'k-', 'linewidth', 3); title(sprintf('scad penalty rule, %s=%5.3f, a=%5...
4d3b06d7069140d9fde8a585198529d6412488b2b917b20c0b9f139beb01d3f3
MATLAB
2,186
64
function passed = ft_test_moxunit_run(unused,varargin) % FT_TEST_MOXUNIT_RUN % Copyright (C) 2017, Nikolaas N. Oosterhof % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: you can redistribute it and/or modify % it under t...
1eb31f2b950c0c568a5fb83712bf8f2617e53be4f2fceeabc3e773a9e3aee605
MATLAB
2,187
63
function [out_table, out_matrix, colnames] = table_long2wide(dat, outcomevarname, varname1, varname2, sidname) % Converts long-format table to wide-format, averaging values within-participant for each combo of conditions in varname1 and varname2 % % [out_table, out_matrix, colnames] = table_long2wide(dat, outcomevarn...
36973b8a645be92343da30e7f5d7285220f76b0c5c47cc91dfbdc431662bb16a
MATLAB
2,187
64
function passed = ft_test_moxunit_run(unused,varargin) % FT_TEST_MOXUNIT_RUN % Copyright (C) 2017, Nikolaas N. Oosterhof % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: you can redistribute it and/or modify % it under t...
91e87506b76a963386e1c6adb366e32b32d81c0322669759b58ce093dbe89c43
MATLAB
2,187
50
function params = CBIG_AuthorTopicEM_CreateEmptyParams(seed, K, brain_mask2mm, init_type, init_file) % params = CBIG_AuthorTopicEM_CreateEmptyParams(seed, K, brain_mask2mm, init_type, init_file) % % Generate a struct of parameters for the author-topic model % % Input: % - seed = seed used by Matlab's random ...
bd7a9a4fbd5ebb5226f9100e6bbdc9906b90c643a966e06f0f78242fd866a51f
MATLAB
2,187
53
function loc_list_three_channel(data,scatter_size,scatter_num) global Int if length(data)~=3 msgbox('Number of files selected should be equal to 3') else figure() set(gcf,'name','Montage Plot','NumberTitle','off','color',[0.1,0.1,0.1],'units','normalized','position',[0.15 0.2 0.7 0.6],'menubar','n...
0055e0b61e550eb188d7edcdfa6c7045260b3d5c1e451bb8a3b213f50cf37d5e
MATLAB
2,188
64
function [ phi_G, Cov_E_p, A_p ] = phi_G_Gauss( Cov_X, Cov_XY, Cov_Y, Z, method, normalization ) % Calculate integrated information "phi_G" based on information geometry. % See Oizumi et al., 2016, PNAS for the details. % http://www.pnas.org/content/113/51/14817.full % % INPUTS: % Cov_X: covariance of data X (pas...
bd5daab55a7a5511fad6fde78ea9e4d3877facfedbd917026b9736dda082b1ab
MATLAB
2,188
67
function Rx=correlmx(x,p,Rxtype); % Rx=correlmx(x,p,Rxtype) correlation matrix of a signal % % Rx : correlation matrix (p+1) x (p+1) % x : analyzed signal % p : last autocorrelation lag % Rxtype : computation algorithm (default : 'fbhermitian') % possible values : 'hermitian', 'fb...
c4bf19bb92ef7d0b869ebd67c25b8053d164825e7f3161cfdc4b9fc6527de7fa
MATLAB
2,188
66
function Y = interpolate_nans(varargin) % FILLNANS replaces all NaNs in array using inverse-distance weighting. % % Y = interpolate_nans(X) replaces all NaNs in the vector or array X by % inverse-distance weighted interpolation: % Y = sum(X/D^3)/sum(1/D^3) % where D is the distance (in pixel...
06ab4e2b83fd924204f8340901b3ae4f37f76157e80bde323e6e7275e06a6ca8
MATLAB
2,189
65
function [model] = obsModelFit(X, Y, obstype) % Fit a model of the form Xj -> Yj % where X(i,j) is discrete value of node j in case i % and Y(i,j,:) is a feature vector % There are several types of obs model. % - 'gauss': we fit a model to the features % p(Y(i,j,:)|X(i,j)=k) = gauss(mu(:,j,k), Sigma(:,:,j,k) % - 'qua...
cd45809568d5a8c581113fb3978e1e1c1964cf3be4b3d6a900589e4dd7adc1d7
MATLAB
2,189
50
%% ------------------------------------------------------------------------ % configuration % every line contains three fields: % 'filename' % 'legend text' % 'Marker' % 'Color' % 'MarkerFaceColor' % 'TextPosition': [x, y] % ----------------------------------------------------...
fc5ab2d9ad57d9689cde788a6bb34d5467c23a6549d4062a3b6ce9f871af0aa1
MATLAB
2,189
64
function [path_score,best_path]=pacman(decoded_event) psize = size(decoded_event); [forward_score,forward_path] = find_path(decoded_event); [reverse_score,reverse_path] = find_path(flipud(decoded_event)); %compare the upper-left lower-right score to the lower-left %upper-right score, take the higher one if forward_sc...
387a10449920c50e112dd21fa6784798ff41c908fd7eadc233ef3359fe14a475
MATLAB
2,190
61
function [bWeights,bWeightsPos,bLong] = bWeightAcc(bLong,bTrunc,LossArr) %% %For each array, determine number of repeats of each element for k=1:length(bLong) maxbLong(k)=max(bLong{k}(:)); end bArr=[0:max(maxbLong).^0.5].^2; bLong{1}=bArr; for k=1:length(bLong) bRepeats{k}=histc(bLong{k},[bLong{1}]',1); end %% ...
8d54870687af40e880e349abfd10721653fccf8d6d0d35c8c978e0dd956cd747
MATLAB
2,191
78
function str = h_copy(vector,direction, title) if ~exist('direction', 'var')||isempty(direction) direction = 'vertical'; end if ~exist('title', 'var')||isempty(title) title = ''; end if ischar(vector) && ~iscell(vector) vector = {vector}; end siz = size(vector); % if ischar(vector) % ...