sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a95968fd12f37d7d79a44669782c552d1cde32b44bb5520c54256b35190dd557
MATLAB
1,545
50
function [spikeWindows, carTraces] = localCAR(spikeWindows, hCfg, nSitesEvt, refSites) %LOCALCAR Subtract local common-average reference from spike windows % spikeWindows: nSamples x nSpikes x nSites, single if nargin < 3 nSitesEvt = []; end if nargin < 4 % usually (always?) the case ...
8b2f26f85e2fcb7f914b3358941da5856b286628364357f688f329fe2ac686b4
MATLAB
1,552
39
function writeNeuroscopeShank(clusters,samplingRate,fileBaseName) % takes cluster IDs and spike times from loadKS (or variant) and writes two file types: % fileBaseName.clu.n = list of cluster IDs in chronological order % corresponding to spike times; first entry = total % ...
7e6cb637847ae8c8e6e2736bb5c486f4068cebd452e342fd29d00c92c2194367
MATLAB
1,553
60
function [localMinsFinal] = iterToMin(signal, array, threshold, isOnset) % [localMinsFinal] = iterToMin(signal, array, threshold, isOnset) % % Summary: This function iterates towards local minimum values, % sequentially from a given array of indices % % Inputs: % % 'signal' - the signal in which we are lookin...
f01b0fdda4681dac196f24e562f9cce90aa78091f714128b6cdd5d75b7e60058
MATLAB
1,553
32
% Folding Maps back: % This only works for 3*3 and 5*5 for now % Can be easily extended to odd numbers. function EMap_Ext2Ori = FoldExMap2Ori(NnEex,NnE,EMap_Ori2Ext,N_E,n_E_HC) % from extended back to original: fold % E EMap_Ext2Ori = zeros(size(NnEex.X)); EMap_Ext2Ori(EMap_Ori2Ext) = 1:N_E; CenterEHC = find(NnE.X>1*n...
62a9a0c49ec4ac2f41a3a134c14822543894c3524bee331afb160a5dfc9b4b89
MATLAB
1,554
62
clear all close all clc if badtrls project_dir = '.\Adults_badtrls\'; else project_dir = '.\Adults\'; end subs = [1:26]; for sub_i = subs sub = sprintf('1%2d',sub_i);sub(sub == ' ') = '0' ses_i = 1; ses = sprintf('%3d',ses_i);ses(ses == ' ') = '0' tic index_pinky_Tstat_func...
c680917d17487fe6313444563d11acfc4340b6240d2bf909cbe69658100b27a5
MATLAB
1,554
44
function [rho,logData,pval] = computeCorrelation(data) % computeCorrelation Characterizes a given spatial system as defined by % a power law function y=ax^k as described in the original manuscript. % % [rho,logData,pval] = computeCorrelation(data) takes as input an Nx2 % vector containing the features and d...
dca2da90cc7f8afb00a0f8d0889c4601f2e830685a206b945465c6d93d5b06ed
MATLAB
1,554
68
clear close all clc load Liza_all_data_psth.mat ctrl= all_psth(1:2:end,:); HT = all_psth(2:2:end,:); %% Metric ON mean_ctrl = mean(ctrl(:,1:40),2); std_ctrl = std(ctrl(:,1:40)')'; n = 3.5; Resp_ctrl = ctrl > mean_ctrl + n * std_ctrl; %%Metric OFF mean_HT5 = mean(HT(:,1:40),2); std_HT5 = std(HT(:,...
7f269b347399337b650497865229f32e5944c5c05d216069214e1443546a46cc
MATLAB
1,555
44
% Function that ignores low-active cells in Ensembles % Input % frame_ensemble: sequence of ensembles % Rclust: Matriz Activity above CAG threshold % Output % reframe_ensembles: zeros where low-active cells fired function reframe_ensembles=ensembleCAG(frame_ensemble,Rclust) reframe_ensembles=frame_ensembl...
8d7905b4497eda847d185d7ec83cf8795c59e4e178c7ecf84b50d66a2612b7ba
MATLAB
1,555
38
function [data, all_strings] = get_all_data_from_level_h5_rec(filename, str, data, all_strings) % This function recursively reads data from an HDF5 file. % % INPUT: % filename: A string that identifies the HDF5 file from which to extract data. % str: The group from which to start extracting data. % data: A ...
d30feafa14235b90ab13b79ffa96dc5e6d1fddedb7d79ed5d3d512bc1dd57b5c
MATLAB
1,555
43
function clusters_mapping(m, p, shrinkage_factor, borders_table, reference_probe_length_tip) [file, path] = uigetfile('cluster_info.tsv');%When the user clicks the load data button, a window should open to enable the user to select a file. datafile = fullfile(path, file); %save path cd(path) info = tdfread(datafil...
b60a3b6130a7850ff777f2067380b6d0deb26751ce323571763989605b4d7165
MATLAB
1,557
44
function [trainedClassifier, validationAccuracy] = trainClassifierfloor(trainingData, responseData) % trainClassifier: Trains a classifier and returns a trained classifier and its accuracy. % Input: % trainingData: Matrix of predictor data. % responseData: Vector of response data. % Output: ...
78bfd04a9b4f213718cf809217a6b19de5e5568c1f3773a6e90ba0a8943fbb6f
MATLAB
1,558
62
clc clear all close all; addpath('E:\Programs\Baseline Wander Comparison\ECG PTB Database'); f = 1.1; fs = 1000; bins = fs/4; N = 30*fs; M = 12; start = 0; stop = 30; DataFileNames; for kk = 1:length(fname), InputFileName = fname{kk}; h = fopen('ECGExtracter.bat','w'); fprintf(h,'...
4ea8627413f00280cccd7ab581b95d195a73afa954827eaa17624e826ca12425
MATLAB
1,559
55
% Test script for ecg_gen_warping % % This script demonstrates the usage of the ecg_gen_warping function to generate % synthetic ECG signals using the warping transformation from the phase to time domain. % % Revision History: % 2023: First release. % % Reza Sameni, 2023 % The Open-Source Electrophysiological Toolb...
78e2e35615dc269fdf70ca6e288a2b41543697ebf0c9734a17049a9d7f16cf68
MATLAB
1,559
35
function [onSets,offSets] = adjOnsetOffset(onSetsInd,offSetsInd,timeThres,vel) %Adjust Onset and Offset vectors to adhere to time and length constraints % % [onSets,offSets] = adjOnsetOffset(onSetsInd,offSetsInd,timeThres,vel) % % Description: This function was created by Jeffrey March, so the onset % and o...
51cafffcfdde1296290eba2b2f833e7a815a3f337893c4b934e5b657b56b7074
MATLAB
1,561
69
%% data prep clear; T = readtable("both_sites_magnitudes.csv"); rows_to_exclude = find(T.hypothesis3_include == 0); T(rows_to_exclude, :) = []; cols_of_interest = [... "GestationalAgeAtStudy_weeks_",... "magnitude_HL",... "Site",... ]; T = T(:, cols_of_interest); T.Site = str2double(replace(T.Sit...
19347750689e900ba22203057049be28c9edcd188cd813f4c8e45ab235637589
MATLAB
1,563
47
clear close all num_mice = 3; % Update this to the actual number of mice % Initialize variables to store the data all_avg_green = []; area_under_curve_green = zeros(num_mice, 2); % Two intervals % Define the time intervals time_interval_1 = [-5, 0]; time_interval_2 = [0, 5]; % Loop over all mice, load ...
c7361ca6f5a5e9da9c8b5f5d884f62d544b9fde33f0e70bd92b55de45fedfb48
MATLAB
1,564
83
% function RunningXcorr for ECG phase wrapping analysis % Reza Sameni, 2012 % close all; clear; clc data = load('ECG2.txt'); fs = 1000; % data = load('16265m.mat'); data = data.val(1,:); % fs = 128; data = LPFilter(data - LPFilter(data,5/fs),50/fs); % x = data(1001:11000); % y = data(1001:11000); x = data(1:12000)...
94b486e2329f2d2a90a4b9676c6fa622cb86d667f53d7c60748365069db0b9c7
MATLAB
1,565
85
function [alpha, beta, ok] = nufft_best_alpha(J, L, K_N) %function [alpha, beta, ok] = nufft_best_alpha(J, L, K_N) % % return previously numerically optimized alpha and beta % use L=0 to return best available choice of any L % % Copyright 2001-12-17 Jeff Fessler The University of Michigan if nargin < 1, help(mfilenam...
a165ceb7b6cc863db508fd7dc080111c6667c991bf8a519b1c8c6eef371aae19
MATLAB
1,565
48
function ItrTuningIdx = tuningShuffle(nz, trans, distx, trace, MaxItr, edg1, htime1, edg2, htime2, edg3, htime3, edg4, htime4, pangle) %initialize surrogate tuning distribution rng('shuffle'); %random number generator will be based on time, i.e. always different ItrTuningIdx=zeros(1,MaxItr); parfor itr = 1:1:MaxI...
fc061541b94c39dabd95517d90c456a8bfdc95056961645a2b0e28d675b96255
MATLAB
1,565
60
function resizeAllInDir(runDir,targetMicsPix) % Perform resize on all pStack files in a directory % % function autoROI.tools.resizeAllInDir(runDir,targetMicsPix) % % Purpose % Batch run of autoROI.tools.resizePStack % Looks for pStack structures in the current directory and all % direct...
5563f3add70d54a52aaf8014544373bd91ea9c9a3379ab04eaae244eca529ac2
MATLAB
1,567
45
clear clc [file, path] = uigetfile('clusters.mat','MultiSelect','off');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path load(datafile) close all %% int_colores = {'c','k', 'm', 'r', 'g', 'y', 'b'}; for w = 1:si...
87ea2e7e7bba40315073e42c6fe72a4c1d5df6418d858804ebf7f815ac1756c7
MATLAB
1,567
48
function x = L2_Linf_shrink(y,t) % This function minimizes % 0.5*||b*x-y||_2^2 + t*||x||_inf % where b is a scalar. Note that it suffices % to consider the minimization % 0.5*||x-y||_2^2 + t/b*||x||_inf % and so we will assume that the value of b has % been absorbed into t (= tau). % The minimization proceeds...
39840585a388c0f8efe510265b997d679aa1a89b1a0fe16afd00c16f466c1486
MATLAB
1,570
42
% Kefei Liu. 2017.5.5 function [h1,h2,a1]=scatterDiagHist(x,y,dedge,varargin) d=x-y; rlim=[min([x(:);y(:)]),max([x(:);y(:)])];rlim(2)=rlim(2)+rlim(2)-rlim(1); diflim=sqrt(2)/2* ((rlim(2)-rlim(1))/2); if nargin<3 || isempty(dedge) dedge=linspace(-diflim,diflim,13); end if length(dedge)==1 dedge=linspace(-...
f165b35689c6682a2bc1b726832921ad87f03377553fb8eeeb726fbcbace1f32
MATLAB
1,572
49
function [val, new_fp] = mread(arr, fp, count, type) % mread: eja (almost) drop-in replacement for fread for reading uint8 arrays % dependencies: c_str.m [computerType, maxSize, endian] = computer; %#ok<ASGLU> isLittleEndian = (endian == 'L'); if (strcmpi(type, 'int32-le')) % data type is int32, little en...
192b893fc6454177fd9f24e73840c54e783d1599e3219f73abd4c3eb5caa207a
MATLAB
1,573
50
function dist = eq_min_dist(dim,N,varargin) %EQ_MIN_DIST Minimum distance between center points of an EQ partition % %Syntax % dist = eq_min_dist(dim,N,options); % %Description % DIST = EQ_MIN_DIST(dim,N) does the following: % 1) uses the recursive zonal equal area sphere partitioning algorithm to % partition the u...
35596444c359d12b68b0bfca0fead3bc13cb061fafddc0c80420d9dba3956adf
MATLAB
1,573
49
%% Reproduce Fig. 1f from deposited dataset % David Wolf, 11/2023 % %% load dataset clear; clc; load('C:\Users\David\Documents\GitHub\OXT-Wolf\data\Fig2_AON_data_smooth.mat'); % for plotting (but not statistical inference) of the Euclidean distance from baseline, the population vectors were smoothed with a sliding wi...
3689878ec7e157951270e84ed41381c3cec10fe2685927d5825d02396503cb58
MATLAB
1,573
31
%-------------------------------------------------------------------------- %RETROICOR_defaults %Default settings for RETROICORplus %EJH 2011-16 %-------------------------------------------------------------------------- %Set Fourier order (3-5th order added to explained variance) RETROICORplus_defaults.fOrder = 5; %...
98622a9ef7438f6541a95da6f6745f5475a67298005f6c8e3aeecc1a2deaecaf
MATLAB
1,573
50
function [Left_Scale,Right_Scale] = Scale_Calculation(I,Neural_Net,cmap) A = I; C = semanticseg(I, Neural_Net); B = labeloverlay(I,C,'ColorMap',cmap,'Transparency',0); figure;imshow(B) [x,y,~] = size(B); for i = 1:x for j = 1:y if ((B(i,j,1) == 162) && (B(i,j,2) == 20) && (B(i,j,3) == 47)) ...
d0226c0ec52740afe4563f016beff91739da72e680eca303b0815f53771e67ef
MATLAB
1,574
47
% Higlight Neuron in Raster Plot in Red % Input % Plot of Raster: Current Figure (from Raster_Plot_V) % Neuron ID Neuron ID % Ouput % @ raster plot: % Rectangle function HighlightNeuronatRaster(NeuronID) % Example: axisfig=gcf; NeuronIDstr=num2str(NeuronID); LengthStr=length(NeuronIDs...
c1d7c12de99c38e0d297d2302ceaeab95413e395518103fe4363b45b997915b5
MATLAB
1,576
44
function [Testing_Frames,Testing_Classes] = Generate_Testing_Set(Frame_Half_Size) TrainingSet_MaxSize = 10^6; Testing_Frames = {}; % xTestImages. Testing_Frames(TrainingSet_MaxSize) = {1}; Testing_Classes = []; % tTest. Testing_Classes(2,TrainingSet_MaxSize) = 0; Dir1 = uigetdir; % Let the user choose a dir...
a2f4aff7d2b5ce5544285097feb3ab7553cc3f18142ec9827deee6394979e452
MATLAB
1,577
71
function [fid raw_data] = read_raw(filename) if ~exist('filename') filename = spm_select([1 inf],'any','select files','',pwd) end for k =1:size(filename,1) [pathstr,fname,ext] = fileparts(filename(k,:)); fp = fopen(fullfile(pathstr,[fname,'.PLOTIN'])); fid(k).spectrum.cenfreq = find_float_after('HZPPPM=',...
ada867cdf917abf3b962e0043ce884e7480b5f2b06219c9b9b0d79ab7e400f8b
MATLAB
1,579
48
function ItrTuningIdx = tuningShuffle2(nz, textre, zse, distx, trace, MaxItr, edg1, htime1, edg2, htime2, edg3, htime3, edg4, htime4, pangle) %initialize surrogate tuning distribution rng('shuffle'); %random number generator will be based on time, i.e. always different ItrTuningIdx=zeros(1,MaxItr); parfor itr = 1...
950fc30dce6ccccfbe2ffd3cb7c058dc83aaaf2cd19cfe7f6da0401e023de340
MATLAB
1,580
54
function [kernel, kernel_ft] = nufft_gauss(type, J, sig) %function [kernel, kernel_ft] = nufft_gauss(type, J, sig) %| %| Gaussian bell kernel functions truncated to support [-J/2,J/2] %| for NUFFT interplation, with width parameter "sig" %| in %| type 'string' or 'inline' %| J interval width %| sig width parameter ...
48b0283b3031281abbbef88826c740070e75d950b086271b94794dcbd2d7da67
MATLAB
1,586
49
function [xd yd delta deltaCI] = rst_shiftdhd(x,y,nboot,plotshift) %[xd yd delta deltaCI] = shiftdhd(x,y,nboot,plotshift) % shiftdhd computes the 95% simultaneous confidence intervals % for the difference between the deciles of two dependent groups % using the Harrell-Davis estimate % See Wilcox p.184-187 % % GAR, U...
de996d39b8d333e551236aef2801ad0163f0a51e1f7e13c047038c77d9c6e53a
MATLAB
1,586
53
function dist = compute_Euclidean_distance_from_baseline(data) %% Euclidean distance from baseline % Input: % data: struct with binned spike counts for odor trials % data.(odor) is a matrix with dimensions: units x time x trials % data.time is a vector spcifying the time bins % % Output: % dist is the ...
86539d9ace37def2c0187fec4714d7b250d09eb63cac45fdd44e77dba14329e9
MATLAB
1,587
46
function [spatial, temporal, S] = compute_pca(M, num_PCs) % Computes the PCA factorization of the provided movie. Note that the % movie is expected to be a 2-D matrix ([num_pixels x num_frames])! [num_pixels, num_frames] = size(M); % Compute the covariance matrix [time x time] cov_mat_size = num_frames^2 * 4 / 1...
2d7a83e59fd2e9bbe25e605103dba860ddf9e0e8896dffcce426c327c01b4a8a
MATLAB
1,588
59
function [numchannels,numtimeframes,samplingrate,thedata]=openeph(openfilename) % openeph: opens a Cartool evoked potential data file (.ep(h)) % % inputs: full path and name of the file to open % % outputs: number of channels, number of timeframes (and sampling rate for % .eph files) as 1-D numeric arrays; data as a 2-...
4bed68c81ba3faa3d39cd676e0a58a65372ffab47a0538d8ea4795d0fa3447fe
MATLAB
1,588
39
function nMerged = mergeBySim(obj) %MERGEBYSIM Automatically merge clusters by similarity score obj.hCfg.updateLog('mergeBySim', 'Merging clusters by similarity', 1, 0); waveformSim = obj.waveformSim; nClustersPrev = size(waveformSim, 2); % ensure targets of merges are smaller than units merging in...
ebacd8596e218fa8ba77e15df31ba7d4a23e141476ddd649ed89ceb56bf64e63
MATLAB
1,588
45
clear [file, path] = uigetfile('*.mat');%When the user clicks the load data button, a window should open to enable the user to select a file. datafile = fullfile(path, file); %save path load(datafile) close all cd(path) clc %% clust_num = fieldnames(clusters.cluster_cells); row = 0; for i = 1:length(clust_num) cell...
6405589b0a97ec85ffdcd981e3e6a9983f87f7d4768607a84928ea96c0cfcbc8
MATLAB
1,592
53
clear close all num_mice = 3; % Update this to the actual number of mice % Initialize variables to store the data all_avg_green = []; % Loop over all mice, load the data, and concatenate it for i = 1:num_mice filename = sprintf('Control/Stim_Onset_Mouse%d_DAMeanData.mat', i); load(filename, 'avg_g...
7214576e1ac8ff8ac5e801496e49171d26e160d7550fb994aba9443281e156a0
MATLAB
1,592
57
clear close all clc data = importdata('/Users/rsameni/Downloads/FHR_values_per_recording.csv'); fs = 1000; wlen = 10; % number of beats hr = data(:, 2); hr(hr <= 0) = []; hr(~isfinite(hr)) = []; rr = 60./ hr; rr_samples = round(rr * fs); peak_indexes = cumsum(rr_samples); [rho, mov_rho] = sqi_hr_dy...
0b76ce6226e96c8450ec87859f21e8745b14a2267364d18ee828900169cab90c
MATLAB
1,593
44
function [Training_Frames,Training_Classes] = Generate_Training_Set(Frame_Half_Size) TrainingSet_MaxSize = 50*10^6; Training_Frames = {}; % xTrainImages. Training_Frames(TrainingSet_MaxSize) = {1}; Training_Classes = []; % tTrain. Training_Classes(2,TrainingSet_MaxSize) = 0; Dir1 = uigetdir; % Let the user ...
4ac932b10e6247c7bcb7acf3c9901403fbdc77c229af1a962259a71f89b19256
MATLAB
1,593
62
fnames = {'hex','iaa','two_oct','hxa','two_hep','ani',... 'msal','lcar','gua','chex','bza','ger','etha',... 'apin','one_oc3','cit','lin'}; minimum = Inf; maximum = -Inf; for i = 1:length(fnames) eval(sprintf('d = jcampread("%s.jdx");',fnames{i})) xdata = d.Blocks.XData; minimum = min(minimum...
f6a1bdfafce0ad960d1b9f22fad09c87608b4b066bcf803d7a04a40bd7044317
MATLAB
1,593
72
% This script tests the goodness of fit of gaussian functions on an ECG clear; close all; clc; % load('SampleECG1kHz1.mat'); load('SampleECG1kHz2.mat'); data = data'; fs = 1000; ch = 2; ksigma = 4; % x = LPFilter(data - LPFilter(data, 3/fs), 250/fs); x = data(ch, :) - LPFilter(data(ch, :), 2/fs); y = -[0, diff(x)]....
563cd17df3d7b92c02969285a7b8905577cda39d70f7f29d8951e323b934e430
MATLAB
1,595
41
function nMerged = mergeBySim(obj) %MERGEBYSIM Automatically merge clusters by similarity score obj.hCfg.updateLog('mergeBySim', 'Merging clusters by similarity', 1, 0); waveformSim = obj.waveformSim; nClustersPrev = size(waveformSim, 2); % ensure targets of merges are smaller than units merging i...
53a97857778ebeb9c0304a66a0219215068c275558c572a64638a90c786a014d
MATLAB
1,599
31
%% eopn3 vs control per mouse cd('I:\My Drive\ELYASHIV\PFC_paper_results_after_revision\per_mouse\f4h') clear clc control = importdata('responsive cells per exp_control.mat'); eopn3 = importdata('responsive cells per exp_eopn3.mat'); %% T =table() T.responsive = [control.reponsive_cells_expsT{1:end-1,2};eopn3....
a9486368df9ac0406cba289a4eb2ff0991213c498b480e994aa16cfab6d09cf6
MATLAB
1,600
48
function der = getweights(layers) n = numel(layers); ind = 0; der = double([]); for l = 1 : n % layer if strcmp(layers{l}.type, 'i') % input if (isfield(layers{l}, 'mean')) curlen = numel(layers{l}.mw); %w_trans = permute(layers{l}.mw, [2 1 3 4]); %der(ind+1:ind+curlen, 1) = w_trans(...
b6db8c9bad424aa9c9903c9b07e8341c37ca755e90349ac42fd9bab3f6a9da3c
MATLAB
1,600
42
%% premutation test sensativity analysis mdes = sensativity_analysis_premutation_test %% function mdes = sensativity_analysis_premutation_test() desired_power = 0.80; alpha = 0.05; n_per_group = 60; n_simulations = 1000; effect_sizes = 0.3:0.01:0.6; % Adjust the range based on your context...
cc15243623da239e930acc804746078bf51ca825807aea89c5da825b759757a4
MATLAB
1,600
45
% Test script for white_noise_wiener_filter (white noise suppression using % Wiener filter) % % Reza Sameni, 2024 % The Open-Source Electrophysiological Toolbox % https://github.com/alphanumericslab/OSET close all clc clear % Load the input audio signal [x, fs] = audioread('/Users/rsameni/Documents/DataFiles/Acousti...
75d73f0d02ddc5f88a93405be9055784bc39026fb57d153c6f2d087bd9d5a568
MATLAB
1,602
52
%% Calculate d' for neural population spike counts between two stimului % INPUTS % - Array of spike counts for two stimuli to compare, of the form: % (nTrial x nCell) with each row corresponding to a % trial (observation) and each column to an individual cell (variable) % % OUTPUTS % - d' scalar (unsigned) % d' = u1 -...
34852a7703fc3c4b92685221313f1acfddcfcec43d54092afaee7e16b2f76844
MATLAB
1,604
68
% Sample code for multiple delay length active noise cancellation from ECG signals % % Reza Sameni (C) % Email: rsameni@shirazu.ac.ir % Web: www.sameni.info % % Created May 2007 % Modified June 2018 clc; clear; close all; load('SampleECG128Hz'); fs = 128; ECG = y(:,2)'; N = length(ECG); n = (0:N-1); ...
33700eee002e17019cff7edb0bace27ebd8ecff7b62dcc36b33a33d1173558b9
MATLAB
1,606
51
% A script showing a common-case use of the model's functions when multiple % simulations are to be run. In this case, we plot simulation outputs for 5 % different multipliers of IKr (corresponding to 80, 90, 100, 110, and 120 % percent availability). %% Setting parameters clear % param is the default model parametriz...
78b52a7e6b47b30776fe097726ffae3536c061edb77707267adc166a18e8db2d
MATLAB
1,607
50
function lcs = logsumexp(X, varargin) % LOGSUMEXP(X, dim) computes log(sum(exp(X), dim)) robustly. Care lightspeed users! % % lse = logsumexp(X[, dim]); % % This routine works with general ND-arrays and matches Matlab's default % behavior for sum: if dim is omitted it sums over the first non-singleton % dimension. ...
80abe3b8a89c84d6682b0698e76ab17b3e828d77f6331c7c029536d645e2f495
MATLAB
1,607
38
function [gsidx] = get_prediction_from_pcc(pcc,grnnet); % GET_PREDICTION_FROM_PCC Sort TF-NTF gene interactions according to their Pearson correlation coefficients. % GSIDX = GET_PREDICTION_FROM_PCC(PCC,GRNNET) returns interactions GSIDX (#interactions-by-3) with rows % [TF_INDEX, NTF_INDEX, PVALUE] sorted by th...
33c03484d95f81e7531a09fcbc359719a1f269988c6661f496ed67229000c47c
MATLAB
1,608
27
%% This script shows how to run an automated model evaluator. In this case, reportParams.reportType = 'full' determines that all Matlab-based criteria are computed and plotted % the evaluator runs the basic version of the model. To run the dynCl % version, please uncomment lines 10 and 18. clear % First, we define whi...
9aea7bde1e62812731c6eac40c39ec9d9ec5680a70c0ee8897dfc4b650b26627
MATLAB
1,608
41
function [ nexFile ] = nexAddContinuous( nexFile, startTime, adFreq, values, name ) % [nexFile] = nexAddContinuous( nexFile, startTime, adFreq, values, name ) % -- adds continuous variable to nexFile data structure % % INPUT: % nexFile - nex file data structure created in nexCreateFileData % startTim...
9b0a97bc64e3cb61f30152458da0b19732bc3cd56be7512688a971c3926e347f
MATLAB
1,609
43
clear; close all; clc order = 3; % Resampling order (2, 3, 4) fs_input = 11025; fs_output = 4000.0; T = 0.5; N = round(T * fs_input); t_input = (0 : N - 1)/fs_input; % Sample test of the Resampler class using the mexFunction interface % Example 1: A mixture of sinusoidal signals % signal_input = sin(2 * pi * 157.13...
3a539154c66a36217252516a9f51d110b406dae6f318b784690e748b9d12acef
MATLAB
1,610
40
function spawnFigures(obj) %SPAWNFIGURES Create the standard cadre of figures obj.hFigs = containers.Map(); for f=1:length(obj.hCfg.figList) figTag = obj.hCfg.figList{f}; figToolbar = 0; figMenubar = 0; switch figTag case 'FigPos' figTitle = 'Un...
b2d22a66b7ab0c7b5ff120398442172ab77b8533c5ab99515b526986b84edcbb
MATLAB
1,611
50
% This script compares the behaviour of fixed-Cl and dynamic-Cl versions of % ToR-ORd after 1k beats (I.e., this does not really showcase the % instability of the fixed-Cl model, it serves mainly to show general % similarity of action potential and calcium transient at the time when the % model is usually evaluated. %...
bbb30701eb6d3886a749aabf834bf0ee9a87dc149a95ceada1006b697e8c89b6
MATLAB
1,611
63
function F=opls(X,Y,Xtest,nOSC) %+++ Function: orthogonal to latent sturctures(O-PLS) %+++ Input: X: m x n (Sample matrix) % Y: m x 1 (measured property) %+++ Xtest: test samples % nOSC: The number of OSC components to remove %+++ Reference: Johan Trygg and Svante Wold, Orthogonal projections ...
54ecb2a9d442407840ea8ac1ce77b21d0d81848b160e1fd43631da3395bac6be
MATLAB
1,612
44
function [pulseOnset, pulseOffset] = getPulseOnsetOffset(signal, threshold) %Created by: Anya Krok %Created on: 19 March 2019 %Description: general code for determination of onset and offset of %optogenetic stimulation based on raw signal from pulse generator % % [pulseOnset, pulseOffset] = getPulseOnsetOffset(...
94e63757daf26a9c6c7721af50e972c950e37c06e96f432971ac6e5ab1ac4fb1
MATLAB
1,616
83
function F=ecr(X,y,A,method,alpha) %+++ Elastic Component Regression, a bridge between PCR and PLS. %+++ alpha: 0 PCR % 1 PLS % (0, 1) transitional models between PCR and PLS %+++ Central South University, Changsha 410083, P.R. China. %+++ Advisor: Yizeng Liang, yizeng_liang@263.net ...
c24595913c62c1ebf28a758096d1578403fd48571b0bb2fa99093f92f8c0f742
MATLAB
1,616
44
function [ output_args ] = preprocessMovie(p,moviePath,saveDir) %preprocessMovie: performs all preprocessing steps on raw movies disp([char(datetime('now')) ' loading movie']) movie = single(loadMovie(moviePath)); disp([char(datetime('now')) ' registering movie']) % use existing registration coord...
85f06a438ddae0ed4e5783b06fad28a67d5d3033f920ee0c9944aaa646e79be9
MATLAB
1,618
48
function Plot_Brains_AG_MSPoI(FinalRepPar,nodes_name,nodes_coord,at,options) gr = options.grlabel; for n = 1:length(nodes_name) Name = nodes_name(n); NodeName(n,:) = string(Name); end %============== PLOT BRAINS==================== % TO save data cd /netapp/vol7_u923/SEME/SEME_...
f60c5b64584eaeaf0df0abd983d31b7b29126280b8ceebd5c44fed6743956629
MATLAB
1,619
75
function [suj empty_suj] = get_series(serie_name,suj,reg_ex,varargin) ind_to_remove = []; ser = {}; for nbsuj = 1:length(suj.sujdir) if ~isempty(varargin) aa = get_subdir_regex(suj.sujdir(nbsuj),reg_ex,varargin); else aa = get_subdir_regex(suj.sujdir(nbsuj),reg_ex); end if length...
2222fdcf8432fbc2e236b6144e8d229d4d3a4415c5b11cf4c1315d1d18fa200f
MATLAB
1,620
48
function pv_nonpv_ccg(cellids,resdir,issave) %PV_NONPV_CCG(CELLIDS, RESDIR, ISSAVE) Cross-correlation analysis. % PV_NONPV_CCG calculates cross-correlations for PV(+) and non-tagged % neurons in 50 ms windows. CCG results are saved for non-tetrode pairs % and tetrode pairs separately. % % See also CCG. ...
c664d3cff09fade86d7e8904c3e6dbfb07a95dd264bf8955ff61e97793d2a2a7
MATLAB
1,620
45
function derived_cardiac_signals(app) %DERIVED_CARDIAC_SIGNALS interpolates the hb_res.dt_instantaneous % Detailed explanation goes here idx = 0; tmp = nan(1,length(app.data)); for i = 1: length(app.data) tmp(i) = app.data(i).tic_multipl; if strcmp (app.data(i).name,'RR Intervall') idx = i; end e...
de16abbb3b1d25b4089d47bbe2391b232792ddec502074dcfe2eeb8bff2f4908
MATLAB
1,620
45
function x_filtered = outlier_filter(x_raw, method, half_wlen, percentile) % outlier_filter - Detects outlier samples with diff values beyond a given % percentile and replaces them with mean or median of a sliding window % around the sample. Other samples remain unchanged. % % Syntax: x_filtered = outlier_filter(x_...
dfdb2fd38b56fa11aa4415e4e1cdd1c2584baefe9f43b3e4e85bed6774311c4f
MATLAB
1,620
41
function [movie_corrected,bleach_filters,bleach_traces,temporal] = debleachMovie( p,movie ) % smooth movie in time [height,width,n_frames] = size(movie); movie = reshape(movie,[height * width,n_frames]); smooth_win = 2000; M = zeros(size(movie)); parfor i = 1:size(movie,1) M(i,:) = smo...
f75192bc7486b0c1df6c73a455aacc5e4fc2fa71085e21bd39621e7d7f994aee
MATLAB
1,620
65
function [pval,Factual,Fdist] = randanova1(m,group,num) % function [pval,val,dist] = randANOVA1(m,group,num,mode) % % Estimate p-value for one-way ANOVA using permutation. % For further information on using permutation to calculate signficance % tests see Anderson (doi:10.1139/cjfas-58-3-626). % % <m> is a vecto...
1832c5b7d88277f4a9fe2d74ba665d1f7d59280d1f62e2c2b71bb0b72c9abd98
MATLAB
1,621
70
function write_result_to_csv(conc,resname,field_list) if ~iscell(conc) conc={conc}; end if ~exist('field_list') field_list = fieldnames(conc{1}); end fid = fopen(resname,'a+'); nbline=0; while fgetl(fid)~=-1 nbline=nbline+1; end for npool = 1:length(conc{1}) f1 = getfield(conc{1}(npool),fiel...
d0741e5093f1ec8e2245ba870df8777d9b6c0790bd9e7a901c5a6e9ee7bed002
MATLAB
1,621
52
function Bursts = test_criteria_set(DataBroadband, SampleRate, NarrowbandRange, CriteriaSet, Plots) % runs burst detection with a single narrowband range and criteria set to % see how the criteria are doing % plots should be 3 arguments DataBroadband SampleRate NarrowbandRange CriteriaSet Plots = [true true true]; end...
db5348ae873a6baa344fec5cd338c5d089418ced3624e834a8685a07420c1d64
MATLAB
1,624
51
function [ output_args ] = extractJoint( p,thisSub ) %% do path handling, etc saveDir = fullfile(p.rootDir,'miniscope', ['subject' num2str(thisSub)],'jointExtraction','extracted'); savePath = fullfile(saveDir,'resultsPCAICA.mat'); if exist(savePath) disp('Skipping subject (already done)') ...
23cc6cf3711cb090a4542926b0939330cf8b1c72d12b08a7d70fbecf099afbe3
MATLAB
1,625
40
%% plot [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path w = 2;% window for ploting (2 = sustaneid) %% for i = 1:length(datafile) load(datafile{1,i}); ...
926cec6191f3faf396a4478203486c38b09965d191e4929f33b5d46e421eca36
MATLAB
1,625
45
function [phase, phasepos] = phase_calculator(peaks) % phase_calculator - ECG phase calculation from a given set of R-peaks. % % Usage: % [phase, phasepos] = phase_calculator(peaks) % % Inputs: % peaks: Vector of R-peak pulse train % % Outputs: % phase: The calculated phases ranging from -pi to pi. The ...
d1815955e461f8b0acbd3945f5dbbb0fcaaf4cd5c63f8f74086391d0fa62a6d0
MATLAB
1,625
61
function [S,G,O] = fcn_staged_multilayer(A,gbound,obound,nsamples,couplingtype) N = length(A{1}); T = length(A); %% gammarange = [min(gbound),max(gbound)]; omegarange = [min(obound),max(obound)]; g = unifrnd(gammarange(1),gammarange(2),nsamples*100,1); o = unifrnd(omegarange(1),omegarange(2),nsamples*100,1); in = inpol...
cb7bc8f5e3ee79f7f1d00f0c42619480679f187e18f269cea2d19c566d9c8147
MATLAB
1,626
60
function EEG = simulate_eeg(Channels, Seconds, fs, bpfilter, hpStopfrq) % Generates a fake EEG signal without any oscillations, to see how many % false positives get generated. % Channels: number of "channels" to generate % Seconds: duration in seconds of the recording % fs: sampling rate % bpfilter: [high-pass, low-pa...
10982b637ce0ff8e981158422b8af31be30061745d46e5f648d1ce417a8deaf3
MATLAB
1,629
50
function spmup_plotmotion(motion_file,radius) % simple routine to plot motion parameters in mm and degrees % also added is the root mean square displacement % % FORMAT: spmup_plotmotion(motion_param,radius) % % INPUT: motion_param is the file in which the motion paramters are % radius the head size (useful to c...
46773dee48cf2bf77c9957ea1d55f3ec8bb4d7f81f3623379bd2951008193f0d
MATLAB
1,629
54
function [clusterIDs,centroids] = mnl_MeanShift(X,bandwidth) %Perform Mean Shift Clustering on the input data X with the given bandwidth %Params: %X : Input matrix %bandwidth: Bandwidth controlling kernel size %Returns: %clusterIDs, centroids [n,p]=size(X); %Initialize clusters to zero clusterIDs=zeros(n,1...
3355763ea500bcb5d5f69c2a9b65ae1ce1c772b56eb7ae65c4ce485439bb86d1
MATLAB
1,630
42
% Read coordinates function [XY,r]=Read_ROI_Coordinates(CurrentPath) DeafultROIRadius=5; SlahesIndxss=find(CurrentPath=='\'); [XYName,XYPathName] = uigetfile({'*.csv';'*.zip'},['All Coordinates (XY) of ',... CurrentPath(SlahesIndxss(end-1)+1:SlahesIndxss(end)-1)],CurrentPath); if ~isnumeric(XYPathName) XYFN = c...
cb1d5d08a7d6fe3d548bea5eb5baaac68846e9fcdec177d8420dc61b342a825d
MATLAB
1,630
52
function th=rotateticklabel(h,rot,enabled) %ROTATETICKLABEL rotates tick labels % TH=ROTATETICKLABEL(H,ROT) is the calling form where H is a handle to % the axis that contains the XTickLabels that are to be rotated. ROT is % an optional parameter that specifies the angle of rotation. The default % angle is 90. ...
44b7d398a91efb28004a3ae5c7a887bbb83f11d600b3aa5bbbf915e056ede7eb
MATLAB
1,633
42
%%devide_cells_by_aria clear clc %% %save only Intensity encoding + IR row_names = {'total'; 'responsive'; 'IR'; '%_reponsive'; '%_IR' }; T = table(row_names); [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd...
94a36c2f94a6a8a4aa0912dcba3902371bb33c020e3a46b26c0bc51c2250f281
MATLAB
1,633
54
%% laser repetitions vs no laser %% compare response per rep clc clear cd('I:\My Drive\ELYASHIV\PFC_paper_results_after_revision\eopn3') all_ints_data = importdata("all_ints_data_eopn3.mat"); all_ints_data_control = importdata("all_ints_data_control.mat"); %% NDs = [10, 8, 6, 4,3,2,1]; for i = 1:length(NDs...
e0ca3ab7f4067db3052cb1a19557d54010fdb316057274be203150c2993194da
MATLAB
1,635
40
function [index, spikes, thr, thrmax, noise_std_detect] = DetectSpikes_Amp(Data, handles) % DetectSpikes_Amp Detect spikes based on amplitude thresholding. Adapted % from WaveClus % INPUT % Data - raw waveform from the electrode % handles - detection parameters % OUTPUT % index - spike times (the only output wri...
e0ddd26278f5594790e3bb6f3e4b2ae4e91225eccb91f1417ca466e097ed21c2
MATLAB
1,637
51
% Tree validation % Measure of how faithfully the tree represents the dissimilarities among % observations and select the best between different methods: average, % centroid, complete, median, single, ward and weighted. % % HBestTree_JP(Sim, numFig) % % Inputs % Sim = similarity as matrix PxP (P=#peaks). % numFig = num...
718e7c337b2cb1a4fe0ca4cb13f42761ac41761956c2a7d0676eabd274810146
MATLAB
1,639
48
function [ nexFile ] = nexAddNeuron( nexFile, timestamps, name, wireNumber, unitNumber ) % [nexFile] = nexAddNeuron( nexFile, timestamps, name ) -- adds a neuron % to nexFile data structure % % INPUT: % nexFile - nex file data structure created in nexCreateFileData % timestamps - vector of neuron...
e1c6f3bdb187b2fdfff84e91861df60d7467f58faeb8db44d3e152363db4c2fb
MATLAB
1,640
43
%% To test the toolbox on the test image "test_data.tif": %% download the folder and cd in it, then run this script %% we recommend reading the README file. clear clc close all current_fold=pwd; % TO PERFORM ESTIMATION OF OPTIMAL K uncomment lines 14-15-16 % [120 370 120 370 30 100] is a representative crop for % tes...
04b955bcecaaaf00db4de856e066d64d75f6f0765e8f2406cab503f0a9392166
MATLAB
1,641
39
% plot ramp from all_data [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path w = 2;% window for ploting (2 = sustaneid) %% for i = 1:length(datafile) load(d...
88c7e7e49ff5a8547bfbcdbb0a0446d8c583b0bdac170b0acae9d36a2ce38d22
MATLAB
1,641
20
%% cog analysis by snp %%% what are the y variables: %%% word pairs (PAL), Y=cognitive.x20197_2_0; for snp=1:length(snps.Properties.VariableNames) Outcome=cognitive_ordered.x20197_2_0; APOE=snps(:, snp);APOE=round(APOE{:,1});APOE(CT_SNPs.FID==0)=NaN; ix= AD_ordered.eid==0 | ~strcmp(ancestries_ordered.pop,...
131850b3a692736fbad31dea9ee8951e371c9d2285fca5a10463138801055609
MATLAB
1,644
72
% function to compute the spatial scaling factor, temporal scaling factor % and scale-specific factor % x1 and x2 are two dynamics with the same number of units, but potential different length of time (row for neuron and colomn for time) function [SSI, TSF, SSF] = scaleFactor_mean_sz(x1,x2,tLimit,sLimit,step) [N,...
e1adce1b6c3367ffa2aa50d6479341670315559d2dd66062382db1f90c798ed9
MATLAB
1,645
68
function [X,Y,Z] = fatcurve(c,r) %FATCURVE Create a parameterized cylindrical surface at radius r from curve c % %Syntax % [X,Y,Z] = fatcurve(c,r); % %Description % [X,Y,Z] = FATCURVE(C, R) sets X, Y and Z to be the coordinates of a % cylindrical surface at radius R from curve C. This function is intended % for use wit...
7037cf0f8affb1a8ff51dbdfe02e804699148b026a4fd5bcda497bcfb62a4c16
MATLAB
1,646
56
function [spectrogram]=spectrogram(sd,param) %unit of timewindow and bin is milisecond while unit of frequency is times/second. tw=param.spectrogram_timewindow; % Integration Time Win bin=param.sdbin; % Binsize?? fr=param.frequency_range; % frequency range [min max] %duration = param.duration; i...
4378ed810ef596a97c6d22ce646f840a9053f5d2f487012f5e024a3c492d4d6d
MATLAB
1,647
42
%% plot% [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path w = 2;% window for ploting (2 = sustaneid) %% for i = 1:length(datafile) load(datafile{...
73ea9ffa188aefb6d6e75fb1bedd30df4cac4724d01791a8bb50430083b23838
MATLAB
1,647
39
function [Beads]=mnl_ExtractBeadInfoFromICY_temp(fname) % Function to extract the bead information %% Pre-allocate the structure Beads=struct('BeadLocation',[],'BeadSize',[],'BeadCentre',[],'BeadExtremes',[],'ImageLimits',[]); %% Info from excel sheet [~,txt,~]=xlsread(fname); NumSpots=size(txt,1)-1; for i=1:NumSpots ...
170b8f0c167dc962aee70857f8c0ab1767787f76356c889f6f4fc39de5804dd3
MATLAB
1,648
46
function [] = imwriteTFSK(Volume,name) %% write 3D image file %% supported formats: single/double/uint8/uint16 %% Input: % @Volume: the 3D image % @name: the file path % % [1] JIAMIN WU, ZHI LU and DONG JIANG etc, % Iterative tomography with digital adaptive optics permits hour-long intravital obse...
76ff91fc576d4fe89e44048833730fb0a79677114c482e7b8961e191ca0cd441
MATLAB
1,649
68
function Plot_deepDreamImage() Save_Predictions = 0; D = dir('D:\Omer\Neuronalizer\Resources\CNN\Input_Samples\Good'); D(find([D.isdir])) = []; File1 = load('D:\Omer\Neuronalizer\Resources\CNN\Runs\7.mat','My_CNN'); My_CNN = File1.My_CNN; % Layers = {'conv_1','conv_2','conv_3','conv_4','conv_5'}; Channel...
aae63505f348ffc968aef849a04151e888fa914444c51ae5da04e5548b8d8905
MATLAB
1,651
56
function argsort = orderClusters(obj, by) %ORDERCLUSTERS Arrange cluster ID numbers by some criterion if nargin < 2 || isempty(by) || (~strcmp(by, 'Y + X') && ~isprop(obj, by)) by = 'clusterSites'; end if strcmpi(by, 'Y + X') && ~isempty(obj.clusterCentroids) [~, argsort] = sort(sum(obj...
743d1445ca86ccece5170902801f2b21ffae93cbacaaf87b110f6cb18e523f24
MATLAB
1,652
52
clear all clc odors = {'hex10','hex','iaa','two_oct','hxa','two_hep','ani','hex01',... 'msal','lcar','euc','gua','chex','bza','ger','etha',... 'apin','one_oc3','neem','gar','cit','lin'}; c = 1/255*[[33 125 255];[33 125 255];[33 125 255];... [33 125 255];[33 125 255];[86 105 105];[86 105 105];... ...
cb2f3f5623b038b068148ec8a686746a06cfefc1b5cb8453a240eb6349110c15
MATLAB
1,652
54
% Copied from gampmatlab toolbox % http://gampmatlab.wikia.com/wiki/Generalized_Approximate_Message_Passing % % Finds the flipped, circ-shifted, and phase-rot version of "in" that best matches "ref" % % [out,fxnvec,fxnmat]=disambig2Drfft(in,ref,n1,n2) function [out,fxnvec,fxnmat]=disambig2Drfft(in,ref,n1,n2) ...
171a195687d6ff6a827354777b008d1adfb4dda4cd0c85407af555587521900e
MATLAB
1,653
73
function [mean_resp, se_resp, mean_s_fr, se_s_fr] = get_mean_resp(session, channel, unit, fold, period, probe, window) % Get mean response and mean firing rate of s-model for a specific neuron % % Parameters % ---------- % % - fold: integer scalar % Fold number % - period: [scalar, scalar] % Time period from saccad...