sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
27316bdc86f0e31e9653b71d9110c92bf0cbbf769391c917cab4ae9743b93cc3
MATLAB
1,065
41
function [distance_1,distance_2,distance_3,distance_4,distance,touch_idx,hit]=distance_base_from_matrix(Data,idx_correct) touch_idx=[]; hit=[]; counter=1; idx_correct_1=Data.correct_trials; touches_whisker=Data.touch_per_whisker(idx_correct,:,:); Data.distance_matrix=Data.distance_matrix(idx_correct,:,:); for tria...
3aad3c2d0c6d7df3e0371362d737fe8a065254d6b58a45ba0d0f131410cb7354
MATLAB
1,065
32
function TR_ExportData(File, Experiment, Type) if Experiment.NumGrps>0 Xstr = cell(Experiment.NumGrps); Data = cell(Experiment.NumGrps); for g=1:Experiment.NumGrps Group = Experiment.Groups(g).Group; Xstr{g} = Group.Name; %sprintf('%g',g); Data{g} = nan(Group.NumRecs,1); for...
9a38edaad4636df0b07000413112c0944232c0c0e42dd74edfbf99dbc706371f
MATLAB
1,065
41
% VL_DEMO_KMEANS_VS_BUILTIN clear elaps energy ; dimension = 128 ; numData = 1000 ; numCenters = 10 ; numTrials = 10 ; for trial = 1:numTrials X = rand(dimension, numData) ; tic ; [idx, C, e] = kmeans(X', numCenters) ; e = sum(e) ; elaps.builtin(trial) = toc ; energy.builtin(trial) = e ; tic ; ...
f6aaadbb85d62cc9ba38cd1cf6f7a3794b7617d79f9eb20c1d079e2494b2aa03
MATLAB
1,065
32
function NS_ExportData(File, Experiment, Type) if Experiment.NumGrps>0 Xstr = cell(Experiment.NumGrps); Data = cell(Experiment.NumGrps); for g=1:Experiment.NumGrps Group = Experiment.Groups(g).Group; Xstr{g} = Group.Name; %sprintf('%g',g); Data{g} = nan(Group.NumRecs,1); for...
13b44f6116d678806e51ca7cd5ff439759139662265793577fa0c7cb94224a99
MATLAB
1,066
36
function [] = ExtDataFig10_NT() % Code for plotting neurotransmitter predictions in Extended Data Fig. 10a. %% parameters pIP10 = [13417,13038]; % pIP10 (L, R) pMP2 = [11977,11987]; dPR1 = [10267,10300]; % dPR1 TN1A = [15521,16465,15148,12883,16207,... 16113,14581,14810,15387,17640,... 13945,14401,13928,16391,...
28c266d82151dea254ef688300568dbe95cbb4c08babe551dc3e0fd16e955cc0
MATLAB
1,066
42
function chr = getTrainingData(dataname) %List of human chromosome lengths chrLen = [249698942 242508799 198450956 190424264 181630948 170805979 ... 159345973 145138636 138688728 133797422 135186938 133275309 114364328 ... 108136338 102439437 92211104 83836422 80373285 58617616 64444167 ... 46709983 518575...
af13c87a9f35bbdf66ef76baa0fb726adba544e911634bdac9b08846f551c54d
MATLAB
1,066
28
function status = fillPatientInformation( obj, data ) % Fill patient information % % Syntax: % status = FILLPATIENTINFORMATION( obj, data ); % % Input parameters: % * data - data from json file(s) % % % Example: % status = FILLPATIENTINFORMATION( obj, data ); % % Available at: https://github.com/NCN-Lab/DBScope ...
b71f8918ef4621d1840f4d8d2a61097bf4ba4cffb170ed6b4aa2e658d7e7e254
MATLAB
1,066
30
% This script does stl to MATLAB format conversion. Note that the double % points are preserved! Also, performs conversion from mm to m if necessary! % Copyright SNM 2017-2019 [~,name,~]=fileparts(pwd); L = length(name)+1; if ~isunix s = pwd; addpath(strcat(s(1:end-L), '\Engine')); else s = pwd...
ec8e3a10bdc06c0ecb1d638a34b2e2f9f2bf3e7dd5aa65d715ae4f999939d8da
MATLAB
1,066
39
function B = mymedfilt3(A, filterSize, padopt) % my 3D median filter without mex if nargin < 2 filterSize = [3, 3, 3]; padopt = 0; elseif nargin < 3 validateattributes(filterSize, ... {'numeric'}, ... {'real','positive','odd','integer','vector','numel',3}, ... mfilename, ... '[m n p]'); ...
8c063838eaad14cd8bca36865724d0b6a2679d22143e09eaed5f84d5325254cf
MATLAB
1,067
19
function scopecam_cnmfe_run( obj, session, trial ) %Remove any previous results otherwise it requires user interaction oldCnmfeFolder = fullfile(trial.getAnalysisDirectory(), 'msaligned_source_extraction'); if isfolder(oldCnmfeFolder) rmdir(oldCnmfeFolder, 's'); end % Run the CNMFE mlvid...
cb9fe156c8615df9790aada864dc791c9dec134ec3004df92861c860a6143a19
MATLAB
1,067
42
% mglTestFillOval: an automated and/or interactive test for rendering. % % usage: mglTestFillOval(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test rendering some points. % usage: % % ...
6d23e356136dba419b91608f7c0bd728917d441e7b01fde08a29d7184197757b
MATLAB
1,068
30
function binSystem = ml_bs_create(boundsx, boundsy, cm_per_bin_x, cm_per_bin_y) % This is the first function of the bin system that should be called to % make the structure that the other code requires. It will discretize % the xy plane using a given bin size for each dimension. % Get the bin ids o...
54e099b5f7be2d54e9867aa56a9675f2f2bd279b6178f1812b0bf0038281b49b
MATLAB
1,069
43
function [D] = gretna_distance(A) %========================================================================== % This function is used to calculated the distance matrix of shortest path % length between all pairs of nodes in a binary graph or network G. % Currently, the calculation is based on a MatlabBGL function. % ...
6ec9cad92c87ea24e32548dd003b1cce2c76b1574ce844994ffb6af56f80f9e6
MATLAB
1,069
41
function KSDs = gretna_KSDs(Data) %========================================================================== % This function is used to calculate the Kolmogorov-Smirnov distance based % similarity among all pairs of probability distribution functions in the % Data. % % Syntax: function KSDs = gretna_KSDs(Data) % % I...
987d38b95e29f76eec8f7ff2fd3d2f2cfed38f77dc73577071a1032a906fa930
MATLAB
1,069
34
% VL_DEMO_IMDISTTF Demonstrates image distance transform % load image im = imread(fullfile(vl_root, 'data', 'roofs1.jpg')) ; im = im(100:200,100:200,:) ; imSize = [size(im,1) size(im,2)] ; % creates an edge map edges = zeros(imSize) + inf; edges(edge(rgb2gray(im), 'canny')) = 0 ; % compute distance transform [distan...
f0c00a700f10aca1aac24de6497a32f9ddfbf3174fbef15a916ea48385da4927
MATLAB
1,069
40
% get unit info for paper figs clear all; globals; initglobals; FramesInf.act = 0; FramesInf.noact = 0; FramesInf.xy00 = 0; FramesInf.removed = 0; FramesInf.totalFrames = 0; base_folder = 'Data\OpenField'; File = {'20160603Thalamus44_opF_W'}; Unit = [13,2]; File = {'20160730Thalamus44_opF_nW'}; Unit = [1,...
432152c1523431f5cfe50699914b9a5bcd2ca50da9c9dfe3aa207c8185f3915a
MATLAB
1,070
25
% VL_INTHIST Calculate Integral Histogram % INTHIST = VL_INTHIST(LABELS) computes the integral histogram for % the label map(s) LABELS. % % LABELS is a [M,N,L] UINT32 array containing L label maps (one for % each MxN layer). Each label map associates to each of the MxN % pixels one of K labels (a value of 0 ...
800cfaf138d2dad416d778e7e5d1259eca8e5f4477602ba61d95a11991feec75
MATLAB
1,070
48
function h = mimage(A, range_min, range_max) %% display montage image of 3D volume data [ImageHeight, ImageWidth, ImageSlices, ImageVolume] = size(A); if nargin < 1 disp('incorrect input number'); elseif (nargin == 1) && (ImageVolume ~= 3) range_min = min(A(:)).*1; range_max = max(A(:)).*1; ...
4fdb433b8d15e7bd70b57fd25e33ac62cf7314122497afb1634faac28c1ae8f2
MATLAB
1,072
33
function[]=SONTest(file) % SONTEST tests the integrity of a SON File usinf CED's SonFix program. % % SONTEST(FILE) % FILE may be a string or a file identifier % If FILE contains a directory root but no filename or *.smr, all % files in the directory will be tested. % Files currently open for writing within Mat...
5411c7c4e495836487067740c593d46edb22aeedee3b907d37c300d26d047901
MATLAB
1,072
32
function [textureHist blobSizes] = BlobStructTextureHist(blobIndIm, colourIm, tBin) if ~exist('tBin', 'var') tBin = 10; end maxVal = 0.43; % semi arbitrary parameter denoting maximum value of gradient % Get oriented gradients for each colour space ogImT = cell(1, size(colourIm,3)); for i=1:size(colourIm,3) o...
a432e4ddf3037859182b41406f1619b40b7babbcd6175c58266394af0f983ea7
MATLAB
1,072
28
function [pnt, tri] = icosahedron42() % ICOSAHEDRON42 creates a 1-fold refined icosahedron % Copyright (C) 2003, Robert Oostenveld % % This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip % for the documentation and details. % % FieldTrip is free software: you can redistribute it and/or modi...
d2b974fc223a54c46585c73c48e856d56027b58dc9fa9b133f857730a899db4e
MATLAB
1,072
22
function fileList = getAllFiles2(dirName, fileExtension, appendFullPath) dirData = dir([dirName '/' fileExtension]); %# Get the data for the current directory dirWithSubFolders = dir(dirName); dirIndex = [dirWithSubFolders.isdir]; %# Find the index for directories fileList = {dirData.name}'; %'# Get a ...
f0ab5b119d262f6548206d5a95ed26ff7eb46060aab835a61c1268855789c81d
MATLAB
1,072
37
function env = getEnvelope(signal) %GETENVELOPE get the peak of signal and concatenate them % signal is [16,time,5] % directly use matlab envelope may be better? env = zeros(16,size(signal,2),5); stimIn = 100000; for pop = 1:16 for cond = 1:5 disp(pop); [pks,locs] = findpeaks(signal(pop,:,cond)); if std(pks...
7bdcfcd178ae43cd74ea7616b9928bcdc2264fe68c5d48cbd8564af09b23babb
MATLAB
1,074
30
function [ns_RESULT, nsFileInfo] = ns_GetFileInfo(hFile); %ns_GetFileInfo Retrieves file information and entity counts % % Usage: % [ns_RESULT, nsFileInfo] = ns_GetFileInfo(hFile) % % Description: % Provides general information about the data file referenced by % hFile. This information is ret...
0eac8425a0a4c387e54dc5f9b11482e171deff7e8642a606c2dd3d27294de68c
MATLAB
1,075
24
function [cb counts] = CountVisualWordsIndex(indexIm, wordIm, numIndex, numWords) % cb = CountVisualWordsIndex(indexIm, wordIm, numIndex, numWords) % % Counts the number of visual words for the visual words in wordIm. % wordIm is an array with visual word identities. Zeros will be ignored. % indexIm is an array wi...
b0ab217b231193ec680b33e026507201a25d6913193b12de541b79125f0c9779
MATLAB
1,075
30
function resF = referenceGaborFilter(gaborBank, im) %filter image with all filters %init resF(numel(gaborBank)).even = []; resF(numel(gaborBank)).odd = []; for g = 1 : numel(gaborBank) %normal filtering %resF(g).even = imfilter(im, gaborBank(g).even, 'replicate', 'same', 'conv'); %resF(g).odd = imfilt...
e7b581ef134aa8b7ea3ac2913a58d5d5f92eb9c90e47b5ac1d47117ebd68ced8
MATLAB
1,075
38
function [dp, dpAvg] = ml_alg_popvectors_compute_dotproducts(maps1, maps2) % Marc Normandin. % maps1 and maps2 are (map_height, map_width, num_cells) 3D arrays. if ~all(size(maps1) == size(maps2), 'all') error('maps1 and maps2 must be the same sized stacks of maps.\n'); end % Each columns ...
806ce7554aca7bbf918439007167f5217de6feb7d2d05150d22039aa0832aeda
MATLAB
1,076
42
% mglTestFillRect: an automated and/or interactive test for rendering. % % usage: mglTestFillRect(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test rendering some points. % usage: % % ...
ddeed683763700859fd068eef9688dbdadc6fd84903909460cd6301e08630d63
MATLAB
1,076
40
function [data] = om_load_sym(filename,format) % OM_LOAD_SYM Load symmetric Matrix % % Load symmetric Matrix % % SYNTAX % [DATA] = OM_LOAD_SYM(FILENAME,FORMAT) % % FORMAT : can be 'ascii' or 'binary' (default) % % Created by Alexandre Gramfort on 2007-11-27. % Copyright (c) 2007 Alexandre Gramfor...
e0014d21e17b2d1ee4cb4393e106655a23f39c2f0998600128a8bad264655f92
MATLAB
1,076
34
function [eyeVelOut, omitCenters] = VOR_desaccadeAlt(eyeVelIn, params) %% Filter Data %% Band pass filter to remove 1)high freq noise 2)Our experimental signal freq N = 3; % Filter order fc = [10 40]; % Cutoff frequency [bb,aa] = butter(N, fc/params.samplerate, 'bandpass'); eyeVelFilt = filter(bb,aa,eyeVelIn)'...
56c0f345c6aae83e0681a4832622b5d061f4c3596b0f06e080435bf9c2366785
MATLAB
1,080
24
function [boxes, blobIndIm, blobBoxes, hierarchy] = getHierarchicalsuperpixels( im ) %UNTITLED Summary of this function goes here % Detailed explanation goes here % Parameters. Note that this controls the number of hierarchical % segmentations which are combined. colorTypes = {'Hsv', 'Lab', 'RGI', 'H', 'Intensit...
92dfc37b85d18733a3a5bb07fec4be3f0dbcd405dd3ecb2f14d9e37c5574a327
MATLAB
1,080
26
clc, clear % SPM12 CAT12 batch for utilising chimpanzee to human deformation map to % deform chimp OPNMF solutions to human MNI space to conduct ARI similarity % analyses % working project directory % wd = '/home/svickery/projects/chimp_human_opnmf/'; % chimp - human deformation field map location % def_map = fullfi...
94a3dbd890f45c9cb25282d84b78f707fb3c4986bd08e629219ee7838440b86f
MATLAB
1,080
39
function out = axes(varargin) % When placed in the path, this function will shadow the built-in "axes" % function. This function tests for the validity of the axes handle % being passed to prevent a crash due when a deleted axes handle is passed. % % You may receive a warning regarding not shadowing built-in fun...
c9607cf33a5ef26d96e30516241b0ebdfecb261d27b85ad956be45546bb3b061
MATLAB
1,080
39
% addMyPaths.m % % function to add relevant ephys data analysis paths, including subfolders % % Users: change the following paths to match those on your local computer function addMyPaths() %% Animal Part Tracker code APTpath = '/Users/hyang/Documents/MATLAB/APT'; addpath(genpath(APTpath)); %% P...
6f857040dfafeb304e4cd5cfe9fa4277fc5e6ab1b1ab80ecb4a4cd802533422b
MATLAB
1,081
37
function [start_A] = generate_startcondition(n_states, n_start_condition) %% Generate random initial transition matrices for Hidden Markov Models. %% authors: Stefano Diomedi %% date: 22nd February 2024 % Inputs: % - n_states: Number of states for which to generate the transition matrix. % - n_start_condition:...
b0cb014d21777ea028820315672f3b81dfb01443085776568699e782628ba21f
MATLAB
1,082
27
function ret=SONWriteMarkBlock(fh, chan, buffer, count) % SONWRITEMARKBLOCK writes data to a marker channel % % Implemented through SONWriteMarkBlock.dll % % RET=SONWRITEMARKBLOCK(FH, CHAN, TIMESTAMPS, MARKERS, COUNT) % INPUTS: FH the SON file handle % CHAN the target channel % TIMESTAMPS a vec...
db1732fbd4c7886332debdee978897056aed8096dfe3c4e8e5c2ea95e89d5b81
MATLAB
1,082
37
function tiff_writer(outputFileName,mov,varargin) % function Y = tiff_writer(name,mov) % % Code to write tiff stack. % % 2015 - Adam Charles %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Parse inputs and set variables if nargin < 2 error('Need to give a name and a file to write!'...
3328d4f64ed3805813a388ee3115199631566c3ad9dec3fb5bf0adcb1c05fe02
MATLAB
1,083
25
function [c, s, num_c, num_s] = getSurroundings( gridx, gridy, imh, imw, patchSize, surrWidth ) % coordinates of center pixels for computing regional sum in integral image(cannot overflow) a_c = (gridx - 1) * (imh + 1) + gridy; % sR,sC b_c = (gridx + patchSize(1) - 1) * (imh + 1) + gridy; % sR,eC+1 c_c = (gridx - 1...
bcb20c1d7e025a8373850b08b1bfb4a9b07650791fdb0d3fa2d57cb9b2fa66ef
MATLAB
1,083
27
function ExportImage(fig, x_size, y_size, resolution, filename, fileformat) % This function allows to save an image by setting: % dimensions (x_size, y_size) expressed in centimeters; % resolution (resolution) espressed in dot-per-inch (dpi) % fileformat is relative to file format used to save the image. Examples % ar...
284bc857897fcd07bb472682b4e3a88bc42d3bde3e92a3ea62871465752de3bf
MATLAB
1,084
30
function success = call_function(input_string) % calls the function in this folder with argument in the format function;argument % and update the appropriate logs try inputs = strsplit(input_string,';'); script_name = inputs{1}; folder_name = inputs{2}; job_ID = get_job_ID(folder_na...
492d9660ef46975f0c2005376d48173708916b83e6c5fabe516e566e54d83a8b
MATLAB
1,084
40
function [] = ExtDataFig06_AveSong() % Code for plotting the population averaged ΔF/F for pulse and sine song around song-type in Extended Data Fig. 6b,d. %% parameters GT = 'nsybD'; % Extended Data Fig. 6b % GT = 'nsyb'; % Extended Data Fig. 6d switch GT case 'nsybD' DataFlag = [1,1,1,1,1,0,1,1,1,1]; ...
081ad95a7b80813343987001771367cabcc3faf83c8742ab8e4fdd6b425e63d0
MATLAB
1,085
315
POmD = [ 0 1 0 1 0 0 0 2 0 0 0 0 0 0 1 1 1 1 1 0 2 0 1 1 1 1 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
721947c79ba2b1bd1caf0a9c0ced300749c305b66dd3e71c86214d267cd872d3
MATLAB
1,085
34
% jumpSegment.m % % usage: task = jumpSegment(task,segnum) % by: justin gardner % date: 04/23/07 % purpose: jumps to a segment % usage: jump to next semgent % task = jumpSegment(task) % % jump to end of trial % task = jumpSegment(task,inf); % %...
76a44ba44a0116078de9d1a78993d8fc9d1780ba4ae28cb14a81cdf59c6fd76a
MATLAB
1,085
38
function [n,names] = plx_event_names(filename) % plx_event_names(filename): gets the names of event channels in a .plx file % % [n, names] = plx_event_names(filename) % % INPUT: % filename - if empty string, will use File Open dialog % % OUTPUT: % names - array of event name strings % n - number of chan...
b585da9bf5452dedc43825245454f3a41c90378623345d41b921040bb7c30e77
MATLAB
1,085
45
function phandle = ternary_plot3( wlimits, name_E, E, name_F, F, ZData, varargin) %ternary_plot3 plot3 with Ternary Coordinate Inputs (ABC) % % %% Process inputs % Check input count if ( nargin < 5 ) error('Too few Inputs') end % If user does not specify ZData, plot at zero ...
2b15c391ba69b6593b865acae9df62c602c78603d53a9d27c860cc2d3a178662
MATLAB
1,087
29
function Uout = generateGaussianProfile(X,Y,rad,aper,k,fl,offset) % Uout = generateGaussianProfile(X,Y,rad,aper,k,fl,offset) % % This function generates a Gaussian back aperture intensity profile with a % fixed aperture size with a focused phase fl. The inputs are % % - X - lateral position X [m] % - Y ...
65b024dc1df2124b46d15f273a6faf2d18f3bfd654c19bed57f3fc053d0d56d8
MATLAB
1,087
32
%% Multielectrode --> .mda for MountainSort %% Read from Recording Segment %Z:\1_Maxwell_Gagnon\ProjectData_Sriram\Granule_cell_recording\NR2_F_10_S1 clear;clc;close all dbstop if error cd Z:\1_Maxwell_Gagnon\ProjectData_Sriram\Granule_cell_recording\NR2_F_10_S1 seg_file_names = dir; seg_file_names(~contains({seg_fil...
1e16eac375a6d67cb8f7dbf67c6496dadf9f9c08ba5ffa0a8b3025cae2eb0226
MATLAB
1,088
33
function logical_removal_vector = pre_post_motion_censoring(FD_vector,FD_threshold,skip) % Code from OHSU Fair Neuroimaging Lab % Written (2014) and commented (9/8/2015) by Eric Earl % % takes in a vector of FD values, an FD threshold, and a number of frames % to skip and outputs a logical frame removal vector of 1s a...
599d0c364c3576ce7e5933b4b93a12d6928bd437b0772b629455d4716db28545
MATLAB
1,088
51
function my_move_net(net_info, destination) if strcmp(destination, 'gpu') for l=1:numel(net_info.ref.layers) switch net_info.ref.layers{l}.type case 'conv' for f = {'filters', 'biases', 'filtersMomentum', 'biasesMomentum'} f = char(f) ; if isfield(net_info.ref.l...
8fa7b521f7c11240a7937256b88bb0b26a4fd228fd794e382db2b1a89d825ddd
MATLAB
1,088
33
function ml_util_bfo_errorbar_groups(angles, groupMean, groupStd) numAngles = length(angles); % Give each group a different color numGroups = size(groupMean,1); blue = linspace(0.2,1,numGroups); %alpha = 0.5.*ones(1, numGroups); %linspace(0.8, 0.2, numGroups); alpha = linspace(0.5, 1.0, num...
cdf58023660f38cc6737468cfb862456b627ef666f9ac6abfdf6d3665fa65d4d
MATLAB
1,089
31
function [params, s_new] = denoise_pow3(params, s, state) % Kurtosis based denoising function % [params, s_new] = denoise_pow3(params, s, state) % params Function specific modifiable parameters % state DSS algorithm state % s Source signal estimate, matrix of row vector signals % s_new Deno...
1cb8d736fede67c340ff8b2513ca08499656bb65b56412a33cefade92fbf3d57
MATLAB
1,090
45
function [CIJ] = makelatticeCIJ(N,K) %MAKELATTICECIJ Synthetic lattice network % % CIJ = makelatticeCIJ(N,K); % % This function generates a directed lattice network without toroidal % boundary counditions (i.e. no ring-like "wrapping around"). % % Inputs: N, number of vertices % K, ...
feb16b838a55dbd1420d568d19ee015eaa8bb599d8776fd26d2f8c69ca80f309
MATLAB
1,090
58
function lab= convertLab(lab,nlab) lab=char(lab) %keyboard for i=1:nlab ilab=lab(i,:); ind= strfind(ilab,'resA'); ilab(ind:ind+3)=[]; ilab = char(ilab) ind= strfind(ilab,'_l'); if length(ind) > 0 ilab(ind:ind+1)=[]; ilab=strcat(ilab, {' '}, 'l'); else end ilab ...
0a32202f19b897f927111e18cd1ab093f5467af7d8293cbe1ed3e9a7e76cffb2
MATLAB
1,091
43
% initStimulus.m % % $Id$ % usage: [stimulus myscreen] = % initStimulus(stimulusName, myscreen) % by: justin gardner % date: 05/01/06 % purpose: init the stimulus variable (and register it in myscreen) % copyright: (c) 2006 Justin Gardner (GPL see mgl/COPYING) % e.g.: ...
4f13552f447e414dee97e614691aeefb5d52072963966982d9d755e334ba8c78
MATLAB
1,091
29
function cpred = convolve_vecs(pred, irf, fs_in, fs_out) % Convolve predictors with HRF, resample to temporal resolution of fMRI % measurements, and clip extra frames extending beyond measurement period. % Note that this implementation is much faster than using conv2. % % INPUTS % 1) pred: predictors to be convolved...
6c46843cdd2867b66edd58fac15fa48eb82e0c0a1861ea27b26bf31229ee8dbf
MATLAB
1,091
32
function value = read_power_2014_motion(motion_file,FD_threshold,DVAR_threshold,key) if FD_threshold > 0.5 disp(['Input FD threshold (' num2str(FD_threshold) ') is greater than the maximum tested against (0.5)']) return end if DVAR_threshold > 50 disp(['Input DVAR threshold (' num2str(DVAR_threshold) ') i...
d523bbc9002b8f9b2d0f858190c871b18097426366abc287414b35a531f92ea7
MATLAB
1,092
23
function d2soz = VR_d2soz(nodes, aij, esoz_map) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % If you use this code, then please cite: % 1.- Ana P. Millan, et al. "Individualized epidemic spreading models % predict epilepsy surgery outcomes: a pseudo-prospective study." % medRxiv (2023): 2023-0...
755c62cffa100d238982c1e39049dc6e2b6c339951a74c6658c98d36833b4f77
MATLAB
1,093
29
function ret=SONWriteADCBlock(fh, chan, buffer, count, startTime) % SONWRITEADCBLOCK writes data to an ADC channel % % RET=SONWRITEADCBLOCK(FH, CHAN, BUFFER, COUNT, STARTTIME) % INPUTS: FH the SON file handle % CHAN the target channel % BUFFER the data to be written (int16 ADC data) % COUNT the...
9739952c003502483460bcd07e73c0beea892cf324a63ac37cb1ef5cc6030484
MATLAB
1,094
53
clear all close all % Sup Fig 7, show how spectrin recovers - shrink % setting up the initial configuration P.y0 = 180*1.2; P.x0 = sqrt(P.y0^2 - (P.y0/2)^2); P.max_y0 = 17*P.y0/2; P.max_x0 = P.x0*15; [r_s,T_s,edges_s,edge_type] = create_mesh(P); P.actin = 1:size(r_s,1); P.k0 = 1;%spectrin spring constant P.d00 = ...
50c85292e707f7687ca1eef5e3ba4c0d178d39e6aa5c89d3909851436a58e2b7
MATLAB
1,095
31
function [informationRate, informationPerSpike] = ml_placefield_informationcontent_v2(meanFiringRateMap, positionProbMap) % This must mathematically be true meanFiringRate = sum(meanFiringRateMap .* positionProbMap, 'all'); % Compute the information rate (bits per second) % Find the non-zero entrie...
d6be1b4d595e3ddc688e3b82b48593f999d6570cb2ac10a57a03c8bd73bc80a9
MATLAB
1,096
39
% mglTestClearScreen: an automated and/or interactive test for rendering. % % usage: mglTestClearScreen(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test setting the screen clear color. % usage: %...
90ca4bca0ed26091e49214166d47bcf79e5216ef77611365de7db2fe5391fdd9
MATLAB
1,098
40
clear addpath(genpath('.')) addpath(genpath(fullfile('..','ANE'))) global result; global resultString; global resultSpikes; %% dir_video=fullfile('E:','data_CNMFE'); list_Exp_ID={'blood_vessel_10Hz','PFC4_15Hz','bma22_epm','CaMKII_120_TMT Exposure_5fps'}; num_Exp = length(list_Exp_ID); % name of file to read % for...
2a67795d06148b3094b3621e88ca063d44f2acf8602459effca007d15d91c345
MATLAB
1,099
45
function phandle = ternary_text( wlimits, name_E, E, name_F, F, string, ZData, varargin) %ternary_plot3 plot3 with Ternary Coordinate Inputs (ABC) % % %% Process inputs % Check input count if ( nargin < 6 ) error('Too few Inputs') end % If user does not specify ZData, plot at...
0f2334164cf92839f5ecacb39dc740fc87a4803d2bb64030082951d71ae2e81e
MATLAB
1,100
31
% VL_IMDISTTF Image distance transform % DT = VL_IMDISTTF(I) computes the distance transform of image I. % The distance transform is defined as % % DT(x,y) = min_{u,v} I(u,v) + (u - x)^2 + (v - y)^2. % % [D, INDEXES] = VL_IMDISTTF(...) returns a matrix INDEXES that % contains for each pixel (x,y) the ind...
6933973225588434ddf563a5db308df3eaa09ed094c5c0059ad40131e30bf4de
MATLAB
1,100
29
% % Style info by methods. % % RESULT % colors Struct by method % .(method) (1*3) Color % line_styles Struct by method % .(method) (string) line style % markers Struct by method % .(method) (string) marker % function [colors line_styles markers] = styles_method() colors = struct(); line_styles = struct(); m...
8a102f04f3f08295a80328936c5a72dadf79813df0c91093fe5b7bdae3950ae9
MATLAB
1,100
29
% mglPrivateDisplayProcessingError.m % % $Id:$ % usage: mglPrivateDisplayProcessingError(socketInfo, results, functionName) % by: justin gardner % date: 01/27/23 % purpose: Private function that is used to handle errors that mglMetal returns % when processing a command. These a...
f646198cbcf4048c11faed4a4d36b993546bd0a5928fbf55a55c8081ab027006
MATLAB
1,101
40
% mglTestMetalText: an automated and/or interactive test for rendering. % % usage: mglTestMetalText(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test rendering some text as an image. % usage: % ...
fa19c45f2cac4cbfcb95faf36edab2108383ad4d425dc2efd0565831075848da
MATLAB
1,102
28
function ret=SONWriteRealBlock(fh, chan, buffer, count, startTime) % SONWRITERealBLOCK writes data to an Real channel % % RET=SONWRITERealBLOCK(FH, CHAN, BUFFER, COUNT, STARTTIME) % INPUTS: FH the SON file handle % CHAN the target channel % BUFFER the data to be written (single floating point) % ...
a2b4e0c70b39940a5626f2ab24b6d3857d793c83d369717fc563a7a4705144d9
MATLAB
1,103
40
function J = vl_imdown(I, varargin) % VL_IMDOWN Downsample an image by two % J = VL_IMDOWN(I) downsamples the image I by half by discarding % each other pixel. % % VL_IMDOWN() accepts the following options: % % Method:: Sample % 'Sample' downsamples the image by discarding % pixels. 'Average' instead a...
f02c1cc7f0532943af8ab276aef1b5f2f4d6771dd8cfc824998c771b9e4abc73
MATLAB
1,103
30
% VL_SLIC SLIC superpixels % SEGMENTS = VL_SLIC(IM, REGIONSIZE, REGULARIZER) extracts the SLIC % superpixes [1] from image IM. REGIONSIZE is the starting size of % the superpixels and REGULARIZER is the trades-off appearance for % spatial regularity when clustering (a larger value results in more % spatial r...
7e4222bd7edea6e78ef1a7f124adfafafe2cece58d2016cb49219b1d0bf64ad0
MATLAB
1,105
45
% mglDeleteSound.m % % $Id:$ % usage: mglDeleteSound(soundID) % by: justin gardner % date: 08/15/15 % purpose: Free up space on allocated sound % % After installing a sound with mglInstallSound you % can remove it with this function if you do not want % ...
dd5b3bda455dae7630e07eea12734a4a1e4997fb09ef8bd6cbe1e09d8cee780a
MATLAB
1,105
37
function [] = checkFlipTimes(fileNameToLoad) % Script to ad hoc check stimulus frame timing. % Example: % run = 999; % date = '20201125T122751'; % fName = sprintf('simseqPRF_test_run%d_%s.mat',run, date); % checkFlipTimes(fName) set(0,'DefaultFigureWindowStyle','docked') % use 'normal' to undock % Load output file l...
ccc523668eccd05b4b8131341987636283943cf269f5edcf16056ec4d771cdc5
MATLAB
1,106
27
function plot_cellreg_spatialfootprints(obj, session) outputFolder = fullfile(session.getAnalysisDirectory(), obj.Config.cellreg_spatialfootprints_plot.outputFolder); if ~exist(outputFolder, 'dir') mkdir(outputFolder); end numRegCells = session.getNumCells(); fprintf('There are %d register...
ce4b676df2f81ce0aed40fefa2e20946ca1f54fcf541af0e976eb72c36f119c6
MATLAB
1,106
31
function make_wrapper_connectotype(handles,parcel_folder) fs=filesep; surv=handles.mc.surv_ix; surv(:,1)=[]; %first column refers to standard, second one to model based n_surv=sum(surv); ix=find(surv); grid_sub_folfer=[parcel_folder fs 'grid_sub']; mkdir(grid_sub_folfer); change_permissions(handles,grid_sub_folfer);...
ee253f52433f0a3e8d34ee7d9ae846a3f7106c8fbf08dbeeb7a3946fdafce4c0
MATLAB
1,106
29
function [pnt, tri] = icosahedron162() % ICOSAHEDRON162 creates a 2-fold refined icosahedron % Copyright (C) 2003, Robert Oostenveld % % This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip % for the documentation and details. % % FieldTrip is free software: you can redistribute it and/or mo...
2f39935a55a1cdb77113e6dbcb17c2b7922d527d77b57f826789a031dd08395d
MATLAB
1,107
42
function res = myConv2(h, tmpX, step) %preparation. X consists of original image surounded by zeros tmpImageSize = size(tmpX); filterSize = size(h); numFilter = ceil(((tmpImageSize(1) - filterSize(1))/2 + 1)/step) * 2 + 1; imageSize = step * (numFilter - 1) + filterSize(1); tmpZeros = zeros(imageSize); sizeX = size...
61573d6321394a2ac004fb8270bb9e8fa881273367db726367368495eebfa438
MATLAB
1,107
38
function [ts_mus, csc, channel, fs, HS] = ml_nlx_csc_load_file( cscFilename ) [Timestamps_mus, ChannelNumbers, SampleFrequencies,NumberOfValidSamples, Samples, Header] = ... Nlx2MatCSC(cscFilename,[1 1 1 1 1], 1, 1, [] ); ts_mus = []; csc = []; fs = 0; if NumberOfValidSamples > 0 ...
9b668ed27b687ca0ca1189bbaf2252f46c7c9c663316337ce683e682912c123a
MATLAB
1,107
35
%% Author: Jiri van Bergen and Xu Li % Affiliation: Radiology @ JHU - Kirby Center % Contact via xuli@mri.jhu.edu % Updated by Xu Li, 2019-07-09 %% Show that image! % Enable button set(handles.ButtonAdjustContrast, 'Enable', 'On'); % Check dimensions if size(handles.CurrentImage,5) > 1 imageSlice =...
331b2d70f8645aeb4ba68d4f8e46823b20cce90cdce63d919bc22f86cc25beb2
MATLAB
1,108
44
% Function File: [reduced_data] = reduce_data (data, p) % % A simple data reduction tool for plot. % % data is a matrix with x-values in the first column and y-values in % subsequent columns. % % p is the horizontal length of the plot in pixels % % reduce_data (last updated:...
4c20207fc86cacdb3c7268cb138e05ab3553d1f3e173a739b3598e6d05d23216
MATLAB
1,108
43
% mglTestGluAnnulus: an automated and/or interactive test for rendering. % % usage: mglTestGluAnnulus(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test rendering various sizes and shapes of vectorized ...
205976ff8ad8849d72d10df6d1c6c29197ca89c0706921434593168836174325
MATLAB
1,109
27
% set FSL environment -- check without the last 4 lines setenv('FSLDIR','/usr/local/fsl'); % this to tell where FSL folder is setenv('FSLOUTPUTTYPE','NIFTI_GZ'); % this to tell what the output type would be fsldir = getenv('FSLDIR'); fsldirmpath = sprintf('%s/etc/matlab',fsldir); path(path, fsldirmpath); clear fsldir ...
84b444be8336772bdbd8613a2a266592feb6636f88fab894e6a0646b5cf88b4f
MATLAB
1,109
36
% mglGluDisk - draw disk(s) at location x,y; alternative to glPoints for circular dots % % $Id$ % usage: [ ] = mglGluDisk( x, y, size, color, [nslices], [nloops] ) % by: denis schluppeck % date: 2006-05-12 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % inputs...
0cb09aadfda8e4afeb7240772c12ac6cda1b62f56e49eba052c3a50dfacdad66
MATLAB
1,110
55
function [Nsample,xtemp,P,y]=plotTCurve(Amp,Nspikes,plot_d,Nbins,percentile) Nspikes(isinf(Amp))=[]; Amp(isinf(Amp))=[]; % [~,idx_temp]=sort(Amp); % plot(Nspikes(idx_temp)) if Nbins<2 Nsample=nan; xtemp=nan; P=nan; return end %linspace(0,0.95,Nbins+1) x = quantile(Amp,linspace(0,percentile,Nbins+1)); %m...
fa648d1cf02e8acfd41d1000a6ff609bb7f9f2710076ea4cbb81d6e729b6f7e1
MATLAB
1,111
45
function c = InvProbV1Cons(x,Imat_t,tn,ni,nh,no,msteam_st_t,mfg_st_t,Tsteam_in_st_t,Tfg_in_st_t,cpfg_st_t,cpsteam_st_t,delta,data) wh = reshape(x(1:ni*nh),[ni,nh]); wo = reshape(x(ni*nh+1:ni*nh+nh*no),[nh,no]); bh = (x(ni*nh+nh*no+1:ni*nh+nh*no+nh))'; bo = (x(ni*nh+nh*no+nh+1:ni*nh+nh*no+nh+no))'; y_r = reshape(...
791423a9303a75c387c34a34987f51473c1739124d668f4a68d0b214b7308a40
MATLAB
1,112
31
% Determine fertility of detections based on size and atomicity. % function fertility = detection_fertility(det,params) n_obj = det.body_cc.NumObjects; % initialize fertilities to default of 1 fertility = ones([n_obj 1]); % collect body size constraints mean_body_area = params.mean_area; max_body_...
8acca44e043ce7e58d855cf1b431431e6d19b09917944bea79c013a93735197c
MATLAB
1,112
37
function [r] = ml_cai_dlc_get_h5_filenames(containerFolder, filenamePrefix) % This returns an array of structures containing information for matching % h5 files, and it is sorted by the sequence number of the file. % % This is meant to be used for files like % behavCam1DLC_resnet50_MODEL.h5 % behavCam2DLC_resnet50_MOD...
6c42cd1db071a152f6d1b85a8b0fc3646756c343a6c0fb51e73589fff0711636
MATLAB
1,114
47
% GAUSSFILT - Small wrapper function for convenient Gaussian filtering % % Usage: smim = gaussfilt(im, sigma) % % Arguments: im - Image to be smoothed. % sigma - Standard deviation of Gaussian filter. % % Returns: smim - Smoothed image. % % If called with sigma = 0 the function immediately returns with ...
1a562cb0ca93d82e140f9411654d6ad4d71b3f5fce2a96ad463f58a08b35b5b8
MATLAB
1,115
44
classdef Data < types.untyped.MetaClass & types.untyped.DatasetClass % DATA An abstract data type for a dataset. % REQUIRED PROPERTIES properties data; % REQUIRED any end methods function obj = Data(varargin) % DATA Constructor for Data obj = obj@types.untyped.MetaClass(varargin{:}); ...
31217e258a4ac8cafff4eb4ef844ed13204a25c87ef22a44354bd17a4f6d332f
MATLAB
1,115
50
function x=powerlawSampler(n,t,x_min,x_max) % powerlawSampler Sample values from a truncated powerlaw distribution % % Syntax %__________________________________________________________________________ % % x=powerlawSampler(n,t,x_min,x_max) % % % Description %__________________________________________________________...
47fb6fef58e77d023a729271f26dbe6e782333d0305804324f11f06408cf06a5
MATLAB
1,115
65
%% clear all close all clc %% Rejections values = 1002:1021; Rejections_analyze = []; saveme = []; Subjects= []; for ii = 1:length(values); try saveme = []; subj = []; name = ['Subject_' num2str(values(ii)) '_rejected.csv']; T = readtable(name); saveme = tab...
233b986f314a1cf732223ece49b478e20c6cbb5ad303837a6964c8b7b6328859
MATLAB
1,116
40
function y=spcharin(x) %SPCHARIN replaces special characters by their codes % % Syntax y=spcharin(x) % % Description % x is a character or 2D cell array of characters % y is the corresponding version with reserved (special) characters % replaced by '%ascii;' codes % % See also: SPCHAROUT % % Jonas Almeida, alme...
a141cb5479a5c0d1ffc5d5e39ac2301a7f9d1ebb5b2a7c84ca87e7a717e7e4b6
MATLAB
1,118
39
function fun = DynMCNNInvProbV1(x,Imat_t,dsr_t,ni,nh,no,tn,delta,data) whd = reshape(x(1:ni*nh),[ni,nh]); wod = reshape(x(ni*nh+1:ni*nh+nh*no),[nh,no]); wfd = reshape(x(ni*nh+nh*no+1:ni*nh+nh*no+no*nh),[no,nh]); bhd = (x(ni*nh+nh*no+no*nh+1:ni*nh+nh*no+no*nh+nh))'; bod = (x(ni*nh+nh*no+no*nh+nh+1:ni*nh+nh*no+no*...
a72179d6452fd5d485bec5b6e7e1b5622555020593244674fa724acf9e759801
MATLAB
1,118
39
function fun = DynECNNInvProbV1(x,Imat_t,dsr_t,ni,nh,no,tn,delta,data) whd = reshape(x(1:ni*nh),[ni,nh]); wod = reshape(x(ni*nh+1:ni*nh+nh*no),[nh,no]); wfd = reshape(x(ni*nh+nh*no+1:ni*nh+nh*no+no*nh),[no,nh]); bhd = (x(ni*nh+nh*no+no*nh+1:ni*nh+nh*no+no*nh+nh))'; bod = (x(ni*nh+nh*no+no*nh+nh+1:ni*nh+nh*no+no*...
435b8144433d15930122d6b86c3035d4f913a1284c4a8fe2b2aeeb4435c3fb06
MATLAB
1,119
44
function weights=dirichletSampler(theta,nc) % dirichletSampler Sample weights from a symmetric Dirichlet distribution % % Syntax %__________________________________________________________________________ % % weights=dirichletSampler(theta,nc) % % % Description %_______________________________________________________...
53e24c7efe02ce84e789641e3e08979445f05b32c8c04d52392ed0b93a430418
MATLAB
1,119
30
function [params, result] = ortho_default(params, W, w) % DSS No orthogonalization function % Does mere normalisation % W = orthof(W) for symmetric dss % w = orthof(W, w) for deflation dss % W Matrix with projection vectors as rows. For deflation % algorithm only previously calculated projections a...
9ba876c0730f0ae4dd770655da2def648acfa09035b82d35c55c2f31c18f84ec
MATLAB
1,119
35
function [ i,o ] = aux_perceive_sc( obj, vec, pts ) % Auxiliar method for ECG artifact filtering % % Syntax: % [i,o]= AUX_PERCEIVE_SC( obj, vec,pts ); % % Inputs parameters: % * obj - object containg data % * vec % * pts % Example: % [i,o]= AUX_PERCEIVE_SC( vec,pts ); % % Adapted from Wolf-Julian Ne...
d5f61899b4a2695e1d6b413ff7bbca2ac2edffa0225994fad131245c9c71eaca
MATLAB
1,119
32
function data = ml_cai_io_timestampdat_readfile ( timestampFilename ) data = []; if ~isfile( timestampFilename ) error('The file (%s) does not exist.', timestampFilename); end fid = fopen( timestampFilename ); if fid == -1 error(fprintf('Unab...
deac20858a962249b5dccd45580b77e39bb72070d0f8f16abfeeb8abca03cdb9
MATLAB
1,119
35
function Y = tiff_reader(name,T) % Y = tiff_reader(name,T) % % read tiff stack. Optional truncate to first T timesteps % % The inputs to this function are % name: String pointing to the tif file to load % T: Number of frames to extract % % The output to this function is % Y: 3D array...
39fe519bc4c4389732f28170448b15e096d7c2b5efe4739811a24ac9cf3e6fd0
MATLAB
1,120
34
function [x_max y_max A]=crit_interp_g(y,x); %fits a gaussian to three points: y=[y(x(1)) y(x(2)) y(x(3))]. Returns the %position (x_max) and value (y_max) of the interpolated critical point %(peak or trough). Things go sideways (complex) if y is mixed sign and %rounding errors can cause spurious complex results ...
8b1394c5e45042e914a68fc23d1c3ddc1bacf75a48c77f51f8ac602d5cc4eb59
MATLAB
1,120
56
function input_info=cnn_layer_dense_softmaxloss_backward(input_info, layer, work_info_batch, output_info) stageout_info=layer.stageout_info; stage_idx=stageout_info.stage_idx; mc_info=work_info_batch.ref.finalloss_mc_info_stages{stage_idx}; tmp_input_info=work_info_batch.ref.fina...