sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7800f915a2c75caa1abb0b6a7400805b1c49251f12d56982668102e7e44194a0
MATLAB
1,707
51
% findLayersToReplace(lgraph) finds the single classification layer and the % preceding learnable (fully connected or convolutional) layer of the layer % graph lgraph. function [learnableLayer,classLayer] = findLayersToReplace(lgraph) if ~isa(lgraph,'nnet.cnn.LayerGraph') error('Argument must be a LayerGraph objec...
b56be8935d8ca622a6ed928e8786dc8c62f7aadc5b898a1fe1d2524b2cb27dbd
MATLAB
1,707
52
function self = SplitClipData(self) % varargin: trainClipT, validationClipT, testClipT verboseLevl = self.VerboseLevel; if verboseLevl > 0 fprintf('Loading network data...\n') end if verboseLevl > 0 fprintf(' - Splitting into train/validate/test splits\n') end isAnnot = self.ClipTable.Type == categorical(...
1735ec06eefeee1bf4c470a8b1a8f9f84e3f2f9de6954fe6167f3f1190002f91
MATLAB
1,708
60
function [ok,remind_row] = selectReminder_SanesLab(TRIALS,remind_row) %[ok,remind_row] = selectReminder_SanesLab(TRIALS,remind_row) % %Custom function for SanesLab epsych % %This function is for instances when more than one reminder trial is %specified. In these cases, the user is prompted to select one of the %remi...
285e376619a91ab0ca8af2d5fc4b926d3f617149e0d98b5a6ea2e9bf5ee4ecbb
MATLAB
1,708
45
function PlotAcrossSessions close all clc figure(1) %%%%%%%%%%%%%%%%%%%%%%%% %---FLAGS---% Xlabel = 'Absolute Day'; Ylabel = 'Lapse Rate'; xmin = 0; xmax = 50; ymin = 0; ymax = 0.41; %Lapse Rate% HLavg = [0.35 0.21 0.13 0.07 0.05 0.04 0.07 0.16 0.02 0.05 0.03 0.04 0.03 0.05 0.04 0.03 0.04 0.03 0.24...
70bd2a1c001132019a319b38c249ff44ff72b5beb1ff1dc7c047df6d997d90f1
MATLAB
1,710
37
%% Plume prob cond 1 & 2 PCF TP 1 TP 2 TP 3 figure(108) boxplot([PlumeProb_PCF_TP1_Cond1,PlumeProb_PCF_TP2_Cond1,PlumeProb_PCF_TP3_Cond1,PlumeProb_PCF_TP1_Cond2,PlumeProb_PCF_TP2_Cond2,PlumeProb_PCF_TP3_Cond2],'Labels',{'PCFTP1 Cond1','PCFTP2 Cond1','PCFTP3 Cond1', 'PCFTP1 Cond2', 'PCFTP2 Cond2','PCFTP3 Cond2'}) ...
cc208092bb94a309387fbe7adf3b675f75ac183823b32dbacc8e9b65fb3d4464
MATLAB
1,710
57
function result = DB_UploadWaveData(tankname,blockname,eventname,data) % result = DB_UploadWaveData(tankname,blockname,eventname) % result = DB_UploadWaveData(tankname,blockname,eventname,data) % % Upload waveform data to a database. A connection to the database should % already be established. % % data = data....
0c728a3ee8eaa9bcaf72e577a802db78789dafb796060ee18a9c1608bf23f797
MATLAB
1,714
41
function pname = DB_GetProtocolName(protocol) % pname = DB_GetProtocolName(protocol) % % Returns name of protocol (scalar) from MySQL database. % % If protocol does not exist, then the user will prompted to enter it into % the database. % % *Requires mym % % DJS 2013 % look on db_util.protocol_types table ...
5d6d0aa8c65bd8ed94949611152f891a21b00cb4891521f36bab8a53f239adac
MATLAB
1,716
72
function bt = get_btensors_from_bvec_bval(bvec, bval, bdelta) % function get_btensor_from_bvec_bval(bvec, bval, bdelta) % % returns the b-tensors (in Voigt format) associated to the bvec, bval, % and bdelta. If bdelta is not provided, it is assumed to be 1 % (LTE or Stejskal-Tanner experiments only) % % the im...
55441c5c3b0f8869070d06d35eabc7c2be671417227c30eba9b470aa1dfdf474
MATLAB
1,717
63
function disabledropdown_SanesLab(h,dev,module,param) %disabledropdown_SanesLab(h,dev,module,param) % %Custom function for SanesLab epsych % %This function disables the dropdown button if the parameter is roved, or %if the parameter tag does not exist in the circuit. % %Inputs: % h: handles of dropdown menu % dev: ...
6bbc7667b1db02f8502813a2849b9d94cf7bde953c4a6bd5c994a0e331fb36e3
MATLAB
1,717
46
function which = get_spike_indices(spikes, show ) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/09/2010 % % get_spike_indices - get the indices of the specified spikes % % Usage: % which = get_spike_indices(spikes, show ) % % Description: % Gets the indices of a set of spikes in the spikes object. ...
18c81674d693ef9449dfe7a7cd055b9c1ec7313c379ceaffea911775946a876b
MATLAB
1,720
66
function K_thresh = cp_cluster_Pthresh(xSPM, p_val) % % Function to find the cluster-size threshold (number of voxels) for a % given (corrected) p-value. % % INPUT: % - xSPM : structure available in the workspace when looking at SPM % results % -p_val : statistical threshold [.05 by default] % ...
7c7d46622dfe627f2849c7ee2111491e0a3e6663316a5f8b49a2de6a027880fb
MATLAB
1,723
40
function [freq, q, qLo, qUp, effRecrMean, effRecrLo, ... effRecrUp, collRecrMean, collRecrLo, collRecrUp] = ... propriosim_stim(t, targetRecr, targetFreq, recrNormIa, ... recrNormIb, recrNormAlpha, recrNormII, recrNormIII, recrNormTouch, Q) %PROPRIO_STIM Summary of this function goes here % t 1 x iT ...
c81a3a9c8bf8538cc2dfffbbd9b9c787b6df2c036d2ec43945e81d9f03f9013e
MATLAB
1,723
42
% PURPOSE: sets, or restores, the uicontrol defaults that MATLAB's dialogs use. % % FORMAT: % % erplab_dialogcolors(bgcolor) % set, before calling questdlg/msgbox % erplab_dialogcolors(bgcolor, fgcolor) % set, with a specific text colour % erplab_dialogcolors() % restore, immediately after %...
4ea2820f9d6f553de77c25e1c83e6c81c632f60dffa3ee59b6be852901a69740
MATLAB
1,726
71
function decoder = train_LDA_iterative(cfg0, X, Y) log = []; log.cfg0 = cfg0; A0 = Y(:, X==0); A1 = Y(:, X==1); m0 = mean(A0, 2); m1 = mean(A1, 2); m = 0.5*(m1 + m0); numN = length(X); numN0 = sum(X==0); numN1 = sum(X==1); numF = size(Y, 1); A0 = A0 - repmat(m0, [1, numN0]); A1 = A1 - repmat(m1, [1, numN1]); A = ...
e082bda5652a60c4d0adfc90974c57c376df835284b91177215e03f4d0d2d57a
MATLAB
1,728
89
function C = TrialFcn_CheckerFlip(C) % C = TrialFcn_CheckerFlip(C) % % Flip checkerboard pattern. % % Uses the Psychtoolbox % % Daniel.Stolzberg@gmail.com 2015 persistent win w ScreenRect black white vbl if C.tidx == 1 % Screen('Preference','SkipSyncTests', true); win = 3; w = Screen('OpenWindow'...
3fd6ebac637f9cdb3048938807964b9e720d11da2237203ebfcb5b705a7a991d
MATLAB
1,729
53
function [a, dmatrix] = decodeDataXVal(data, audiovisuoCode, P) dataA = getOrgData(data,audiovisuoCode,P); % dataA is bins x imp stim x unimp stim x comp x rep s = size(dataA); nBins = s(1); nStimImp = s(2); nStimUnImp = s(3); nClu = s(4); nRep = s(5); [nfold,folds] = getFolds(s,P.fol...
3d34442e4201f5d223d49a30ef01f93ad04f0faa7943e04b13b0c9d17877dbdc
MATLAB
1,730
57
function tpraw2text(rawfilename); % TPRAW2TEXT - Convert a 2-photon raw .mat file to text % % TPRAW2TEXT(RAWFILENAME) % % Converts output from a TwoPhoton raw .mat file to text. % % 2 types of files are generated: % % The first is a header file named [RAWFILENAME 'hd.txt'] that has % the names of the cells that...
47860b8c8a810788e38e87729255714c528f19087dbe97f9aa69d25ef8adea2b
MATLAB
1,730
49
function [P,Rsq,yfit]=myPolyFit(X,Y,Powers,FitMethod) % Polynomial fitting routine % % INPUTS: % - X: independent variable % - Y: dependent variable % - Powers: order of the polynomial fit % - FitMethod: allowed values: 1. 'NonNeg' - enforces positive % polynomial coefficients. 2. 'Free' - a...
4fb61cc08475a52e01886a705815e82373e6678004a2433444da3caf49d5c873
MATLAB
1,730
48
function mappedX = diffusion_maps(X, no_dims, t, sigma) %DIFFUSION_MAPS Runs the diffusion map algorithm % % mappedX = diffusion_maps(X, no_dims, t, sigma) % % The functions runs the diffusion map algorithm on dataset X to reduce it % to dimensionality no_dims. The variable sigma is the variance of the Gaussian % us...
85407ab9fd0c282cd9b23bbd71321722892a3ed78e77503f2cf4116f5490b17e
MATLAB
1,732
58
function r = issubfield(s, f) % ISSUBFIELD tests for the presence of a field in a structure just like the standard % Matlab ISFIELD function, except that you can also specify nested fields % using a '.' in the fieldname. The nesting can be arbitrary deep. % % Use as % f = issubfield(s, 'fieldname') % or as % f = i...
26a3b157e1b986de592ee9de30b403bba1d813930838abb8f45b6f5d1d6d6d28
MATLAB
1,736
51
function panel = make_uipanel_on_grid( panel_pos, my_title, params, h,visibility) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % make_uipanel_on_grid - returns uipanel object with specified position % % Usage: % panel = make_uipanel_on_grid( panel_pos, my_title, params, h,visibility) % % De...
625be6a791230f11ad4d4fb6cedf8e2e381b4fb0849726512d995bff72defffc
MATLAB
1,736
70
function y = em_Liley(t, params) he_rest=params(1); hi_rest=params(2); Nee_beta=params(3); Nei_beta=params(4); Nie_beta=params(5); Nii_beta=params(6); Gamma_e=params(7); Gamma_i=params(8); gamma_e=params(9); gamma_i=params(10); Tau_e=params(11); Tau_i=params(12); Se_max=params(13); Si_max=params(14); mu_...
a9b52371c172beafe42b47cbb32f82f9369c0e96f86c8f868dd3c4db6a9f11de
MATLAB
1,736
49
% In the Dropbox folder, I put abbreviated movies from one experiment % showing the difference between filtering and not filtering. % 'exp5d1B_raw' is the unfiltered (raw) version (made of 'M0's, below); % 'exp5d1_hpf' is the filtered version. A single image could be created with % the code below: change 't000XXX' t...
327f50f883e215220d45e3f04bbbe43693bad06f343e947f2ad8b467a88f2e49
MATLAB
1,738
46
%% Source parcellation atlas = load('scout_Desikan-Killiany_68_template.mat'); atag = 'DK'; cd(bsdir); Pa_04 = do_sourceparcel(sFiles_4,atlas,bsdir); Pa_08 = do_sourceparcel(sFiles_8,atlas,bsdir); Pa_16 = do_sourceparcel(sFiles_16,atlas,bsdir); Pa_32 = do_sourceparcel(sFiles_32,atlas,bsdir); clc,[roiid_04,m_04,idx_04...
4b21d2ea8aa46e203c43a8b97e1ea7e9bb942a5cf8a2ceba12ccab8a99de558e
MATLAB
1,740
64
function [L,D]= mchol(G) % function mchol(G) % % returns the modified cholesky representation of a matrix G % % the implementation follows the steps of the algorithm at page 111 of % "Practical Optimization" 1982 % by Philip E. Gill, Walter Murray, and Margareth H. Wright % ... % MC1 [Compute the boun...
7d1b2bf85a08d253e896983bb5ff0a3a1acf331465fc7c7764e97184d4def2c5
MATLAB
1,740
51
util.clearAll; % stimuli outdir = fullfile(util.get_paths().figs,'full_matrix'); util.mkdir(outdir) %% load the data and combine betas % Get the beta tables from matfiles taste_str = util.str.taste_strings(); beta_tables_taste = ... cellfun(@connect.read_matfiles_taste, taste_str, ... 'UniformOutput', false); ...
7bf3b6b8459d08e2503bedae330f38cba27918f2cf2d63b28ba6fd9487831c68
MATLAB
1,741
51
%% The screen's bounds in an OH/OHA/TOH/TOHA trial % A useful container for passing the four-tuple of screen bounds around. % Copyright (C) 2022 Richard Hugh Moulton % % 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 % th...
e13428d607382471b445df50aa1e4d467895018c46f9daff9c088dca103c5c70
MATLAB
1,741
64
close all; clear all; gt_dir = '/path/to/refinenet/datasets/EgoHands/SegmentationClass/test'; pred_dir = '/path/to/refinenet/cache_data/EgoHands/'; im_dir = '/path/to/refinenet/datasets/EgoHands'; dir1 = dir(fullfile(gt_dir)); %remove '.' and '..' from directories dir1=dir1(~ismember({dir1.name},{'.','..'})); idx = ...
0b34ab606f758fb055a6ea0f98f56e70e649058d88f24a9c08070b5cfb5bcd7f
MATLAB
1,743
63
function [IND,Genes,Genes_compressed] = findActivatedPoints(Data,classes,inputSize,net,netName,layerName,Dmat,Threshold,FIG,Sample) im = Data.XTrain(:,:,:,Sample); %cat(3,Data.XTrain(:,:,:,Sample),Data.XTrain(:,:,:,Sample),Data.XTrain(:,:,:,Sample));%imread('ngc6543a.jpg'); imResized = imresize(im,[inputSize(1),inputS...
276bec40c7e3b3827a2a7fabcdd9ea0779cd1846f7bb72badef10d277cc4ceb0
MATLAB
1,746
59
function [km] = SStat_KM(z,d,t,ptype) % [km] = SStat_KM(z,d,t,ptype) % % Kaplan-Meier curves estimation and plot. % % Input % z: Discrete covariate (mx1, m # of subjects) with the strata categories. % d: Logical vector (mx1) indicating censorship status (1 if the subject got % the failure event or 0 otherwise). % t: V...
fab0238ca6b2819723fe02a9a03e52796174260183d924fc3a8bec1007a9545d
MATLAB
1,748
46
function map = jetm(n) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % jetm - Muted jet colormap. % % Usage: % map = jetm(n) % % Description: % JETM(N), a variant of JET(N), is an N-by-3 matrix containing a muted % version of the JET colormap. JETM with no arguments is the same % ...
04dd025cef140793dad1f76d60e5d7ea0a89046208e8f01641b1e3070a6a798c
MATLAB
1,751
53
function [z,r] = get_zvalues( w, covar, r ) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % get_zvalues - calculate normalized mahalanobis distance of spikes % % Usage: % [z,dof] = get_zvalues( w, covar, r ) % % Description: % Calculates the Mahalanobis distance of each waveform in w fr...
16fd344bd20c0f970613cf6aa4c6ecf67ecb8d6e94bf2f535147114c27c1ece8
MATLAB
1,751
87
function G = GellermannSeq(plot) % G = GellermannSeq([plot]) % % Generate a sequence of trials for a two-alternative task based on the % rules outlined by Gellermann, L.W. Chance orders of alternatig stimuli in % visual discrimination experiments. J. Gen. Psychol. 42: 206-208, 1933 % % Optionally plot data % % Daniel.S...
3b06f793108edca23ab07cd4146bb054750585e621f808e684894d1d6f071af7
MATLAB
1,753
55
function plotcube(varargin) % PLOTCUBE - Display a 3D-cube in the current axes % % PLOTCUBE(EDGES,ORIGIN,ALPHA,COLOR) displays a 3D-cube in the current axes % with the following properties: % * EDGES : 3-elements vector that defines the length of cube edges % * ORIGIN: 3-elements vector that defines the s...
97b139df46c6984821fa931ac9bb96869968b35190502aa8a23c904801d89bb1
MATLAB
1,753
46
function [im,fcx,freqx,fcy,freqy] = prairieviewnoiseanalysis(filename, linesx, linesy, note) % PRAIRIEVIEWNOISEANALSYS - Analyze noise in prairieview recording % % [IM,FCX,FREQX,FCY,FREQY] = PRAIRIEVIEWNOISEANALYSIS(FILENAME,LINESX,LINESY,NOTE) % % Performs fourier analysis on a Prairieview image file and plots the r...
e9f21d672a64c05c5bb09b66f11e67320742cd2d88832a2686183bf117498477
MATLAB
1,753
55
function raise_band (hObject, event, hndls) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % raise_band - callback to raise clicked patch to front of visibility % % Usage: % raise_band (hObject, event, me) % % Description: % Pulls the clicked object to the top of the ui stack; useful % f...
d698c8b18cb02d079544731e73506b65d0041a23128aac56fd4ab53746b2bfd8
MATLAB
1,755
65
function res = grs2rgb(img, map) %%Convert grayscale images to RGB using specified colormap. % IMG is the grayscale image. Must be specified as a name of the image % including the directory, or the matrix. % MAP is the M-by-3 matrix of colors. % % RES = GRS2RGB(IMG) produces the RGB image RES from the grayscale ...
e41fe6620a8e789e7ff22e4aefeaae7fafaa1b084e289372ae58d2a2e670c52d
MATLAB
1,756
71
function plot_sign_star(p, yMaxData, x0, orderRightToLeft, plotNS) arguments p, yMaxData, x0 = 1, orderRightToLeft = true, plotNS = false end % p is a triangular matrix yl = ylim; if isinf(yl(2)) yMax = yMaxData; else yMax = yl(2); end yr = yMax-yl(1); if plotNS [r, c]...
ea218d4b5c4c8c75712445d5f03596659c527e3dd1950df6bdeeadc4d1139233
MATLAB
1,757
78
% PURPOSE: subroutine for ploterpGUI.m % Creates default X ticks for ERPLAB's plotting GUI % % FORMAT % % def = default_time_ticks(MVPC, trange) % % INPUTS % % MVPC - MVPCset % trange - min and max MVPC window time in ms % % OUTPUT % % def - tick values to show in x axis % % *** This function is...
a9ac277d4b3f5a42563fb326731072348e3f622af2cd5f45d1ec6c45906ef190
MATLAB
1,758
56
function [all_pts, str_fn,labels] = get_TPs_config(p_small, plus_sessions) % Gives the TPs for some configurations. % To indicate sessions on the TP matrix % % Inputs % p_small smallest TP considered % plus_sessions in {0,1,2} with % 0: sessions on a cross, % ...
514579b805c7445380a58da51bd5e397fd64711f46284f776f700d606e514d2d
MATLAB
1,761
44
%% Setup util.clearAll; cur_save_dir = fullfile(util.get_paths().figs,'ANOVA_correlations'); util.mkdir(cur_save_dir) % Get the beta tables from matfiles beta_tables_taste = util.load.all_taste_betas().sep; beta_tbl = util.load.beta_table(); %% First do the anova for the taste betas themselves G = findgroups(beta_tbl....
e1a58df280814f9b063a7c9367c408953b4bae35fc1b5863185ab1c3e95f7f15
MATLAB
1,763
82
function [y,xf,cf,t] = ERBgram_largeFile_v2(x,fs,compress,lowfreq,numchan,smoothcut,resamplefactor) % function [y,xf,cf] = ERBgram2(x,fs,compress,lowfreq,numchan,smoothcut,envcut,toPlot) % Plots a gammatone filterbank output of signal x, plus marginal spectrum % and envelope. % fs: sampling frequency [default 44100] % ...
cba8d76c05e1156e333d0ba809e4f37ca0797a8cdd578dc433e022e4c598c5d0
MATLAB
1,771
77
function [y,xf,cf,t] = ERBgram_largeFile(x,fs,compress,lowfreq,numchan,smoothcut,resamplefactor) % function [y,xf,cf] = ERBgram2(x,fs,compress,lowfreq,numchan,smoothcut,envcut,toPlot) % Plots a gammatone filterbank output of signal x, plus marginal spectrum % and envelope. % fs: sampling frequency [default 44100] % com...
332c7673211c6f031eee04255aa73853426a48ca4ac75a3926a8e88da2e92f76
MATLAB
1,774
63
function [D0,phisq0] = lme_fit_init(X,Zcols,y,ni) % [D0,phisq0] = lme_fit_init(X,Zcols,y,ni) % % Starting values for linear mixed-effects iterative estimation. % These starting values are based on the ordinary least squares estimators. % % Input % X: Ordered design Matrix (according to time for each subject). % Zcols...
965d2c2111492d708a1629581d647779fe722ccb57d9e56588d32c0637c22854
MATLAB
1,775
65
function [DMR,Omega,Phi] = computeDMRparams(duration,Fs,omega,phi) % [DMR,Omega,Phi] = computeDMRparams(duration,Fs,[omega],[phi]) % % Compute the dynamic moving ripple % % Input: % duration ... 1x1 scalar value with the intended duration of the % signal. % Fs ... 1x1 scala...
e57634fbbe6b5af33fd76a8d1d9a0ea4b9256cb1f84ca1983e9c2a2e12faabca
MATLAB
1,776
52
function varargout = DB_GetSpikeWaveform(unit_id,conn) % waveform = DB_GetSpikeWaveform(unit_id) % [waveform,tvec] = DB_GetSpikeWaveform(unit_id) % [waveform,tvec,stddev] = DB_GetSpikeWaveform(unit_id) % [waveform,...] = DB_GetSpikeWaveform(unit_id,conn) % % Retrieve mean spike waveform from database. % % tvec is a tim...
809373786b5090e846024115ad6c617c0b57f791043531543cbcf9b77bb399e5
MATLAB
1,777
55
%% Create population level brain masks for ridge redression optimisation % For ridge regression optimisation a population level grey matter and EPI % masks are needed and they are calculated based on each subjects mask from % preprosessing % % Population level EPI mask % Only voxels where all subjects have signal a...
74d0dc44cf1aa6e34e631e3e54bb74a220daae4ce87cda5c19efcdc86491ce7e
MATLAB
1,778
56
function expPath = getIOPath(config, ioChar, mode) %GETEXPBASEPATH Uses the info in the config file to build the path to the experiment folder where the stimuli are % % We handle 'simulate' mode as follows: % if we have a train subfolder, use that. Otherwise, check for test. Otherwise work in current folder ...
0479866543f59ba85f96b9d23df91183fc58e5b5320657e7c600f51a975ab5f0
MATLAB
1,779
64
function reformat_tank_data_jy_externalHD(BLKS) %reformat_tank_data % Function to reformat and save ephys data from epsych program. % % Program prompts user to select TANK, then cycles through each BLOCK, % calls TDT2mat (@DJS) to reformat tank data to a matlab struct, then % saves as a -mat file in google ...
644d4147dd03dc60a4f5a80bc1dfbb0f73083c755e9e504359069f7555be388b
MATLAB
1,780
51
%% clear all close all; clear; outdir = fullfile(util.get_paths().figs, 'connectivity'); util.mkdir(outdir); %% Load matfile data % Taste and hemisphere combinations taste = {'sour', 'salt', 'sweet'}; hemi_combos = {{'R', 'R'}}; matrix_type = {'full'}; num_taste = length(taste); num_hemi_combos = length(hemi_combos); ...
ed741c10a0628b53a9a6543df91054db4811ec06b84fc19a229c592cd80e10af
MATLAB
1,780
37
function plx_id = writeplxfilehdr(filename,freq,nch,npw,maxts) pad256(1:256) = uint8(0); % create the file and write the file header plx_id = fopen(filename, 'w'); if plx_id == -1 error('Unable to open file "%s". Maybe it''s open in another program?',filename) end fwrite(plx_id, 1480936528, 'integer*4'); % 'P...
653ed7a074f14ea4131eacebfdd3391a44b5caf857c942a1f225c9916f16fc6d
MATLAB
1,781
69
function varargout = DB_GetProtocol(block_id,add_unique) % P = DB_GetProtocol(block_id,[add_unique]) % [column_names,data] = DB_GetProtocol(block_id); % % Retrieve protocol data for block_id (scalar integer) from the currently % selected database. % % Optionally set add_unique to true (default = false) to return unique...
c01696a2b01754a27c496b931198e5f6ca770ceab070bc2a533c56f77f5afa30
MATLAB
1,781
44
function Source_Signal=produceMultiplePulses(experimentType,source_signal,inter_trial_interval,nber_trials,sample_rate) conditions=["V" "AV" "A"]; if strcmp(experimentType,'safety_testing') nber_trials_perCondition=10; for c=1:length(conditions) if strcmp(conditions(c...
b44bf971423d6e9c53b9548dcb56db66e6d206a45ad9bc11801ff487a8727c9a
MATLAB
1,783
47
function factor = find_scale_factor(nFibers) %FIND_SCALE_FACTOR Summary of this function goes here % Detailed explanation goes here % Suppose that N fibers in the model (e.g. 1) are enough for perception, % find the scale factor that makes experimental and model match sumModel = 0; sumExp = 0; allPercepThr...
80c6f592c36c8ca3aaa50900c9da59b063203a0c3e0706c71273c96739197180
MATLAB
1,786
30
%----------------------------------------------------------------------- % Job saved on 06-May-2022 15:19:55 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- clear matlabbatch subjfolder = dir('F:\fMRI_QC\fm...
79acbeebb1edec7b04b3e6ce9af00c8049e28125c7e803513daccc4c7a49ea80
MATLAB
1,787
61
classdef global_log < handle methods(Static) function obj = get_instance(reset) arguments reset logical = false end persistent log_ if reset || isempty(log_) show_date = true; show_time = true; ...
968abd94f4a1951f17f07fef50014075e4a60682d08c469ae947cc3a08aa435e
MATLAB
1,790
74
function closeGUI_SanesLab(hObject) %closeGUI_SanesLab(hObject) % %Custom function for SanesLab epsych % %This function closes the GUI window % %Input: % hObject: handle to GUI figure % %Written by ML Caras 7.28.2016. Updated 4.21.17. global RUNTIME PUMPHANDLE GLogFID %Check to see if user has already pressed the ...
291f0b4951aebcedb67e334bd030952ff84e193af149bae6b960e84725b35162
MATLAB
1,796
60
clc; clear; close all Fig7c=figure(); N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simulations) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %R=1 yline(1,'--k','Linewidth',2) hold on %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
482ac5207e847caca2d31347ba7b89616f5b307ac628b3d14b8e274651917e36
MATLAB
1,797
42
function [CI_dpDiffBoot, p_dpDiffBoot, CI_cDiffBoot, p_cDiffBoot] = getdprimeDiffBootCI(nHits1,nHits2, nMiss1, nMiss2, nFalseAlarms1, nFalseAlarms2, nCorrectRejections1 , nCorrectRejections2) nReps = 10000; alpha = 0.05; %alpha value rng(1,'twister'); isHit1 = [ones(1,nHits1) zeros(1,nMiss1)]'; ...
622a79c9f3d0a6d0fb741aa1f131e74f9858e15b2df1d5a9606692f89d916cc4
MATLAB
1,800
83
function IND = CAMind(im,CAM,Threshold,Dmat,FIG) if nargin <3 Threshold=0.5; Dmat = 'R'; FIG=0; elseif nargin <4 Dmat = 'R'; FIG=0; elseif nargin <5 FIG=0; end imSize = size(im); CAM = imresize(CAM,imSize(1:2)); CAM = normalizeImage(CAM); CAM(CAM<0.2) = 0; cmap = jet(255).*linspace(0,1,255)'; ...
3d443d17f45004140ed496463535ef5f73e89fec265486a44ecc06363e25fb37
MATLAB
1,803
57
function tpfileparams =tpfnameparams(dirname,channel,params) % TPFNAMEPARAMS - Returns any parameters that might be needed to create filenames % % TPFILEPARAMS = TPFNAMEPARAMS(DIRNAME,CHANNEL,PARAMS)% % % Examines the directory DIRNAME and returns any information that would be % required for the program ...
bdcf5f9a2c7191a646eacd7d2beb1f520f84f19beb9fa76307fb6b850ed75463
MATLAB
1,803
55
function [mvpc] = f_average_auc(mvpc, svm_scores,tst_target,smoothing) % Create the decoding accuracy at each time point (averaged over classes) [Nitr,Nblock,Ntp,Nclasses,~] = size(svm_scores); % Nblock = mvpc.nCrossfolds; % Nitr = mvpc.nIter; % Ntp = length(mvpc.times); % Nclasses = mvpc.nClasses; % Nruns = N...
43697d07f8a24ff65b91d0d39c4e9cb61b00737bf6dde0b337375cd6ad0f1558
MATLAB
1,807
48
function [dr_initial, dr_all_raw, dr_all_offset] = analyzetpstack_getdirdrift(ud, dirname, numpreviewframes) % ANALYZETPSTACK_GETDIRDRIFT - Get drift correction information from a directory % % [DR_INITIAL, DR_ALL_RAW, DR_ALL_OFFSET] = ANALYZETPSTACK_GETDIRDRIFT(UD, DIRNAME, NUMPREVIEWFRAMES) % % Given current userda...
33f27e026612bbd34eff5a4b4f2f3cc56a1e1a283b5e6497a753a8ea393116ea
MATLAB
1,809
68
function J = func_LDA(data,Labels,method) % J = func_LDA(data,Labels,method) % method = 'element' will perform element wise LDA; i.e. 1-dimensional lda % = 'vector' will perform the usual LDA; i.e. using a vector % (d-dimensional lda) typ=isa(Labels,'categorical'); if typ==1 Labels=double(Labels); en...
e9039f006646dbdad40e3a634b8d2317454aed655a82d9b64196c7c936ba322d
MATLAB
1,809
62
% PURPOSE: compare number of channels and channel labels between 2 ERPsets. % % FORMAT: % % test = checkchannel(ERPold, ERPnew) % % INPUT: % % ERPold - ERPset 1 % ERPnew - ERPset 2 % % OUTPUT: % % test - 0: ok % 1: number of channels do not match % 2: l...
76a0cda3885209b55c273c7e4ffec44a99207a689709151bd016636001d44c5c
MATLAB
1,810
57
function [UAll, M, muTimeCourse, mu, sigma, S, U] = getComponents(data, code, P) %%% Will compute the components of data %%% Supposes that data is timepoints x imp stim x unimp stim x clusters x repeats nBins = size(data,1); % can be different from P.nBins if take average response instead of timecourse ...
d7107d22c7f403a6c9f93a19ede1eef51ca876a63ea116062e2dd25d34b969aa
MATLAB
1,810
82
function handles = saveGUISettings_SanesLab(handles) %handles = saveGUISettings_SanesLab(handles) % %Custom function for SanesLab epsych % %This function saves GUI settings to a file (*.GUIset) %that can be re-loaded at a later date. % %Inputs: % handles: GUI handles structure % %Written by ML Caras 8.3.2016. %...
6e5df22253a7595b39d82dc7d9f406ba830c3f112b2a9a2d660131ca8762f827
MATLAB
1,813
55
% MAIN_burstdetection.m % This script operates the Burst Detection algorithm on the PeakDetection MAT files % by Michela Chiappalone (17 Marzo 200, 12 Gennaio 2007) clr check = 0; [start_folder]= selectfolder('Select the PeakDetectionMAT_files folder'); if strcmp(num2str(start_folder),'0') errordlg('Selection Fai...
40b077cf95bbb48f9d20b832f43cb4561127af4c0e5e086862a548cfa93f58fa
MATLAB
1,814
77
function StartSpikeSorting(Action,hGUI,Par) % Run spike sorting functions. This is for after preprocessing steps. % Created 22 April 2016 JDY %---FLAGS---% if nargin < 3 pname = get(hGUI.edit_pathname,'string'); subject = get(hGUI.SubjectID,'string'); session = get(hGUI.session,'string'); Par.Pname = pname; Par...
319afb68d08d67f39e85e1936b2e1bb8aa20917434b7f05307cf7f0e88102ccd
MATLAB
1,815
62
function resultats=MainArtificalDispPIV(Case) % INPUT: % Case : % =1: Initial linear (10 stesp) and the constant displacements (10 % steps). For creep test. % =2: Constant displacements (20 steps). For stress relaxation test. % OUTPUT: % resultats.Xlag: x coordinates of applied x displacement % resultats.Yl...
4d7b380cd6585a579df33f11427c66518359213fa5722b3b3a436aaa2ab33906
MATLAB
1,816
40
function [trl, event] = wsws_trialfun_test(cfg) % triggers load(cfg.triggerfile) % behav load(cfg.behavfile) event=[]; trl=[]; begsample_PTB=[]; nc=0; StimLabels={'SWS','NVS'}; CondLabels={'P+','P-','P0'}; for nTr=1:size(Stim_onset,1) thisList=block_conditions(Stim_onset(nTr,1),Stim_onset(nTr,2),5); if thisL...
93123e8015a2d5f07caa8422e2e145c0cd189f96e0a6574673398f665352bdc1
MATLAB
1,817
45
% Example 1: Classification of multi-omics data using the DeepInsight-3D model % % In this Example, multi-omics example data (saved in Data folder as % dataset1.mat) is first converted to images using DeepInsight3D converter. % Then CNN net (resnet-50) is applied for training the model. The % performance evaluation (...
16f9f1e87fe58b02d451b289e4eb21ab466071d3e6fad43b1c4843e39a67f877
MATLAB
1,820
69
function [M,S,U] = getTransMat(data,P) % gets transition matrix M % data should be timecourse x clusters x repetitions % bins is binning of the stimuli % P contains diverse general parameters if ~isfield(P,'reducingMethod') P.reducingMethod = 'SVD'; end if ~isfield(P,'recenterTimePoint') P.recenterTimePoint ...
64e0bdc4829bd807730e12762fb514752ef3ef1d569a8e02b07fa24fd56dfe34
MATLAB
1,820
56
%% Get the information necessary for plotting the spheres of ROIs util.clearAll; region_info = util.get_region_info(); % Get coordinates of the seed regions seed_region_names = cat(2, util.str.chord_ROIs().modules{:}); seed_region_info = region_info(seed_region_names, :); region_coords = seed_region_info.coords; % Add...
2a18583f6516b32063b9b863ce284cd44e1df360bee7253206ac631949dd6a3a
MATLAB
1,823
59
%% clear all close all run(['..', filesep, 'def_local']) addpath(genpath(path_mTRF)); %% allfiles={'405','406','407','408','409','410','411','412','413','414','415','416','417','418','419','420','421','422','423'}; StimProfiles_freq=([2 8]); % Model hyperparameters myLags=-(-0:1:30); FreqFilt=[2 8]; direction = -1;...
8765564413310dc9a1c534dcb639665a015de058bd3adf992deafab2694894f6
MATLAB
1,823
58
function pixellists = findmypixelsinlinescan(params,impixinds,dr,ims); imsize = [params.Main.fullImagePixelsPerLine params.Main.fullImageLinesPerFrame]; linesperframe = min(params.Main.Lines_per_frame,size(ims,1)); % actual lines might be less than expected N = size(params.Linescanpoints,1); % number of pixe...
82ecbabd2750b2e7f4e3076ffa943f239f43dd738fe5e64e0becefc200adb31e
MATLAB
1,824
61
function [] = linkCUDAMex(lib_num, doReset) if(nargin < 1 || isempty(lib_num)) fNames = kgmlm.CUDAlib.compileCUDAMexFunc(); else [~,fNames_grp] = kgmlm.CUDAlib.compileCUDAMexFunc(); fNames = fNames_grp{lib_num}; end clear mex; [~, CUDAdirectory, CUDAlibSubdirectory, MATLABdirectory, ~, objDir, mexDir, mexS...
0d3b85a2c873fb70813d8b3d73fb829a17119d37a62f3e0d5fa3f9e826e02826
MATLAB
1,826
56
%This function creates a tethraedric mesh (.msh file) wich serves as input file for %ELMER FEM function meshgenerator2_ot(name,N_points,points,N_faces,faces,surface,label,label_tetra) %name output name %boundary differents element for elmer boundary condition (integer) %class type of element (tetr...
24d9e2b7b96f8d824246d68728db3c8778b57f3d61bf0624c5354a6dbd9378ce
MATLAB
1,826
94
function saveobjtube(fname,x,y,z,varargin) % Save a tube plot of a number of tubes as a Wavefront .obj file % % saveobjtube(filename, x, y, z) - Saves a tube plot of the tubes % in the NxT vectors. % % saveobjtube(filename,x,y,z,radius,param,subdivs,vec) - As tubeplot (see function) % x,y,z denotes the path, radius i...
ec6e58bdac011d20abc72f6533b54af9a1afdda601d5b95bf4cd4bd3b43fa714
MATLAB
1,826
66
% PURPOSE: retrieves ERPLAB's command history % % FORMAT % % erph % % INPUTS % % % OUTPUT % % displays the ERPLAB's command history, from the whole session, on the command window % % % Author: Javier Lopez-Calderon & Steven Luck % Center for Mind and Brain % University of California, Davis, % Davis, CA...
fc0a350644a11fda946cccb27ff3a9a8505f27ef47f73c459011b79f94862e6c
MATLAB
1,828
24
%----------------------------------------------------------------------- % Job saved on 06-May-2022 10:32:43 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- clear matlabbatch subjfolder = dir('F:\fMRI_QC\fm...
2a9060d983494b71de7bcc9a68a88903346b368d0b6b9c6cef6a3dcae6567046
MATLAB
1,829
58
function collectGUIHANDLES_SanesLab(handles) %collectGUIHANDLES_SanesLab(handles) % %Custom function for SanesLab epsych % %This function collects GUI parameters for the selection of the next trial, %and for pump setting % %Inputs: % handles: handles structure for GUI % %Written by ML Caras 7.24.2016 %kp 11.06.2016 ...
24c37bb68fba6dad2aa401371c3ae1dc6b54dbba3390c6f0223e554932ba1525
MATLAB
1,836
46
function [STMtx,UnitListOut] = restrictTranges(UnitList,Trange,STmultiply) % % Aleksander PF Domanski PhD UoB 2016 % aleks.domanski@bristol.ac.uk % % NB - unit timestamps are assumed to be in NLX format (100us precision) % and are convered to seconds on processing. % Takes imported (MClust-style) .t timestamps,...
5eef4fddc00e43c591db5ea0e837113c0b5c83496a1076ffa1c9697ca9675fd1
MATLAB
1,840
62
function out = create_new_example_dataset(bten, SNR_1, SNR_2) % this function allows the creation of a new example dataset with the % specified level of noise sigma1 = 1 / SNR_1; sigma2 = 1 / SNR_2; n = size(bten,1); % create the final data container out = zeros(64,64,6,n); %% define parameters and signal for a non-...
cf26866bad229e71c0db63f1a24f8a6198b211238a241360f3d54fa8f48e9b38
MATLAB
1,843
55
function LEiDA_cluster %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % LEADING EIGENVECTOR DYNAMICS ANALYSIS % % This function computes k-means clustering of leading eigenvectors % % - Reads the pre-processed LEiDA_data % - Saves the Cluster properties for a range of K % % Saves the outputs to LEiDA_k_results.mat % ...
6af61359e5b48aec65932785747ce1ac72b7016ea1e7edd37355665411c52475
MATLAB
1,847
68
function PlotDataRasters % Created 29 Nov 2017 JDY % Edited 22 Jan 2018 JDY % close all clc %---FLAGS---% Behavior = 1; subject = '253888'; % subject = '255183'; % subject = '255184'; session = 'WA'; Block = '51'; Path = '/Volumes/YAO EXHD 2/PROJECTS/AM Discrimination/Ephys/processed_data/'; Dat...
bc46ac46970086512ace7f9d747a5030653acbe0a24eb610691c9ee0f8f26b11
MATLAB
1,848
82
%% Example Plot LFPs cfg = []; cfg.linewidth = 2; cfg.channel = 5; cfg.interactive = 'no'; figure('windowstyle','docked') ft_singleplotER(cfg,visLFP,audLFP); hold on plot([0 0],ylim,'--','color',[0.6 0.6 0.6]); hold off %% Example with SPIKEs cfg = []; cfg.binsize = 0.001; cfg.latency = [0 0.5]; PSTH = ft_...
46ceadbeb8f5ca84b7850e4c5994e01e4a791b13904ad471cf682b138e8ba8e4
MATLAB
1,850
79
function StartSpikeSorting(Action,hGUI,Par) % Run spike sorting functions. This is for after preprocessing steps. % Created 22 April 2016 JDY %---FLAGS---% if nargin < 3 pname = get(hGUI.edit_pathname,'string'); subject = get(hGUI.SubjectID,'string'); session = get(hGUI.session,'string'); Par.Pname = pname; Par...
5d0ccd5919395797d03e6c68d318e94782b6fb3f179091b9aa7d23ce5998558a
MATLAB
1,854
59
% This script converts the peak train stored in ascii format (.txt) in % Matlab sparse format (.mat). This is the correct file format to run the % analysis using the developed scripts and Matlab functions. % The same directories tree are mantained. Time stamps and peak % amplitudes are stored. % % Pao...
bebc727b57789c2a287e729ca4317d09b322107123f78a59c16962e8ac63a2d2
MATLAB
1,855
49
function dists = pairdist(X,Y,nosqrt) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/09/2010 % % pairdist - Computes a pairwise Euclidean distance matrix. % % Usage: % dists = pairdist(X,Y,nosqrt) % % Description: % DISTS = PAIRDIST(X) returns a symmetric positive definite matrix DISTS % such that...
3b316fcdbe700320b93a1680263b54efc00c4b5cbc2c8cd107b2c104593b39bd
MATLAB
1,856
32
%%% Although the code should be run on a supercomputer to get Arnold tongues with a %%% good resolution, this is a test call that can be used on a local machine. %%% The predefined parameters below will generate the data for a dithering level %%% zeta = 0.15 %%% 26-01-23 first commit fpath = 'test'; %path...
65f1340302c36b8bc46889dd42166e9efb5be225c9c476a60881ed6e71b28230
MATLAB
1,856
57
%% Setup clear close all %% extract the surfaces from a nifti image of specific rois hemisphere = 'left'; nifti_paths = util.get_nifti_folders(); volumes = util.create_empty_table(nifti_paths); volumes.Variables = ... cellfun(@(x) util.read_nifti_folder(x, hemisphere), ... table2cell(nifti_paths), 'UniformOutpu...
06587442505c7289efc2d067ff2e0078674e51fe43c04060f5f56aa43208b5ca
MATLAB
1,858
73
function ph = pp_make_phys_struct( epData, t1, t2 ) % % pp_make_phys_struct( epData, t1, t2 ) % Sub-routine called by pp_prepare_format. % % Creates matrix of filtered ephys data. First, filters the entire data % stream from epData. Then extracts a window of data around each trial % onset. % % % K...
66cbb8d0adb5f2303f73e41d2794a16f3f454a41b3a13bbbaf1e443ad620a50c
MATLAB
1,859
73
function plot_spike_rf(S,P,param,cfg) % plot_spike_rf(S,P,param,cfg) % % For use with DB_QuickPlot % % DJS 2013 win = [cfg.win_on cfg.win_off] / 1000; % ms -> s % Organize by stimulus onsets ons = P.VALS.onset; TS = cell(size(ons)); for i = 1:length(ons) ind = S >= ons(i) + win(1) & S < ons(i) +...
938053184c21bfdc58e7a73fd3676d444a392b9d9d6cfbd8efc92abf00288bea
MATLAB
1,860
57
function [NextTrialID,LastTrialID,Next_trial_type] = ... aversive_trialselect_SanesLab(TRIALS,remind_row,... trial_type_ind,LastTrialID) %[NextTrialID,LastTrialID,Next_trial_type] = % aversive_trialselect_SanesLab(TRIALS,remind_row,... % trial_type_ind,LastTrialID) % %Custom function for SanesLab epsych % ...
69e5e95bcbf787b0f4079e16ad40e1d9a243e2d922a77d83caf17efe560ff943
MATLAB
1,864
54
function V = takeTimestep(V_old, J, J_old, A_new, A_old, A_J, exact, preconditioning, second_order) % This function takes as inputs the current 'state' (voltage and current % vectors) and matrices that define the numerical representation of the % problem such that: % % A_new * V_new = A_old * V_old - A_J * J . %...
e1e4ccefe4239025dcfb18a6601fba8d39e6f163076ba4083b89c44a0abcd1a3
MATLAB
1,864
48
function out = convert_1x6_to_1x21(in) % function convert_1x6_to_1x21() % % converts a tensor from a 1x6 to a 1x21 representation % % in_1x6 = [xx, yy, zz, sqrt(2)xy, sqrt(2)xz, sqrt(2)yz] % % tmp_6x6 = % [ xx*xx xx*yy xx*zz sqrt(2)*xx*xy sqrt(2)*xx*xz sqrt(2)*xx*yz % ...
af15acb119e338f5045e510439c7d680e00380dd83568c9d6e55b1cf17f5f20f
MATLAB
1,870
80
function [ comMaxAssorVec , nodMaxAssorVec ] = eval_com_assortatvity_wu(CIJ,ca) % return the maximum assortativity from Betzel % https://arxiv.org/pdf/1702.02807.pdf % make ca column vec if ~iscolumn(ca) ca = ca'; end % and autofix mat CIJ = weight_conversion(CIJ,'autofix'); % number of communities num_coms = l...
caca86d6b26b498512b39b046f589ec7b250bd4c456e1f46f895a3fae895ee52
MATLAB
1,870
60
% PURPOSE: bring ERPLAB windows back to the front after an OS-level dialog % % FORMAT: % % erplab_restorefocus(h) % % h - a single figure handle, or a list of figure handles ordered front to back % as returned by allchild(groot). Anything that is not a live, visible figure % is ignored, so callers do not need t...
abb2bba99b1eaf4d3d3937b10180301617eada3c63fb46dde4f46b924bed47d0
MATLAB
1,872
69
function reformat_tank_data_mlc(BLKS) %reformat_tank_data % Function to reformat and save ephys data from epsych program. % % Program prompts user to select TANK, then cycles through each BLOCK, % calls TDT2mat (@DJS) to reformat tank data to a matlab struct, then % saves as a -mat file in google drive fold...