sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
829ddc517d66fa2ddc8469cd3d39772a17d014a5850b8a0de4abd6fd362ece81
MATLAB
1,049
40
function [ UniqueFaces ] = UniqueFaces( Faces ) %UniqueFaces Return only one instance of each face in the input if(isempty(Faces)) UniqueFaces = []; return; end temp = sort(Faces,2); [~,ix] = sort(temp(:,1),1); tempSorted = temp(ix,:); [numFaces, dim] = size(tempSorte...
f57a01f7534778e0b7595965aecf3809d4328bc717d1dba5cdcb0c22f2d6af56
MATLAB
1,049
34
function wave = addAmplitudeProfiles(wave, Aspace, Atime) % ADDAMPLITUDEPROFILES adds separate spatial and temporal amplitude % profiles to a wave pattern % INPUTS: % - wave: X x Y x T matrix of a real or complex wave pattern % - Aspace: scalar or X x Y matrix giving spatial amplitude profile % - Atime: scalar or...
0f9ad7a02e8f95812e39c494ec26241fe4481f99c2803e0f37f2e995c39d5b17
MATLAB
1,050
45
function I = cellfind(C,pattern) % I = cellfind(cellArray,[pattern]) % % Returns index vector I of cells containing a % desired pattern. Pattern can be anything that % would be in a cell: a num, string, struct, another % cell, etc. If pattern is omitted, I returns the % indices of non-empty cells. % % Note the algorit...
288a2116f9848128c92b17a7fbecc149ed00d94c6a168a3de1df7a59d083a390
MATLAB
1,051
37
%% clear all close all run(['..' filesep 'def_local']) addpath(path_fieldtrip) ft_defaults %% allfiles = {'405','406','407','408','409','410','411','412','413','414',... '415','416','417','418','419','420','421','422','423'}; for n=1:length(allfiles) %%% load training data File_Name = allfiles{n}; l...
1c75e8d6e147f63099c7ab2c120aca94e3541bbe68ada5bdc5cd5b30b4306a93
MATLAB
1,053
34
% PURPOSE: hides the axes interaction toolbar on the given axes. % % FORMAT: % % erplab_hideaxestoolbar(ax) % % INPUT % % ax - axes handle, or array of axes handles % % % From R2025a a collapsed axes toolbar is drawn as a persistent "..." button on % top of the plot, where earlier releases showed it only while h...
a63042cdf6c639f1df861ef561c9d05f9e46bc29c432295ef8d3c988b9c19e3c
MATLAB
1,053
35
function [COctrl, COcool, SPctrl, SPcool, SOctrl, SOcool] = import_data(dataDir, file_name) % Open the data T = load(fullfile(dataDir, file_name)); fprintf('%s\n', file_name) B = T.behavior; % Remove correction trials B(B.CorrectionTrial==1,:) = []; % Filter Data by noise type and mask CO = filterData(B,[0 1]); ...
148694a15035874b9fb5f0058116c238108401b3ed539631e881794b1e894eb5
MATLAB
1,058
40
function collate_wav_stim_data() close all; set(0, 'DefaultTextInterpreter', 'none') set(0,'DefaultAxesFontSize',12) % Import wav files searchpath = 'D:\stim\Barascud_wav_files\'; searchhname = fullfile(searchpath,'*resampled.wav'); soundfiles = dir(searchhname); soundfiles = {soundfiles.name}; % rng('shuffle') ...
1e4f486e4dcd85d3be73abc3b39e5045143429eb6c0f4597d296b4068354e8d9
MATLAB
1,058
39
clipTable = project.ClipTable; revClipT = ReviewClipTable(clipTable); labels = revClipT.GetBehaviors() %% clipT = revClipT.GetClipTable() clipT = revClipT.GetClipTable('complete') clipT = revClipT.GetClipTable('incomplete') %% revClipT = revClipT.SetCurrentClip(1) currClipT = revClipT.GetCurrentClipTable() currA...
ea211a29213c3d95724eb5e8715c167cfb14ae1acf0c03c2541ce9d008b522d6
MATLAB
1,058
32
%% Function to apply skin segmentation % Input: Image in RGB % Returns: Thresholded image function [finalimg] = huelayer1(img) % Converting it into HSV after Denoising img1 = imgaussfilt(img,3); imghsv = rgb2hsv(img1); imglab = rgb2lab(img1); h = imghsv(:,:,1); s = imghsv(:,:,2); v = imghsv(:,:,3); r = doub...
1c37595733f43e48bfdfb3eb49ee4a538c89c705050c7aa1f1e6b5eaa8ab478e
MATLAB
1,061
43
addpath('../dependencies/gptoolbox/matrix'); addpath('../dependencies/gptoolbox/mesh'); addpath('../dependencies/gptoolbox/quat'); addpath('../dependencies/vtkToolbox/MATLAB'); addpath('../functions'); %% alphaEndo = 60; alphaEpi = -60; betaEndo = 0; betaEpi = 0; if ~exist('result', 'dir') mkdir('result'); en...
950f87c8f0bbb010c8f9b1891d954c51f584b0070b22b95c551f9cfba6d0a150
MATLAB
1,063
16
% REMOVE BAD CHANNELS - Execute % function [bad_channels_to_be_removed, all_amp_data_bad_chnls_removed, all_grad_data_bad_chnls_removed] = ... bst_ast_remove_bad_channels_execute(all_amp_data, all_grad_data, channel_amp_data_CombinedCutoff_logical, low_sig_range_all_channels_val_logical, channel_grad_data_CombinedC...
b0ba67894f6f2ed79e5c203d6fddae2568df98e74ca69ff5025d0a707afaa3f5
MATLAB
1,063
26
%this is a program that generates trial averages and forms clusters based %on that. Data in TimeAnalysis/XXCBDLXXDLXX. Created by Haleh Fotowat. close all clearvars path=uigetdir; cd(path) stim_type_cnt=4; % Length_trial_type=(size(F_dff_pool_all,2)/stim_type_cnt); filenames=dir('*ha_allcells.mat'); %read the non-sm...
5fbd7e8b47eceb262627a06ea98b95edca3e7af618fcd65457ed2d13b1a97230
MATLAB
1,065
40
%% function [PreFtem, RecallFtem, SpecifTem, Dice, FmeasureF] = Fmeasure_calu(sMap,gtMap,gtsize, threshold) %threshold = 2* mean(sMap(:)) ; if ( threshold > 1 ) threshold = 1; end Label3 = zeros( gtsize ); Label3( sMap>=threshold ) = 1; NumRec = length( find( Label3==1 ) ); %FP+TP NumNoRec = length(find(Label3==...
ec2a98d59a69ff87bc75e9d72dae010ddeb134b19bf3690ecd873bbca0116157
MATLAB
1,065
42
function alpha = normalizeAngle(alpha, varargin) %NORMALIZEANGLE Normalize an angle value within a 2*PI interval % % ALPHA2 = normalizeAngle(ALPHA); % ALPHA2 is the same as ALPHA modulo 2*PI and is positive. % % ALPHA2 = normalizeAngle(ALPHA, CENTER); % Specifies the center of the angle interval. % If CENTER...
8a481a28ba6174a0c3131091b99a9a5fcf5c1d999e75e126d4186d03e306ee23
MATLAB
1,066
42
function plotColor3(xValues, yValues, zValues, colorIDs, colorMap, lineWidth, alpha) IDs = unique(colorIDs); if ~exist('colorMap', 'var') || isempty(colorMap) colorMap = parula(length(IDs)); end if ~exist('lineWidth', 'var') || isempty(lineWidth) lineWidth = 3; end if ~exist('alpha', 'var') || isempty(alph...
7f30c09d759337ae968cee6dfc59718c4c587ccc58814c2a269e0d7d0928dfcc
MATLAB
1,067
33
function X = imcropmiddle(X,sizeout,preference) % function X = imcropmiddle(X,sizeout,preference) crops the middle portion of a given size % X image matrix % sizeout size of the output image if nargin<3, preference='SE'; end if length(sizeout)>2, sizeout = sizeout(1:2); end [M,N,three]=size(X); siz...
1fcabe3fac419c83404b170bc9298f139c84b497f64153ae800e9a90eacb880d
MATLAB
1,071
34
function [optMask,optMaskVect] = ridge_optimisation_mask(gmMask,funcMask,thr) % Choose pseudorandomly a fractions of voxels included in both grey matter and functional % masks % % INPUTS % gmMask = Population level grey matter mask % funcMask = Population level EPI mask % thr ...
f8bea139f4b237cb88e929a7f55a3ebeef6bc3cc2f749fafe8a9406d98e571ba
MATLAB
1,071
36
function data_epoch = ieeg_baselinesubtract(data_epoch,samples_base,varargin) % % function data_epoch = ieeg_baselinesubtract(data_epoch,samples_base,baseline_function) % subtracts the mean signal during samples_base from each epoch % % input % data_epoch: data with electrodes X epoch X t % samples_base: samples fo...
6e8a1557e85ce44f42f9bbf38a897fbb6676c309f98c7146d314ce93f6519a93
MATLAB
1,073
25
%this is a program to take the plane number corresponding to the %experimental plane and scale factor for all the fish in the pool and also the final pool %cluster data and generate CSV files to be transformed into zbrain coordinates choose folder with relevant pool data %Created by Haleh Fotowat clearvars close all pa...
82f175b98cbcc5084e16055197ccf6d45548077ce1f44e8ca83fab9cab4f481c
MATLAB
1,073
40
%% Prepare Psychtoolbox Screen('Preference', 'SkipSyncTests', 0); PsychImaging('PrepareConfiguration'); PsychImaging('AddTask', 'General', 'FloatingPoint32Bit'); PsychImaging('AddTask', 'FinalFormatting', 'DisplayColorCorrection', 'ClampOnly'); PsychImaging('AddTask', 'General', 'EnableBits++Mono++Output'); ScreenNu...
c1c0d3799806092fcf7232188b944f567615e98fb6bfd63d50237cbafb4df790
MATLAB
1,082
27
function [clu] = epochSpikeTimes_v2(clu, epocType) % EPOCHSPIKETIMES Epoching of spike times into trials (=epochs) based on events from tr struct % Change to original version: take tr from clu.trCell per unit % Inputs: % clu.spikeTimes: {1×n cell} % spike times in the session for each cluster % ...
2a34413a09a652a4868fa9bc3500b6b866c843bd9e82a9eb3da09c3e69e1262d
MATLAB
1,083
36
%uigetdir2: Select multiple directories % %USAGE: filedirs = uigetdir2 % %OUTPUT: Cell array of directory paths % %Author: Tiago (2020) %Source: https://www.mathworks.com/matlabcentral/fileexchange/32555-uigetfile_n_dir-select-multiple-files-and-directories % MATLAB Central File Exchange function [pathname] = ...
b8770c4a34f7d7cb0a71cfc42457d4f038eb3be8ac79d4446a122a60586b683e
MATLAB
1,083
30
function create_events(bidsdir, sub, ses, task, run) % below needed for HPC cluster % create a local cluster object %cluster = parcluster('local') % start matlabpool with maximum workers set in slurm submission file %parpool(cluster, str2num(getenv('SLURM_CPUS_ON_NODE'))) % add the path of the folder that...
f42862c71e2d099bbb1a5199a3bf40aa81c0e9f99bb62c062ddfc84fce84a5e2
MATLAB
1,083
36
function [surprise, distUpdate, conf_p1, unpred, p1_mean, pred_error, N_used, p1_sd] = ... get_IO_outcomes(in, s) % Return key outputs inferred by the Bayesian IO with parameters specified % in in. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ===== * ===== Optimal infer...
d3400099fd8bd736f2ee54ce483b009e92e7c59ebd0ac8da96442b757e2cf6e5
MATLAB
1,084
38
clc; clear; close all Fig3a=figure(); Ntrials_1=2000; %Ntrials_1: number of learning cycles to learn the background. %There is no embedded pattern in afferents for 2000 learning cycles. (step 1) N_mu=500; %There are 500 independent simulations (number of simulations) xax = 1:1:Ntrials_1; %%%%%%%%%%%%%%%%%%%...
216792697b095db668a4d08581b0689e9001a5e9d3d932377e7849dfff910ef2
MATLAB
1,090
38
function [RgMeans,nRg] = lme_mass_RgMean(Rgs,Data) % [RgMeans,nRg] = lme_mass_RgMean(Rgs,Data) % % Mean of the data for each region. % % Input % Rgs: 1 x nv segmentation vector containing a region number assigned % to each vertice along the surface. % Data: Any data (eg. a matrix whose colums are estimators of the co...
86ecd69142f02c54b1aae9a88a752b5b65cb3ac462290d5b90aea4157da47793
MATLAB
1,090
38
function make_config() if isfile('config.mat') load('config.mat', 'nrnBin', 'deltaQnC', 'qMaxnC', 'nbNod', 'stimStart', 'stimDur'); else nrnBin = fullfile(getenv('NEURONHOME'), 'bin'); if ~isfolder(nrnBin) nrnBin = 'C:\nrn\bin'; end deltaQnC = 0.01; qMaxnC = 120; nbNod = 21; sti...
073eb4e335dbeeab2eeb566d5e6087b69e67d6bf28aba17ec42458ea058a6f53
MATLAB
1,093
40
% Intraparietal stimulation disrupts negative distractor effects in human multi-alternative decision-making % Kohl, C., Wong, M.X.M., Wong, J.J., Rushworth, M.F.S. & Chau, B.K.H. % eLife 2022 % Script to generate Figure 3 - figure supplement 1b clear all; close all; clc; % Load estimates generated from gLME ...
5b535858abe5e8c5cb80437d00dcf1ceb37f9da9ed9b8ad89840b88e69a96d21
MATLAB
1,093
27
function usel_out=SelCells(fn,minFR,critCvBW) % Select cells from PFC and HC data sets & cut out event periods (trial case) % outputs % Tmtxs {no. trials} time axes for selected trials % iFRs {no. brain areas}{no. trials}(timerange,no. neurons) spike FR matrix % EvtLs (no...
676a6a1335b617ce8464ffbeec741764c42c649ae7f6f9c789a0e7ea1ac03688
MATLAB
1,093
37
function data_epoch = ccep_baselinesubtract(data_epoch,samples_base,varargin) % % function data_epoch = ieeg_baselinesubtract(data_epoch,samples_base,baseline_function) % subtracts the mean signal during samples_base from each epoch % % input % data_epoch: data with electrodes X epoch X t % samples_base: samples fo...
7a8f8cf3c4c05272a10cac935d166b4f08c51fc0b73af72e551da06d3080762d
MATLAB
1,096
34
%% Master-file loop clearvars; close all; clc % Select the file to analyze [pathS] = uigetdir(pwd, 'Select the folder with files to analyze'); CBF.sourceP = fullfile(pathS, filesep); % Select where to save the results [pathP] = uigetdir(pwd,'Select where to save the results'); CBF.folderP = fullfile(pathP, filesep);...
8b76671061fe018e83e5ae15d45584f21b3a5780c261789c4176d5defce1c599
MATLAB
1,096
29
function cm_data = my_PiYG( m ) % Copy of PiYG from matplotlib (diverging colormap). % From %https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/_cm.py cm = [... 0.55686274509803924, 0.00392156862745098, 0.32156862745098042; 0.77254901960784317, 0.10588235294117647, 0.49019607843137253; 0....
14b97094f20c1dfdf1ce1c001b205406dc2f095fe45d6433ee04ca2f93e19e16
MATLAB
1,097
63
function [t,n,b]=frenet(x,y,z) % FRENET Calculate the Frenet frame for a polygonal space curve % [t,n,b]=frenet(x,y,z) returns the tangent unit vector, the normal % and binormal of the space curve x,y,z. The curve may be a row or % column vector, the frame vectors are each row vectors. % % If two points coincide, the...
21eded70fe9f561f615b64dd39f8536810d017bd1a87bc6553dd9ef8c3dac773
MATLAB
1,097
42
function p = getPosition( o, u ) %getPosition Get position of graphics object % % p = getPosition(o,u) gets the position of a graphics object o with units % u. % % In contrast to getting the Position property directly, this function % honors the ActivePositionProperty of axes. % Copyright 2009-2020 The ...
0c483faa88195cb2c8bf8502e3595aa43bb49836cbfa7a46ee16caf0642c9561
MATLAB
1,098
45
clc; clear; close all Fig4a=figure(); Ntrials_3=60000; %Ntrials_3: number of learning cycles to learn the background. %There is no embedded pattern in afferents. %(Note initial conditions in this step are from step 2.) N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simul...
1c708a0faa0343f29951d20107fcc3c83d6c25f3380772504647ca9a3afa190a
MATLAB
1,098
56
% PURPOSE: resolve the read/write path for ERPLAB's editable completion message % % FORMAT: % % filename = erplab_msg2end_file(action) function filename = erplab_msg2end_file(action) if nargin < 1 || isempty(action) action = 'read'; end paths = erplab_user_paths; action = lower(action); switch action case '...
dd509da63d453a17c57005e15396771fd4e40e7b2d89f2de7d2ec52c46a11331
MATLAB
1,099
38
function PreprocessingWrapper clear all close all clc % Run full processing workflow. Take data from raw (epData) format, % through automatic spike sorting steps. % % Note: user input is required in the middle, to select clean trials. %%%%%%%%%%%%%%%%%%%%%%%% %---FLAGS---% Subject = '255183'; Session = 'GA'; ...
0055a29b23f3dc18fefe1b90b002c2a69340574d5f83161e47b6b4ab7fcd9565
MATLAB
1,101
44
function [data] = logistic_regression_data_generator(n, d) % Data generator for logistic regression problem. % % Inputs: % n number of samples. % d number of dimensions. % Output: % data data set % data.x_train train data of x. % data.y_train tr...
3a0e20e85a4dbb6c997a891fe476131c4935a410d345e019b07e8ee4fea1c3d8
MATLAB
1,102
43
% This function is written to check if the string of interest exists in the parent structure %Author: Guanghui ZHANG--zhang.guanghui@foxmail.com %Center for Mind and Brain %University of California, Davis %Davis, CA %Feb. 2022 % ERPLAB Studio function count = f_findstring(Parent_Structure,String_checked) ...
9ba48bd214dab4cc815cc5788b3d3a4f4539af157e8804ac69d27db9c11d7c2c
MATLAB
1,104
42
function [ph] = SU_PSTH(spkCell,msSmooth, startBinT, endBinT) %plotSpikePSTH Function to plot smooth PSTH from spike time data % Detailed explanation goes here binWidth = 0.001; % in seconds, bin to milliseconds edges = [startBinT:binWidth:endBinT]; % % tmp = cell2mat(spkCell); % nTr = size(spkCell,1); % [N,~] = hi...
23544009e464da05fcbdd964ec58ea65a824397c1b46daee02a140b53ba20725
MATLAB
1,105
24
function plottpcellalignment(cellnames1, cellnames2,changes1,changes2,pvimg1,pvimg2,dirname1,dirname2,drift1,drift2,rowsperpage); if strcmp(computer,'PCWIN'),maxcolors = 256; else, maxcolors = 1000; end; pvimg1 = rescale(pvimg1,[min(min(pvimg1)) max(max(pvimg1))],[0 maxcolors]); pvimg2 = rescale(pvimg2,[min(min(pvimg...
05f9288cd11e04f2ab68971e0519494df3a511a389c453909fa220ba7101ac96
MATLAB
1,106
40
function design = designMatrix_dummy(cfg0, group) % [design] = designMatrix_dummy(cfg, G) % Returns a design matrix using dummy coding for the groups. % % G Array of length N, where N is the number of trials, that contains the group each trial % belongs to, as identified by a unique numbe...
86101b6836da944174f7d815016060077cf610c693f482c1ce7f5184b3af8718
MATLAB
1,107
47
function hist = updateHist_SanesLab(TTLstr,hist,handles) %hist = updateHist_SanesLab(TTLstr,hist,handles) % %Custom function for SanesLab epsych % %This function updates the TTL history for plotting purposes % %Inputs: % TTLstr: String identifying the TTL % hist: vector containing TTL high/low history % handles...
dfae68e370ed6cad5e487b5972bbcf540a21b7ba01388ea0e07c700a8f43575e
MATLAB
1,108
32
function [vSound] = ComputeTimbreStim(formants) % % Creates vowel or click train % % Includes attenuation and envelope of sounds global gf if sum(formants)>0 vowel = newMakeVowel2009( gf.duration/1000,... gf.fStim, ... gf.pitch,... ...
4f54fdd6136eb54e7a30051759151345bab6722c2807e561ed6b5d75efbdfcb1
MATLAB
1,109
47
function [y] = filtfast(x,dim,i,ftype,fsize) %author: V Wyart %edits: N Myers (added Butterworth filter) if nargin < 5 error('Missing input arguments!'); end if dim > ndims(x) error('Filter dimension exceeds input dimensionality!'); end if isempty(i) i = 1:size(x,dim); end fungaussian = @(...
636a2b693e70823bc0b36ca9f0f019126be7e1dea8de4596c1ceacac4a68244c
MATLAB
1,111
33
function [LabelStrout, LabelColors] = f_MarkLabels_gridlocations_ERP_Waveiwer(Gridata,usedIndex,AllabelArray) % Builds the plain-text label list and a parallel per-row color (for % addStyle 'FontColor') shown in ERP_layoutstringGUI's labels table: % blue = unused in the grid % red = used more than once in the gr...
150ffa883fa80b29ed599f6a7e6711f217d00f29110b4dcdf4316eec21b4324b
MATLAB
1,112
30
function c = censored( tau_c, M, T ) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % censored - returns the expected false negative rate due to censoring % % Usage: % c = censored( tau_c, M, T ) % % Description: % Estimates the percent of a cluster that is lost due to censoring. ...
d87784eb827205d69ba3c10cbb9759e1d657e5f2b57e53ebdfef27a82846434d
MATLAB
1,112
34
function [mag_eq,phase_eq] = MacDonald_equalize(filename) % This matlab function will return the inverse of the minimum phase, mpeq, % and the inverse of the allpass, apeq, of a measured impulse response. % Filename is the name of the text file that includes the impulse response. % % MacDonald & Tran, 2007, Loudspeaker...
704d05f5b81a5e7edb927090b1210d0202ca7d51e79c4b323b961f386c5fd4ee
MATLAB
1,113
28
function spiketimes = unwrap_time( t, tr, dur, spacing) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/08/2010 % % unwrap_time - convert from within trial time to absolute time % % Usage: % spiketimes = unwrap_time( t, tr, dur, spacing)% % Description: % Takes a list of spike times relati...
b9f234b97e538b45ee58a4be91311b57b9f6a15adcfdc75035031c4c973d0b7a
MATLAB
1,115
31
function analyzetpstack_setChanges(ud,fig,i,newchanges) % ANALYZETPSTACK_SETCHANGES - add a change to a cell's parameters, such as movement, not present, etc % % Note: sets userdata of 'fig' if ~isfield(ud.celldrawinfo,'changes'), ud.celldrawinfo.changes = {}; end; gotChanges = 0; if length(ud.celldrawinfo.changes)<i,...
73727c6a667f5700816a54144cbce3eba235c500a55a1da68adefc38a74959e1
MATLAB
1,116
41
clc;clear;close all; Fig9c = figure(); N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simulations) N_trials=5000; %number of learning cycles %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
f07e4834ff4801da2ad59d49212eb16b7f388254207fa9e64d68f11306bdcfd6
MATLAB
1,116
36
function evaluate_clustering % % Function to evaluate the clustering results from the 1821 voxel space % % % I would have to recluster to 2-10 to do this % PROJECT='/Users/HDF/Dropbox/Fran/Academics/PhD/matlab/projects/COBRA_COMPLEXITY_PHASE_FD/'; HCP_PROJECT=[PROJECT 'RUN2/']; Cmax=9; % only clustered 2-10 for RUN1 ...
011c19c6626cc5955136178a0ad91c1d158f001b16acda5b86edb251d2e1836a
MATLAB
1,117
29
%% PairStrings='AB'; audioTypes={'SWS.wav','_voc_6Bds.wav'}; stimlist_filename=[stim_path filesep 'list_stimuli_102018.csv']; delimiter = ','; formatSpec = '%q%q%q%q%q%q%[^\n\r]'; fileID = fopen(stimlist_filename,'r','n','UTF-8'); if ~ismac StimList = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'ReturnOnEr...
a21fa3770deb24a2aa4154804a94a7c47f0d0743e17d910fcf9ee8613a293c20
MATLAB
1,117
29
function [A_new, A_old, A_J] = prepareNumerics(K, M, dt, second_order, lumping_factor) % This matrix takes an input stiffness and mass matrix as well as the % desired timestep (assumed fixed) and creates instead a problem expressed % as: % % A_new * V_new = A_old * V_old - A_J * J % % that represents the diffusiv...
f5dc9a2ec2aefb782ed260c70be646763db3cfb11206f58f2c7a6a4484d6a559
MATLAB
1,118
46
function [ W ] = Window( Image, X, Y, Radius ) %WINDOW A helper function which returns an array of pixel values %surrounding a target coordinate in the passed image. %Window returns a 1D array of intensity values neighboring the %passed coordinates. If the window passes the boundaries of %the input image the window i...
e2460667b363da311c7686e04c4993eb6b7d209aeed89127c9537c87bd79273a
MATLAB
1,119
43
function [x,y] = cellname2position(exppath, cellname) % CELLNAME2POSITION - get a position of a cellname in a vhlab 2-photon experiment % % [X,Y] = CELLNAME2POSITION(EXPPATH, CELLNAME) % % Finds the position of a cell with a given CELLNAME in pixels. % % Example: % % if S is an ndi.session % e = S.getelements()...
67c73a390d35eef91efd2bbdce68dc8b55b0f4dde9c69e8b6ef87d92e3f713f6
MATLAB
1,122
43
function handles = setupIOplot_SanesLab(handles) %handles = setupIOplot_SanesLab(handles) % %Custom function for SanesLab epsych % %This function sets up the GUI input-output plot axes and options % %Inputs: % handles: handles structure for GUI % %Written by ML Caras 7.24.2016 global RUNTIME ROVED_PARAMS %Setup X...
c22e95ba621a615954642773e3530b32b5b8bdec508af8661c5f679e4771c0da
MATLAB
1,125
65
function tvreg_smoothen(fn, sampling_frequency) zs_f = load([fn '_zs.txt']); [nNodes, nSamples] = size(zs_f); %% smooth_f = nan(size(zs_f)); noise_power2 = nan(1,nNodes); acc_power2 = nan(1,nNodes); for i = 1:nNodes my_noisy_f = zs_f(i,:); [my_smooth_f, ~, ~, optimal_alpha, noise_power, acc_power] = ... ...
759c8f8439cbdceac35f7f875ec14a497b42312ec61d5c2034226d3b30d7dd9f
MATLAB
1,126
47
function collate_wav_stim_info() close all; set(0, 'DefaultTextInterpreter', 'none') set(0,'DefaultAxesFontSize',12) % Import wav files searchpath = 'D:\stim\Barascud_wav_files\'; searchhname = fullfile(searchpath,'*resampled.wav'); soundfiles = dir(searchhname); soundfiles = {soundfiles.name}; % rng('shuffle')...
21eb261f73e409750a3e1536a208329f6290df2127d5c6894e64e03c47e85278
MATLAB
1,127
56
function fit1 = fitness_soea45(A1, paramsvec, eegdata1, paramstoest, T1,tcut, fhz1) paramsinput = [paramsvec, zeros(1,10)]; paramsinput(paramstoest) = A1; % load in the data to fit against eegautocor = eegdata1{1}; z = eegdata1{2}; z2 = eegdata1{3}; a4=[]; parfor RunIter = 1:5 % run 5 times for stability: - t...
51d65152101898419c070a49619b29cba076dccf3ebdcc5c272e8838e96f6b1b
MATLAB
1,128
37
function [DataEMGfilt, samplesEMG]=filterRawEMG(address,ID, run, opt) in_EMG=[address '\EMG\' ID '\' ID '_S1R' int2str(run)]; load(in_EMG); if ~exist('opt','var') || isempty(opt) opt.order=5; opt.fc=10; end %% nocht Fs = samplingFreqEMG; Fo = 50; Q = 35; BW = (Fo/(Fs/2))/Q; [b,a] = iircomb(Fs/Fo,BW,'notch...
7eb5f9d369469e1f82669758f567e90ebe8b0f53ebd4e7e65e8786f53e01191e
MATLAB
1,129
48
function [adj_mat] = get_seg_spatial_adj(seg,vals,conn) % given 3-D segmentation, find regions that are adjacent % uses the function findNeighbours found here: % https://www.mathworks.com/matlabcentral/fileexchange/68549-findneighbours if nargin < 3 conn = 26 ; end if ~ismember(conn,[ 6 18 26 ]) error('conn ...
e2f1bd9a5ba115f3f29dc33bb36c0bb800dc4018d34ee3e84907209c6d79a905
MATLAB
1,129
45
function [FA, AD, RD, ax_dir, FA_col] = compute_lamda_params(d,siz) % function compute_lambda_params() % % helper function to compute parameters from a second order tensor's % eigenvalues % FA = zeros(size(d,1),1); AD = zeros(size(d,1),1); RD = zeros(size(d,1),1); ax_dir = zeros(size(d,1),3); FA_col = zeros...
56f8acd81b792b4a92e4c49dbf0aeaa021b84e839b5ca884d0258928b224ebb5
MATLAB
1,132
43
%% function [PreFtem, RecallFtem, SpecifTem, Dice, FmeasureF, IoU] = Fmeasure_calu(sMap, gtMap, gtsize, threshold) %threshold = 2* mean(sMap(:)) ; if ( threshold > 1 ) threshold = 1; end Label3 = zeros( gtsize ); Label3( sMap>=threshold ) = 1; NumRec = length( find( Label3==1 ) ); %FP+TP NumNoRec = length(find(L...
0773d41d4f46149ef25933a3b6fb6328af456a7e5305babafefb18ccd324277b
MATLAB
1,134
47
%% Load model net = importSleepNetHybrid() %% Predict sleep stage net = importSleepNetHybrid(4); % load validation data for model 4 load('sleep_net_validation_data','-mat','X_test_4','Y_test_4'); % WARNING: Inputs need to be z-score normalized X = normalize(X_test_4); % classify() returns class labels instead of p...
4879cce9aec38cbde06a9d414c33e8a771ca80702662c5df32051ac52fb14506
MATLAB
1,134
52
%% cd(dataPath); load(fileNames(len).name) fprintf('loading session : %2.0f\n',len) %% clear epochedFF TrialCount=1; epochedFF=nan(length(StoreType),sum(Iscell),161); for exp =1:length(StoreTimes) Ff=StoreFF{exp}; TrialTimes = StoreTimes{exp}; CaTimeStamp=StoreCaTimes{exp}; for trial=1:length(TrialTim...
cf83f334c6f93ac3f67f6e30191a4663d42dbf5ceec11f4f98eceb0edd24cb08
MATLAB
1,134
40
function [rgr, out] = tp_sydney_red_green_ratio(dirname) % TP_SYDNEY_RED_GREEN - compute red/green ratio for Sydney Padgett's data % % OUT = TP_SYDNEY_RED_GREEN_RATIO(DIRNAME) % % Given an experiment directory, return the RED/GREEN ratio from a set of cells that are % defined in t00001 (green) and exist in t00002 (red)...
f802c520e19e4d12d25392e801a656e3427baba1b21901244cddcc6e101662dd
MATLAB
1,136
55
function handles = loadGUISettings_SanesLab(handles) %handles = loadGUISettings_SanesLab(handles) % %Custom function for SanesLab epsych % %This function loads GUI settings from a *.GUIset file % %Inputs: % handles: GUI handles structure % %Written by ML Caras 8.3.2016 %Get the path name from the preferred directo...
44c9a05d22a32cbf277bc259a47eca243a36fb70bbf0ddb1f6ad98614b15aa23
MATLAB
1,138
35
function test_my_colormaps( ) % Display the colors of some colormaps. % -- test a hand define colormap for curves n_colors = 64 ; % 14 ; cm_data = viridis(n_colors) ; %my_blues3(n_colors) ; cm_data = parula(n_colors) ; cm_data = redblue(n_colors) ; % magma, viridis, inferno, plasma, my_PiYG fig_tmp =...
be8f0a47cab6e8028c8f91fe2cb08079f30ae14153119728747b1c2ba9d228c8
MATLAB
1,138
39
function [response_bias] = ... wrap_modelfun(modelfun, stimulus_azimuth, ... probe_FP_azimuth, does_use_saccades, fitted_parameters, ... AV_stimulus_azimuths, AV_FP_azimuths, AV_biases) %UNTITLED Summary of this function goes here % Detailed explanation goes here if size(AV_stimulus_azimuths, 1) ~= ...
d56dd933c2977872af9f4a8e7e5712ecb791832a37b7a27dbaf719fecaf33ecc
MATLAB
1,139
67
function [DA,TDT] = SetupDAexpt(tank) % [DA,TDT] = SetupDAexpt % [DA,TDT] = SetupDAexpt(tank) % % Used to initiate an experiment with OpenEx % % If the input, tank, is omitted then a prompt will appear to select or % create a tank. % % DA is an ActiveX object that controls an experiment designed in OpenEx. % % TDT....
6ef8b5220806336101edb49e91522701e9ab1fa500b70bae70fe3a29f5107a70
MATLAB
1,141
59
% PURPOSE: store ERPLAB session-only state in root appdata % % FORMAT: % % value = erplab_session_state(action, field, value) function output = erplab_session_state(action, field, value) output = []; state_key = 'ERPLAB_SessionState'; if nargin < 1 help erplab_session_state return end action = lower(action)...
c07272e7a4929677d3df0a07ff27e5d09dc263d4e54129f9a9c4e4d56dd1f49c
MATLAB
1,141
31
function show_some3d(folder, n, ratio, cmap, savefig, save_path, save_name) img_names = dir(folder); assert( length(img_names) >= (n+2)); figure; set(gcf, 'Units','pixels', 'Position', [0, 0, 400*n, 600]) for i = 3 : n+2 axis equal; img = imread3d(fullfile(folder, img...
50d6ec693866e8a78d77dfc9082ceb880d2f8adf8525c805941187a871e96eb1
MATLAB
1,145
39
function [SelPerAS, Sel_sPerAS] = selectivity_all_AS(model, Q, iActiveSites) arguments model (1,1) Model Q = linspace(0, get_max_threshold(model)); iActiveSites = []; end fascIdsByAs = load_active_sites(model.paths); if isempty(iActiveSites) iActiveSites = 1:size(fascIdsByAs, 1); end % Com...
290872bd6c6b9432573fd15929ac0b3b89e2e65438d502e9c7cf081990d9ed2f
MATLAB
1,146
37
function Spikes = pp_save_manual_sort( subject, session, Spikes, channel, spikes ) % % pp_save_manual_sort( subject, session, Spikes, channel, spikes ) % Incorporates the manual changes from splitmerge tool into the Spikes % struct, changes flag to indicate channel has been sorted, and saves % the updated fi...
9581bf705c5a15ff84014ad1e02fe89617dec5ea3415334d218f80c5417a392c
MATLAB
1,148
43
function escapedStr = strescape(str) %STRESCAPE Escape control character sequences in a string. % STRESCAPE(STR) converts the escape sequences in a string to the values % they represent. % % Example: % % strescape('Hello World\n') % % See also SPRINTF. % Copyright 2012 The MathWorks, Inc. escapeFcn =...
6f4de893a6420e7238dfa831e9d8e302fab4b96449ef04411a2ef66feb2c948b
MATLAB
1,150
33
function dist=KLDiv(P,Q) % %% This function has been adopted from the following GitHub repository: "https://github.com/cds-swinburne/Hartoyo-et-al-2019-DATA-n-CODE." % dist = KLDiv(P,Q) Kullback-Leibler divergence of two discrete probability % distributions % P and Q are automatically normalised to have the s...
39c4976407b91d9cd47d6eb772d0f92f8c418ba3b03fb783a2c5ea392a2f358c
MATLAB
1,152
53
function out=trimstd(data,percent) if percent<1; disp('multiplying percent input by 100...'); percent=percent*100; end npnts=length(data); nppnts=round(npnts*(percent/100)/2); srtdata=sort(data); %Windsorize... srtdata(1:nppnts)=srtdata(nppnts+1); srtdata(npnts-(nppnts+1):end)=srtdata(npnts-(nppnts+1)-1); ou...
56757aeec9a6368e5f826ca1788fbe32c61b3c0ba73bb0b9686aedc728ba81fb
MATLAB
1,153
40
function V = load_potential(model) log = model.getLogger('potential'); %% Get fiber population coordinates and parameters [fascIdsByAs, activeSites] = load_active_sites(model.paths); %% Place fiber segments if isfile(model.paths.fiberCompart) fibersCompart = load_fibers_compart(model.paths); log.info...
e1a808c0458eed0b32e880fc8901788503fe9c598c22b8b1cea8c4045797dd8c
MATLAB
1,153
49
function [IND,Genes,Genes_compressed] = findActivatedPoints_gradCAM(Data,inputSize,net,Dmat,Threshold,FIG,Sample) im = cat(3,Data.XTrain(:,:,:,Sample),Data.XTrain(:,:,:,Sample),Data.XTrain(:,:,:,Sample));%imread('ngc6543a.jpg'); imResized = imresize(im,[inputSize(1),inputSize(2)]); scoreMap = gradCAM(net.trainedNet,im...
6230754ab4f31a9f03376dcc10b238a9931460894fa4aaa93948e999f7378d65
MATLAB
1,156
53
function varargout = TrialFcn_PumpControl % Custom function for SanesLab epsych % This function sets and controls a New Era-1000 Syringe Pump. % % % Daniel.Stolzberg@gmail.com 2014. Edited by MLC 7.22.2016. disp('CONNECTING TO PUMP...') %Create a serial connection to the pump pump = serial('com1','BaudRate',19200,'D...
6c44c84383b5ed271e1ab20a62ebd76631640ca0e357513b39b96c635214f0b5
MATLAB
1,158
23
erplabstudiover = '12.01'; % current erplab studio version erplabstudiorel = '03-June-2025'; % DOB erplabstudiodeveloper = 'Simmons,Zhang,Garrett,Winsler'; % erplabstudiolabel = 1;%0: using ERPLAB; 1:using ERPLAB Studio %ColorB = [170 180 195]/255; % old background color (until ve...
19312a38df9c74043db0dd7257615329659006c4340c51aebfc5770376c264e0
MATLAB
1,159
36
function [fNames, fNames_grp] = compileCUDAMexFunc(lib_num) fNames_grp = {["kcGMLM_mex_create.cpp", "kcGMLM_mex_clear.cpp", "kcGMLM_mex_computeLL.cpp", "kcGMLM_mex_computeLL_async.cpp", "kcGMLM_mex_computeLL_gather.cpp"], ... ["kcGLM_mex_create.cpp", "kcGLM_mex_clear.cpp", "kcGLM_mex_computeLL.cpp"]}; ...
46aaa4668cc83e10ac4fc289173c3c1c344ea9d941b6554722d9e43c7e78180f
MATLAB
1,159
41
function M = ConvPixel(FVec,xp,yp,A,B,Base,FIG); % M=ConvPixel(FVec,xp,yp,A,B,Base,FIG) if nargin==6 FIG=0; end n=length(FVec); % Plot in pixels M=ones(A,B)*Base;%zeros(A,B);%(-50000)*ones(A,B);%zeros(A,B);%(-30000)*ones(A,B);% for j=1:n M(xp(j),yp(j))=FVec(j); end % if (xp,yp) has some duplicates then value ...
66e148900bd21fb6fa82b0e1e9b9fee7673bee2e50b162499f52c67b80d34aee
MATLAB
1,160
44
function c = fcn_mst_plus(a,dens,dist) % compute threhsold with minimum spanning tree and edges added to reach % certain percent density % inputs: matrix, density [0-1], distance transformation (inv, minus) % outputs: binary mask to do thresholding % written by Rick Betzel, Josh Faskowitz additions, Indiana University,...
7e66669ccbb03e40ff8745a74103810276d4335549ba85bd332dfba47751acfa
MATLAB
1,161
45
function [signalOut,spatfiltmatrix] = ieeg_car(signal, chans2incl) % This function performs Common Avregae Reference (CAR) filtering on a % signal % % Inputs: % signal = time x channels % chans2inc = channel indiced to include in common average reference % % Outputs: % signalOut=signal*spatfiltmatrix; % % ...
f103e8d1bb192cbf1976269fe9bbb2332e29a871cdd92e66f82392944b2c27d5
MATLAB
1,162
35
function count_ep_kept() % Check the nb of epochs kept for the analysis (after epoch rejections by % visual inspection, amplitude criterion & possibly removing 10 first ep). % Nb of ep kept saved in TSL_analyze_EEG.m w/ save_ep_kept = 1. folder_fn = './results_EEG_lica/data/' ; %folder_fn = './results_EEG_lic...
babda20cc677fcb4e9757e58174eceebf5bdce7cf0ece06ca8f76a8d0cd41217
MATLAB
1,163
38
%% clear all close all run(['..' filesep 'def_local']) addpath(path_fieldtrip) ft_defaults %% load wsws_badComps_test allfiles = {'405','406','407','408','409','410','411','412','413','414',... '415','416','417','418','419','420','421','422','423'}; for n=1:length(allfiles) %%% load test data & components...
d35418dbeb906853a9f2ff01fc04d26bba185f2fe9c4aaee539662705d6c476e
MATLAB
1,164
52
function [maxD,meanD,K] = genmodel_dist_bin(aij,bij,d_aij,d_bij) % the distance function from generative modeling paper % enforce binary aij = aij>0 ; bij = bij>0 ; % note the binary functions evalfuncs = cell(4,1) ; evalfuncs{1} = @(a_) sum(a_,2) ; evalfuncs{2} = @(a_) clustering_coef_bu(a_); evalfuncs{3} = @(a_) be...
5117ba706c5dc05dc99342c2576fd259aea300cb24cf152e23db6ef7f7619e88
MATLAB
1,168
53
% This function is to remove calibration when importing ERPSS files % % Author: Guanghui Zhang & Steven Luck % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2022 function ALLERP = f_erp_remv_Calibrate(ALLERP, ERP_index) if nargin<1 help f_erp_remv_Calibrate return end if nargin<...
9686122aa1997d751b9736acb57ee8189c06e73ee7cbb1177fef60e13202a961
MATLAB
1,168
35
plotDir = 'C:\Users\fciotti\OneDrive - ETH Zurich\HEN\recr_extr_plotsCOMPLETE\'; f = load([plotDir '3_36-70.mat']); f(2) = load([plotDir '3_1-35.mat']); f(3) = load([plotDir '1_71-105.mat']); f(4) = load([plotDir '1_36-70.mat']); f(5) = load([plotDir '1_1-35.mat']); f(6) = load([plotDir '3_71-105.mat']); re...
2046ee880fae7397763e6742fb518a9331377544df98ceeea76c20edc34d588e
MATLAB
1,169
31
% https://github.com/emilmont/Artificial-Intelligence-and-Machine-Learning/blob/master/ML/ex1/featureNormalize.m % function [X_norm, mu, sigma] = featureNormalize(X) %FEATURENORMALIZE Normalizes the features in X % FEATURENORMALIZE(X) returns a normalized version of X where % the mean value of each feature is 0 an...
219e0200b1f17b26afeb61fb93c91c64bc950c13b5eb20babd502f93a0e1282d
MATLAB
1,169
37
function corr_dist = get_pce_dist(res_list, idx_list, img_size) % This function compute pairwise PCE correlation among a bunch of fingerprints. % INPUT: % res_list A list of residual paths % idx_list A list of tuples, each tuple includes residual indexes that forms a fingerprint % img_size image di...
4f7f7a264ab9de1b3569379c03a0ccfa4bd6e41f465d10d4d0180e60c2986733
MATLAB
1,169
38
clear; Original_image_dir = 'E:\dataset_denoising\'; write_MAT_dir = ['C:\Users\csjunxu\Desktop\RID_Dataset\']; eval(['cd ' Original_image_dir]); d = dir; for i = 1:length(d) if ( (d(i).isdir == 1) && ~strcmp(d(i).name,'.') && ~strcmp(d(i).name,'..') ) filepath = d(i).name; write_sRGB_dir = [...
7fbce7f29c8075952d4b6b4fe63ec58c993d3f44304a682d1bd8e433ba4ae888
MATLAB
1,170
41
function delays = plotLags(w,lags) nMice = numel(w); % get the average across mice--interpolate in case not all the same time % bins? % take the first one as reference delays = nan(1,nMice); lagsRef = lags{1}; wMean = nan(numel(lagsRef),nMice); for k = 1:nMice wMean(:,k...
ff3195db6ba613495ba81f0f658894f6bf65f087c7cfc584531afae72f607b50
MATLAB
1,179
55
function [] = boot_plot(x,y,bootIter,extend) if nargin < 3 bootIter = 1000 ; end if nargin < 4 extend = 0 ; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % add ones for intercept X = [x ones(size(x,1),1)] ; %% full regression [fullreg,~,~,~,stats] = regress(y,X) ; disp(...
ee10fbd1a7f0e696193d30994111d0fd52eff9b69a49037df5688aa9e25272c2
MATLAB
1,182
42
%this is a program to take the plane number corresponding to the %experimental plane and scale factor for all the fish in the pool and also the final pool %cluster data and generate CSV files to be transformed into zbrain coordinates choose folder DMDLBRDLCB_allbrainspoolPL %created by Haleh Fotowat clearvars close all...
714be222d3a140039c7d59026088ebcea2d6986a3722ecf70b3edc42564ebf5e
MATLAB
1,183
38
function all_params_RW = get_all_params_RW() % learning rates, in [0, 1] all_a = 0.05:0.05:1 ; % 20 values; 3*21: 63 all_a = [0.005:0.005:0.04, 0.05:0.05:(1-0.05)] ; % 27 values all_a = [0.005:0.01:(1-0.05)] ; % 95 values all_a = [0.005:0.005:0.04, 0.05:0.01:(1-0.05)] ; % 99 values n_a = length(all_a) ; all_l...
fcfac7ff1eec6432ebc6accdfdc7c02eedb5b7efc7aa486f2469370c05c08cff
MATLAB
1,183
44
function [] = setupComputeStructuresHost(obj, reset) if(nargin < 2) reset = false; end if(~isempty(obj.LL_info) && ~reset) return; end trs = obj.trials; obj.LL_info = struct(); obj.LL_info.X = cell2mat(reshape([obj.trials(:).X], [], numel(obj.trials))'); obj.LL_info.Y = cell2mat({trs(:).Y}'); obj.LL_info.bin...
9e783ac8a025a631f18d2628f58e2bb3b521b468d5b103450b9125beefd7576d
MATLAB
1,186
41
function fname = tpconfigfilename(dirname) % TPCONFIGFILENAME - Name of the PrairieView configuration file % % FNAME = TPCONFIGFILENAME(TPDIRNAME) % OR % FNAME = TPCONFIGFILENAME(TPCONFIGFILE) % % If TPDIRNAME is a directory, then READPRAIRIECONFIG determines % the name of the config file. If TPCONFIGFILE is a f...