sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ad08367610081f20047e5f7fd2c619b841494f45baaae7c8774e2d05f68b5b8a
MATLAB
3,005
128
clear all; close all; clc; matrixBeforeHex = ([0 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 1 0 1 1 0 0 0 0 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 ]); matrixAfterHex = ([1 0 1 1 1 1 0 0 1 0 1 0 0 1 0 0 ...
bcedd9642d3948280aed1838b6cf32acea8a1c0b8e79d9b849edddbf82bf7b20
MATLAB
3,006
115
function multiple_boxplot_bee_bar(data,xlab,Mlab,colors) % data is a cell matrix of LxM where in each element there is a array of N % length. M is how many data for the same group, L, how many groups. % % Optional: % xlab is a cell array of strings of length L with the names of each % group % % Mlab is a cell array of ...
3e9238a785e6d4f862d844e81a05f2b8f2c80a824a64462f52cf99663c97f5fd
MATLAB
3,010
119
function pred=sopls_pred(varargin) % sopls_pred Applies a sequential and orthogonalized PLS model to new data % The function sopls_pred applies a sequential and orthogonalized PLS (SO-PLS) % multi-block regression model (calculated by sopls_mod or sopls_cv) on % a new set of data (for validation on a test ...
18c7bda588931549ae782a5534a314538b82e808e3d5ee45c1f6380883e1ce28
MATLAB
3,011
95
function corrected_p = bonferroni_correction(p_values) % Applies the Bonferroni correction to a vector of p-values. % % This function adjusts a set of p-values to control the family-wise error rate % using the Bonferroni correction method. It is commonly used in multiple hypothesis % testing to reduce the risk of Typ...
475625a29e9ad6774907ead0a79677b03958962f3be2dcc467ea4694b04d971e
MATLAB
3,011
95
%%% this script provides benchmarks for how many cycles it takes to produce %%% a given patch in a time-frequency plot clear clc close all Parameters = analysisParameters(); PlotProps = Parameters.PlotProps.Manuscript; SignalCycles = 1:5; Frequencies = [1:20]; Frequencies = reshape(Frequencies, 4, []); MaxFrequen...
b0f7b958a1f98c1044ec61b5b2489fe185a206e37e46c3425baebe29320d0977
MATLAB
3,011
103
function [P, Q, R, S, T] = ecgWavesSoI_RRT(ecg, Rpeak, fs, RRf) % % 'RR interval & time based' version. % This function approximately finds the peaks and borders of the Q and T waves % in the input ECG signal using RR intervals and time-based information. % % Inputs: % ecg: Single channel ECG signal % Rpea...
cda9e6174bfce53df90f159e1f3cce2865bed254c2f7ba33459b03012e7148a1
MATLAB
3,011
87
function varargout = AboutDataHigh(varargin) % AboutDataHigh % % Tells information about DataHigh. % % Copyright Benjamin Cowley, Matthew Kaufman, Zachary Butler, Byron Yu, 2012-2013 % ---GNU General Public License Copyright--- % This file is part of DataHigh. % % DataHigh is free software: you can redistribute it ...
824ecba42d3b2ca265ee285a986b9f2ea5c919d5fcadf9ac16395897cd716249
MATLAB
3,015
76
function MergeNlxFiles20180118 %tetrode‚Ì–{”‚Æ“‡‚µ‚½‚¢ƒtƒHƒ‹ƒ_–¼‚ð‚·‚×‚Ä‹L“ü %uÅ‰‚̃tƒHƒ‹ƒ_+ƒ}ƒEƒX–¼{joinv‚Æ‚¢‚¤ƒtƒHƒ‹ƒ_‚ªì¬‚³‚êƒeƒgƒ[ƒh‚²‚Ƃɓ‡‚³‚ꂽnttƒtƒ@ƒCƒ‹‚Æ %Event.mat‚ª•Û‘¶‚³‚ê‚éB clear all; CoreFolder='C:\Users\B133_2\Desktop\CheetahData'; % Folder{1}=[CoreFolder '\' '2018-4-13_18-45-0 500...
eda407ba89c45f33904e89533afc8f6d0154a9c949b0a49a478c749dd9448449
MATLAB
3,016
76
function MergeNlxFiles20190212 %tetrode‚Ì–{”‚Æ“‡‚µ‚½‚¢ƒtƒHƒ‹ƒ_–¼‚ð‚·‚×‚Ä‹L“ü %uÅ‰‚̃tƒHƒ‹ƒ_+ƒ}ƒEƒX–¼{joinv‚Æ‚¢‚¤ƒtƒHƒ‹ƒ_‚ªì¬‚³‚êƒeƒgƒ[ƒh‚²‚Ƃɓ‡‚³‚ꂽnttƒtƒ@ƒCƒ‹‚Æ %Event.mat‚ª•Û‘¶‚³‚ê‚éB clear all; CoreFolder='C:\Users\C238\Desktop\CheetahData'; % Folder{1}=[CoreFolder '\' '2018-4-13_18-45-0 500...
b65959d676f627a72ca76a3cae874c945b8e4d434ac4d5fb924dc9e4cec2cae9
MATLAB
3,017
113
function CV=plsldacv(X,y,A,K,method,weight,OPT,order) %+++ K-fold Cross-validation for PLS-LDA %+++ Input: X: m x n (Sample matrix) % y: m x 1 (measured property) %% % A: The maximal number of LVs for cross-validation % K: fold. when K = m, it is leave-one-out CV % metho...
07f4b4c992d68201b5b360abd9111cb44bb5bd80fa10d935717648143e5d54d5
MATLAB
3,018
72
function centroid = train_kmeans(features,labels,nBoot,ratio) % train_kmeans unsupervised clustering using the k-means algorithm. Robust % centroids are obtained by bootstrapping the data such that the proportion % of seizure free and non-seizure free patients are equal to the variable % 'ratio'. % % centroid ...
40b9a5b0d7c69bd51bdb657526388f130b964ca1145e37a5c254156b705b4bb8
MATLAB
3,020
108
%% [cols,alpha] = chooseColors; this_cols{1} = 'k'; this_cols{2} = cols(2,:); this_cols{3} = [.7 .7 .7]; %% plot accs over time for using all 5 dimensions figure('Position',[100 100 300 300]) hold on for config = 1:3 dc_means = cellfun(@(x) squeeze(mean(x,1))',td_accs,'UniformOutput',false); rep_mean = mea...
464f2840c7379bc0d644ac67f13b93157b15de79b5bffb184a8457e68eaeb522
MATLAB
3,021
112
function F=randomfrog_pls(X,Y,A,method,N,Q,criterion) %+++ Random Frog for variable selection for high dimensional data. %+++ Input: X: m x n (Sample matrix) % Y: m x 1 (measured property) % A: The maximal number of latent variables for % cross-validation % method: dat...
cf92aaaeffa0cbc0c30ea4ae15d151374f1552119f546c7340811bc515708665
MATLAB
3,021
73
function varargout = ballistic_subj_gui(varargin) % BALLISTIC_SUBJ_GUI MATLAB code for ballistic_subj_gui.fig % BALLISTIC_SUBJ_GUI, by itself, creates a new BALLISTIC_SUBJ_GUI or raises the existing % singleton*. % % H = BALLISTIC_SUBJ_GUI returns the handle to a new BALLISTIC_SUBJ_GUI or the handle to %...
8b50da76bb3d27ea329b1acdfc16029acbe10519680ebfa0b27d5298b1a8f080
MATLAB
3,024
101
function RM = spmup_auto_reorient(P,which_image) % FORMAT: reorientation_matrix = spmup_auto_reorient(p,which_image) % % IMPUT: p is a cell string of images to process (see spm_select) % which_image is a integer for wich image to obtain RM % % OUTPUT: RM is the reorientation matrix obtain from affine reg to the...
db9a08bfc59fc9952cb94ba11610b485fb2be57394daaa32a9c65e2a3644c7f3
MATLAB
3,024
69
% ConnectionMat_Fix.m is a function generating connetivity matrices % Input: % N_Post,NnPost,Size_Post: number, index projection, and grid size of % presynaptic neurons % N_Pre,NnPre,Size_Pre: Same for postsynaptic neurons % Peak_EE: Peak connectivity prob...
0e9eef79aadbb94aa780683004ae25c123bd78c654f47ba65d4cddeea559b8e6
MATLAB
3,027
91
function [peakLocs, peaks, siteThresh] = detectPeaksSite(samplesIn, siteThresh, hCfg) %DETECTPEAKSSITE Detect peaks on a given site, computing threshold if necessary % determine threshold if it has still escaped us MAX_SAMPLE_QQ = 300000; if ~isempty(hCfg.evtManualThreshSamp) siteThresh = hCfg....
5321e236a4310c43c0d86d3766f0b233f0e756bc70b761135809a166e930aaff
MATLAB
3,027
116
clear; clc; close all; rng('default') assert(~isempty(strfind(pwd, 'embanded/examples/matlab')), 'Please change folder to the examples directory') run(strrep(pwd,'examples/matlab','setup.m')) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Simulate data. % Generate some training data num...
7e5da4d356b527c197b8b5c82b3278627c3d8aa1e7bbb3c5d055b4522fe394a6
MATLAB
3,027
80
function [x,info] = get_grn_data(NETWORK,path_dream5) % GET_GRN_DATA Load gene regulatory network of the DREAM5 challenge. % [X,INFO] = GET_GRN_DATA(NETWORK,PATH_DREAM5) for path PATH_DREAM5 and index NETWORK returns % gene expression levels X (#genes-by-#samples) and network information % % INFO.tfidx i...
141b26a529448f093110ea28075eecf95537d567ea0afce0d8ef7b8277d3d43a
MATLAB
3,028
75
function MergeNlxFiles20180118debug %tetrode‚Ì–{”‚Æ“‡‚µ‚½‚¢ƒtƒHƒ‹ƒ_–¼‚ð‚·‚×‚Ä‹L“ü %uÅ‰‚̃tƒHƒ‹ƒ_+ƒ}ƒEƒX–¼{joinv‚Æ‚¢‚¤ƒtƒHƒ‹ƒ_‚ªì¬‚³‚êƒeƒgƒ[ƒh‚²‚Ƃɓ‡‚³‚ꂽnttƒtƒ@ƒCƒ‹‚Æ %Event.mat‚ª•Û‘¶‚³‚ê‚éB clear all; CoreFolder='C:\Users\B133_2\Desktop\CheetahData'; % Folder{1}=[CoreFolder '\' '2018-4-13_18-45-...
a933f12270028c6d3ccd9516b9e9d80708a611f05033be99419677e717ce26b9
MATLAB
3,030
81
function x = ACR(p,n,alpha); %ACR Upper percentiles critical value for test of single multivariate normal outlier. % From the method given by Wilks (1963) and approaching to a F distribution % function by the Yang and Lee (1987) formulation, we provide an m-file to % get the critical value of the maximun squared Mahala...
6f07177b1f3e485f14fe80b0dcd7408319761d352f676a5933bb30e5a2786776
MATLAB
3,031
97
function updateSelect(obj, iClusters, force) %UPDATESELECT Select a (pair of) cluster(s) across all views iClusters = min(max(iClusters, 1), obj.hClust.nClusters); if numel(iClusters) > 2 iClusters = iClusters(1:2); elseif isempty(iClusters) iClusters = 1; end if numel(iClusters)...
2373c5146bd2258bf7c845f304aa5029600d377f5f9c616aca577cfde13a9408
MATLAB
3,032
62
% Get Data from Several Analysis Variables function [Rasters,LENGHTRASTER,NGroups,SIG_FRAMES,LABELS,THR,... ExperimentRaster,signif_frames,labels_frames,CummFrames,CummGroups,... TotalNG]=get_ensemble_intel(NN_data_Read) NC=numel(NN_data_Read); % DATA PER CONDITION Rasters={}; % ...
668c4bfb82cf16f49ad045a5bb3f60e39a66a9c819aad593f73e97be030db2db
MATLAB
3,035
90
function [OptF1mean,OptThresh,OptF1median,OptThreshMedian]=mnl_OptimumEuThreshViaF1Star_MagWeighted(efPxTrace) EuThreshVals=0.05:0.01:1; szTh=size(EuThreshVals,2); dim=efPxTrace(1).dim; n=1; for i=1:szTh EuThresh=EuThreshVals(i); [FinalClusters,FinalClusterIDs,~,~,~]=mnl_EuclideanCrawler_Mag_Weighted_v3(efPxTra...
5f7d27cff5de78f2fa2a570d72614253bcb622178d12f11380a4982ce7961582
MATLAB
3,036
109
function [D,P] = all_shortest_paths(A,varargin) % all_shortest_paths Compute the weighted all pairs shortest path problem. % % D = all_shortest_paths(A) returns the distance matrix D for all vertices % where D(i,j) indicates the shortest path distance between vertex i and % vertex j. % % ... = all_shortest_paths(A,u...
939f09b08d81e9e112473262b271537dab2a954222df982af776ca727571c498
MATLAB
3,036
68
%% Figure 5A dt = 5e-5; load(fullfile(pwd, 'datasets', 'highcond_multibranch_decode.mat')) idx_cell = 12; idx_trials = [1, 2]; idx_cond = 3; t = -500*dt:dt:dt*(size(data(data_decode(idx_cell).idx(idx_trials(1))).EPSP_highcond{idx_cond}, 1)-1-500); for i = 1:length(idx_trials) figure subplot(131) for j ...
f7f73e8e3903a8731efe8a850948945f7ff2b582e9eae1adeaf10bd519d28a51
MATLAB
3,038
57
function Project = Workspace_To_Project(Workspace) Project = struct('Segments',{},'Vertices',{},'Points',{},'Neuron_Axes',{},'Parameters',{},'Info',{}); for w=1:numel(Workspace) % For each Project. Project(w).Segments = Workspace(w).Workspace.Segments; Project(w).Vertices = Workspace(w).Workspace.Vertices; ...
37cce725e6bd325bc5234c2ee0cd4c6853995eeed16d66be4ee1d5a92ad13ce3
MATLAB
3,040
100
function [P, Q, R, S, T] = ecgWavesSoI_cRR(ecg, Rpeak, RRf) % % Approximates peaks and borders of the P, Q, R, S, and T waves in the input ECG. % % Usage: % [P, Q, R, S, T] = ecgWavesSoI_cRR(ecg, Rpeak, RRf) % % Inputs: % ecg: Single-channel ECG signal % Rpeak: R-peak positions (if RRf is false) or R-pea...
80668e877296eccb562f803a0de2b68fd88d32379ade01dca4f49f8b770d78e9
MATLAB
3,041
99
function [mn, vr_mn, varargout] = robust_weighted_average(x) % robust_weighted_average - Robust weighted averaging % % Usage: % [mn, vr_mn, md, vr_md, best_beat, vr_best_beat, best_beat_index] = robust_weighted_average(x) % % Inputs: % x: An (N x T) matrix containing N ensembles of a noisy event-related sign...
519a2d85e12858180bab4ac21600123eebdad3e8f3bdf445e6843b4bf6ab1519
MATLAB
3,042
89
%% Import data from text file % Script for importing data from the following text file: % % filename: Q:\OneDrive - The University of Colorado Denver\From Dropbox\STED\STED Data\230822\45nmYG_DyMINvsSTED\BarGraphResults\ROI1.csv % % Auto-generated by MATLAB on 18-Oct-2023 16:33:09 %% Set up the Import Options and i...
6d5c47ed17d27943387f64ef5e6f6b844c670333154b1d70835a1e664ab38e74
MATLAB
3,042
94
function h=mnl_boxplot2(data,ColumnNames,YvalueLabel,IncSD,IncIP) % Marcus' version of boxplot where outliers are not recorded, and raw data % points are plotted too % % Red line is the mean, red whiskers are the standard deviation, blue line % is the median, blue box is the interquartile range, and the blue whiskers %...
a7d9c9f59a02b43344fc1c833e46ce6706e3aa0f1d57571d1642801dc1fe60e9
MATLAB
3,042
87
% Matlab structure to Python dictionary % all_beh in python % Index(['block_type', 'cluster_name', 'correct', 'date', 'first_lick', % 'identified', 'last_lick', 'licks_left', 'licks_right', 'mouse_name', % 'response', 'session_type', 'spike_times', 'spike_times(stim_aligned)', % 'stim_durati...
798d330ae8445da2d910165013baa901aaf392c2582388e76e9a334c31edac22
MATLAB
3,044
72
function [y, B, conv] = easi_source_separation(x, nsou, lambda, nlintype) % easi_source_separation - An adaptive blind source separation algorithm using the EASI (equivariant adaptive separation by independence) algorithm % % Syntax: [y, B, conv] = easi_source_separation(x, nsou, lambda, nlintype) % % Inputs: % x: in...
7f8eca4756aa5c73341e73ac1543a94d04398b20d8aa56550e3f6c000db28449
MATLAB
3,045
76
function data = alignData2Mov(data,tBefore,tAfter) %alignData2Mov - Align photometry and velocity data to movement onset and %offset % % Usage: % data = alignData2Mov(data,tBefore,tAfter) % % Description: This function aligns data to movement bouts % within a specified window. % % % Input: % ...
6efb80e7d594d48abb7dc10ff23e024d16f3cd75719dd7ea626bbddea5e860f7
MATLAB
3,047
83
% This program is intended to extract % % % 1. extract time series of BOLD signals from session3 and 4 % 2. contract between sessions % % % by Hiro Taiyo Hamada, Araya Inc. addpath(fullfile(pwd, '/programs')) %% contrast between anesthesia 1st and 2nd % Anesthesia 1st datapath1 = fullfile(pwd, '/data/session3'); li...
d401fa6cb2011762716d69466dffca9d66756ce896f65cd5b78c23929c956e3e
MATLAB
3,050
121
function multiple_boxplot_mmp(data,xlab,Mlab,colors) % data is a cell matrix of MxL where in each element there is a array of N % length. M is how many data for the same group, L, how many groups. % % Optional: % xlab is a cell array of strings of length L with the names of each % group % % Mlab is a cell array of stri...
67e98480672a6355101dfff122aaf06d0fb28cfdf680307c68a1612a83ee74bd
MATLAB
3,051
94
function data_subBG = XxSubBackground(data, thresh, radius, tmin, tmax) show = 0; n_perSIM = 9; ndirs = 3; nphases = 3; [height,width,nframe] = size(data); num_SIM = size(data, 3) / n_perSIM; data_subBG = zeros(height,width,nframe); for j = 1:num_SIM d = double(data(:,:,(j-1)*n_perSIM+1:j*n_perSIM)); % calculat...
4fd661a9ce528ed74138e6b3ea6b7811834e4d26b7eff27db2e0c1ee853bdac7
MATLAB
3,052
99
% test baseline wander removal by curve fitting % Status: UNDER TEST % Reza Sameni, 2005 clear; close all; % load LTE07102005_40s.txt -mat;data = LOUETTE_40s';clear LOUETTE_40s % load fortict_20-Jan-2006.datfortict_20-Jan-2006.dat_acq.mat; % load fortict5_20-Jan-2006.datfortict5_20-Jan-2006.dat_acq.mat;data = data'; %...
1985e8b57677b27b3dea6bae11cda1a7fc134230ed4c8b65b2b1b713c9c04398
MATLAB
3,054
88
function cbars = createBrainColorbar(colormapSG, ticksSG, varargin) % createBrainColorbar Creates simple colorbars for brain visualizations % Parse inputs p = inputParser; addRequired(p, 'colormapSG'); addRequired(p, 'ticksSG'); addParameter(p, 'FontSize', 8); addParameter(p, 'BarWidth', 0.015); parse(p, colormapSG, ti...
c2c91ed79b49b1971b9b6dda0d46fd4a3768d9f27fb468d562fcce5c323b614e
MATLAB
3,054
92
function [spikeMatrix, peak_idxs, peakTimes_ms, classes, peak_vals, dip1, dip2 ]=comBIN_wave_clus(cluster,data,sr) npointsbeforepeak=20; npointsafterpeak=20; peakTimes_ms=cluster.cluster_class(:,2)'; peak_idxs=uint32(cluster.cluster_class(:,2)'*sr/1000); clear index clear spikes classes = (cluster.cluster_class(:,1...
eb6936ac2ba627ac9180bbdc0da5138b20548025945fff12132c53d64c66055e
MATLAB
3,055
106
% A test code for Signal quality indexes based on different methods % The channel selection method tries to rank the components according to % their similarity to the fetal mixtures. % % Fahimeh Jamshidian Tehrani, % jamshidian.t@cse.shirazu.ac.ir, % fahimeh.jt@gmail.com % February 2020 % % The Open Source Electrophysi...
70a81570fccd190a5f49c1d335fd59f26f778ae73e144d62bd78436d7e13c9b4
MATLAB
3,056
124
function b_model = RaguEEG_Mod_AAHC(eeg,n_mod,ProgBar, IgnorePolarity, max_n,repidx) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License if nargin < 6 repidx = []; end if nargin < 3 ProgBar = true; end if nargin < 4 IgnorePolarity = false; end if (...
1b3aa8aecea251b71eff23842e2e4bd70a60f2fef9f2f90dc439d5aabaf8d0db
MATLAB
3,061
123
disp('This code is just a front-end to check that the real implementation'); disp('of JADE does run as seen on TV.'); disp(' '); disp('This is indeed just a toy problem... Please run JADE on your real data.'); disp(' '); disp(' '); disp('The demo will display a figure with 3 rows: '); disp('o First row: three `source s...
e183ba7882f6e145c5cd2f814e65007b9283aa8fe56c203c1f236fad237f7427
MATLAB
3,061
78
%% HPC for large amount of IC tests % RadiusInd: 10^-RadiusInd when using % SampleSize: specify an integer. Fix % SaveID Just for saving tag function [] = HPCICTest(RadiusInd,SampleSize,SaveID) CurrentFolder = pwd FigurePath = [CurrentFolder '/Figures/Demo022722/']; addpath(CurrentFolder) addpath([CurrentFolder '/Utils...
93efffb7e097e96f8ee0c768888afa25b09617024e5c2cee0494cfaa19b13d43
MATLAB
3,062
84
clear p = params_2DAA; fpath = fullfile(p.processed_data_dir,'allData.mat'); load(fpath,'evs','tis','bvs','traces') [cols,alpha] = chooseColors; %% run DR and decoding procedure for different trial samples fpath = fullfile(p.data_dir,'eval_avoid_decoders_per_ses'); saveData = 1; saveFigs = 1; n_rep = 80; n_rep_eval ...
f733d82c6ad56f96166dbe14caf4da966edc970bbb18c040fb62e45a003b13c9
MATLAB
3,064
68
%% Analyze Data clear all; [FPfiles,FPpath] = uigetfile('*.mat','Select FP Files to Analyze','MultiSelect','On'); if isempty(FPfiles) fprintf('No Files Selected'); else if (~iscell(FPfiles)) FPfiles = {FPfiles}; end nFiles = length(FPfiles); [analysisOpt,ind] = listdlg('PromptStr...
2eab5405e675db7bad5e2e585e8042c33a950d9e49df654d98cda16ca5f03164
MATLAB
3,069
116
function [bad_subject] = find_group_outliers(SPM_file) % routine that checks for outliers among subjects % using a modified boxplot rule, each voxel is analyzed % looking for outlier subjects and the proportion of outlying % voxels is obtained per subjet allowing to decide, using again % a modified box-plot rule, if a...
a201b30d9f54d1c2844d2c26efc3da9229f739b1359c15f898ef95fe73bd0691
MATLAB
3,073
79
%%% Train the model addpath('~/matconvnet/matlab'); vl_setupnn rng('default') sigma_min_array=40;%[ 0, 10, 20, 40, 60, 80,100,150,300, 500]; sigma_max_array=60;%[10, 20, 40, 60, 80,100,150,300,500,1000]; for i=1:length(sigma_min_array) gpuDevice(); sigma_min = sigma_min_array(i); sigma_max ...
9807c44f39bcc79b19e712aa3ee4c5001bcb78d5d41a798ae437f76af4c7e771
MATLAB
3,075
65
function [index, rank, yy] = sqi_power_level_crossing(x, w, th, varargin) % Channel selection based on the number of level crossings of the signal power envelope % % Usage: % [index, rank, yy] = sqi_power_level_crossing(x, w, th, ranking_mode, normalize) % % Inputs: % x: ECG signal (rows represent channels, ...
cbd80909dbb973b138800f1db3f8e13a449577bfabe9f59cb5fd30aea7263b04
MATLAB
3,077
62
function [fig_TM,PTTMHistoCell MedianPTTM Max]=TouchAlignByTM(PegTouchCell,TurnMarkerTime,yhight) %TouchAlignByPeg(PegTouchCell,pegTimeArray2D,100,30) %Called by PegTouch,Detach %Touch aligned By Pegs global PTpegHistoCell OneTurnTime ShowFig PegTouchByTM1=[];PegTouchByTM2=[];PegTouchByTM3=[];PegTouchByTM4=[];P...
8742061c766bed97eae90571424e89807eb927e43b2f806f9ae28f48d79d9fa0
MATLAB
3,080
78
%% Setup % Plot EXPERIMENT_ID.mat file from FinderSpiker % It states the anlaysis status and make the following plot: % - Raster of Raw Activity % - Sorted Raster by Activity % - Sorted Raster by Changed Groups between conditions % - Neuronal Ensembles Raster % - Sorted Neuronal Ensembles Raster % % Functions: %...
111755dc7dcc58d7dd1a902e2da71d7e7a7b74bcfa48872195301ccbc22a500b
MATLAB
3,081
101
%% clear clear % close all clc %% load ecg load ecgptb.mat %% prepare data ecg=ecg(10*fs+1:20*fs,:); % 10 sec multichannel ecg L=size(ecg,1); % ecg length tst=(1:L)/fs; % time stamp w1=.75; % window length of the first median filter used in base line removing w2=.9; % window length of the second media...
0fceeabea414cb385962d7f16f2b0f23bb40bc636780a2d6d72350fd80473a0d
MATLAB
3,082
90
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% This script is used to test whether the functions in this %%%%%%%%%% %%%%%%%%%% package can run smoothly. %%%%%%%%%% %%%%%%%%%% Suggest: every time you make some modification of codes ...
ebd8cf4a6fb343198261c8f24afecf01d1af52ecf4312ec8e609ab58aac4bfd5
MATLAB
3,084
109
function wc = get_coresponding_water_content(rawname) if findstr(rawname,'PROTO_SPECTRO_DYST') anat_dir='/home/romain/data/spectro/PROTO_SPECTRO_DYST/anat'; roi_dir='/home/romain/data/spectro/PROTO_SPECTRO_DYST/fid_pos_nii'; preproc_subdir='vbm5'; anatdir_wc = '*t1mpr*'; %elseif findstr(rawname,'/PROTO_U731_C...
2e28d2056a14b2b707ce518e217c229eefb6be63ca9eb70a16b7e6679b3e91e1
MATLAB
3,089
79
clear close all clc fname = 'sample'; load(fname, 'sampling_rate', 'channel_names'); % Load the data from the CSV file to have a similar quantization effect sample_raw = importdata('sample_raw.csv'); signal = sample_raw.data'; % QUANTIZE THE DATA AND CONVERT IT TO WFDB FORMAT USING mat2wfdb % Set parameters for da...
d83a30cba3367501c2b2f3ef28fb00609570f8bfbae51f755970d77ecc0923b4
MATLAB
3,089
94
%% Function to order Neurons by Condition (influented by Plot_Clusterin_from_NN.m) % Input % NumberofVideos: Number of Videos for Each Condition (vector) % Raster: Raster per viedo per condtion (cell) % Output % NewIndex: Sorted Neurons by Condition % Raster_Conditon: Raster p...
672f4684a0e7acef34a50ded3c5313b7dcebade3425f89c66992ca9428574efd
MATLAB
3,092
126
%compute T2 from c result structure metab_list = { 'Glu','Ins','sIns','sNAA','mNAA','GSHd','sNAA_NAAG','Glu_Gln','PCho_GPC','CrCH3_PCrCH3','CrCH2_PCrCH2','sNAA_mNAA'}; metab_list = { 'Ins','NAA_NAAG','Glu_Gln','PCho_GPC','Cr_CH3_PCrCH3','Cr_CH2_PCrCH2'}; figdir='/home/romain/data/spectro/hipo/resume/T2fig_all'; res...
aa8a48a44ef7fd3fa2d0a03663664cd5364fb9175d5f21d8b08f4cce0bd85837
MATLAB
3,093
85
function out_ch=postprocessing_v2(out,fs,num_chans) % John's postprocessing code % POST PROCESSING JANCA DETECTOR DETECTIONS % @======================================================================== % Authors: Sayeed, John Thomas % DATE CREATED: 23-April-2021 % DATE MODIFIED: 22-Spetember-2022 % Wrote a co...
0f0809942edaf193e675b2bb658c4f4cddb0bdb42af3116419dcb64526c7878f
MATLAB
3,094
66
%% Prerequest % 1. combined rhd file (use RHD file merger % https://intantech.com/downloads.html?tabSelect=Software) % 2. single trial behavioral data, generated from 'Lick_BehavDat.m' %% 1. read rhd file disp('select the RHD file'); read_Intan_RHD2000_file; %read RHD file file_num = extractAfter(filename,asMany...
84237af9dde36711e7f3c85cd768da2c68f1d0c9d87e0f35a6b69da1561d78a0
MATLAB
3,096
93
function [cs,index] = XxSort(c,mode) % ------------------------------------------------------------------------ % sort_nat: Natural order sort of cell array of strings. % usage: [S,INDEX] = sort_nat(C) % % where, % C is a cell array (vector) of strings to be sorted. % S is C, sorted in natural order. % INDEX...
fc9c7b93c8da401bb71eb4e58b7c52c904c07ff54ada9055e0da3ecfd6d96eb9
MATLAB
3,096
98
%% Convert Scan Image Files % Author: Pratik clear all data = struct('mouse',[],'date',[],'acq',struct()); data.acq = struct('FPnames','','nFPchan',[],'FP',[]); %% Pull Wheel Data choice = menu('Are you adding Wheel Data?','Yes','No'); switch choice case 1 [fFiles,fPath] = uigetfile('*.mat','...
65daccf267ce3e655d56b27e3bf243f0aa9b423756e5ddb5228cc45e43e44dcb
MATLAB
3,098
109
%{ ---------------------------------------------------------------------------- Determine the time window for task relevant neurons %Start of task %Sound on %Sound off %Before choice %After choice (0sec) %After choice (1sec) %After choice (2sec) %p = 0.001 %Each epoch, predict the prior, sensory and choice...
1c9b35ccf3efd8460a7cd8bb8f193fdd94b2af0b687a26ed738efea77cee3ddf
MATLAB
3,100
103
close all clear all %% Load (or compute and save) data % check if data file already exists filename = './sim_data.mat'; if exist(filename,'file') fprintf('previously computed data found.\n') fprintf('loading previously computed data....\n') load(filename) % if it doesnt, recompute data else fprintf...
6184cf5a05517483f811d82a2a5b3567e9a368fecf6d6104aaa15653aa3a3f98
MATLAB
3,100
86
function [anUnits, cond] = getBinnedSpikeCounts(trials, units, varsOfInterest, options) % outputs are: % - spikeCounts (trials,units) array for each trial condition (this is a % useful object for decoding % - high dim tuning object for each unit % - mean 1d tuning for each object + pref var value % example inputs: %t...
fa11fc0a755649bf68cf87ab9c73836d27d4e3b4c94d4cd79e97e1e25794c66d
MATLAB
3,101
123
clear; clc; close all; rng('default') assert(~isempty(strfind(pwd, 'embanded/examples/matlab')), 'Please change folder to the examples directory') run(strrep(pwd,'examples/matlab','setup.m')) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Simulate data. % Generate some training data num...
a50c61516c37266de6fe01ad517c0acb05344426a26195ebc778eca17403c611
MATLAB
3,103
86
function [samplesOut, channelMeans] = filtCAR(samplesIn, windowPre, windowPost, trimPad, hCfg) %FILTCAR Apply user-specified filter and common-average referencing if nargin < 3 windowPre = []; end if nargin < 4 windowPost = []; end if nargin < 5 trimPad = 1; end ...
1ad263a7e9c2423ee2463c52a09132e653969dd98fc3b658acea762feac00da9
MATLAB
3,107
82
% 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 Neuroscie...
48d4a3933a8b388609c83eca799927e15530df72220342ef6e39f0c85206da94
MATLAB
3,107
100
clear p = params_2DAA; fpath = fullfile(p.processed_data_dir,'allData.mat'); load(fpath,'evs','tis','bvs','traces') [cols,alpha] = chooseColors; %% fpath = fullfile(p.data_dir,'identification_of_motion_dims'); saveData = 1; saveFigs = 1; n_rep = 80; aa_sessions = 3:9; n_pc = 10; % default number of trials n_tr = 300; ...
6352e50faf99732cf7007ca1ad27fd263bb461cc6888a40a763333b1ff34ea45
MATLAB
3,107
101
function [info_o] = concatenate_fid(info,str_concat) if nargin==1 str_concat=''; %concatexam end if strfind('subject',str_concat) concat_OK=1; else concat_OK=0; end correct_center_freq = 0; io=1; while length(info)>1 info_o(io) = info(1); info(1) = []; ind_to_remove=[]; ...
2761a35fa084c1fad51464c7ce6f0efb456bea35394dcd50ac4f37959756829c
MATLAB
3,108
46
function params = echtparams(varargin) % This function loads basic parameters for processing the ECHT output, % unless otherwise specified. Requires the finputcheck function from % EEGLAB % % Written Tylor J Harlow 9/12/2023 - tylor.harlow@uconn.edu params = finputcheck(varargin,... { % LabVi...
4d726f9fae40fabccfbf20df5098760d1480a5af299e078fa0df16b0a1dabdf1
MATLAB
3,108
117
function y = mtimes(ob, x) %function y = mtimes(ob, x) % A * x % A' * y % y' * A % x' * A' % B * A (calls private/fatrix2_mtimes2) % etc if isnumeric(ob) if isscalar(ob) % scalar * object y = fatrix2_scalar_times(ob, x); else % row_vector(s) * object y = (x' * ob')'; % trick: x <-> ob end return end if ~isnu...
27a10490711591a126c71440f2d250a1029c70753fbaa27e06c6da23ce37e928
MATLAB
3,114
126
function [gm,Labels,CondLabels,GroupLabels] = RaguGrandMeans(V,Group,Cond,L1,L2,Gl) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License if nargin < 3 Cond = (1:size(V,2))'; end if isempty(Cond) Cond = (1:size(V,2))'; end if isnan(Cond) Cond = ones(...
2c40c468e2e2d29339601c270373c7867ee2f8ecb383e66faff150488c630284
MATLAB
3,116
83
function [finalData, flagMatrix] = unwrapBeh(rawData) % [finalData, flagMatrix] = unwrapBeh(rawData) % % Summary: This function converts the periodic encoder trace to a smooth % measure of number of wheel rotations. It can work for any periodic signal % that goes from 0 to 1. Should be robust to extra data poin...
5dfe08f2c79c5b64abe16aedd2ce6ce7e4503386024bc1a8a95b8b22612e678b
MATLAB
3,116
51
function GUI_Params(P) P(1).GUI_Handles.Software_Name = 'Neuronalyzer'; P(1).GUI_Handles.Software_Version = '2.0.0'; P.GUI_Handles.UI = 1; % 0 = figure. 1 = uifigure. P.GUI_Handles.Multi_View = 0; % 0 = Single-view project. Multiple files are loaded as separate projects. 1 = Multi-view project. All files are lo...
678847ea5770c453afe943a0621dfaf5110df57e7ac8e7f11b2abbcf0a0566b1
MATLAB
3,116
65
% Cardiac model ToR-ORd % Copyright (C) 2019 Jakub Tomek. Contact: jakub.tomek.mff@gmail.com % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the Licens...
216df8c7d549f84e86189aedaa9ee0771f692e3689f80cc08769b4c9bed7461c
MATLAB
3,118
74
% 3D reconstruciton for csLFM % The Code is created based on the method described in the following paper % ZHI LU, SIQING ZUO, MINGHUI SHI etc. % High-fidelity long-term intravital subcellular imaging with confocal scanning light-field microscopy % in submission, 2023. % % Contact: ZHI L...
e9a739f3b2af1eb45da56225c16006708e4f03b816464168b1b409697eed7562
MATLAB
3,122
84
function [myState myMap]=StateSpace_v1(myState,myMap,opt) % input: myState (with current ".state_history" and ".action_history" % parameter: myMap.action1, myMap.action2, myMap.reward % output: myState (with updated ".index", ".state_history" and ".reward_history" % opt.use_data=0; >> normal state transition % opt.use...
94b93e137ca4c926c898225a352c0949c5230560be4cc4cf6ff449ac4b005224
MATLAB
3,124
57
function [Im1_NoiseReduction,Im1_branchpoints,Im1_endpoints,Im_Skel_Rad] = Pixel_Trace_Post_Proccessing(Im1,Scale_Factor) % TODO: get params from the Parameters struct. EndPoint_Min_Distance = 3; % Min_Object_Pixel_Size = 30; % 30. Min_Object_Size_Ratio = round(10 ./ Scale_Factor); % um to pixels. % Fill "bl...
4389c0722312bce8aef4c380a988498f1c18295d632edeab2b16bd31e71143ea
MATLAB
3,125
72
clear,clc close all fnames = {'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'}; odors = {'Hexanol 10%','Hexanol','IAA','2-octanol','Hexanal','2-heptanone','Anisole','Hexanol 0.1%',... 'M...
9c92879175bcafc2e46cf666c5cdb60969d15327f394ef9db78966c307b2e030
MATLAB
3,129
107
close all; clear; clc; resultfname = 'testWeightedHistogramAveraging02.txt'; % parameters subject = {'Dog_1', 'Dog_2', 'Dog_3', 'Dog_4', 'Dog_5', 'Patient_1', 'Patient_2'}; f0 = 60; % powerline frequency Hz Q = 30; % notch filter Q-factor wlen = [0.5 1.0 3.0 5.0 10.0]; % energy window lengths in seconds drop = 200; % ...
d01888069edea863fcc20602aa49ab8d16d0e0bef8069f3d1ad8b60305dc7d84
MATLAB
3,129
100
a = 45; b = 45; xyz0 = [0,0,1]; xyz0_p = [0,0,0]; xyz1 = [cosd(0),sind(0),1]; % The length of this vector is 1. xyz1_p = [cosd(0),sind(0),0]; % The length of this vector is 1. xyz2 = [cosd(90),sind(90),1]; % The length of this vector is 1. xyz2_p = [cosd(90),sind(90),0]; % The length of this vector is 1. xyz3 = [co...
f8b51b3724994a11e27c89c9bafb55d1a97f817068dba8a35a6d6b771382d7f7
MATLAB
3,129
79
function [ av_trials,err_trials ] = collect_ae_trials_for_tone_analysis(p, traces, bvs, tis, speed_control,alignment_type) %alignment_types: % 1: tone start % 2: action start % 3: tone end spd_dims = 18:22; %dlc pre_steps = 15; post_steps = 15; for sub = 1:p.nSubjects ...
4f688cef21a4dad79535068b65cee817433560393d5780e81961fdfae8fe9e53
MATLAB
3,130
87
function [brst_files, int_templ, path] = find_xls(app) path = uigetdir(pwd, 'please select master folder that contain all *.xls files to combine'); files = dir(fullfile(path,'**','*.xls')); tmp = string([]); for i = 1: length(files) tmp(i)= string(files(i).name); end [~, tmp_idx] = sort(tmp); files(tmp_idx) = fil...
b7894933c66f9f6dd149bfd070e645b907da0dc58a2ba32dc711106f5d6ef9c0
MATLAB
3,132
104
% Function to accumulate Simmilitude Matrices % of each Ensemble Analysis For each Experiment of the same % experimental setup, i.e., same experimental conditions % % Input % Load experiment manually from different folder: one by one % R_Condition: Selected rasters of the Experiment % fs: Sampling Frequency % O...
cf39432edd4650d627c953e6178ad7237c8fd4e0407e279ab4a8eb66b510e3c3
MATLAB
3,132
80
function [grp,node] = layereddiagram(h,data) %% Set dimensions of the graph % autocorrelatemap() and crosscorrelatemaps() depend on this function. load('structures','groups','regions'); subplot(h); set(h,'DataAspectRatio',[1 1 1],'Visible','off','NextPlot','add'); gr = length(groups.name); % Number of hyperstru...
dd334b8b4248f13b9604983f899f32ab48cf986cefc567f643cc92ab342aeae3
MATLAB
3,134
135
%% plot projections of DR data trial average (not per task) onto spd_dims [cols,alpha] = chooseColors; this_cols = {}; this_cmap = spring; this_cols{1} = this_cmap(30,:); this_cols{2} = this_cmap(50,:); this_cmap = winter; this_cols{3} = this_cmap(1,:); this_cols{4} = this_cmap(35,:); this_cols{5} = this_cmap(64,:); ...
38c87584074fb695de308a4488b82020a72d2e733bf1bb8be613cd70e4f07bfb
MATLAB
3,135
93
%% Graph two groups of traces function [testStats pvals sigIdx sigP] = graphSetsOfAverageTraces(treatTraces, nullTraces, test, span, binLengthStart, binLengthEnd, yLimits, behaviorName) % treatTraces = allTracesTreat; %data to analyze % nullTraces = allTracesNull; %data to analyze % test = true %run ttests across t...
c6baa63e579f25f7bc5d76cafa54f164931d1884a814d8caff869a468b97f7ed
MATLAB
3,135
97
function seqNew = getTrajNewTrials(ws, dat, varargin) % % seqNew = getTrajNewTrials(ws, dat,...) % % Extract neural trajectories from a set of new trials using previously-fitted % model parameters. % % INPUT: % % ws - saved workspace variables that include the previously-fitted % model parameters 'es...
de88a5f55c283337a15d4d63368455ee1beb7b915032f2a02de8076be192877e
MATLAB
3,135
110
function [total_error, max_error] = eq_area_error(dim,N) %EQ_AREA_ERROR Total area error and max area error per region of an EQ partition % %Syntax % [total_error, max_error] = eq_area_error(dim,N) % %Description % [TOTAL_ERROR, MAX_ERROR] = EQ_AREA_ERROR(dim,N) does the following: % 1) uses the recursive zonal equal a...
60258bfd7bc4d854bc5654e92f0b7e00fcb47afdaec86b5ce8b3bf8a9c2548f7
MATLAB
3,141
94
function [features1, features2, features3] = spikePCA(spikeWindows, hCfg) %SPIKEPCA Project spikes onto their principal components % if strcmpi(hCfg.vcFet, 'pca') prVecs = spikePrVecs(spikeWindows, hCfg); % else % mrPv_global = get0_('mrPv_global'); % if isempty(mrPv_global) % ...
13d6373f446be534a2151e45cd946d458e3680336d46a346426224fbe830ab63
MATLAB
3,144
104
function prot = read_twix_hdr_DICOM(DICOMfile) % modified version of Philip Ehses' read_twix_hdr.m to run on DICOM files % and extract the Siemens parameters from the Private_1029_1020 tag % % It is not clear if the XML part of this header is actually useful - but % the ASCCONV section clearly contains all the 'regular...
83206a2e6e4bcee4b351bb8dad36111e70b4c9d6fd91e924a749dec229b85ad2
MATLAB
3,144
93
function [MAMA,MHMA,MH2MA] = precompute_moments(x,preNodes,postNodes,par); % PRECOMPUTE_MOMENTS Computes moment tensors used in CORRECT_GRN_NETWORK. % [MAMA,MHMA,MH2MA] = PRECOMPUTE_MOMENTS(X,PRENODES,POSTNODES,PAR) for gene expression levels X, ... and parameters PAR returns % % MAMA,MHMA,MH2MA moment tens...
1704a4b343913f6449baea75cd585446a0440c734ae400a1b95a78669a990079
MATLAB
3,145
79
function y = lp_filter_zero_phase_2nd(x, fc) % lp_filter_zero_phase_2nd - Fourth-order zero-phase Butterworth lowpass filter % built from a second-order (biquad) IIR section applied via zero-phase % forward-backward filtering. % % Syntax: y = lp_filter_zero_phase_2nd(x, fc) % % Inputs: % x: Vector or matrix of i...
68ece29c43acc89e5e4a452d94e050f26d94af583b0cb815247e5c87427c44d7
MATLAB
3,145
113
function [energy,dist] = eq_energy_dist(dim,N,s,varargin) %EQ_ENERGY_DIST Energy and minimum distance of an EQ point set % % Syntax % [energy,dist] = eq_energy_dist(dim,N,s,options); % %Description % [ENERGY,DIST] = EQ_ENERGY_DIST(dim,N,s) does the following: % 1) uses the recursive zonal equal area sphere partitioning...
9326ae0a4ac672eb0f8ae0dd53dfdd39e5053b6d7a5977e7478874e7e6f9b4d9
MATLAB
3,151
119
function y = kaiser_bessel_ft(u, J, alpha, kb_m, d) %function y = kaiser_bessel_ft(u, J, alpha, kb_m, d) %| %| Fourier transform of generalized Kaiser-Bessel function, %| in dimension d (default 1). %| shape parameter "alpha" (default 2.34 J) %| order parameter "kb_m" (default 0) %| See (A3) in lewitt:90:mdi, JOSA-A, ...
3fce5d8cf5d10eaca897580a38518fe8b2497ce6d40c538eb0a463398462d17b
MATLAB
3,155
89
function varargout = RaguSTT(varargin) % RAGUSTT M-file for RaguSTT.fig % RAGUSTT, by itself, creates a new RAGUSTT or raises the existing % singleton*. % % H = RAGUSTT returns the handle to a new RAGUSTT or the handle to % the existing singleton*. % % RAGUSTT('CALLBACK',hObject,eventData,handl...
40c0c3cc53cf39ff1ddd97c25f7aadac68ba0015e4bd8f02a609762ed26c73d2
MATLAB
3,155
103
close all; clear; clc; resultfname = 'testProcessSeizureEEG_EnergyDistributions01.txt'; % parameters subject = {'Dog_1', 'Dog_2', 'Dog_3', 'Dog_4', 'Dog_5', 'Patient_1', 'Patient_2'}; f0 = 60; % powerline frequency Hz Q = 30; % notch filter Q-factor wlens = [3.0 10.0 30.0]; % energy window lengths in seconds x = []; ...
3bb0bb148873a6e7e00542d1ce4c0c1c1ee89ed5abd8eddc89ad9c5089dab24a
MATLAB
3,158
114
function[haxe,h1]= plot_ConfInt2(varargin) % Programmer: Deirdre Bolger % Input Variables: % DataIn = the input matrix of data; % no. data points X no. subjects % points % T= time vector (vertical) % ...
388e8171794a8552428973fe580ace174364cf21f4a6ff6c74465a4009a812c9
MATLAB
3,159
89
% Hierachichal Clustering of Raster Coactivity % . % Input % R: Raster of Neural Activity(Frames x Cells Raster) % CAG_TH: Coactivity Threshold % Nensembles: Number of Ensembles to Cluster % SimMethod: Method of Simmilarity % Ouput % Raster Structur with Fields: % Data.Data=R; % Frames x ...
c03869e4478606f989c645069fb19d9bc91af3cfb4ee6de24c2814e1d2d77248
MATLAB
3,160
170
function fid = read_basis_and_save_raw(filename) if ~exist('filename') filename = spm_select([1 inf],'any','select files','',pwd) end for k =1:size(filename,1) [p f e]=fileparts(filename(k,:)) file_in = fullfile(p,[f,'.IN']); if exist(file_in) fp = fopen(file_in) s='qsdf'; while ~isemp...