sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0b30b5088b0e01eba281ee5773963b36e3ec9709c6081f08e402b2b71274d6b3
MATLAB
1,100
35
function [AutoCo]=AutoCorr(Array,duration,Direction)%bin‚ÍhistƒOƒ‰ƒt‚ׂ̍©‚³i•ªŠ„”j %—¼•ûŒü‚̏ꍇA‘S‘Ì‚Åduration‚Ì’·‚³‚É‚È‚é‚æ‚¤‚É‚µ‚Ä‚¢‚éB Array(Array==0)=[];%Excel‚©‚çƒf[ƒ^‚𒼂Ɏ‚Á‚Ä‚«‚Ä‚¢‚éê‡A0‚Å–„‚ß‚ç‚ê‚Ä‚¢‚邱‚Æ‚ª‚ ‚é Array=sort(Array); AutoCo=[]; if Direction==1 %•ЕûŒü for n=1:length(Array...
4c217bf8a0c41be93216c3a23f884993a5d2f05901688a49e9014e859f2b8667
MATLAB
1,100
24
function meanfigure cd('C:\Users\C238\Desktop\touchcellLtRt_matsuda'); load('FiringRate_TouchCountData.mat'); RtRepeat5TouchSpike4FR_BinMeanArray=[]; RtRepeat5TouchSpike4FR_BinStdArray=[]; RtRepeat5TouchSpike4FR_BinArray for d=1:5 RtRepeat5TouchSpike4FR_BinMeanArray=[RtRepeat5TouchSpike4FR_BinMeanArray mea...
177dd839c0083ec02e84c7b4941776ded9217b6255338f889fed2344e7daa4fa
MATLAB
1,101
27
function phase = phase_shifter(phasein, teta) % phase_shifter - Phase shifter; used for shifting the ECG phase signal % % Usage: % phase = phase_shifter(phasein, teta) % % Inputs: % phasein: Calculated ECG phase % teta: Desired phase shift. teta>0 and teta<0 corresponds with phase leads and phase lags, re...
96a457d033ff2d8a3fe7986d0b156f4f635de40f16a6e15f256b915cebee8f40
MATLAB
1,101
30
% Authors : Simon Wadle 2019-2023 %function corrects movement by utilizing the NormCorr Package function motion_corrected_data = NormCorrWidefield(Yf) gcp; addpath('NoRMCorre'); %Yf = read_file(name,1,200); Yf = single(Yf); [d1,d2,~] = size(Yf); %% perform some sort of deblurring/high pass filtering gSig = 7; gSiz = ...
0b786f93a1c258c7397fdc06079885132aa03330be522a1aceb13e8cfcd0fd01
MATLAB
1,102
43
function FourierfunctionAC %UNTITLED2 ‚±‚̊֐”‚ÌŠT—v‚ð‚±‚±‚É‹Lq % Ú×à–¾‚ð‚±‚±‚É‹Lq global ACresult ACresultW fname tfile AAC figAC bin=500; figAC=figure; subplot(2,1,1); plot(linspace(1,5000,bin),ACresult,'color','k');hold on plot(linspace(1,5000,bin),ACresultW,'color','b'); ylabel(['AC']) M=mean(ACres...
549ea70e6d9179dee875b69e17aa6797c160dfa8a271820cfbf3e4396804f765
MATLAB
1,102
26
function [zProb, zGenProb] = mean_center_timescore(ProbAll, GenProb, PreserveDim) % [zProb, zGenProb] = mean_center_timescore(ProbAll, GenProb, PreserveDim) % GenProb is a P x 2 matrix, with the first column indicating the mean % general probability of an event, and the second column the standard % deviation. This func...
56a3bc4034348bceeb6958986ae6a212a3519b54d9bb45c6db91cd8cfba198c8
MATLAB
1,102
34
function [spiketimes, trials, groups, trialStarts] = createExampleData % createExampleData Generate random spike times for testing spikeRasterPlot % [times, trials, groups, starts] = createExampleData() Generate a random % spike times for two neurons across 20 trials. % Copyright 2020-2021 The MathWorks, Inc. % Creat...
07f5fd1c1d5312d749bc5102a1f479dbdbc3a4d89ffc6e02103c5ce11b4b6421
MATLAB
1,103
47
function DB=hbf_BEMOperatorsB_Linear(meshes,coils) % HBF_BEMOPERATORS_B_LINEAR make DB matrices for linear-basis BEM % % DB=HBF_BEMOPERATORS_B_LINEAR(meshes,coils) % meshes: BEM geometry, [N x 1] cell array of hbf structs % coils: coil description, hbf struct % % DB: DB matrices in [N x 1] cell array % % v160229...
521736a9b58357d6088272a46fb751eb0c35de6e3e9e94344df01670dfa414b8
MATLAB
1,103
28
function [Segments,Traced_Segments] = Trace_Short_Segments(Data) Min_Segment_Length = Data.Parameters.Tracing.Min_Segment_Length; [Im_Rows,Im_Cols] = size(Data.Info.Files(1).Raw_Image); % TODO: this is already computed in the parent function. Segments = Data.Segments; Traced_Segments = zeros(1,numel(Segments...
c772b9abd586879f9e11953b2a81db75589dbe92862c248bfee319d7cd68851e
MATLAB
1,103
33
function y = HRSmoother(x, ExcludedHR, wlen, varargin) % % HR = HRSmoother(x, ExcludedHR, wlen, RefLevel), % Heart rate smoothing % % Open Source ECG Toolbox, version 2.1, September 2010 % Released under the GNU General Public License % Copyright (C) 2010 Reza Sameni % Shiraz University, Shiraz, Iran % reza.s...
8c19438cb5b683550723de24addd87a23423a9242094a32a0933dc2afeac2df7
MATLAB
1,106
51
function NosePokeDrinkAnalysis close all cd('C:\Users\B133_2\Desktop\NosePokeData'); for N=2:7 % FileName='101_180119' % FileName=[int2str(N),'01_180119']; FileName=[int2str(N),'_180406']; eval(['load ',FileName,'.mat -ascii;']); eval(['data=X',FileName,';']); StartTime=data(1,2); StopTime=data(1,...
145da494dfe4ff4a6dbaab8a79d9c9029c262f85d46eff5deadbbdca051c8593
MATLAB
1,107
59
function [o no]=get_subdir_regex(indir,reg_ex,varargin) if ~exist('indir'), indir=pwd;end if ~exist('reg_ex'), reg_ex=('graphically');end if length(varargin)>0 o = get_subdir_regex(indir,reg_ex); for ka=1:length(varargin) o = get_subdir_regex(o,varargin{ka}); end return end if ~iscell(indir), indir={indi...
48997ea91e4b9620b0b2917ae9a5d389b0ebcd38d2390240260ebd5b4f0c7231
MATLAB
1,107
48
function mnl_InsertProgressTrackerInLoops(i,n) %Inputs % i=the current number % n=the total number of loops to do persistent i_prev_prct; PcValue=(i/n)*100; rPcValue=round(PcValue,1); if rPcValue==100 && i<n PcValue=99.9; else PcValue=rPcValue; end msg=sprintf('%s\n','Percent Complete...'); %% Print message...
e55441cfc8d1a385a978008f45380dd309c99f4d07d8cb29053a6e6bd2b3d9e5
MATLAB
1,111
20
function [ShiftedArray]=ShiftArray(Array,TurnMarkerTime) % global OneTurnTime Array(Array==0)=[];%Excel‚©‚çƒf[ƒ^‚𒼂Ɏ‚Á‚Ä‚«‚Ä‚¢‚éê‡A0‚Å–„‚ß‚ç‚ê‚Ä‚¢‚邱‚Æ‚ª‚ ‚é %Array‚ðTurnMarker‚ÅØ‚èŽæ‚Á‚ďˆ— ShiftedArray=[]; for n=1:length(TurnMarkerTime)-1 tempArray=Array(Array>TurnMarkerTime(n)&Array<Tu...
1a7127a7f7c16f7f5cefbe0f73399f1a385c7690c057abfbf096585ddfad5aca
MATLAB
1,112
54
% fastICA test % Reza Sameni, 2005 close all; % teta = -4*pi:.01:4*pi; % r = 1*sin(5*teta).^9 + 1*sin(teta); % [s1,s2] = pol2cart(teta,r); % N = length(teta); Wp = .2; Ws = .25; Rp = .5; Rs = 60; [N, Wn] = ellipord(Wp, Ws, Rp, Rs); [B,A] = ellip(N,Rp,Rs,Wn); N = 1000; n = 0:N-1; s1 = sin(2*pi*.003*n).^2; s2 = 1*on...
52600d12ee5cd36d04547e2a25f0211aa347b3c627fe9e50b2cd8454ea226afb
MATLAB
1,112
26
close all clear all; clc; s = load('peak_distanse_control_before.mat'); m = load('peak_distanse_control_after_saline.mat'); l = load('peak_distanse_control_after_hcl.mat'); dis_before = s.peak_dis; dis_after_saline = m.peak_dis; dis_after_hcl = l.peak_dis; bin_edges = 0:0.001:0.2; figure histogram((dis_be...
c14b7d213b5165cb3af0bbfbbf70aa7b732cecb7fb351ee8714389d63e29c72a
MATLAB
1,112
36
%Shinjini Kundu (c) 2015 function [ B,T ] = Gen_Stack( IMAGES ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here slices = size(IMAGES{1,1},3); for k = 1:slices BIG = []; MEAN = []; for i = 1:size(IMAGES,1) BIG1 = []; MEAN1 = []; center_image ...
b6565bc4f83928bcc6a493fed2212cb1289735ce883ef770eb2a5584dd47371f
MATLAB
1,113
52
% test fetal ECG preprocessing % Reza Sameni % July 2018 % Revised: % Oct 2020: obsolate psd replaced by pwelch clc clear; close all; load('FOETAL_ECG.dat'); data = FOETAL_ECG(:,2:end)'; clear FOETAL_ECG; fs = 250; % load patient165_s0323lre; data = data(:, 2:6)'; fs = 1000; N = size(data, 2); % make the data no...
cfa44660186abe2071e5f992d1995a55ab616efab4ed56792865a1a74ed4ce4f
MATLAB
1,113
41
function argpair = fatrix2_construct_args(ob, varargin) %function argpair = fatrix2_construct_args(ob, options) %| %| Given a fatrix2_block object, return a cell array of name, value pairs %| such that the object could be re-constructed by %| ob = fatrix2(argpair{:}) %| This is useful for constructing variations of th...
1ee6b5f113404306b9cdc79400799551437378c7f9b2c64f8bfaa1a520b84e7f
MATLAB
1,114
27
function proj = templateFeaturesBySpike(obj, spikes, sites) %TEMPLATEFEATURESBYSPIKE Get template features features for selected spikes on given %sites nSites = numel(sites); nSpikes = numel(spikes); proj = zeros(nSites, nSpikes); iFeatures = obj.templateFeatures(:, spikes); uniqueTemplates...
3db745a0d68987c2b362614dfb8aa397f5858159531568284ee4e2b741d21db7
MATLAB
1,114
37
% Function to re-label hebbian sequence % Input % labels: Vector sequence of neural ensemble instances % HebbSequence Vector of Ensembles Sequence % mode: 'sequence','2-freq' % Output % relabels resorted sequence of neural ensemble instances function relabel=relabel_ensembles(labelsEns,HebbSequenc...
ea7d1fdf0d05fbe807170a9dacae8db664be6d742bad5a0044fdf8a71ddc5b17
MATLAB
1,114
37
addpath('functions'); addpath('demo_data') addpath('perturbation') addpath(genpath('results_figures\sp_results')) load('patient_data.mat'); % 1 is a seizure-free case, 2 is a non-seizure-free case % patient_number = 1 % Uncomment this line if running script from here patient = patient(patient_number); %% Un...
968c1ac72b8db1415ae2b45424151a034ff9932c06220692d76b69cccca731af
MATLAB
1,117
37
function [Centroids,AllPoints,RealClusterIDs] = mnl_GenerateDemoClusters_2d Centroids=[1 2;1 8;2 2;3 8;4 1;4 5;4 6;7 1;8 4;9 7]; szCent=size(Centroids); NumPointsPerClust=25; AllPoints=nan(szCent(1)*NumPointsPerClust,szCent(2)); RealClusterIDs=nan(szCent(1)*NumPointsPerClust,1); NoiseSpread=0.333; for i=1:szCent tP...
833ab5428920b2953125f56c80ad371ec6264ab7b6d1123a159c708b60b9751e
MATLAB
1,118
36
function points = centres_of_regions(regions) %CENTRES_OF_REGIONS Centre points of given regions % % points = centres_of_regions(regions); % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. % $Revision 1.10 $ $Date 2005-06-01 $ % Documentation files renamed % $Revision 1.00 $ $Date 2005-02-12 $...
773f4d42b64516392f25b39f1d42801675baf0b7ea9d6b9736a610b0153b27d7
MATLAB
1,119
37
function Trials = load_task_output(Participants, Sessions, Task, Paths, RerunAnalysis) % single function to load main outcomes for PVT and LAT. % LAT types are Lapses, Late, and Correct Responses. % PVT types are Lapses (<.5), Correct Responses and Bugs. % From Lapses-Causes. TaskDataDir = fullfile(Paths.AnalyzedData,...
aa584913736742af3dd92efa4434640fdc064308775625900711885530a0f9ae
MATLAB
1,119
33
function [mesh,success]=hbf_CorrectTriangleOrientation(mesh) %HBF_CORRECTTRIANGLEORIENTATION checks orientation of triangles and % corrects it to CCW (works only in the simplest case). % %[mesh_out,success]=HBF_CORRECTTRIANGLEORIENTATION(mesh_in) % mesh_in: the mesh to be checked/corrected; hbf struct for triangle ...
b348fce461894facea48bd69234309cd9b2f52155f3add5e0ed0e192d26a4d1a
MATLAB
1,119
33
function success = revert(obj, revertTo) %REVERT Summary of this function goes here success = revert@jrclust.interfaces.Clustering(obj, revertTo); if success good = find(obj.clusterCenters > 0); % find both empty cluster centers and centers that don't belong to % this cluster ...
b2c5a889daf09091c1a4d83bdf3b5d2bab590156e493f59cd9674dbbc14ed710
MATLAB
1,120
43
classdef comments_comparison < handle % % Class: % adi.file_comparison.comments_comparison properties n_comments1 n_comments2 %Comments in 1 only %Comments in 2 only %---------------------------------------------------- %ID: ...
d022c966b093453a441ad2d0c379e26d04eb12ae5165aad1a4dcf9dd7f94f392
MATLAB
1,120
29
% function to idnetify if a neural ensembles is a subset % from another neural ensemble % Input: % NeuroVectors: Matrix where 1 is for active Neuron Index % Ouput % EnsemblesIndx: Columns of Ensembles which belong to Other: % [i,j]: ith ensemble is member of the jth ensemble function Ensemble...
e51058c08c36a1ee4426dfb2eb2dfd3d5611f8328da25e2fd9661b614ffb6179
MATLAB
1,120
34
clc;clear; load 'gradient1-3 data' load 'subject infomation' nsubs = 1790; nROIs = 1533; %% %**********************************************step1 : Caculate Global Dispersion for i=1:nsubs cen1 = median(gradientAll1(i,:)); cen2 = median(gradientAll2(i,:)); cen3 = median(...
f0ddf354bc424475c493f047e4d14739ef6d03de320a8f9264ab89896e42694c
MATLAB
1,121
30
% Function to denoise signal bye wavelet analysys % It use the 'sym8' and the degree increases % until the autocorrelation finds a local minimum % Input: % xd: signal % Ouput % xdenoised: denoised signal % noisex: noise=xd-xdenoised function [xdenoised,noisex]=mini_denoise(xd) dbw=1; % Degree (Or...
1bb8918bd7a7463190dd670751aae73311dca8b869dc0796704e7d00c654f187
MATLAB
1,122
61
%% plot_LFP from all channels LFPs clc clear load("E:\PFC\LFP\all_locations\all_chennels_each_eria.mat") plot_example_lfp = 0; %% fields = fieldnames(all_channels_LFPs); for i = 1:length(fields) figure T = all_channels_LFPs.(fields{i}); for w = 1:size(T,1) for j = 1:size(T,2) T2(w, j,:...
27356a430c1b922a1db5b424a2b9be175b52b1fd80041bd3dfeb4a2f1479a66a
MATLAB
1,122
33
function [h,CV] = benhoch(p,FDR) % [h,CV] = benhoch(p,FDR) % Benjamini-Hochberg Procedure to address false discovery rate (FDR) % % INPUT VARIABLES % p : vector of individual p-values % FDR : false discovery rate (default = 0.05) % % OUTPUT VARIABLE % h : Benjamini-Hochberg adjusted hypothesis test ...
11db9e4e215b7d6311990652e532b5e051d71dd8a20ef2da677cb17170469f3e
MATLAB
1,123
40
% here we further analyze how consistent the neural dynamics of individual % subjects is with the found joint one clear p = params_2DAA; fpath = fullfile(p.processed_data_dir,'allData.mat'); load(fpath,'evs','tis','bvs','traces') %% fpath = fullfile(p.data_dir,'dr_validation'); saveData = 1; saveFigs = 1; n_rep = 80;...
a092db1cf443bad52e3d3dc9680f113fa8913655bcb4e6ec9e84c43b0e2c1658
MATLAB
1,124
43
% HMM batch processing example by Yunxiang Zhang (yxzhang@gmail.com) %last updated Nov 12th, 2021 path = '/Users/brunger/Dropbox/archive/programs/single_molecule/HMMbatchscript/examples/film2'; %% Find smm files cd(path); matfiles = dir(fullfile(path, '*.txt')); nfiles = length(matfiles); disp(nfiles); for...
b4011d838759b9df74671142372247038abcbf358391b7cd2650387bc69dd920
MATLAB
1,124
26
function plot_line_arrow_therapy(ax, t_start, t_end, plot_line_t_start) font = 18; axes(ax) y_lim = get(ax, 'YLim'); if exist('t_start', 'var') && ~isempty(t_start) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Lines %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
ec7592a5ccb661bd60773c2c302fabb69ac66f4bbb036b1513252b2da029d9a6
MATLAB
1,124
46
function [] = plotCORR(val1, val2, label, stim, COPE_texts, color) % This code is to plot the correlation between two groups % % % inputs: % val1: % val2: % label: % stim: % COPE_texts: % flag: % % % by Hiro Taiyo Hamada, 2020/12/17, clear COPE; close all; count = 1; n1 = length(val1); index = find(~is...
f2e7548f3cf5fc04a8461cf9f3549d55a1f0f9c8de4b075a999f148432e196d4
MATLAB
1,124
43
% A test script for warping_transform function clear; close all; clc % Example 1: % Generate warping matrix using quadratic interpolation in_len = 50; out_len = 57; interp_order = 2; M = warping_transform_col(in_len, out_len, interp_order); % Example 2: % Define input and output knot points % in_knots = [1, 50, 100, ...
7b6d6afa58bf32765b7a793b78d9877d5c3e958bc2795a7f986c5b549e49b155
MATLAB
1,127
44
% Make Line Sequence a Vector of Values of Dsicrete Onset Times % Input % Onsets x values % yvalues y values % varargin if any intervals (optional) % Output % xseq function [xseq,yseq]=makelineseq(Onsets,yvalues,varargin) % If there are Intervals if ~isempty(varargin) IntervalsX=vara...
20fea6d32bf368d48ae82c79567d8d887ce0a28efa1346df17c5136201b996a2
MATLAB
1,129
27
function [f,findx]=getfgrid(Fs,nfft,fpass) % Helper function that gets the frequency grid associated with a given fft based computation % Called by spectral estimation routines to generate the frequency axes % Usage: [f,findx]=getfgrid(Fs,nfft,fpass) % Inputs: % Fs (sampling frequency associated with the data)-...
60e8a654b010bc5fc84f0214ae88f373ab2c75ac876a17172d9f22bdbc2e1a8d
MATLAB
1,129
1
function [tv,g]=rst_tvar(x,percent) % function [tv]=tvar(x,percent) % Returns the estimated squared standard error of the trimmed mean of x. % x must be a vector. If x is empty, then NaN is returned. % percent must be a number between 0 and 100 % % The trimmed variance is calculated from the winsorized variance, vw, %...
813044f81dd56ba124f37f1148c32c29bb7f11f2280a1c3cec61b67c6db74ca8
MATLAB
1,129
39
% Authors : Simon Wadle 2019-2023 %function reads coordinates from PrarieView log files and gives x, y %coordinates in MATLAB format function coordinates = read_coordinates_from_txt_file(txt_filename) fid = fopen(txt_filename); information = fscanf(fid, '%s'); fclose(fid); x_idxs = strfind(information, 'x'...
3082e3b84a220f2d288311938222fb6e38efd48d83026ba96a5f0ceb3025f8b4
MATLAB
1,131
34
% Feature Extraction % Input % xdenoised: clean signal (by wavelet analysis) % noisex: noise(by wavelet analysis) % Output % SkewSignal: Skewness from denoised signal % SkewNoise: Skewness from noise % SNRbyWT: Signal Noise Ratio [dB] % ABratio: Max Peaks Aplitudes Ratio function [SkewSig...
9d07ed6eb0cb563539650fca05add7592812cf7af5b7ca0868756172cd3feb60
MATLAB
1,131
38
function out = perlinNoise1D(Npts,weights) % function out = perlinNoise1D(Npts,weights) % % I first heard about 'Perlin noise' from the MRF Nature paper % (www.nature.com/articles/nature11971). I then made this Matlab code by % translating the pseudo-code from http://freespace.virgin.net/hugo.elias/models/m_perlin.htm ...
94995b71bc7fe8470a4c964d399fc9f435c99823a39a9588df26a8c5396c5614
MATLAB
1,132
49
% A test script to extract R-peaks from sample records of the PTB-XL % dataset close all clear clc data_path = '../sample-data/ptb-xl/*.mat'; % set data path fs = 500; % set sampling frequency data_list = dir(data_path); for k = 1 : length(data_list) fname = fullfile(data_list(k).folder, data_list(k).name); ...
b5a1357e7e106c2d1a08fbc20b75bfc4d0b718afc5d03bb311699379da77c7d7
MATLAB
1,132
38
% This function Retrieves inter events interval & event duration % Input % r: vector of ones that indicate the events % Output % IEI: inter events intervals % ED: events duration function [IEI,ED]=interval_duration_events(r) % Setup IEI=[]; ED=[]; if ~isempty(r(r>0)) dr=diff(r); % +dr -> start Interv...
60a2ae361a064c3328aa9eb6c9d39dc96998d4907a61e8ff39cd9e99786c2ec0
MATLAB
1,133
33
%%devide_cells_by_aria clear clc %% %save only Intensity encoding + IR [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 for i = 1:length(datafile) load(da...
9b02b5318a48f478aa43bd53cdb9cceef33c31621adb01b345f1cfb4f56d41d2
MATLAB
1,133
92
%% Initial conditions P_I4_0 = 0; A_I4_0 = 0.05; P_I3_anterior_0 = 0; A_I3_anterior_0 = 0.05; T_I3_0 = 0.05; A_I3_0 = 0.05; T_I2_0 = 0.05; A_I2_0 = 0.05; T_hinge_0 = 0; A_hinge_0 = 0.05; x_h_0 = 0; % x_g_0 = 0.1; x_g_0 = 0.4; %% inital neural states % CBI2 V_CBI2_0 = -60; % mV % CBI3 V_CBI3_0 = -60; % mV % CBI4 ...
8d339dd0c4ae5965447c9558d99d949051e521fd1097129948c67513a163a0bb
MATLAB
1,134
33
function scrollplotdemo % Created by Steven Lord, slord@mathworks.com % Uploaded to MATLAB Central % http://www.mathworks.com/matlabcentral % 7 May 2002 % % Permission is granted to adapt this code for your own use. % However, if it is reposted this message must be intact. % Generate and plot data x=0:1e-2:2*pi; y=sin(...
28594a533147030de321f36ad63f86587cbb95d48bb54e27c79f3f4b60e6b72d
MATLAB
1,137
54
function k0 = nufft_offset(om, J, K) %function k0 = nufft_offset(om, J, K) %| %| offset for NUFFT %| in %| om [M,1] omega (radians), typically in [-pi, pi) (not essential!) %| J # of neighbors used for NUFFT interpolation %| K FFT size %| %| out %| k0 [M,1] prepared for mod(k0 + [1:J], K) (+ 1 for matlab) %| %| Copy...
341d9d6e877e775a691b40334f5a1954372e90959a0e51342bf3866c907290da
MATLAB
1,139
30
function [mappedX, W, mu_X] = prewhiten_2(X) %PREWHITEN Performs prewhitening of a dataset X % % [X, W, mu_X] = prewhiten(X) % % Performs prewhitening of the dataset X. Prewhitening concentrates the main % variance in the data in a relatively small number of dimensions, and % removes all first-order structure...
dacf7583a37c7d93faa507bc7679e875035ac93b0f0d31973c71a3b01263d516
MATLAB
1,141
37
classdef I2_Hill_Type_Muscle_Model properties I2_struct end methods function obj = I2_Hill_Type_Muscle_Model() obj.I2_struct.tau=2.45; obj.I2_struct.beta=0.703; obj.I2_struct.a0=0.165; obj.I2_struct.g_scale=2.0; ...
0003179a221e5a343f8fe7e131456a77f62cebdf66d817b6281919fca7bd0a21
MATLAB
1,143
31
% Function to plto conout of probabilities function plot_multiclass(x1Grid,x2Grid,PosteriorRegion,CMprobs,Xpca,ONEpca,... TWOpca,Y,CM,ColorIndx,BestKernel,AccuracySVM,Yclass) fprintf('>>Plotting regions: ... ') MissClassifed=find(Yclass~=Y); figure; contourf(x1Grid,x2Grid,... reshape(max(PosteriorRegion...
8db4e53786906a3009924fad6569751d086e095db6e6a694228c11213e1b8ce2
MATLAB
1,143
49
close all; clear; clc; % parameters path = 'E:\Sameni\Projects\Seizure\Dog_1\'; subject = 'Dog_1'; number = 4; % mode = 'interictal'; mode = 'preictal'; ch = 1:16; % desired channels time = [5 10]*60; % in seconds nfft = 10000 - 1; SpectralWinLen = 10; % in seconds SpectralOverlapPercentage = 50; % [0 99] % load sign...
9e4a85fba5923ca128ef3697f165c1f5a4cbe3b8c487245690f2a75dc1921be3
MATLAB
1,143
34
function [latency, peak, first_peak, f1] = lfp_latency(LFP, ploting) %% LFP LATENCY % calcualte peak/ first time fr crosses 1std form baseline delay = 3116; fr = 1000; %hz [peak_val, peak] = max(abs(LFP(delay:end))); t = (1:length(LFP))/1000 - delay/fr; b_std = std(LFP(1:3000)); %baseline std latency = find(abs(LFP(de...
3ab76f043a63a2d53676d63138e07ca2aa0e5b359cce686b71c6c75b67f3ffea
MATLAB
1,145
32
%% Iterations of LDE: Use precomputed function to determine output of a cell type % Input: L4EmeshX, L4ImeshY Domain of precomputed functions % LDEFrfunc_Subf Functions of all input type for certain cell % population % L4EUse,L4IUse All input L4E L4I % LDEUse Just fo...
412512c2178aac5cf4ea91d38ed8b983868908380f0753ac33aa1a8361944ccc
MATLAB
1,145
46
function handle = XxWriteMRC_BigEndian(handle, image, header) % disp('write position') position=ftell(handle); % dataclass=class(image); switch header(4) case 6 dataclass='uint16'; case 4 dataclass='complex'; case 2 dataclass='single'; end if position==-1 fprintf('Invalid MR...
951040ddf9689223a2472b32eff60f58560f83ae2cb735745d6c7a456b7a7d91
MATLAB
1,150
33
function [ data_st, hilbert_params ] = sigproc_perform_hilbert_transform( data_st, hilbert_params ) % sigproc_perform_hilbert_transform performs hilbert transform % Usage : % [ data_st ] = sigproc_perform_hilbert_transform( data_st ) % [ data_st, hilbert_params ] = sigproc_perform_hilbert_transform( data_st, hilber...
aa1dd5a9f26256ae53ef4104a0b69e79848d9ec4eff5908852fa71169cb3f3a1
MATLAB
1,151
1
function filteredArray = gaussianFilter(array, sigma) % Filter an vector with a gaussian of specified width % Returned vector has the same length as the input vector % Total area is preserved, edge effects are eliminated bins = length(array); if (bins == 0) filteredArray = []; return; end if (sigma <= 0) filteredAr...
d55eb577762f06f5ea454fb61ab5d3d265fe82f21e72a8111f542be9395463f0
MATLAB
1,151
40
function Fig_similarity_10000(VI_sim,tot_VI,NC,savefig) close all f = figure; plot(VI_sim(:,1),'o','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','b',... 'MarkerSize',10); hold on plot(VI_sim(:,2),'o','LineWidth',2,... 'MarkerEdgeColor','k',... 'M...
f1ef8f5fd155782eec3acd6a6b1fab7757e2dc2760daa0f5316f77051170fe58
MATLAB
1,151
39
function cellids = select_pv_cells(cellids) %SELECT_PV_CELLS Select VP neurons from CellBase. % SELECT_PV_CELLS(CELLIDS) selects parvalbumin(+) (PV-)cells that are from % CELLIDS (default, all cell IDs in CellBase). Well-isolated units % (ID > 20, L_ratio < 0.15) are returned. % % See also PV_PAVLOVIA...
7a56d0b33eba4d6b8ea3c3118c449f96222555cefaa3b57c16e9e3dd592ffd88
MATLAB
1,152
33
function [ nexFile ] = nexAddEvent( nexFile, timestamps, name ) % [nexFile] = nexAddEvent( nexFile, timestamps, name ) -- adds an event % (series of timestamps) to nexFile data structure % % INPUT: % nexFile - nex file data structure created in nexCreateFileData % timestamps - vector of event tim...
415a613d548b78dbceed2df0d4391c90b998a8112495d50d2008ae49005aa6f9
MATLAB
1,153
42
function [nnode, ind, offset] = DOTHUB_nearestNode(point,nodes) %This function outputs the node (1x3) present in the list nodes (Mx3) that is closest %to the 3D location specified by point (1x3) and the offset in whatever %dimensions are provided. %Inputs (point,nodes) : the single point and the list of nodes %Output...
e60778d92b7d261b486afb2e07154675f575a4d00cd31c93e9c4f6cacdf867cd
MATLAB
1,153
39
%% Modify rate map % CurrentFrE: The rough ratemap % ConvMat: Convolution kernel % CurrentBlowupModi: Blowup mat. Should be same dim of CurrentFrE. We get % rid of where blowup is true % CurrentsteadyModi: Steady mat. Should be same dim of CurrentFrE. We get % rid of where steady is false. % Output: FringMap function ...
9c92ecb4acad797cedd0f6d83b4b9d39f286e7e737911956311c2b6d008c7319
MATLAB
1,154
49
function [numberOfNeurons] = editor_precount (neuron, pathname, filename) if isempty(lasterror) == 0 %c'è errore [filename, pathname] = uigetfile({'*.jpg;*.tif;*.bmp;*.png;*.gif','All Image Files'}, 'Pick an image'); str = strcat(pathname, filename); %complete directory neuron = ...
4dc6b2a73bd30f56b4b06ba620e85ab7dfe806e7dccb514b15421b7d472fe2a2
MATLAB
1,159
38
function expanded_region = expand_region_for_diam(region) %EXPAND_REGION_FOR_DIAM The set of 2^d vertices of a region % % Expand a region from the 2 vertex definition to the set of 2^dim vertices % of the pseudo-region of a region, so that the Euclidean diameter of a region % is approximated by the diameter of this se...
5bc8c0d7cd77c482740fd2e9cd907cd456b5c7d6afa1c8a26d1de3fc40137d97
MATLAB
1,160
40
function [windows, timeRanges] = extractWindows(obj, samplesIn, spikeTimes, spikeSites, fRaw) %EXTRACTWINDOWS Isolate windows around spiking events from matrix of samples % returns nSamples x nSpikes x nSites if nargin < 4 spikeSites = []; end if nargin < 5 fRaw = 0; end i...
9ffa657048fcff3279cd8c40ebe3883d3d1c44cb23fed1656e258ab96c6f5335
MATLAB
1,161
46
function lineplot_with_shaded_errorbar(x, y, colors) % x: cell or 1D array, datapoints on the x axis % Y: cell or 2D array (dataset arranged as column), datapoints on the y % axis % colors: color to be used, N*3 matrix, each color in each row % example: % x = [1:10]'; % y = cell(1,2); % for i = 1:20 % y{1} = [y{1}...
e70115121f8d176e4f8e4c35732dc20821bfbe4db8e7b32c15686fc990235984
MATLAB
1,161
29
function [trainedClassifier, validationAccuracy] = trainClassifierview(trainingData, responseData) % Create an SVM template for classification template = templateSVM(... 'KernelFunction', 'linear', ... 'PolynomialOrder', [], ... 'KernelScale', 'auto', ... 'BoxConstraint', 1, ... ...
2f96f2fa5261bfa0d16588ead7176c2c281e5e5ba439591e88c061fc0488140d
MATLAB
1,162
30
function [fBeads]=mnl_RemoveBeadsOnEdge(Beads,dim) %NB Remember that I've already switched the X and Y axes so dim(2) is the %image X and dim(1) is the image Y szB=size(Beads,2); n=1; r=1; for i=1:szB Xpos=Beads(i).BeadCentre(1); Ypos=Beads(i).BeadCentre(2); Zpos=Beads(i).BeadCentre(3); Xsize=Beads(i).B...
3b35d7116c1ecf2b658a9e532dcd0fc400bf88eeffc477acbc332d2a8c74368c
MATLAB
1,163
48
function [alpha, beta, ok] = nufft_alpha(N, J, K, alpha, beta) %function [alpha, beta, ok] = nufft_alpha(N, J, K, alpha, beta) %| %| Determine alpha and beta, as associated with the scaling factors %| for min-max interpolation, from arguments. %| %| in %| alpha [L,1] Fourier series coefficients of scaling factors %| ...
5a8761a7c02ec3525ba6b2140fe961283699943423b6cc8421ed838eb289dfd2
MATLAB
1,163
46
function data = load_data(session, channel, unit) % Load data % % Parameters % ---------- % - session: scalar % Session number with format: yymmdd % - channel: scalar % Channel number % - unit: scalar % Unit number % % Returns % ------- % - STIM: boolean arr...
e6da14f3e3b62b36dbefe4031b885cb0a744ea1d2173db4f213e2ed7b7f93586
MATLAB
1,163
48
function fr0 = get_fr0(session, channel, unit, fold) % Get firing rate of null model % % Parameters % ---------- % % - fold: integer scalar % Fold number % % Returns % ------- % - fr0: scalar % null firing rate r = get_resp(session, channel, unit, fold); tri...
dd0fea3fff41c5b3bfe35ec856fd97ab30259a37863cecf8209e7b150f424756
MATLAB
1,164
19
function [NoiseIm] = MakeCheckNoiseFun(ImWidth,ConInc,CheckSize); % [NoiseIm] = MakeCheckNoiseFun(ImWidth,ConInc,CheckSize); % function to draw a patch of random noise 'checks' with a given balance between black and white in the image % needs inputs of ImWidth (image width in pixels), ConInc (the contrast increment ap...
e90b9b2c5c19d120daa1fd24fcfe51adaf9069f9c3deb417ab78c25465c68781
MATLAB
1,164
40
function data = calcLickLatency(data) %calcLickLatency - Calculate lick latency % % Usage: % data = calcLickLatency(data) % % Description: This function find the first lick onset after the reward % delivery and calculates the latency / delivery from the delivery of a % reward to consumption % ...
da3c1ac311089f1ba1a5a42dd575346bab966df9dd66806fd72c1470ef566712
MATLAB
1,166
48
function mmil_write_value(fid,value) %function mmil_write_value(fid,value) % % Purpose: writes a value to open file specified by fid % handles multiple data types, including vectors and cell arrays % % Created: 02/25/11 by Don Hagler % Prev Mod: 10/07/13 by Don Hagler % Last Mod: 07/02/19 by Feng Xue % if isfloat(v...
14f13e5caaf073eb80c994269f00cf3152c1c1e47a9e708707fcac7e909c3726
MATLAB
1,167
30
%Author: Tatjana Schmitt, 2019-2023 function edges_turning_points_maps = edges_turning_points(BF, radial_vectors_mean_BF_smoothed, borders) % creates images for edges and turning points with 1s as borders edges_turning_points_maps = cell(1, size(borders.turning_points,2)+1); for j = 1:size(edges_turning_points_ma...
62827fa95dd22ed76f053651000807f988e30a2ef68715ee5a1fa7dd38cc3cac
MATLAB
1,167
50
%% get noise Corrs function [noiseCorr, signalCorr, totalCorr] = calc_noiseCorr(spikes1, spikes2, nShuffle) spikes1=spikes1(:); spikes2=spikes2(:); if numel(spikes1)~=numel(spikes2) error('spikes1 and spikes2 must be vectors of spike counts with equal length') end if nargin<3 nShuffle = numel(spikes1); end ...
3047c338b0c392132403a3158a617529d81c775329a0eacca66595da7d12bf84
MATLAB
1,169
51
function fo = adjust_phase_to_first(fi) fo = fi; zero_filling=size(fi(1).fid,1); NS = size(fi(1).fid,2); pas_temps=1/fi(1).spectrum.SW_h; ppm_center = fi(1).spectrum.ppm_center; SW_p = fi(1).spectrum.SW_p; f_METAB_ref = 0.9 ; i_METAB_ref=(-(f_METAB_ref-ppm_center)*(zero_filling-1)/SW_p+(zero_filling-1)/2)+1; fi...
714190bc88b99282404744bfa96569f3e6e9a9f7d2f105fe875060d886869c2e
MATLAB
1,169
30
function [a, b, cPrime, totalEffect, pValueA, pValueB, pValueCPrime, pValueTotal] = mediation_analysis(X, M, Y) % Performs a simple mediation analysis with significance testing % X is the independent variable % M is the mediator variable % Y is the dependent variable % Ensure input vectors ar...
7cca61c26d7de5ad105e2204adf1868115c1b0229cb7d2895bdc918fe374cb40
MATLAB
1,169
36
function [] = visualizeContrastMadinoHamada2(val1, val2, val3, texts, color) % preparation for the count = 1; clear COPE nROI = length(val1); % blue stim control COPE.first(count:nROI, 1) = val1; COPE.second(count:nROI, 1) = val2; COPE.labels(count:nROI, 1) = {'peaks of ΔCBV(Grandjean2019)'}; COPE.color(count:nROI...
a98c35a19e67053f100e7a1c295066ebe113c044fb1bc0ba41fc6ed4867594ed
MATLAB
1,170
38
% Function that creates a Color Map for the ExperimentalConditons % Input % Starts a GUI to set the colors % Ouput % CM: Colormap % ColorIndx: Struture with colors function [CM,IndxColor]=Color_Selector(NamesCond) % Colors: ################################################################# Nconditions=numel(Names...
ef2012737809b4fb3ba554280da7846af4c58c740a31c17cf7fc6367b9e07235
MATLAB
1,170
39
% create Gaussian model % ------------------------------------------ % This file is part of the adaptative_threshold SPM plug-in % Copyright (C) Cyril Pernet and Chris Gorgolewski 2012 classdef Gaussian < Distribution properties mu = 0 sigma = 1 sigma_sqr = 1 end properties(Constant...
f6d22c67d582411d74d28a62f4b4c9d5afbd48d22452cb53f0220bfb5c64891e
MATLAB
1,170
39
function [numchannels,numtimeframes,samplingrate,thedata]=opensef(openfilename) % opensef: opens a Cartool simple EEG data file (.sef) % % inputs: full path and name of the file to open % % outputs: number of channels, number of timeframes and sampling rate as % 1-D numeric arrays; data as a 2-D numeric array where dim...
da90d996ac284a897d524ffded10075f61de7acb97ec5fa41cd65c7f5ee130ae
MATLAB
1,173
47
function PlotMSNFSI20200413 clear all;close all; path=['G:\CheetahWRLV20200411']; cd(path) load widthPtoT % X=[AllCellwidth.' AllCellPtoT.']; AllCellwidth = X(:,1); AllCellPtoT =X(:,2); thresholdwidth=5; thresholdPtoT=10; [idxMSN,S1]=find(AllCellwidth>thresholdwidth & AllCellPtoT>thresholdPtoT); [...
e9a7070bb52aadda026a34e37860771fbfcb34e3a5c0e48f6d0260200b9cc3f6
MATLAB
1,173
34
function c_caps = cap_colats(dim,N,c_polar,n_regions) %CAP_COLATS Colatitudes of spherical caps enclosing cumulative sum of regions % % Given dim, N, c_polar and n_regions, determine c_caps, % an increasing list of colatitudes of spherical caps which enclose the same area % as that given by the cumulative sum of region...
9423b84e539794fbae5ab2a164ee15cbdad648b35292b6d026e5e07b588c490d
MATLAB
1,174
59
function [x, y] = clusts4plot(p, thresh, y) % Sets up permutation p-values to plot clusters with patch % Inputs: p = pvalue vector % ylim = two element vector of ylimits % % Written Tylor J Harlow 9/12/2023 - tylor.harlow@uconn.edu % Orient [r, c] = size(p); if r > c p = p'; end % Get indic...
411c0359d12bca5b0864eaac52bb63fdf392cc7808c430f65be8001bffc95322
MATLAB
1,176
39
function [M]=mnl_PermsNoColumnBias(v,n) % Function that works out the different combinations of selecting n values % from vector v, regardless of order %Inputs % v - vector e.g. [1 2 3 4 5 6 7] % n - number to select % %Outputs % M - Matrix with all the possibilities ap=perms(v); %All permeabilities uap=unique(ap(:,1:...
632a41020f06ddd0f62c1192c88210ca2c7956b08405691b4e3ec1c7b7c633e2
MATLAB
1,176
37
clear all close all load Scurve_data_IV.mat %% S-curve splitted in regions, I(V) f = figure(1); lines_width = 2; plot(Scurve_sim.V(1:1000), Scurve_sim.I(1:1000),'Color','#F5266D','LineWidth',lines_width); hold on plot(Scurve_sim.V(1000:end), Scurve_sim.I(1000:end),'Color','#3385F5','LineWidth',lines_width);...
9243bdccb123e1a46dd034c1696e026107047fb62bea74baa28b05f26442deec
MATLAB
1,177
33
% Copyright 2024 Eelke Spaak, Donders Institute. % See https://github.com/Spaak/rift-phase-and-visibility for readme/license. % Belongs with: % Spaak, E., Bouwkamp, F. G., & de Lange, F. P. (2024). Perceptual foundation and extension % to phase tagging for rapid invisible frequency tagging (RIFT). Imaging Neuroscience,...
e2113bf688bcd9be090992a2d0508423799e49ce6726d73b59451d25c0aebbe5
MATLAB
1,180
54
function sn = nufft_scale_kb(Nd, Jd, Kd, kb_alf, kb_m) %function sn = nufft_scale_kb(Nd, Jd, Kd, kb_alf, kb_m) %| %| Compute KB scaling factors for NUFFT %| %| in %| N,J,K [d] %| kb_alf [d] %| kb_m [d] %| %| out %| sn [[Nd]] scaling factors %| %| Copyright 2004-7-8, Jeff Fessler, University of Michigan if nargin == ...
98e9fd240d25e3c071f4851b55e32c56061254629a0e7e12e89c209e5f466f2a
MATLAB
1,181
39
%Please cited this Toolbox as: %Dimitriadis SI, Laskaris NA, Tsirka V, Vourkas V, Micheloyannis S, Fotopoulos S. %Tracking brain dynamics via time-dependent network analysis. %Journal of Neuroscience Methods Volume 193, Issue 1, 30 October 2010, %Pages 145-155 %threhold schemes for graphs (especially for fun...
af3ff3d5300d6edfda600524fd8c5afd0d013f6d75be5f2d4286de8307c4422f
MATLAB
1,181
46
function ind = ChannelIndex8(x,ff,fs,th) % Channel selection based on peak-detection % % Reza Sameni % December 2008 L1 = size(x,1); % % % L2 = size(x,2); % % % rng = floor(1/(2*(ff/fs))); % prefiltering % load FiltCoefs Num % x = filter(Num,1,x')'; % x = x.^2; % + and - peaks are both acceptable ...
c298d762a619a3b571bb4b693008b553cfaefce6426521a412f6f7a4efae615e
MATLAB
1,182
32
function [spikes1] = int_spikes_pol(spikes,nch,thr,par); %Interpolates with cubic splines to improve alignment. w_pre = par.w_pre; w_post = par.w_post; detect = par.detection; int_factor = par.int_factor; nspk = size(spikes,1); s = 1:size(spikes,2)/nch; % length of the single spike ints = 1/int_factor:1/int_factor:si...
dfc77dea5d8f0be288ad385a99568fc5f8eebe589ab141a9cb503c55503a64b4
MATLAB
1,182
32
function V = gompertz_exp_alpha0_beta(param, DT_invitro, temps, Vc, V0) % param = [alpha_0, beta] parameters of Gompertz growth, according to % dV/dt = (alpha_0-beta*log(V/Vc))*V % hence alpha_ = relative growth rate at V = 1 cell (volume Vc) % DTinvitro = doubling time in vitro in hours DT_invitro = DT_invitr...
ef7ebd099dd4a0e89da5f9da644dc975f91db57f2cb7a6efdd605b8cf12a5343
MATLAB
1,183
30
function autoScaleFigTime(hFigTime, hClust, selected, iSite, channel_idx) %AUTOSCALEFIGTIME Automatically scale features in FigTime hCfg = hClust.hCfg; autoscalePct = hCfg.getOr('autoscalePct', 99.5)/100; % get display features for figTime on iSite, compute the % autoscalePct'th quantile, set ylimi...
1bdb2935bdb58217aaf29bf0a963b1198ae9be23982a20be093f839fbeb8ff5b
MATLAB
1,184
29
function [] = writeNex5VarHeader(fid, varHeader) % [] = writeNex5VarHeader(fid, varHeader) -- write nex5VarHeader structure % to the specified .nex5 file. % % INPUT: % fid - file id % % varHeader - nex5VarHeader structure fwrite(fid, varHeader.Type, 'int32'); fwrite(fid, varHeader.Version, '...
6bb7930b1381379319973b5226aa53aa37866bbfb9470389d5b2d91e8dfbad7b
MATLAB
1,184
43
function state = mmil_check_nargs(nargs, expected_nargs, errorMsg) %function mmil_check_nargs(nargs, expected_nargs, errorMsg) % % Purpose: to have a common function to check and handle % this simple parameter passing check. % % Currently, the function compares the # of args and, % if they are different, throws...
afb5388e1e9699954cbcd9669645f47affd6ffd085e63bb3a054b474338bb03e
MATLAB
1,185
34
function thedata=computedataagainstref(thedata,ref) % computedataagainstref: changes the reference of a data set % % inputs: data as a 2-D numeric array where dimension 1 contains the % timeframes, dimension 2 contains the channels; ref as either a number % (1-D numeric array) or the 'avgref' string for average referen...
62df50ab519fc5a4d825fd731191b7c2b0407509dc45d77003f70b27cc3206d4
MATLAB
1,186
65
clear close all clc % load ECG1 % s = data; load ECG2 s = data(:, 1:5*fs);%end); s = LPFilter(s - LPFilter(s, 1.0/fs), 100.0/fs); DiffOrder = 2; % smoothness constraint order greater than 1 snr = 5; % dB nvar = var(s, [], 2)/10^(snr/10); x = s + sqrt(nvar(:, ones(1, size(s, 2)))).*randn(size(s)); h = diff([zeros(1...