sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c0d269cbe337baf1d56e21a7bf3e7189f072dd58223ef80a64dfaab1a8f3815f
MATLAB
1,307
50
function [ hFig, hAxes ] = CreateRenderingFigure(varargin) %CREATERENDERINGFIGURE Create the figure used to render meshes %WindowSize - Size of window, tuple %Renderer - Renderer to use, string %ReverseZ - bool, if true reverse the Z-axis WindowSize = [0 0 1024 768]; renderer = 'opengl'; ZD...
15c84b38d3f49be222c264521da0c80396373fe147f3e314baee57120a203ff9
MATLAB
1,308
40
function folds = createFolds(cfg0, G) % [folds] = createFolds(cfg, G) % Divides trials into folds for cross-validation. The function attempts % to divide the trials as evenly as possible over the number of folds, % while trying to balance the different conditions as much as possible. % % cfg Confi...
3395c99aa4688474b0adadc74a49231f9747a7b9ac79371df47f78a322dcfa95
MATLAB
1,308
48
function [h] = setAxisHandle(h, colorToBlack, xtickMinor, ytickMinor, position) % SETAXISHANDLE Setting for figure axis % Author: florian drawitsch<florian.drawitsch@brain.mpg.de> % modified: Ali Karimi <ali.karimi@brain.mpg.de> if ~exist('colorToBlack','var') || isempty(colorToBlack) colorToBlack = 1; end if ~exi...
492f20d02031a1e34524c2156fe914f72ac42fcd941f3a032c0c85cf822d00d9
MATLAB
1,309
47
function SCM_rotationNumber(i_z,simPar) %%% Computes and saves the rotation number of the sine circle map across %%% natural frequencies and stimulation amplitudes for a given dithering level. %%% The name of the output file is based on the dithering level index. %%% 26-01-23 first commit aVect = l...
69aa319be94f6af105eaf298bbc8fd6c2632e20f9d7731931311cba0d58236f2
MATLAB
1,311
50
function checkSensors(bits, vars) % % This function checks the value of the bit inputs to the RM1, and also the % parameter tags known as licks. Licks indicate when a sensor has been held % for the minHoldTime. % global DA gf h for j = 1 : length(bits) bit = bits(j); variable = vars{j}; ...
d26dd26ac0403b6116376db5e10ec82c3101dc56f74460c33e8800667af14517
MATLAB
1,311
68
function med = circ_median(alpha,dim) % % med = circ_median(alpha) % Computes the median direction for circular data. % % Input: % alpha sample of angles in radians % [dim compute along this dimension, default is 1, must % be either 1 or 2 for circ_median] % % Output: % mu mean...
56363abc671bb54db0f6f78dacf67e60a3c25914adfe3afab56c2a972d332302
MATLAB
1,317
96
% Verts = [0 0 0; % .5 0 0; % 5 0 0; % 0 .5 0; % 0 5 0; % 0 0 2.5; % 0 0 4; % 2 0 4; % 0 2 4; % 0 -2 4; % 6 6 6] % % % % Links = [1 2; % 2 3; % 1 4; % 4 5; % 6 7; % 7 8; % ...
30d9d8019c98e8a758764ef68e2ad0754ca361c46e17d8871d5484cf7da5f717
MATLAB
1,318
53
function [results] = scaleDWB2(results, params, addPriorForWB, precomputedPortion) % i.i.d non-mean Gaussian over spike history coefficients & constant K = size(params.B,1); w_sig_idx = 1; b_sig_idx = 2; H = double(params.H); %w_mu = H(w_mu_idx); log_w_sig = H(w_sig_idx); %b_mu = H(b_mu_idx); log_b_sig = H(b_sig...
ae3bb076bca21c6ae807b197d90f78a3085e8fd4c629d9faabf5955e77a4d570
MATLAB
1,318
38
function [results] = GMLMprior_spkHist(params, results, spkHistPrior_setup) % i.i.d zero mean Gaussian over spike history coefficients, improper uniform over baseline rate terms H = double(params.H); %% log hyperprior if(isfield(results, 'dH') && ~isempty(results.dH)) [lp_H, results.dH(:)] = DMC.priors.halfTPrior(...
b7907f8103da35a91f3a996e7752195ffc4fe732d249727d4c78ba904c78538f
MATLAB
1,318
50
function [expectation,unscaled_expectation,p] = theoretical_spiking_expectation_3D(raster, x_window, y_window, time_window) motif_order = [ 1 2 3 2 3 2 3 3 3 3 3 3 ...
ea2e64737914cb8700dc771d2dfb138c3f0ec45ea26d323feebf371b276bb9e9
MATLAB
1,319
35
function plotPerformance_SpatialMask_SNR_bar [dataDir, options, c, d] = import_settings() % For each ferret files = dir( fullfile(dataDir,'*.mat')); for i = 1 : numel(files) [COctrl, COcool, SPctrl, SPcool, SOctrl, SOcool] = import_data(dataDir, files(i).name); sp = create_figure...
8961c4d9571415f308d126b7f6ba9e6a8759a8b5d87a97867066809226895b45
MATLAB
1,320
48
function analysis_loop(CBF) % List all mat files in the folder stk_files = dir([CBF.sourceP,'*.mat']); %% Set up file logging diary(fullfile(CBF.folderP, sprintf('log_%s.txt',datetime("now", 'Format','dMMMy_HH-mm-ss')))) % Initialize fprintf('%s\n',datetime("now")); fprintf('%s\n',version); %% Run through all rec...
8fad718f0557e2b23b5289c8d54ec3a8693fa32587fa7088059b85e13d2bcc3e
MATLAB
1,320
60
function TrialFcn_AMAversive_PumpControl % TrialFcn_PumpControl(TRIALS) % % This function sets and controls the pump variables for the Aversive AM % Detection task. % % % Daniel.Stolzberg@gmail.com 2014. Edited by MLC 10/30/2014. fprintf('CONNECTING TO PUMP...') pump = serial('com1','BaudRate',19200,'DataBits',8,'St...
0be1de3caecc37d0bf948244600b9fb0a9bc0b0a8900f8a179f869116ea30374
MATLAB
1,322
37
function [unmixed] = main_GELMM(unmixed_FCLSU, M0, img) % Function to unmix lambda stack based on Generalized Full Extended Linear Mixing Model (GELMM) algorithm % ------------------------------------------------------------------------- % Inputs: unmixed_FCLSU - 6D stack of unmixed output from FCLSU % M0 - ext...
0242cf9720588fd24b55a71a037aec1b1305a7880dad456e2d78637396f385b0
MATLAB
1,323
37
function plot_total_recruitment(model, args) arguments model (1,1) Model args.minDiam double = -Inf args.maxDiam double = Inf args.quantile double = [] % Truncate threshold to this recruitment quantile end filterByDiam = isfinite(args.minDiam) || isfinite(args.maxDiam); fiberActiveAll = load_ac...
d6d79935f5bb12e78a445af8278e271c362419e44f625c8b062766bc9b9c946e
MATLAB
1,323
68
%Offline dprime calculation %Initialize hitrates = []; %Pull out stimuli and response codes Depths = [Data.AMdepth]'; Resps = [Data.ResponseCode]'; %Remove reminder trials startInd =find(Depths ~= 1, 1,'first'); Depths = Depths(startInd:end); Resps = Resps(startInd:end); Stimuli = unique(Depths); %Convert respon...
f50276e95d456abca819e335ee0e23fb34601b294c4b717aa29e0e5f24e52eeb
MATLAB
1,323
52
classdef StructureManager %STRUCTUREMANAGER Summary of this class goes here % Detailed explanation goes here properties IDToObjTable end methods function obj = StructureManager(size) obj.IDToObjTable = containers.Map('KeyType', 'int64', 'ValueType', ...
fab5e4eccc8e89272b6ea58abd35dded5c1c9a7518c063297d90e5382eeb9235
MATLAB
1,323
56
function Me = Meq4e(Xe,Tz) %*************************************************** % AeQ4E: % Creates the element mass matrix of elastic % quadrilateral 4-node element such that % Syntax: % Me = Meq4e(Xe,Ge) % Input: % Xe : coordinates Xe = [x1 y1; x2 y2; x3 y3; x4 y4] % Tz : =0, z tractions assumed zero, Tz...
40c94bfac2f2facde332b914e7e22ba8083d622949e7fb4b9013778b97b2868d
MATLAB
1,324
50
%%This function is used to check whether the fileds of MVPC are the same %%across MVPCsets % *** This function is part of ERPLAB Toolbox *** % Author: Guanghui Zhang % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2025 Sep function MVPC = f_checkmvpc_str(MVPC) if nargin <1 ...
35da792573a364e6de6e094a55dd35ef82bdf7ba1e9244a06f3cb63a8d5e9c89
MATLAB
1,326
31
function create_color_wheel() % Following a solution suggested in: % https://www.mathworks.com/matlabcentral/answers/213463-colormap-on-the-outside-of-a-circle#comment_281019 N = 256; % Number Of Colours In Colour Wheel th = linspace(0, 2*pi, N); % Angles ...
eee662bb8f99e44984790ca81fc3da817b65d49f276d8f282b87170fb8076d47
MATLAB
1,327
36
function [ScoreTrain,CoeffTrain,ScoreEval,CoeffEval,explainedTrain,explainedTest] =PCAeval(X,X_) % centre the data around zero using shared mean mu = mean(X); % mu = mean([X;X_]); X = X-mu; X_ = X_-mu; A = (X'*X) / length(X); % compute the covariance matrix (normalised by the num of elements) [V,latent] = e...
81aad029c0ad3b687762527fa8fda144786ffa7b6ec6487cc4289dafa9dab028
MATLAB
1,329
47
function handles = Remind_Callback_SanesLab(handles) %handles = Remind_Callback_SanesLab(handles) % %Custom function for SanesLab epsych % %This function forces a reminder trial when the REMIND button is pressed %Input: % handles: GUI handles structure % %Written by ML Caras 7.27.2016 global GUI_HANDLES AX FUNCS RU...
9f64b1604924fcdeb046d9b41505aaed5c83e13aa66db6084359d231fc38ecfc
MATLAB
1,329
35
function plotPerformance_SpatialMask_SNR [dataDir, options, c, d] = import_settings() % For each ferret files = dir( fullfile(dataDir,'*.mat')); for i = 1 : numel(files) [COctrl, COcool, SPctrl, SPcool, SOctrl, SOcool] = import_data(dataDir, files(i).name); sp = create_figure( fi...
c26f7e58538827c680ae15cee19b9c38bca134e3b41f70fa6b088cb78f2e9b5d
MATLAB
1,329
39
function dOut = mahalFuncTrialWise_joon(dat1,dat2) % calculate relative Mahalanobis of each trial between two condition % specific centroids % dat [trials, features, samples] % e.g. dat = rand(150,20,500); % random data, 150 trials, 20 channels, 500 time points % lab is a vector of binary condition values [1 or...
c1e701e0bbc9ae5e351e294791ca0126f05f49d12e5a95de2cf3888e2d371693
MATLAB
1,334
51
function [resultant_vr] = Dani_Function_VectorStrength (dirAng, dirAnaly, cond,cc) %% close all % Load all data trials from all flies in dataset cd(dirAng) files = dir(['*', cond '.mat']); NumFiles = length(files); % Parse data by fly num, trial num for p = 1 : NumFiles temp = strread(char(files(p).nam...
50842dbd1358c560e27c35baa57829a8ee7af39d888caa5644b4dd8fbdfa1e17
MATLAB
1,335
27
% TPPREVIEWIMAGEFUNCTIONLISTGLOBALS - Declare global variables for TPPreviewImage functions % % Declares the global variable % % TPPreviewImageFunctionList -- a structure list of installed TPPreviewImage functions % TPPreviewImageFunctionChannelList - a list of installed acquisition channels, such % ...
e0eaad5911986533600c29218ff54d6f2dae29cc3bcdc58fbbf838fa9118b17c
MATLAB
1,335
22
% FILTER TRIALS BASED ON DISTRIBUTION CUTOFFS % function [filtered_combined_data, filtered_combined_data_cutoff_logical] = bst_ast_distribution_filter(max_amp_range_all_trials, trialAmpHighCutoff, ... max_grad_range_all_trials, trialGradHighCutoff, all_amp_data_bad_chnls_removed) % Take out any trials with...
17cf718f0e1372a96c21f0710d5f66105b3d0abef202a89f448a2a4bf72529d8
MATLAB
1,338
37
function [LP,D]=LinearPattern(X) % function Y=LinearPattern(X,type) output column and row means from all 4 subsignals, subsampling by 2. % X 2-D matrix % LP.r11, LP.r12, LP.r21, LP.r22 are row means (column vector) % LP.c11, LP.c12, LP.c21, LP.c22 are column means (row vector) % D The difference between...
522441a35cb3b27363ee6bc9cef33d3847ffbfe8332bc0911d5b26c28176bcf4
MATLAB
1,340
56
function [MD,FA,eigVals,DT] = estDT(sigVals, bVals, bVecs) % % Estimate diffusion tensory % % sigVals: [N_bval * Nx * Ny * Nz] matrix % bVals: [N_bval * 1] vector [s/mm^2] % bVecs: [N_bval * 3] matrix [s/mm^2] % % (c) 2022, Corey Baron % Check inputs szin = [size(sigVals), 1]; if ~isreal(sigVa...
82d217bf72da86871b0263d7b241aa1fc5539f0185d156e7f32b0b0e5aee54ff
MATLAB
1,340
59
%quick and dirty tool for plotting out HMC sample progress % I didn't document this well, but it's not super imporant % This prints out stuff I want for the DMC task GMLM, but not every GMLM function [] = plotSamples(obj, samples, sample) clf; TotalSamples = size(samples.H, 2); if(nargin < 3 || isempty(sample)) sa...
dd460918b260ccee419a5c0e1bd7d3ef79fdf06682e17dbf266b22ae63a5651b
MATLAB
1,342
31
function PTParameters=initialize_psychToolbox() Screen('Preference','SkipSyncTests',1); KbName('UnifyKeyNames'); AssertOpenGL; KbCheck; WaitSecs(0.1);%wait 0.1 secs GetSecs; sound(1); %initialize sound so that doesn't take too long first time we use it presentation_screen = max(S...
8f525cfb967f049da9a9796e883afee099bf95d9cc36ae3e2090516e8ca6b471
MATLAB
1,343
43
% demo use script suite2p_exper_dir = ['/Volumes/van-hooser-lab/Users/Diane/For_Steve/SCN1-722']; target_directory = ['/Users/vanhoosr/Desktop/2722-05-05']; directory_mapping{1}{1} = 't00001-001'; directory_mapping{1}{2} = {'t00001-001'}; directory_mapping{2}{1} = 't00002-001'; directory_mapping{2}{2} = {'t00002-0...
76f2ea797c6dfc412092b47e1b4643c0bc2501f0787b21e4dbba5557a85bd6ce
MATLAB
1,345
35
function str_out = get_str_param(struct_param) % Based on input parameters (as given by function get_all_params_to_test), % return a string describing the model parameters. % % struct_param = struct('AboutFirst','WithoutFirst', 'learned_param', 'transition',... % 'decay',[Inf],'decayF', [Inf], 'window', [Inf],...
5d53cd7634422ac4f02038e255d3cd69639ad25401e5f61c507bba7ff1fcd26d
MATLAB
1,347
55
% mvpch - history function for MVPCsets. %Author: Guanghui ZHANG %Center for Mind and Brain %University of California, Davis %Davis, CA, USA %2024 function str = mvpch( command); str = ''; if nargin<1 help mvpch return end if isempty( command ) return; end try ALLMVPCCOM = evalin('base','ALLMVPCCOM');c...
0f7d4daa06d93f6597101b7fd45816153125f5d685b62bf9e76ec9fdf7999877
MATLAB
1,349
64
function M = lta_read(fname) % M = lta_read(fname) % % lta_read.m % % Original Author: Bruce Fischl % CVS Revision Info: % $Author: greve $ % $Date: 2014/07/10 04:11:44 $ % $Revision: 1.5 $ % % Copyright © 2011 The General Hospital Corporation (Boston, MA) "MGH" % % Terms and conditions for use, reproduction...
e2e0b923c422b4225b07c8719ff92000614a6643d9eb7c23b73ed111c661f782
MATLAB
1,350
29
function fiberCenter = shift_inside(fiberCenter, area, buffer) % Tested to work with multiple regions and holes % Shift fiberCenter towards the closest edge of 'area' % buffer can be the fiber radius for example or radius plus min distance [d, x_poly, y_poly] = p_poly_dist(fiberCenter(1), fiberCenter(2), area.Verti...
c6d46031d0a61f72a8422261c21dad02230cedd1705d1fc67999570d864052e1
MATLAB
1,352
40
function wsws_ICA_plot(snum, file) % function to plot IC topographies and timeseries % snum = subject number (scalar) % file = 'train' or 'test' data run(['..', filesep, 'def_local']) addpath(path_fieldtrip) ft_defaults % load hdr & comp struct if strcmp(file, 'train') fprintf('... loading training components fro...
564fe870d8449f98c7538c6d9e1c77f8b6cd7462bc57002936f27e040ff7f9aa
MATLAB
1,353
43
function feedback(correct, side) global DA gf gf.TrialNumber = gf.TrialNumber + 1; if correct == 1, if side == 0, valve(4,200,1,5,'left') %(bit, pulse_time, pulse_N, index and name for recording time) elseif side == 1, valve(5,200,1,7,'right') %(bit, pulse_time, puls...
a7985e8141d901a729c7d47e696da14e2cd02b0e94054d12d5e87060d906914b
MATLAB
1,355
37
%% Setup % This script combines sessions from different tastes to make a combined % connectivity matrix between the hemispheres util.clearAll; % stimuli outdir = fullfile(util.get_paths().figs,'compare_tastes_corr'); util.mkdir(outdir) %% load the data and combine betas % Get the beta tables from matfiles taste_str = ...
6eadeb51f2dbd59deeaa40be26dc14b8b545f715cc5b703c71bdaa253ed266fe
MATLAB
1,358
39
function main_figure(unmixed, M0, lambda, channel, filename) % Function to generate and save figures % ------------------------------------------------------------------------- % Inputs: unmixed - 6D stack of unmixed image % M0 - extracted fingerprints % lambda - array of lambda (wavelength) values of m...
6c3b6307516f9773a785c866eddc0c94a702a8530a47af6b2e97a8c83eba7379
MATLAB
1,360
48
clear datafile = 'IMDBMULTI'; load(sprintf('%s/%s.mat', datafile, datafile)); label = label - min(label); fid = fopen(sprintf('%s/%s.txt', datafile, datafile), 'w'); fprintf(fid, '%d\n', length(label)); for i = 1 : length(label) g = graph_struct(i); num_nodes = length(g.al); fprintf(fid, '%d %d\n', num_n...
3642aa91035f932040f815071bdcdeb528a31d0ec6fac55237fbd15217dd8ef7
MATLAB
1,361
54
function [detvtx,pth] = SStat_mass_FDR2(pval,maskvtx,rate) % [detvtx,pth] = SStat_mass_FDR2(pval,maskvtx,rate) % % Two-stage FDR approach to achieve tighter control of the FDR. This % procedure is more powerful than the original FDR procedure implemented in % SStat_mass_FDR. % % Input % pval: P-values. % maskvtx: Mask'...
54eca5e5b27fc591cb2851096c9374dec30c369663883a143883e159c19abe93
MATLAB
1,363
63
function varargout = PumpControl_SanesLab % pump = PumpControl_SanesLab % % Custom function for SanesLab epsych % % This function sets and controls a New Era-1000 Syringe Pump. % % Outputs: % varargout{1}: serial port object associated with pump % % % Daniel.Stolzberg@gmail.com 2014. Edited by MLC 4/5/17. %Close a...
7dbd3eb6d8621c2fc5a1cea09d3295d7ae921ff4beb05f28673d9b92abefe23b
MATLAB
1,363
57
function spikes = pp_sort_channel(data, thresh, reject) % % spks = pp_sort_channel(data, thresh, reject) % Runs the UMS algorithm for data of a given channel/group of channels. % Important: include the optional inputs to ss_default_params, in order % to use the thresholds calculated from clean data segments. ...
a00cf9384928c904e33440a5dd9604275eb490f922404bc8b641dcd2fbe08fd1
MATLAB
1,364
46
function padded = padmatrix(input, wherepad, padval) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/09/2010 % % padmatrix -- pad a matrix % % Usage: % padded = padmatrix(input, wherepad, padval) % % Description: % PADDED = PADMATRIX(INPUT, WHEREPAD) adds zero rows/columns to the % matrix INPUT. W...
5959381ad2ee39f0df05fdc8e991879e3f8318a77bc350cf2c83d7d4ee47f3b6
MATLAB
1,365
51
%% GIFT ICA to Slicer colormap Pma = 'H:\DataProcessing\GIFT_\ALL_mean_component_ica_s_all_.nii'; Patlas = 'D:\ownCloud\PROJECTS\MRI\FINALIZED\SlicerFinal8\CorticalAtlas-Split.nii'; Tareas = 'D:\ownCloud\PROJECTS\MRI\FINALIZED\conn_catlas.txt'; Tcolors = 'D:\ownCloud\PROJECTS\MRI\FINALIZED\CATLAS_COLORS-SPLIT.txt'; th...
e4887d3a0e30c21d1dba2f68dc9e5d73f94b98dfb03df836b73cc15340c24c69
MATLAB
1,365
48
function E = DB_GetElectrode(tank_id) % E = DB_GetElectrode(tank_id) % % Returns electrode info for a tank with database index 'tank_id' % % All depths are in microns % % Daniel.Stolzberg@gmai.com 2014 try E = mym([... 'SELECT e.target,e.depth,e.tank_id, ', ... 't.manufacturer,t.pi...
8f58d19d77a3e88231c8f388641e5611e13b62db80803cb83e2428f79b8073d1
MATLAB
1,366
36
function colors = emphasize_cluster_colors(spikes) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % emphasize_cluster_colors - make color matrix for each minicluster ID % where the colors for clusters are separated % % Usage: % colors = emphasize_cluster_colors...
afa422296e07d237ec9d47c8e1633b1509076ef86868f61811b522b44e3b152f
MATLAB
1,367
38
function totalThresh = compute_total_thresh(model, threshMode, threshValue) %COMPUTE_FASC_THRESH Calculate recruitment threshold of fascicles % Default (w/ only one argument passed) is 10% recruitment % fascThresh iAS x iFasc % Inf means missing value (i.e. out of active site range) % NaN means out of inje...
07b2482d2ee8e8ca7657059b1122edec22b617d9fdd258e5e76f7f918476a8c5
MATLAB
1,369
23
%----------------------------------------------------------------------- % Job saved on 08-May-2022 10:00:51 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- clear matlabbatch subjfolder = dir('F:\fMRI_QC\fm...
b1132d55884f91bae853f7cb17a184f7cb7a545e9dca2be5460093658f994114
MATLAB
1,370
55
function e = UpdateDAtags(DA,TRIALS) % e = UpdateDAtags(DA,TRIALS) % % DA is a handle (or array of handles) to the OpenDeveloper ActiveX control % returned from a calls to SetupDAexp. % % % TRIALS.NextIndex is the trial index which will be used to update parameter tags % running on RPvds circuits % % % ...
e1436f69a597aa426c50fdb3ad74dc4ea44c4f2b3394be7c8c955205d182c7e3
MATLAB
1,373
24
function [super_noise] = expectation_conditioned_on_constituent_parts_2D(actual, raster,neuron_window, time_window) [expected,unscaled_expected, p] = theoretical_expectation_2D(raster, neuron_window, time_window) super_noise = [ expected(1), expected(2), (e...
137362edea8b67f1d2e117c1cd3936fbb27fa35214b054955b11887f9c76b0d4
MATLAB
1,374
48
function [class_contribution] = triple_correlation_class_contributions_3D_sp_wr(arr, x_window,y_window, time_window) class_contribution = zeros(1,14); class_count = zeros(1,14); max_time_lag = ceil(time_window / 2); [N_x, N_y, N_times] = size(arr); for x1 = -floor((x_window / 2)):ceil((x_...
6635b35a96746cf0e988af9c3049d3bf6e7a3b24b62cee82d67e4723a0d146f7
MATLAB
1,374
37
function analyzetpstack_correctdriftall(fignum, channel) ud = get(fignum,'userdata'); ds = dirstruct(getpathname(ud.ds)); answ= {'[-6:2:6]','[-6:2:6]','[-100:10:100]','[-100:10:100]','10','5','1','1','0'}; searchx = eval(answ{1}); searchy = eval(answ{2}); refsearchx = eval(answ{3}); refsearchy = eval(answ{4}); howof...
c1ee2239b7dd18a7ede18b88029028ddb5da03e09d4e65b2f031260338ca9456
MATLAB
1,374
36
function fiberCompartMod = assign_mod(fibersCompart, motoR) %% count fibers in nerve % get ids of non-empty fascicles TODO: only assign to fibers reached by AS? fascIdsNonEmpty = find(~cellfun(@isempty, fibersCompart)); % loop non-empty fascicles to sum up fiber numbers of all populations nFibsTot = sum(cellfun(...
9658221d414bc77220d54b3bb44c504720304c0fb37998a5a70b5481b57477f1
MATLAB
1,376
22
%----------------------------------------------------------------------- % Job saved on 17-Jun-2022 09:26:13 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- clear matlab subjfolder = dir('F:\fMRI_QC\fmri-op...
3d69ea8e3b703a4b4a6b92d4592d18b570ac340840f305b328a6af9ac052e138
MATLAB
1,377
22
%----------------------------------------------------------------------- % Job saved on 17-Jun-2022 09:26:13 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- clear matlab subjfolder = dir('F:\fMRI_QC\fmri-op...
bc30ce40216c67d3c98934dd6ea15bb9e15f16222eab09d90e738d79303ffad6
MATLAB
1,378
39
function [unmixed] = main_ELMM(unmixed_FCLSU, M0, img) % Function to unmix lambda stack based on Full Extended Linear Mixing Model (ELMM) algorithm % ------------------------------------------------------------------------- % Inputs: unmixed_FCLSU - 6D stack of unmixed output from FCLSU % M0 - extracted fingerp...
f197b11214076ff2da8aa3d3cf31b5a2879f5c6432a08cf997576471e5b93455
MATLAB
1,380
50
function [data] = linear_regression_data_generator(n, d, std) % Data generator for linear regression problem. % % Inputs: % n number of samples. % d number of dimensions. % std standard deviation. % Output: % data data set % data.x_train ...
f9fd0369904f0a7a87fa8884480f360e9938f388e94ab8fa22b2eef2ce2f53ae
MATLAB
1,382
38
function [recrNormIa, recrNormIb, recrNormAlpha, recrNormII, ... recrNormIII, recrNormTouch, Q] = upsample_recr(recrNormIa, ... recrNormIb, recrNormAlpha, recrNormII, recrNormIII, recrNormTouch, Q) %UPSAMPLE_RECR Summary of this function goes here % Detailed explanation goes here factor = 10; if facto...
37c9f775c8177be72f6303113932706f679be2c7bd4ea2e030bd7d85ba221305
MATLAB
1,383
46
function [sigma_noisy] = spike_to_calcium(sigma_sim, params, flnoise) % function [sigma_noisy] = spike_to_calcium(sigma_sim, params, flnoise) % % Transfers spiking data to calcium transients, convoluting the spikes % with exponential decays. % % Input: 1. sigma_sim: N * T matrix, with 0 and 1's giving spikes ...
39bc0a8185e592d19d41c9b256953d924897b4aadc4bfe6cbdc8ab7da3176b68
MATLAB
1,383
52
function CSD = CSD_construction(lfp,z,plt,tt) %%% Adapted from https://github.com/haiderlab/Current-Source-Density %% estimate CSD % 5 point hamming filter from Ulbert et al. J Neurosci Methoods 2001 % ('Multiple microelectrode-recording system for intracortical % applications') - equation 5 for sp...
7006f3032f771c3cdb80abcef1d545e69040a3d1503144d66118e5d6bd943615
MATLAB
1,384
41
function fascThresh = compute_fasc_thresh(modelOrFiberThresh, threshMode, threshValue) %COMPUTE_FASC_THRESH Calculate recruitment threshold of fascicles % Default (w/ only one argument passed) is 10% recruitment % fascThresh iAS x iFasc % Inf means missing value (i.e. out of active site range) % NaN means ...
1fb5b41f2f7952713aa9019683b78d76bf9e368142022fd0f31d0f36e4347091
MATLAB
1,389
40
function activeArray = makeActivePatternsArray(patterns, npat, nt) %MAKEACTIVEPATTERNSARRAY converts pattern matrix to activity array % This function takes the PATTERNS matrix output by FINDALLPATTERNS and % converts to a PxT matrix giving the number of patterns of each time % present at each time step, where P i...
4a6310f1e24a2448a33f3eedc7d1287476ab9e2fc8199a3896b37bdafb5011c7
MATLAB
1,389
44
function [im,params]= previewprairieview(dirname, numFrames, firstFrames, channel) % PREVIEWPRAIRIEVIEW - Preview PrairieView image data % % IM = PREVIEWPRAIRIEVIEW(DIRNAME, NUMFRAMES, FIRSTFRAMES,CHANNEL) % % Read a few frames to create a preview image. DIRNAME is the % directory name to be opened, and NUMFRAM...
99329348a2f2b6a1743d634bf3bd12767acb1d99fc7ce03c9819fe0b19602a29
MATLAB
1,390
65
function [log_stds, d_log_scales] = scaledGaussianComponent(ws, log_scales_0, grps, dU_0, log_stds) % i.i.d. multivariate zero-mean normal prior distribution over columns of ws with covariance matrix % defined in GMLMprior_dmcStimVar % % calculates prior and all derivatives compute_D1 = nargout > 1; precomputed...
078508b0cf50ab009936ed47bb33eacb734b757f543c3b7d0a3569d7c9091b29
MATLAB
1,392
24
function [super_noise] = expectation_conditioned_on_constituent_parts_3D(actual, raster,x_window, y_window, time_window) [expected,unscaled_expected, p] = theoretical_spiking_expectation_3D(raster, x_window, y_window, time_window); super_noise = [ expected(1), expected(2...
19288781f74b38a26f24bd8a126af66286114f80df1b7994c18a0bf25d700b71
MATLAB
1,392
41
function y = istrue(x) % ISTRUE converts an input argument like "yes/no", "true/false" or "on/off" into a % boolean. If the input is boolean, then it will remain like that. % Copyright (C) 2009-2012, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and ...
4038b26fb80f0745f13b2fd44e4bf8f108695489751dca4f5fd8be44af1e9e9a
MATLAB
1,392
55
function data = ft_read_lfp_tdt(tank,block) % data = ft_read_lfp_tdt(tank,block) % % Read continuous (LFP) data from TDT Tank and convert for use with % FieldTrip toolbox % % See also, trialfun_tdt % % DJS 2013 if nargin == 0 || isempty(tank), tank = char(TDT_TankSelect); end cfg.tank = tank; cfg.datatype = 'Blo...
f66e1efbc1d3a67fa40c348a2b6793d6a2e08374e9318067c5a3c28d92868d3b
MATLAB
1,393
58
function [Rcorr,nRcorr] = SchreiberCorr(S) % Rcorr = SchreiberCorr(S) % [Rcorr,nRcorr] = SchreiberCorr(S) % % Implements spike-train reliability measure introduced by Schreiber et al, % 2003. An Rcorr approaching 1 indicates very high spike-time reliability % across trials, whereas Rcorr approaching 0 indicates very p...
bf6c158edc52e9bcf135dc1d54fda9b10fa92c39df3c774c7287f8c1bcd49d86
MATLAB
1,396
65
%% Simple Whole-Screen Flash % % Daniel.Stolzberg@gmail.com 2016 % Modifiable Parameters FlashDur = [0.5]; % flash duration (seconds) ITI = [2 5]; % inter-trigger interval (seconds) FlashOnColor = 1; % flash intensity [0 1] FlashOffColor = 0; % flash intensity [0 1] NFlashes = 100; % number o...
e5f831270b66ccbd74a223073b4536deba561fc93fee0b7e9fa1afc22c837d83
MATLAB
1,396
39
p=8; % selecting the participant Indcs= IL_Inds{p}; %Get the indices for various trials of an specific Surface-Foot combination data= IL_inputs; %Get the indices for various trials of an specific Surface-Foot combination tit={"Participant 8", "Left Foot - Sloped Surface"} ; % set the title of plot ...
b44bde773f1bad6bde5b57c317de66459871bc31f03c7e7154101d3849035d6c
MATLAB
1,397
40
function [ Node ] = ColladaAddStandardAccessor( DOM, Node, ArrayName, Count) %COLLADAADDSTANDARDACCESSOR( DOM, Node, ArrayName, Count) %Create a standard accessor for verticies and normals, i.e: %<technique_common> % <accessor count="8" offset="0" source="#box-lib-positions-array" stride="3"> % <param name="X" ...
191df73b45efa62544515ff29890c23eaf1dfab2851dd609df421cdb7d6b02c5
MATLAB
1,398
51
function [] = reduce_hspace_subplot(h_subplots, percent_removed, increase_width) % Reduce the horizontal space between subplots by percent_emoved percents. if nargin<3 increase_width = 1 ; % otherwise, shift towards center end pos = get(h_subplots,'position') ; n_subplots = length(pos) ; right1 = pos...
1baf88a517cfa13da7e8ca3814cd50fdcc0e5cd0dcb9478c0c5bc5940229f412
MATLAB
1,399
46
function [im,params]= previewprairieview(dirname, numFrames, firstFrames, channel) % PREVIEWPRAIRIEVIEW - Preview PrairieView image data % % IM = PREVIEWPRAIRIEVIEW(DIRNAME, NUMFRAMES, FIRSTFRAMES,CHANNEL) % % Read a few frames to create a preview image. DIRNAME is the % directory name to be opened, and NUMFRAM...
24399baaf5a737cee0721e37f8d3b6ffea8c157434e74a1ba851b4da66dbc797
MATLAB
1,399
56
%========================================================= % FileName: linear_classifier_test.m % Designby: Zhe % Modified: 09/02/2021 % Describe: Testing linear classifier for the position decoding % from FPGA recorded traces. %========================================================================= clear...
86429685cc7e505c99a5a2c7ae7813c2126823b18202153b552bf3c147accf9a
MATLAB
1,399
45
function im = tppreview(dirname, numFrames, firstFrames, channel) % TPPREVIEW - Preview twophoton image data % % IM = TPPREVIEW(DIRNAME, NUMFRAMES, FIRSTFRAMES,CHANNEL) % % Read a few frames to create a preview image. DIRNAME is the % directory name to be opened, and NUMFRAMES is the number of % frames to read....
eb33df2156c16d74cf103c055688d42ece66d5d1b5319c9bcf20962354b3f56e
MATLAB
1,399
46
function P = slice_AS(model, project, planeP, planeV, roundPrec, iActiveSites) arguments model (1,1) Model project (1,1) logical planeP (1, :) = [] % Default is centered at each AS z. Point in plane, if given scalar it is auto-broadcasted to vector planeV (1, 3) = [0, 0, 1] % Vector perpendicular ...
b4fc20b5dae26e77fd9ca941012abf149cb3f364eb533557185f52da5e0a037b
MATLAB
1,400
40
% Loads and plots factor loading (assembly membership of units into assemblies during each experimental phase % % Aleksander PF Domanski PhD UoB 2015 % aleks.domanski@bristol.ac.uk % % NB assumes factors have been calculated on each area independently, thus % units may not line up based on exlusion criteria not b...
8056ee4d3c2699f134eb15cf3530eab82ca78f4346df86451fde30f78a1eb4cd
MATLAB
1,401
45
bDir = '..\data\'; dirList = {'1. ABJ','2. JHS(x)', '3. JJH', '4. KCH', '5. SYS(x)', '6. KDH','7. OSL(x)','8. KSH', '11. LJJ(x)', '12. SHH(x)', '13. SJH', '15. SSK', '16. BSW', '17. KKM'}; GoodChannel = [2 3 30 6 7 28 29 8 24 25 34 35 62 37 36 63 60 39 58 41 40 57 56 11 12 23 22 15 14 13 19 20 16 17 18 43 53 54 ...
00b89ac54ae19bb7a0130bd5c5708dd9b8a4b5494c3817d53bd8ec1f9ac8f175
MATLAB
1,402
64
function fit1 = fitness_moea20(A1, paramsvec, eegdata1, paramstoest, T1,tcut, fhz1) paramsinput = [paramsvec, zeros(1,10)]; paramsinput(paramstoest) = A1; % load in the data to fit against eegautocor = eegdata1{2}; eegdatadegdist = eegdata1{5}; a2=[]; fithvg=[]; parfor RunIter = 1:5 % run 5 times for stabil...
7d4c33477c5dcff70d463b70d4c265df61b457300b04e61d3e88b62e840c8342
MATLAB
1,403
52
function D = CalculateFlowMatrix(prevFrame, currFrame) if length(size(currFrame)) == 2 I0 = im2double(prevFrame); I1 = im2double(currFrame); else I0 = im2double(rgb2gray(prevFrame)); I1 = im2double(rgb2gray(currFrame)); end I0 = single((I0-min(I0(:))) ./ (max(I0(:)) - min(I0(:)))); I1 = single((I1-min...
a39888c8b1062f49dd7d7fcb4b434000ac9266092151a1d69a3c3f7bb2876ccd
MATLAB
1,403
47
function im = tppreview(dirname, numFrames, firstFrames, channel) % TPPREVIEW - Preview twophoton image data % % IM = TPPREVIEW(DIRNAME, NUMFRAMES, FIRSTFRAMES,CHANNEL) % % Read a few frames to create a preview image. DIRNAME is the % directory name to be opened, and NUMFRAMES is the number of % frames to read....
5609ceced0614b973b94571f07f222868fd1e5f42aa8a09853bf3220cc60e321
MATLAB
1,404
51
function [data] = multiclass_data_generator(n, d, l, std) % Data generator for multiclass classifier problem. % % Inputs: % n number of samples per class. % d number of dimensions. % l number of classes. % std standard devision of gaussian pr...
23b77c262e3d57dab56b2a4e0fc71cf501822c1e7f955fa5177537402f740334
MATLAB
1,406
43
function ExtractFeatures(self, varargin) %EXTRACTFEATURES Extracts spatial/temporal features from project frames % EXTRACTFEATURES(SELF) extracts features from streams and cameras % specified by STREAMS and CAMERANAMES in config.txt % % EXTRACTFEATURES(..., 'PARALLELIZE', TRUE) parallelizes process (by % defa...
88db8693344dc44685edab6ab7b2a05de6cd58e1bbf56fad623076e9f3a94859
MATLAB
1,408
45
% PURPOSE: gets current ERPLAB's version % % FORMAT: % % version = geterplabversion; % % or % % % [version reldate] = geterplabversion; % reldate=release date % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon % Center for Mind and Brain % University of California, Davis, % Davis, ...
7e6a80338cc31ebd21f3b96cc0dbd8d82531e7715f99f4c0851bc390828282c8
MATLAB
1,411
77
%% Flip Checkerboards % Sends 1 ms pulse from from Bits# TrigOut to TDT digital input on every % Checkerboard flip. % % DJS 3/2016 nFlips = 100; % # flips IFI = 1; % inter-flip interval (seconds) nCheckers = 10; [window,ScreenRect,frameRate] = PTB_NormalExpt_Startup(0,1); black = BlackIndex(window); white = WhiteIn...
6bee79641dd31ccad6e0362077fdaa9b0a60853984d23e8050841b544a6853c6
MATLAB
1,412
40
function [umo,vmo,p11,p12,p21,p22] = tvl1_optimization(um,vm,grad,rho_c,Iw1x,Iw1y,p11,p12,p21,p22) epsilon = 1e-2; OUT_ITERATION = 10; INNER_ITERATION = 30; tau = 0.25; [M,N] = size(vm); sz = M*N; theta = 0.1; lambda =50; taut = tau / theta; n_inter=0;n_outer=0;error = 1000000; ...
72456209d48ae4a08ee71a67e80d42bffea844019fce8857c84e8ea58627a6de
MATLAB
1,412
60
% PURPOSE: subroutine for ploterpGUI.m % Creates default Y ticks for ERPLAB's plotting GUI % % FORMAT % % [def miny maxy] = default_amp_ticks(ALLMVPC, yrange) % % INPUTS % % ALLMVPC - ALLMVPCset % yrange - min and max ALLMVPC amplitudes % % OUTPUT % % def - tick values to show in Y axis % miny ...
84e498322497e9740fd6d4db5957a48fe644fb1eb46adbc2b6d9e88dfa9e9e9c
MATLAB
1,413
49
function handles = findModuleIndex_SanesLab(moduletype, handles) %handles = findModuleIndex_SanesLab(moduletype, handles) % %Custom function for SanesLab epsych % %Inputs: % moduletype: a string containing the desired TDT device % handles: GUI handles structure % %Example usage: handles = findModuleIndex_SanesLab('...
1817a97fa47adbf35510ca6fe41c879bddef835322447bfcc931920b0c7e0537
MATLAB
1,414
55
function v = dist_var(val, pgrid, doWarning) % Compute the variance (v) of a probability distribution (val) over a discrete % grid (pgrid). % % Usage: % v = dist_var(val, pgrid, doWarning) % NB: doWarning: 1 allow a warning message on whether the distribution is % normalized to sum to 1 (default: 0) % % Copyright ...
5cecec7431a928d2addab8d467dbf4716018c07881e328e25726f76e01f348ca
MATLAB
1,414
75
% function fcn_gnets( clear all close all clc k = 5; params = rand(k*(k - 1),1)*10; N = 128; sz = rand(k,1); sz = sz/sum(sz); sz = round(sz*N); while sum(sz) ~= N dff = sum(sz) - N; if dff > 0 for i = 1:dff r = randi(k); if sz(r) > 0 sz(randi(k)) = sz(randi(k)) -...
837da3d902be9de66ff9063bb6a632d2c60ee30220ce51c160ec0034878225ef
MATLAB
1,416
58
function [rho pval] = circ_corrcl(alpha, x) % % [rho pval ts] = circ_corrcc(alpha, x) % Correlation coefficient between one circular and one or more linear random % variables (1 column per variable). % % Input: % alpha sample of angles in radians % x sample of linear random variable % % ...
6e99114f999472993192e8c8f8c830c6c4890d91338dd9d857c95345f44f52d4
MATLAB
1,417
52
function previews2tif(ds, dirname,scale,map) % PREVIEWS2TIF - Convert all preview images in a 2P directory to TIF % % PREVIEWS2TIF(DS, DIRNAME [, SCALE, MAP]) % % DS is a directory structure DIRSTRUCT object. % % The files will be written in the DIRNAME/analysis/scratch directory. % % All files will be scaled by t...
40836bb0fc1b601ede3e0cab62c6576a360ed49deb3d9b08e0e6ebeac4b0d343
MATLAB
1,418
40
% *** This function is part of ERPLAB Toolbox *** % 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 % Creat...
2d4d7da0db5e5ed9b772bf16d45ee8e9ae7226651e4c3a5553c9bb8af696d4b4
MATLAB
1,422
38
function model = load_model(subject, electrode, as, loadPotentials) %LOAD_MODEL Summary of this function goes here % Detailed explanation goes here if nargin < 4 loadPotentials = false; end modelName = [subject '_' electrode]; modelNameAS = [modelName '_AS' as]; load(['data\Nerve\' subject '_noElectrode\Epineu...
7f94dc94e52300852e5e47ef5aaae351ac01f84b7391a57d70d120e4368fcba8
MATLAB
1,425
52
function [b b0] = circ_skewness(alpha, w, dim) % [b b0] = circ_skewness(alpha,w,dim) % Calculates a measure of angular skewness. % % Input: % alpha sample of angles % [w weightings in case of binned angle data] % [dim statistic computed along this dimension, 1] % % If dim ...
84d412b6fc5f646f7a32c26daf8325264133c6c5ce17ec7cadc9bc0a64c4cf5c
MATLAB
1,428
47
% function for finding and saving spike times for columbia data set % Arguments: file_id = patientID + recording number function fx_find_spikes_columbia_data(file_id) % Load corresponding mua file mua_file = [file_id, '_mua.mat']; load(mua_file, 'data', 'metadata') % run status update dateti...
2dc6c512ee21c2a4927646fd992ad2db4b7a75fe21153eda95b7a94fd21a0a85
MATLAB
1,429
51
% X: data matrix, each row is one observation, each column is one feature % d: reduced dimension % type: type of kernel, can be 'simple', 'poly', or 'gaussian' % para: parameter for computing the 'poly' and 'gaussian' kernel, % for 'simple' it will be ignored % Y: dimensionanlity-reduced data % ...
4d1296adf88b8735143b83ee636c6ccfaeb7f909220b54668050af469489a1f3
MATLAB
1,429
51
function pw = lme_realizedPower(stats,C,alpha) % pw = lme_realizedPower(stats,C,alpha) % % Power associated with a contrast C for the actual realization of the % linear mixed-effects model (Depends on the Statistics toolbox). % % Input % stats: Struc...