sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
56a70c59880dc0d89bfaff1f256cd4fd89d7e22d25da5c1a06e9d05df6d739d7
MATLAB
3,057
81
function [ F, J ] = gauss2dfun( params, xy) %GAUSSIAN2DFUN evaluates modified gaussian with params at x % Output: % F: function value % J: Jacobian of the parameters %Written by Dimos. %========================================================================== %Unwrap inputs %===========================...
5baae0359d2498aeb78bb66320f159054b37853d98ab10fd81ea41955871dd7c
MATLAB
3,057
129
function [p_BPA] = VBA_BPA(priors0,posteriors0) % performs Bayesian Parameters Averaging (BPA) % function [p,o] = VBA_BPA(posterior,F) % IN: % - priors0: a Kx1 cell-array of VBA prior structures (where K is the number of subjects) % - posteriors0: a Kx1 cell-array of VBA posterior structures (where K is the number ...
c2f3eabc2bbbcb0347bcf22f8bf56a4425de96e47b5cee40b3e9f8ad554fcf4b
MATLAB
3,057
86
function [stop, reason] = stoppingcriterion(problem, x, options, info, last) % Checks for standard stopping criteria, as a helper to solvers. % % function [stop, reason] = stoppingcriterion(problem, x, options, info, last) % % Executes standard stopping criterion checks, based on what is defined in % the info(las...
225d40c799f53f7fd5e925467fd0727fd2ea2d763fcbc543a77cb6d5d3a5794a
MATLAB
3,058
98
function SpikeSortDU(datDir, varargin) verbose = true; saveDir = datDir; preprocessRange = [0 600]; timeRange = [0 Inf]; lfp = true; lowpass = -1; for i = 1:2:length(varargin) switch lower(varargin{i}) case 'verbose' verbose = varargin{i+1}; case 'savedir' saveDir = vararg...
87094166cd74c963e997e9af3a168b597a0eefcddcd577c6799ccf0bcff52a94
MATLAB
3,058
89
% Use corrected S S = Scorr; % run the first block of main_DIAN_centrality_anal_signed first BrainViewCmap = jet(101);%jet(100);% hot(100); % BrainViewCmap = interp1(linspace(0,100,10),Plot.redbluecmap(10),linspace(0,100,100)); T = readtable('DIAN_Seitzman_246.xlsx'); load('IM_13nets_246_newcolor_MNI.mat'); % load p...
e0cc1120553b5839dea06fd0a90c0def404c58a45d4accd1e2196b50f906c558
MATLAB
3,058
114
function [uniquedays,muperday,Sperday,nperday,hax,hfig] = PlotLabeledReachesPerMouse(labeldata,varargin) [hax,hfig,mousename,sepdays] = myparse(varargin,'hax',[],'hfig',[],'mousename','','sepdays',true); if isempty(hax), if isempty(hfig), hfig = figure; else figure(hfig); end hax = gca; end for i = 1...
50487706a2d19ebba14755f5024e30f02f8d482a3d2133adee48f63c933af339
MATLAB
3,059
143
clear clc global glm %%%%% SET HYPERPARAMETERS %bin width resolution=2; glm.res=resolution/100; %pulse duration duration=65; %ensure duration can be divided by resolution if(mod(duration,resolution)~=0) duration=duration+1; end glm.pulsedur=duration/100; glm.keep_regression_values=0; % only consider pulse...
572a040066338218a1bf0ae98ca607cee69bc825fd230b5c6db21a69147259ba
MATLAB
3,059
57
function cMap=UniversalColorMap(ColorCode,TempContrastLow,TempContrastHigh) if (TempContrastHigh-TempContrastLow)<=0 warning on warning('Provide UniversalColorMap with separated contrast values!') error('Provide UniversalColorMap with separated contrast values!') end if ischar(...
d7f5ca04d6ce0fe80aaa32bb3b18cf9493448d19f4cbb4378452c2b2e4853d96
MATLAB
3,059
104
function [ripple_stats, chan_labels, lab, data] = chanSelect(sub, ripple_stats, lab, data) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Thalamic spindles and Up states coordinate cortical and hippocampal % co-ripples in humans % % Dickey et al. 2024 % % Sub-select good channels for ...
5ee324ed19e87c90417c6b27c16fa1243a79264bafff9af11762d461c0964ece
MATLAB
3,061
91
function ft_write_sens(filename, sens, varargin) % FT_WRITE_SENS writes electrode information to an external file for further processing in external software. % % Use as % ft_write_sens(filename, sens, ...) % % The specified filename can already contain the filename extention, % but that is not required since it will...
e293e1ba3164231e6587154de242c3911dacf642d772523ff1e4f42a192f530e
MATLAB
3,061
70
% JPSTH calculates jpsth for two spike counts aligned around an event % jpsth.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 it and/or modify % it under ...
33a42a4034799eb44c08834ed4bc892722a1543e5f36d01cb005ef7b898c5578
MATLAB
3,062
73
function cPPI_with_deconv_FIR(stat_path,exp_folder,N,N_ROIs,q_level,ground_truth) % ======================================================================== % Ruslan Masharipov, October, 2023 % email: ruslan.s.masharipov@gmail.com % ======================================================================== tic for subj...
9149ab76812ac97ceda8394b5bf7a0b6b4c379b3316fb9457c6913131ba0ab5d
MATLAB
3,062
94
function costs = surfprofile(problem, x, d1, d2, t1, t2) % Plot the cost function as a surface over a 2-dimensional subspace. % % function surfprofile(problem, x, d1, d2, t1, t2) % function costs = surfprofile(problem, x, d1, d2, t1, t2) % % Evaluates the cost function at points % % gamma(t1, t2) = exponentia...
7640a56ec1cb26091251e810c8594e301a18aef57d712276ec8542e2e0ec7ea6
MATLAB
3,063
71
function EEG = DS_Zscore(EEG,StartEEG,EndEEG,~) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Normalize EEG signal using sliding window % % Part of detect_spindles toolbox: % % Authors: Stephane Sockeel, PhD, University of Montreal % Stuart Fogel, PhD, University of Ottawa ...
92b7078dc23a4aec3afa9c45401006b8f62ecfb5a6253d71b762fe9154d3f27c
MATLAB
3,063
77
function varargout = handleVarargin(optionalInputs, optionalVariables, defaultValues) % assignedInputs = assignDefaultValues(optionalInputs, optionalVariables, defaultValues) % This function can be used to when you 'varargin'. It will assing % varargin{1, 2, ...} to their corresponding variables (you don't need to % d...
73d47e2fc10843d92ae307e0874a210cd944789082959d948bb7ae60927c2b86
MATLAB
3,064
79
classdef Workspace < handle properties images TCA params end methods function ws = Workspace(def_file) addpath('./lib'); %load def file load(def_file); %number of temporally concatenated runs ...
9ba54f673334bc88948b442b297695798909121bf26e40963b53c68370e9ef6e
MATLAB
3,064
95
function hfigs = PlotExampleLabelsAndPreds(lbld,predfns,movieidx,frames,varargin) [hfigbase,naxperfig,landmarkcolors,figpos,prednames,err] = ... myparse(varargin,'hfigbase',100,'naxperfig',5,... 'landmarkcolors',[],'figpos',[10,10,2100,1500],... 'prednames',{},'err',[]); nviews = size(lbld.movieFilesAll,2); nla...
ffbc1204edb25932859fabc16ad210e2a98fd112daa73fb2bbce7b174d0709a2
MATLAB
3,064
106
function GND = FillEmptyGND(data, chanInds, EEG, binNames, nGoodTrials, nBadTrials, expDesc, fNames) % function GND = FillEmptyGND(data, chanInds, EEG, condNames, expDesc, fNames) % Fill up an empty GND structure with data and other fields (will call % MakeEmptyGND subfunction) % % Inputs: % data = [nPP nTimes nBins...
5bf914faec7f1b58cfdb6159f706d6ccabb4af73916077d33c9f8b4c96b03427
MATLAB
3,066
122
%% Illustrate benefit of using T distribution instead of plugin estimate % We use a naive Bayes classifier with 2 Gaussian features %% % This file is from pmtk3.googlecode.com function naiveBayesBayesianDemo() setSeed(0); C = 3; [Xtrain, Ytrain] = makeDataHelper([2 5 8]*1); [Xtest, Ytest] = makeDataHelper([2 5 8]*20)...
d967fa9b8096140b2104b8249cb8ef139c1b118d25daabb13d323d33bb7800fc
MATLAB
3,066
89
% Copyright 2015 Idse Heemskerk and Sebastian Streichan % % This file is part of ImSAnE. % % ImSAnE 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 3 of the License, or % (at your option) any l...
17d2a7798f107920461780de5c02556344dcd28e6994c80814ef4be5974dcb49
MATLAB
3,067
75
function J = convBox( I, r, s, nomex ) % Extremely fast 2D image convolution with a box filter. % % Convolves an image by a F=ones(2*r+1,2*r+1)/(2*r+1)^2 filter. The % convolution can be performed in constant time per-pixel, independent of % the radius r. In fact the implementation is nearly optimal, with the % convolu...
6e6fbf0447a35214c547d4b01a6ab2db6307f74cf764a18bab1bc974d441f892
MATLAB
3,068
85
function HMM = fit_HMM_simcv(datadir, hmmdir, HMM_name, n_train, n_test, betwgroup_diff, Y_noise, k, cv) % HMM = fit_HMM_simcv(n_train, n_test, betwgroup_diff, Y_noise, type) % % fit a group-level HMM to simulated timecourses using % simulate_cv_generatetc, either only to the training set or to all % subjects. % This ...
939caa89ccc28042f91221046a16d2e0792aa4937a8a5888254cfc8647c04bb5
MATLAB
3,068
98
function [tfr,t,f] = tfrstft(x,t,N,h,trace); %TFRSTFT Short time Fourier transform. % [TFR,T,F]=TFRSTFT(X,T,N,H,TRACE) computes the short-time Fourier % transform of a discrete-time signal X. % % X : signal. % T : time instant(s) (default : 1:length(X)). % N : number of frequency bins (default :...
e074f4de44bd652e76a5c87eb1847e136adf0d3c94399e083e296ee22accb8e3
MATLAB
3,068
97
function [MergedStack] = StackMerge_wBorders_noLoading(Stack1_Input,Stack2_Input,Borders,Limits) %this will load in two stacks and merge them vertically and help avoid %memory loading issues if large stacks if length(Limits)~=1 Stack1=Stack1_Input; Stack1_Name = 'Stack 1'; disp(['Stack1_Name = ',Stack...
83d3daee5ad9f46f695f9963a5ba453484c024bbc9455adbfc24a820eb0628e8
MATLAB
3,069
107
function p = redgreencolormap(m,varargin) %REDGREENCMAP creates a red and green colormap. % % REDGREENCMAP(M) returns an M-by-3 matrix containing a red and green % colormap. Low values are bright green, values in the center of the map % are black, and high values are red. If M is empty, the length of the % map ...
912aedc902d59fd018414058bc212106f1e4b3f11902773f6253ffc4d7236f61
MATLAB
3,069
95
function [cs,index] = sort_nat(c,mode) %sort_nat: Natural order sort of cell array of strings. % usage: [S,INDEX] = sort_nat(C) % % where, % C is a cell array (vector) of strings to be sorted. % S is C, sorted in natural order. % INDEX is the sort order such that S = C(INDEX); % % Natural order sorti...
3fafaa47a05944602316216c86f3e634803324d92fe389b147ef17c0a1bdcd59
MATLAB
3,070
114
function [o]=approxbrunnermunzel(x, y, sidedness) % sidedness = 1 -> two sided; = 2 -> greater ; = 3 -> less % ported from % https://github.com/toshi-ara/brunnermunzel/blob/master/src/bm_test.f alpha = 0.05; % for computing 95% CI TOLER = 10^(-10); P1 = [0.0, 1.0, 0.0]; P0 = [0.0, 0.0, 1.0]; % columnize d...
60044f9ff20716daf062efbee1c127b9cbe28a37f56a521e8d63ecd34faf985a
MATLAB
3,070
80
function Log3DPlotZeroCorrection(TempXData,TempYData,TempZData,Input_Color_Map,MarkerSize_3D,AdjustRatio) warning on all warning off verbose warning off backtrace if length(size(Input_Color_Map))>2 for i=1:size(TempXData,2) Color_Map(i,:)=horzcat(Input_Color_Map(1,i,:)); ...
5df78455754f8dc49ead09bfc5d06d54ebf3246cd5a080708a3299cf2004b00e
MATLAB
3,071
109
%% this script generates a distribution of LED -> PD spreads for each of the three layers %% this section shows the ideal spreads are not too far off from the real LED -> PD position spread led = generate_spread_values('wurth_led'); pd = generate_spread_values('osram_3710'); ds = [3 27]; folder = 'D:\data\22...
fd8bb9b1cff13b22a507a8803e1053df09c831fad36e693cd188e95d85b5c714
MATLAB
3,071
90
function headmodel = ft_headmodel_singlesphere(mesh, varargin) % FT_HEADMODEL_SINGLESPHERE creates a volume conduction model of the % head by fitting a spherical model to a set of points that describe % the head surface. % % For MEG this implements Cuffin BN, Cohen D. "Magnetic fields of % a dipole in special volume ...
70e49278fcc4c39be1621e40a7b2a4357fe0646ae15341f1f89b30958c0dea4d
MATLAB
3,072
114
%% plotSDO_shearSDO % % plot diagonal Band of SDO which contain the majority of the SDO effects, % sheared, such that the diagonal is on the horizonal axis. % % PREREQUISITES: % computeSDO() % INPUT PARAMETERS % sdoMatrix: % - The target spike-triggered SDO to plot % OPTIONAL POSITIONAL ARGUMENTS ...
21ba897474e55d8fa24b1c0d4c4ddeb02ed85183c2d02794b1d28f6241a51d44
MATLAB
3,073
87
function publishMethod(mfile,methodName,evalCode) % Publish a class method or a subfuncion of an mfile to html. % % INPUTS: % % mfile - the name of the mfile containing the function/method without the .m % methodName - the name of the method/function % evalCode - [true] | false if true, the code is evaluated an...
36bf7e52bee9ae068be76de683764cae25aa00fb0401e9ac0a7c7b1f8164e0fe
MATLAB
3,073
61
function [spmat] = helm_near_corr(S,zpars,eps) npts = S.npts; npatches = S.npatches; ipatch_id = zeros(npts,1); uvs_targ = zeros(2,npts); norders = S.norders; ixyzs = S.ixyzs; iptype = S.iptype; srcvals = S.srcvals; srccoefs = S.srccoefs; npp1 = npatches+1; n3 = 3; n9 = ...
2016aa798fd05ea1e4fd58b33783169bc2c1b3aa0e6dbd8f6c2d5a182ca5616d
MATLAB
3,074
97
function [tfr,t,f] = tfrppage(x,t,N,h,trace); %TFRPPAGE Pseudo Page time-frequency distribution. % [TFR,T,F]=TFRPPAGE(X,T,N,H,TRACE) computes the Pseudo Page % distribution of a discrete-time signal X, or the % cross Pseudo Page representation between two signals. % % X : signal if auto-PPage, or [X1,X2] if cros...
dfdbbc0c4c618788344108d263412d52ba2c4181ac875275af98625799a09bd2
MATLAB
3,074
85
%% NS prepare pipeline %This main file will call the the neccessary routines to generate the NS %results of the publication: "Stimulus-Induced Rotary Saturation imaging of %visually evoked neuroelectric response: preliminary results and data %analysis" (currently under review) % Author: Milena Capiglioni, University o...
f864a129c89dd1fbb46f799c89b49a4d7cac247d36b7c828b67551ecaf113e84
MATLAB
3,074
93
function cfg = dataset2files(cfg) % Helper function that converts a dataset into headerfile and datafile % if necessary. This is used in PREPROCESSING and DEFINETRIAL % % This function operates only on % cfg.dataset % cfg.datafile % cfg.headerfile % and returns the updated cfg. % Copyright (C) 2004, Robert Oost...
24c1e56615461cf25b9ad0bf03de3663a518db61b358e99bb0e37d9dbb154161
MATLAB
3,075
97
function [nfft,tableout]=nextfastfft(n) %NEXTFASTFFT Next higher number with a fast FFT % Usage: nfft=nextfastfft(n); % % `nextfastfft(n)` returns the next number greater than or equal to *n*, % for which the computation of a FFT is fast. Such a number is solely % comprised of small pri...
2ca4ccbe55845721938f75f81bcaff3506da580f724c6f6fb6db2f865e350bc9
MATLAB
3,075
93
function cfg = dataset2files(cfg) % Helper function that converts a dataset into headerfile and datafile % if neccessary. This is used in PREPROCESSING and DEFINETRIAL % % This function operates only on % cfg.dataset % cfg.datafile % cfg.headerfile % and returns the updated cfg. % Copyright (C) 2004, Robert Oos...
aed5d32aff64b84fe0d8871a9191a1fb730fc7b94abc1a9f2c043b35d2d92c56
MATLAB
3,075
75
function varargout = jbm_quickInfoGUI3(varargin) % JBM_QUICKINFOGUI3 M-file for jbm_quickInfoGUI3.fig % JBM_QUICKINFOGUI3, by itself, creates a new JBM_QUICKINFOGUI3 or raises the existing % singleton*. % % H = JBM_QUICKINFOGUI3 returns the handle to a new JBM_QUICKINFOGUI3 or the handle to % ...
5732c24652dfd27fb6da7273495766465aece30d2a9014bbb58ad2e5f0a51a68
MATLAB
3,076
84
%Accuracy 49.44% 20printer with 70 and 30 svm+full image fc7 %Accuracy 51.67% 20printer with 80 and 20 svm+full image fc7 %Accuracy 59.77% 20printer with 80 and 20 svm+full image fc6 and 51.11 %with 70% train clc close all clear %D:\Doaa_PHD\PHD2020\DataSets\ck\CK48وو %D:\Doaa_PHD\PHD2020\DataSets\jaffedba...
469db836286fe0fb8ac8d24b8c4359f6e3d30d238b19d9b264e6f3910f0a13de
MATLAB
3,077
171
function [] = compute_logistic_regression(ratto) nreps=50; load(['data/Sessions_trials/' ratto '_sessions.mat']); minperf=.7; minbeta=.7; mintri=100; ind=find([sessions.hit]>=minperf & (([sessions.bdir]+[sessions.bfreq])/2)>=minbeta & ... [sessions.valid]>=mintri & [sessions.good]==1); sessions=sessions(ind...
84f80f414aed8e2e335416455e7877e5a4e0a1787ef54765b0bbb84716f20c8e
MATLAB
3,077
96
function [file] = read_ctf_ascii(filename) % READ_CTF_ASCII reads general data from an CTF configuration file % % The file should be formatted like % Group % { % item1 : value1a value1b value1c % item2 : value2a value2b value2c % item3 : value3a value3b value3c % item4 : value4a value4b value...
d29da765b9b1068f183eb20784b3f56f26a19d9552c2120d6e0570b2b048bc94
MATLAB
3,078
103
%% var_to_tsdata % % Generate random multi-trial Gaussian VAR time series % % <matlab:open('var_to_tsdata.m') code> % %% Syntax % % [X,E,mtrunc] = var_to_tsdata(A,SIG,m,N,mtrunc,decayfac) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % A VAR coef...
ea3d7c17580216beda9cf477774708760f53c9545d80e0687af993c882a46f20
MATLAB
3,078
63
function CBIG_ASDf_FC2doc_estFactors_wrapper(corrMat_ASD_path, corrMat_con_path, sub_info_file, output_dir) % CBIG_ASDf_FC2doc_estFactors_wrapper(corrMat_ASD_path, corrMat_con_path, sub_info_file, output_dir) % % Wrapper function to compute z-normalized, discretized FC and write into % word documents that will be used ...
deb3d5e0310e6c99fb1331b9593b5a7216494c74fe8f869f485b63fcfb05d410
MATLAB
3,079
105
function tucker_me_test %TUCKER_ME_TEST Very simple tests of tucker_me. % Code by Tamara Kolda and Jimeng Sun, 2008. % % Based on the paper: % T. G. Kolda and J. Sun. Scalable Tensor Decompositions for Multi-aspect % Data Mining. In: ICDM 2008: Proceedings of the 8th IEEE International % Conference on Data M...
d5bafba9d3cb31863fdd323dcba0d4881ecf0419c04914cf1469700fd8894b14
MATLAB
3,080
112
% demo for binary data classification close all clear variables dim.p = 32; dim.n_t = 1; dim.n_phi = 16; dim.n_theta = 0; dim.n = 0; g_fname = @g_classif; options.sources = struct('type',1 ,'out', 1); % one binomial observation; options.priors.muPhi = zeros(dim.n_phi,1); options.priors.SigmaPhi = 1e0*eye(dim.n_phi)...
f68241c0f8546fabc53ab00b4820d9e0c1a46c002683f04a05831ed209163708
MATLAB
3,080
90
function [C,time,g,s,k, phi, sta, stb] = minTimeGradient(C,rv, g0, gfin, gmax, smax,T, ds,show) % [C,time,g,s,k, phi, sta, stb] = minTimeGradient(C, RIV/RV, g0, gfin, gmax, smax,T, ds, show) % [C,time,g,s,k, phi, sta, stb] = minTimeGradient(C, [], [], [], gmax, smax, T, [], []) % % Given a k-space trajectory C...
3d8ef021331e250c54bf097a805e8d01685300911c1101ebb68d83ed24a23e01
MATLAB
3,081
92
function [depth] = ft_sourcedepth(dippos, headmodel) % FT_SOURCEDEPTH computes the distance from the source to the surface of % the source compartment (usually the brain) in the volume conduction model. % % Use as % depth = ft_sourcedepth(dippos, headmodel); % where % dippos = Nx3 matrix with the position of N...
d9eb101d562b2513c121981f5cf047c4c5c9480442f366ea6df2a6f8f0407f3c
MATLAB
3,081
131
%% Interpolate some data using a joint Gaussian % Based on p140 of "Introduction to Bayesian scientific computation" % by Calvetti and Somersalo % See also https://users.oden.utexas.edu/~tanbui/PublishedPapers/BayesianTutorial.pdf function main() demo(0.1) demo(0.01) end function demo(priorVar) setSeed(1); Nobs = 1...
fa07632b62d6988917ccb4b2c4e12788b712cc37cde5d53666f4df3921daab54
MATLAB
3,081
83
% plot_rawICs.m % Sarah West % 9/16/21 % Plots raw ICs from calculate_ICs.m for looking at/inspection. function []=plot_rawICs(parameters) % Return parameters to individual names. mice_all = parameters.mice_all; num_sources = parameters.num_sources; yDim = parameters.yDim; xDim = parameters.xD...
29e056381166ed55e851dcfc58f95a310d43cafecf3fd3b8c1a94f8db7d1ff1a
MATLAB
3,083
126
function elasticDistortionsDemo() %% Illustrate elastic deformations %PMTKauthor Kevin Swersky %load goodsix.mat loadData('pmtkImages', 'isMatFile', false) I = imread('digit6.png'); setSeed(2); %rand('seed',30); cm = ones(64,3); cm(:,1:2) = repmat(linspace(1,0,size(cm,1))',1,2); X = repmat(1:size(I,2),siz...
d2bc487b411f8d10c5559f5a6cb1f6c24e4fd6d451067afff58204ea1aba4783
MATLAB
3,083
76
function shorten_ufmf(input_file_name, output_file_name, desired_frame_count) % read in the header input_header = ufmf_read_header(input_file_name) ; input_frame_count = input_header.nframes ; % find the end of the header headerstart = 0; % loc of something after the header headerend = min(min(...
7438a420807c2dc43f202d4adcc8fa665ffad92e880fea6f1d1b2576d714fb03
MATLAB
3,084
73
function [P_all,w_all] = DeleteSample3DPointsRomain(r,c,S,w_in,cRig,K) nviews = numel(r); cNames = {'L','R','B'}; % for now. P_all = nan(3,numel(r{1})+1,numel(r{2})+1,numel(r{3})+1,3); w_all = zeros(numel(r{1})+1,numel(r{2})+1,numel(r{3})+1,3); for view = 1:numel(r), fview = view;...
afb8bad25c1a048e32fc139a4cea0728daf07efd86e51584645ea83ebbe315af
MATLAB
3,084
97
function generators = getGaussGeneratorsFixMovie(experiment, ... imEnsemble, runningfixations, modelparams, xmar, ymar) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here Nx = experiment.projector.screen(2); Ny = experiment.projector.screen(1); Nyx = Ny * Nx; [Nyim, Nxim, Ni...
fb953e53264e30925ebc7b5ab97ccbd68585047889df332f0233e248ba74d869
MATLAB
3,084
88
function [x,iflaw]=fmpar(N,p1,p2,p3) %FMPAR Parabolic frequency modulated signal. % [X,IFLAW]=FMPAR(N,P1,P2,P3) generates a signal with % parabolic frequency modulation law. % X(T) = exp(j*2*pi(A0.T + A1/2.T^2 +A2/3.T^3)) % % N : the number of points in time % P1 : if NARGIN=2, P1 is a vector containing the three % ...
c089fdcba2516639e09da91d8da4a4b4ba01790f7310fb53a3d61709b0fa4a73
MATLAB
3,085
83
function [W, output] = logregBoundOptL2overrelaxed(X, Y, lambda) % Fit the weights for L2 penalized multinomial logistic regression via % overrelaxed bound optimization in O((cd)^3) where c is the number of % classes and d is the number of dimensions. % % Inputs: % % X nexamples-by-ndimensions % Y ...
073148edc8be111305f60dd77b2f8e4f78bbac2097a73b958676b9c2dec642dd
MATLAB
3,087
68
function Aout = h_routinesForInVivoAnalysis(flag, varargin) for ii = 1:length(flag) switch(flag(ii)) case 1 % 1) spine number syntax: Aout = h_routinesForInVivoAnalysis(1, synapseAnalysisData, figFlag) presenceMatrix = varargin{1}.presenceMatrix; synapseNum = sum(presenceMatri...
5f072426e7b5f6b98ef30a86db739b48273bfe7ccf8087d0923d17a5bd36d0f3
MATLAB
3,087
84
% fooof() - Fit the FOOOF model on a neural power spectrum. % % Usage: % >> fooof_results = fooof(freqs, power_spectrum, f_range, settings, return_model); % % Inputs: % freqs = row vector of frequency values % power_spectrum = row vector of power values % f_range = fitting range (Hz) % sett...
7282c42813b53501b4faf30cb7add3de63c843a817be74056a18e65f7537df42
MATLAB
3,087
109
% Demo for Balloon model. % This demo inverts a balloon model of the HRF. close all clear all % Choose basic settings for simulations TR = 2e0; % sampling time interval (in sec) n_t = 60/TR; % number of time samples (over 40 sec) deltat = 5e-2; % micro-time resoluti...
c91be2b3e6d5359d3fec6ef524b5fae4452d0f925748c3f807d09ef1920ab54a
MATLAB
3,090
91
function [depth] = ft_sourcedepth(dippos, headmodel) % FT_SOURCEDEPTH computes the distance from the source to the surface of % the source compartment (usually the brain) in the volume conduction model. % % Use as % depth = ft_sourcedepth(dippos, headmodel); % where % dippos = Nx3 matrix with the position of N...
51f7a7da9fca07732a707897f3b7b2e469b9271699faa721432b138906e5243a
MATLAB
3,091
136
function coor = coords_txt2coords_mat(name,pos,mni) if nargin ==0 % names !!!! realk= []; [FileName,PathName,FilterIndex] = uigetfile({'*.txt','electrode names';},'open electrode names file','xx_Name.txt'); if isequal(FileName,0) || isequal(PathName,0) disp('User selected Cancel') ...
f3e5397331eb062e8a4ad3f7c376461ec3bc0e720b2dc96bf3fe49dbf9ce96a6
MATLAB
3,092
116
function [hyp,p,z] = mengz(varargin) % This function implements Meng's z-test for correlated correlations (Meng, % Rubin, & Rosenthal (1992), Comparing Correlated Correlation Coefficients, % Psych Bulletin 111(1), 172-175.) % % mengz(r1, r2, r12, n) compares two correlations r1 and r2: % r1: correlation between X and Y...
8e6581234c8dca23fc2f74147ef766ba462cc2e391718b647ae899da827b1797
MATLAB
3,093
91
function [params, s_new] = denoise_artifact(params, s, state) % DENOISE_ARTIFACT can be used for denoising source separation (DSS) % during component analysis % % See also COMPONENTANALYSIS % Copyright (C) 2005, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the docume...
ac42faaba10523439d1d3b96ac770d8d7626ad898afb3cb747cbe3021af61742
MATLAB
3,093
101
function model = linregRobustStudentFitConstr(X, y, dof, sigma2, includeOffset) % Constrained gradient-based optimization of linear regression with Student T noise model % We assume X is an N*D matrix; we will optionall add a column of 1s internally. % Set dof=[] or 0 (or omit it) if it is unknown. % Set sigma2=[] or 0...
41aa939cc928e95d2935191782a3bf3ad2b124ef65560bfaf8be9ccba9bb8f69
MATLAB
3,094
121
function [Delta490] = DeltaF(t,Ch490,Ch405,varargin) % Smooth and process 490 channel and control channel data for fiber % photometry. %Inputs: % 1--Ch490-GCamp Channel % 2--Ch405-isosbestic control channel % 3--Start time- Set a specific sample to start at % 4--End time-specify a specific ending sample %mdi...
8383abf64f2f50b9bb8c4b049168170d06062df8a6d5d018291016d7c314d816
MATLAB
3,094
83
function stims = InsertTriggerCodes(trigChannel, sampleTime, trigDeltaThresh, ET, triggerScaling) % stims = InsertTriggerCodes(trigChannel, sampleTime, trigDeltaThresh) % finds trigger values based on threshold for diff() % gets the delay between on&off as the trigger value, rounds to nearest % integer % Inputs: trig...
c29f4d243e15f6522065555a21df5b1af86a132a4cd73d710d4cba07375294e3
MATLAB
3,094
109
function unitTest() windowMin = -10; windowMax = 30; window = [windowMin windowMax]; binWidth = 10; signal1 = [-10 0 20; -25 -10 20; -45 30 45]; signal2 = [-11 0 20; -22 -10 23; -45 30 43]; expectedSpikes1 = [1 0 1 0; 0 0 1 0; 0 0 0 0]; expectedSpikes2 = [1 0 1 0; 0 0 0 1; 0 0 0 0]; expectedPSTH1 = [...
ccafdd82d6417e21b1c567063471ba9bf2f847e318c8e8e44f1298f0d3074576
MATLAB
3,094
116
function catFAtest() % Categorical factor analysis - check the code is syntactically correct % We create some synthetic data with NaNs, fit the model, % infer the latents, and impute the missing entries clear all setSeed(16) % generate data [trainData,testData,simParams] = makeSimDataMixedDataFA(100); nClass = simPara...
33a026c1764d851d1f2fe9d20399cf250b006344086e8dbf5d6b5674f491fbee
MATLAB
3,095
78
function [R_pos,R_neg,R_combined,pred_pos,pred_neg,pred_combined,pos_mask,neg_mask]... =General_cpm(train_group,test_group,train_mats,train_behav,train_covars,... test_mats,test_behav,test_covars,adjust_stage,thresh_type,thresh,id_pd) %% CPM analysis no_node = size(train_mats,1); test_no_covars = si...
b77c66b3a3b240984c205070401d2b877eb0d547e1261a1e31a66369ef3f9a9b
MATLAB
3,095
86
%% The following script is used for constructing a model to reconstruct muscle activity from MCx and afferent activities in a training data currentFolder = pwd; addpath(currentFolder) cd([currentFolder, '\data']); datafile = 'DRG_M1_PM_EMG'; load(datafile); [Model, Info, parm, W] = testjob(xdata, ydata, xtes...
da12d28a9b94015d08501a1fcf4d2827bdd5a26f24c36d53bd72e84a03795f68
MATLAB
3,096
99
function [testVals,trainVals,order,RAW,AUC]=ComputeRankOrderList(Data,Condition,NumTests,varargin) % Test to see if one condition (column) is reliably the larger then all % other columns across random 50/5-0 NumTests in the data % Data : Number of samples X number of conditions. % labels Optional condition name...
aabcb92363e114c9b3d5c00752298b5cd0aa4fa282c5870aaa73cbf866c87ef1
MATLAB
3,097
139
%clear %close all %% Load current data %load('WinRest') %load('Tr1b') %load('Cells') %load('MovT') %load('Speed') Tr1b=Tr1; % to check %% Detect small calcium transients [NCell,Nz] = size(Tr1b); % Savitzky-Golay filter Tr1b = sgolayfilt(Tr1b',3,5)'; figure for i = 1:NCell plot(MovT,Tr1b(i,:)+i-1) hold on e...
223fee26af779e04b29c5b6a0d6174d84b686313016f51e4c1a7ee8976c83872
MATLAB
3,098
130
% Demo of the TrueSkill model %PMTKauthor Carl Rasmussen and Joaquin Quinonero-Candela, %PMTKurl http://mlg.eng.cam.ac.uk/teaching/4f13/1112 %PMTKmodified Kevin Murphy function trueskillDemo() setSeed(0); % Let us assume the following partial order on players % where higher up is better % 1 % / \ % 2 3...
551b2b5d5ba62b49de5f5639c5b4780dffed77ec4e072087f9d944fef75246bd
MATLAB
3,098
72
function Obj=SOFAconvertTUBerlinBRIR2SOFA(irs) % OBJ=SOFAconvertTUBerlin2SOFA(irs) converts the HRTFs described in irs % (see TU-Berlin HRTF format) to a SOFA object, using the MultiSpeakerBRIR % Convention. % % SOFA API - demo script % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Science...
96a68fbd7e4013cc92e8bf17232f89893cecf21d0ffbf9a7b3d8defdfee0e074
MATLAB
3,098
79
function [Vertices_sm, A] = tess_smooth_bs(Vertices, a, nIterations, VertConn, isKeepSize) % TESS_SMOOTH: Smooths a surface. % % USAGE: [Vertices_sm, A] = tess_smooth(Vertices, a, nIterations, VertConn, isKeepSize) % [Vertices_sm, A] = tess_smooth(Vertices, a, nIterations, VertConn) % % INPUT: % - Vertic...
769aad563314f3594a1fa68886da569932d2f24e654bd49747c2c4fc1b11e14e
MATLAB
3,099
89
function jump_distance = calculate_jump_distance(folders,option) if strcmp(option,'global_remapped') data_folders = 'global_remapped'; elseif strcmp(option,'place_field_shifted') data_folders = 'place_field'; elseif strcmp(option,'spike_train_shifted') data_folders = 'spike_train'; elseif strcmp(option,'cro...
b1a046def4b39d721510de501f1b0a18d91e351f84671093648f856069d5dbbd
MATLAB
3,099
92
function gaussEvec lambda1 = 9; lambda2 = 1; tx1 = 5; tx2 = 4; theta = 30 * pi / 180; rot = [cos(theta), -sin(theta); sin(theta), cos(theta)]; [x1, x2] = generate_ellipse(lambda1, lambda2); v = rot * [x1; x2] + repmat([tx1;tx2], 1, size(x1,2)); % compu...
84b90df33a38bd17eedd482bb2aa18684f8daeca03ae1c18dc3bd46818165f14
MATLAB
3,100
105
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% wrapper_full_calibration.m -- A wrapper for the calibration runtime. %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function []=wrapper_3shell(pat_ix, model, inverse_model) pat_cell = {'110411','117122'...
a6dc869ae8ecb73b52a924872e18a276c68b8a13377b37598f8d744d55a21daf
MATLAB
3,100
92
function [sigma,shrinkage]=covCor(x,shrink) % x (t*n): t iid observations on n random variables % sigma (n*n): invertible covariance matrix estimator % % Shrinks towards constant correlation matrix % if shrink is specified, then this constant is used for shrinkage % The notation follows Ledoit and Wolf (2003, 2004) %...
b34c527741fe4248faa9bf86db9e369d72bf767dc25123a4831ccf430cd0a51b
MATLAB
3,104
88
function [W, output] = boundOptL2overrelaxed(X, Y, lambda) % Fit the weights for L2 penalized multinomial logistic regression via % overrelaxed bound optimization in O((cd)^3) where c is the number of % classes and d is the number of dimensions. % % Inputs: % % X nexamples-by-ndimensions % Y ne...
44a08468757de0642e78b19e2cc7f8d39f8e3dbc412cf24b0b2d93f8e7748c81
MATLAB
3,105
96
% This script can be used to try out the experiment behaviorally (defaults to word version) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% enter subject ID & task variant %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% prompt = {'Enter subject ID:','Enter paradigm (dynamic/words/visual):'}; dlg_title = 'StateSwitch Input'; num_l...
23de2e2ed06fda1f4f90265be23ef925ccb30b457edb602e606da6c01fb01b44
MATLAB
3,106
82
clear all %% %Define default Parameters [opt] = ParameterOptions(); %% %Estimate diffusion attenuation as function of flip angle (1-180o) FlipArray=[1:179/99:180]; for k=1:length(FlipArray) S0_Flip(k)=FreedDWSSFP(opt.G,opt.tau,opt.TR,FlipArray(k),0,opt.T1,opt.T2); S_Flip(k)=FreedDWSSFP(opt.G,opt.tau,opt.TR,Flip...
dbb6bd9de93b28181736d67e79f4dfdd56b36c9fdcf612f5091f02b94be5e2e7
MATLAB
3,109
86
function [smoothed_array] = affine_diffusion_3d(original_array,t_tot,dt,aff_flag,verbose) % affine_diffusion_3d smooth an image using the affine-invariant % mean_curvature flow. Runtime is a bit restrictive. % % t_tot = total evolution time, in "seconds" % dt = numerical evolution parameter % aff_flag =...
f031eb65ebfc7039a35f4bcd4d7f2d816bdd69fe0922aecf451798e9e15f534a
MATLAB
3,110
52
ind = 1; data = dir('/DATAPOOL/ERRORMONITORING/SEM_mri_data/P*'); %% for i = 1:size(data,1) data_anat = [data(i).folder, '/', data(i).name, '/mri/SEM_', data(i).name, '/nifti/anat']; fprintf(data(i).name); anat_image = dir(fullfile(data_anat, "*.nii")); anat_image = [anat_image.folder, '/', anat...
f52726ac4103b60f70b4a509561bf50894746c55da06a208adfe3292f54021ec
MATLAB
3,110
86
function [Gm,k] = calc_significant_path(sites_jk,stddev_level,avg_type,invert_y) % returns only the gradient vectors that have stddev < stddev_level % for each site of the lattice % % each row in the resulting Gm mean gradient vectors corresponds to the position % [y,x] = ind2sub(simParam.L,(1:numel(prod(simParam.L)))'...
2c81e6ab2dc61dadbddfcddeb6fa2cc7d1e22cc18b1797eacf96a0b928465329
MATLAB
3,111
100
function imLabel( labels, position, S, pvPairs ) % Improved method for labeling figure axes. % % USAGE % imLabel( labels, position, [S], [pvPairs] ) % % INPUTS % labels - cell array of strings, labels for display % position - 'left', 'right', 'bottom', or 'top' % S - [] rotation for to...
b13ba6c28643be745491c30ed5de752a5bf54a8c77bf42272f766b0605a869e4
MATLAB
3,116
71
function best_seed = CBIG_AuthorTopicEM_ComputeBestSolution(root_dir, K, ... seeds, alpha, eta) % best_seed = CBIG_AuthorTopicEM_ComputeBestSolution(root_dir, K, ... % seeds, alpha, eta) % % Return the index of the initialization (seed) of the Expectation- % Maximizaiton (EM) inference algorithm run that returned...
4f51015f4ef5be868806be7adea4cbae4c8c6d896c1cb92d55308679907518d6
MATLAB
3,117
92
function [dat] = ft_preproc_padding(dat, padtype, prepadlength, postpadlength) % FT_PREPROC_PADDING performs padding on the data, i.e. adds or removes samples % to or from the data matrix. % % Use as % [dat] = ft_preproc_padding(dat, padtype, padlength) % or as % [dat] = ft_preproc_padding(dat, padtype, prepadleng...
778410bd78b00245a1996e29a6f5923ed647a9ae0e16060f3c19e5147a8a77d2
MATLAB
3,120
82
function [X0,H0,X1,H1] = demoGenData1(n0,n1,k,d,sep,ecc,frc) % Generate data drawn form a mixture of Gaussians. % % For definitions of separation and eccentricity see: % Sanjoy Dasgupta, "Learning Mixtures of Gaussians", FOCS, 1999. % http://cseweb.ucsd.edu/~dasgupta/papers/mog.pdf % % USAGE % [X0,H0,X1,H1] = demoGe...
0ee5251b5c41c946d7781528dbbafe6a8f1ab94772444f038ceca577145b5a04
MATLAB
3,122
104
function c = ttv(a,v,dims) %TTV Sparse tensor times vector. % % Y = TTV(X,V,N) computes the product of a sparse tensor X with a % (column) vector V. The integer N specifies the dimension in X % along which V is multiplied. If size(V) = [I,1], then X must have % size(X,N) = I. Note that ndims(Y) = ndims(X) - ...
e9220cd4a736e7fef58f9af6de9f06523ff507903051eac11da21c69725a58c5
MATLAB
3,122
93
function scatterHistDiff(x, y, xeb, yeb, colors) % takes paired data x and y, optional arguments for errorbars around % individual datapoints (see ploterr) and plots a scatterplot as well as a % rotated histogram of the differences between the two. % requires http://nl.mathworks.com/matlabcentral/fileexchange/22216-pl...
eb513cd7ec5fc95d6ddc6fadc10eceae13b0b2c686d670f011c230f97744981a
MATLAB
3,122
112
% note: change current folder to figure "number" clear all;close all;clc; rawPath=pwd; %displays the current working directory - set it to the figure "number" savePath=rawPath; addpath Panels/ addpath Functions/ load("Strycnhine_Population_All") load("colors") %% Figure 6 dataPath = [rawPath,'/Panels']; %raw data fi...
4d64f1f227eda011fa34422eed51a4eddca694d3cb86f7c6f445d78b76b6192b
MATLAB
3,123
106
function status = makessense(data, field) % MAKESSENSE determines whether an existing field in the data structure makes sense % % Use as % status = makessense(data, field) % % See also GETDIMSIZ, GETDATFIELD % Copyright (C) 2018, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox....
d1212bd22215d5e5f06cf578dff54a21f0ca36c4824d2436ff1fbee817006ccf
MATLAB
3,123
117
% 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,...
6254783f9277a27a5f141395761a7898bed186e10005937c4b7eb54bc9082f0b
MATLAB
3,124
80
% calc_wiTrialCorr % Used in Figure 4e clear r_conv50b for sess = 1 : 8 isSess = find(sigSL.session == sess); % All trials in this session sig_coh_sess = sigSL.sig_coh(isSess); % signed coherences of all trials in this session cohs = unique(sig_coh_sess); for d = 1 : length(useD) dim =...
426033369bc452c91356066857012b8b8f0b602aee4ba0bda89446c498565afa
MATLAB
3,125
73
function ax = plot_time_to_food(si_exp,si_th,si_th_param,normalize_run_trials,cMap) if (nargin < 4) || isempty(normalize_run_trials) normalize_run_trials = true; end if (nargin < 5) || isempty(cMap) cMap = @winter; end assert(isfield(si_th(1),si_th_param),'si_th_param must be a nume...
419d8b00505110c40d9693dd5a4d097100235160d8b7bfbb13ca249ce2fd5d33
MATLAB
3,126
106
loadParameters; params.basecallingResultsDir = '/Users/Goody/Neuro/ExSeq/exseq20170524/6_base-calling'; %% Load Ground truth information %load(fullfile(params.basecallingResultsDir,'groundtruth_codes.mat')); %Turn the Nx3 array into a set of strings %gtlabels = {}; %for i = 1:size(groundtruth_codes,1) % transcript_...
1b25df9fb0aa6665e02805990b39e54f40eb751ee9f551cb37cce9dc7413d859
MATLAB
3,127
116
% Author: Birgit Nierula % nierula@cbs.mpg.de function other_prepro_loop1(subject, condition, srmr_nr, sampling_rate) %% eng preprocessing %% set variables subject_id = sprintf('sub-%03i', subject); analysis_path = [getenv('OTHERDIR') subject_id '/other/prepro/']; if ~exist(analysis_path,'dir'); mkdir(analysis_path...
afaf234af86e6131429822771461f62d61c3d2356f1a72a20cef40ccdb972ec3
MATLAB
3,127
95
function SpikeSort(datDir, varargin) verbose = true; saveDir = datDir; preprocessRange = [0 600]; timeRange = [0 Inf]; lfp = true; lowpass = -1; for i = 1:2:length(varargin) switch lower(varargin{i}) case 'verbose' verbose = varargin{i+1}; case 'savedir' saveDir = varargin...
623d7acec5f7aabe5a32f093b119aac14da96891f76e08cbcfeef96f75e65418
MATLAB
3,128
79
function vers = eegplugin_detect_spindles(fig, trystrs, catchstrs) % eegplugin_detect_spindles() - EEGLAB plugin for sleep spindle detection % % Usage: % >> eegplugin_detect_spindles(fig, trystrs, catchstrs) % % Inputs: % fig - [integer] EEGLAB figure. % trystrs - [struct] "try" strings for menu callba...