sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
56da51ebffa7894104854909913cebe3de4ec622f31a9892daba1b6cd90ed390
MATLAB
1,860
111
% Normalize % throught the "dim" h dimention % % Method 'z' % for z-score % % Method 'm' % for mean substraction % % Method 'mdB' % for decilBell : 10*log(signal/baseline) % % Method 'bz' % for bootstrapping z-score (Revisar por que esto es absurdo) % % % % V 0.1 % % Pablo Billeke % % 15.06.2012 % fu...
5bdb45dd8a7fed38407acc89a3e1ca307e47df206b9aae424b56e0f8aaea853c
MATLAB
1,860
60
% 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 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
8662263ba65a986945383f3f0af9ad767ef898e58eb72e3dc8eb7fe9bf273613
MATLAB
1,860
58
function [msmooth, Vsmooth, loglik, VVsmooth] = ... kalmanSmoother(y, A, C, Q, R, init_mu, init_V, varargin) % Kalman/RTS smoother. % Input/ output is same as for kalmanFilter % For learning with EM, we also need to compute % VVsmooth(:,:,t) = Cov[Z(t+1), Z(t) | y(1:T)] t=1:T-1 % This file is from pmtk3.googlecode.c...
86b51acf5ce588f8252ad6fd6d0bd47d997a2ca9fa39220813829fd642b86cc5
MATLAB
1,860
95
function ignoreSection(self,src,~) if self.verbosity > 9 disp(mfilename) end if isempty(self.channel_to_work_with) xlim = vertcat(self.handles.ax.ax.XLim); xlim = xlim(strcmp({self.handles.ax.ax.Visible},'on'),:); xlim = round(xlim(1,:)/self.dt); else xlim = round(self.handles.ax.ax(self.channel_to_work_with).XL...
c56182e4e0019cda4b25149a3f0cc37cddde5637a9e8012a1bf704c14b38be57
MATLAB
1,860
53
% AUTHORSHIP % Primary Developer: Stephen Meehan <swmeehan@stanford.edu> % Provided by the Herzenberg Lab at Stanford University % License: BSD 3 clause % classdef SuhSubset<handle properties(SetAccess=private) dataSet; selected; parent; end methods function th...
61ebb77e914b101e055b8a69a85c8f52db7aec2e9dc115e8468aceb58616b621
MATLAB
1,861
49
function h = plotClassProb(X, Y, predictFcn, varargin) % Plot probability assigned to each class for a 2d grid % This is a hacked version of plotDecisionBoundary. % % X - an n-by-2 data matrix % Y - an n-by-1 matrix of class labels % predictFcn - a handle to a function of the form yhat = predictFcn(Xt...
eb0812c3b733703b622978d354e23accf6a6a622db1e559ef8b2a79b5688bfc7
MATLAB
1,861
74
function Vinv=V2Vpinv(V,para); % calculates 'inversions' of a leadfield-matrix % under various notions of inversion % % usage: Vpinv=V2Vpinv(V,para); % % input: % V nxmx3 matrix where V(i,j,k) % is the potential in the i.th channel of % a unit dipole at the j.th grid-point in k.th direction % para option...
970aaf2d7407d7ceb3c2b0e688f6afbbd4c133f4efb168d21079c58a26c55876
MATLAB
1,862
68
function out = rocAnalysis(x,y,tail,nrand) % % function out = rocAnalysis(x,y,tail,nrand); % x, y: vectors of observations from two conditions % tail = 0 (test i~=0.5), 1 (test i>0.5), -1 (test i<0.5); % nrand: number of randomizations for permutation test if ~exist('tail', 'var'), tail = 0; end if ~exist('nra...
162b15e92f17d04240254c506d77adc5518f17dd657da3b9aa82f85dbda50b4b
MATLAB
1,863
61
function varargout = plot_mseVsNoise2(vcf, summaryInfoTable_raw, kecn, varargin) % plot_mseVsNoise(vc, summaryInfoTable, avColors, sortFlag) %% handle optional inputs (varargin): nOpVar=0; % counter for optional variable nOpVar=nOpVar+1; opVars.sortFlag = []; defaultValues{nOpVar} = 0; nOpVar=nOpVar+1; opVars.limNoise...
1b44858e19643291adf504e34d79f8dfc1c143f67edc797d3f877777cb1b033e
MATLAB
1,863
84
% 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 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
3ccd66c92be6ec99e5ac33535e2f5a8c2884a33ff7826284df0d7e9d4865cf39
MATLAB
1,863
49
function H = VBA_spm_logdet(C) % returns the log of the determinant of positive (semi-)definite matrix C % FORMAT H = spm_logdet(C) % H = log(det(C)) % % spm_logdet is a computationally efficient operator that can deal with % full or sparse matrices. For non-positive definite cases, the determinant % is considered to b...
508478de861134b619ac7abce23950ac9a1a5579411e63fcaef6f4be6a04d04b
MATLAB
1,863
42
clear all; close all; clc; addpath wjn_toolbox-master addpath spm addpath lead dbs %% % 0. load tf data Dt=spm_eeg_load('data/iEEG/tf_spm_ecog.mat'); Dt = spm_eeg_load('C:\Users\ICN_guest\Charité - Universitätsmedizin Berlin\Interventional Cognitive Neuromodulation - PROJECT ECoG Atlas Connectomics\data\iEEG\tf_spm_eco...
8e83cae7d72beeb386b6a7e11c2afd0e431886a7c05970731e066ea06d391993
MATLAB
1,863
35
function StateSwitch_addSurroundingCues_dynamic_170911(expInfo, screenInfo, indRun, indBlock, indTrial) % adds the surrounding cues for the next flip for indAtt = 1:4 if strcmp(expInfo.cuetype, 'woWord') CueImg = ['img',filesep, expInfo.MAT.attNames{indAtt},'QwoWord.png']; else ...
bc61e17ee63b4ebb00a0a77b82402a8789f1c2ef79e8e9ffbc5c2d823330cf72
MATLAB
1,863
69
function [ powerfast, powerslow ] = ... wlProc_calcMagPowerFastSlow(magsignal, samprate, flong, fshort) % function [ powerfast, powerslow ] = ... % wlProc_calcMagPowerFastSlow(magsignal, samprate, flong, fshort) % % This function computes the instantaneous power of the fast-changing and % slowly-changing portions ...
31f2022d80be8caae5a49bd8e6e3859607ade6e536181d7fcaf344052514b2ce
MATLAB
1,865
56
% Author: Birgit Nierula (Mai, 2020) % nierula@cbs.mpg.de %% Remove double detections of R-peaks %% --> to use after manual detection steps % This script follows SRMR1_01_prepro_2_manualPeakDetection.m % The script removes double detected qrs triggers ana_dir = '/data/pt_02068/'; sav_dir = '/data/p_02068/SRMR1_exper...
86a72c84965ad25d435fbca56ce3edc9f4f82ba48c6cf489628893341dea1d3d
MATLAB
1,865
68
function jbm_todo() todo_dirpath = 'C:\Users\Josh\Desktop\todo'; todo_filepath = [todo_dirpath '\todo.mat']; if ~exist(todo_filepath) todo_struct = []; save(todo_filepath,'todo_struct'); elseif exist(todo_filepath) temp = load(todo_filepath); todo_struct = temp.todo_struct; end modified_...
98bcbb2256485bd20996eda2ad96a6b623e8930b13b927939d504fd9675e5dba
MATLAB
1,865
52
function [output] = volumethreshold(input, thresh, str) % VOLUMETHRESHOLD is a helper function for segmentations. It applies a % relative threshold and subsequently looks for the largest connected part, % thereby removing small blobs such as vitamine E capsules. % % See also VOLUMEFILLHOLES, VOLUMESMOOTH if nargin<2 ...
b9b38f03405c250148a474dd5e45d6b290cf038a0f0ce33338ab80613ae492a2
MATLAB
1,865
49
function p = CBIG_corrected_resampled_ttest_kfoldCV(accuracy_vec, threshold) % p = CBIG_corrected_resampled_ttest_kfoldCV(accuracy_vec, threshold) % % This function tests whether an accuracy vector (obtained from repeated K-fold cross-validation) % is statistically different from a threshold. The accuracy vector can...
10092e8d4363da4461f38142b6c621efc3c5287a944da8e2be9289cc1ba63549
MATLAB
1,867
50
%% Illustration of a function g and its second order approximation. % %% % This file is from pmtk3.googlecode.com function newtonsMethodMinQuad figure(); hold on; xmin = -5; xmax = 0; ymin = -20; ymax = 150; domain = xmin:0.01:xmax; f = @(x) -x.^3; Xk = -4; f1 = @(x) -3*x.^2; f2 = @(x) -6*x; t = @(...
69f9089c30a3b2d5e6b432829ab7824fc6ac7a3a0c009ae983cfcc5dcdeb7dcb
MATLAB
1,867
72
function X = imNormalize( X, flag ) % Various ways to normalize a (multidimensional) image. % % X may have arbitrary dimension (ie an image or video, etc). X is treated % as a vector of pixel values. Hence, the mean of X is the average pixel % value, and likewise the standard deviation is the std of the pixels from %...
8326818e53ba31dd0f351f7046a0ffc1c413fca6e4830c1269a7a97dc8cbbe07
MATLAB
1,867
45
data = dir('/DATAPOOL/ERRORMONITORING/SEM_mri_data/P*'); %% for i = 1:size(data,1) data_func = dir([data(i).folder, '/', data(i).name, '/mri/SEM_', data(i).name, '/nifti/func/run*']); fprintf(data(i).name); for j = 1:size(data_func,1) dir_folder...
8812d5b0b8434745ec3b0b870aed1fd02aa8f05cdbe7035dc8af988d01c8b3e6
MATLAB
1,868
44
function imdata = calculate_pairwise_correlation_and_overlap(Iall,Isyn,Isyn_trans,ctrlshift_xy) %Calculates 3D and 2D correlation between synaptic channels %Control image is the image shifted to check for spurious correlation correlations = zeros(size(Iall,2),size(Iall,2)); overlaps = zeros(size(Iall,2),size(Iall,2));...
e6f1354d495735cd3f711c06e4b35742068ea88f7d358b8ab89859ca3294eb34
MATLAB
1,868
82
function out = read_tobii_tsv(filename, varargin) % READ_TOBII_TSV % % Use as % hdr = read_tobii_tsv(filename) % or % dat = read_tobii_tsv(filename, tsv, begsample, endsample) needhdr = (nargin==1); needdat = (nargin>1); if needhdr % get the original header details fid = fopen(filename, 'rt'); tsv = st...
31a6cbecf8fddb68208e598aa17d8575e8177b39116388f02e881efac580f3e7
MATLAB
1,869
41
% Script for running a simple ex-Gaussian analysis % ========================================================================= % % Dependencies: % - MATLAB's Statistics and Optimization Toolboxes % - John D'Errico's fminsearchbnd file: http://bit.ly/Ky3xll % % Explanation of variables: % y - Nx1 vector of ...
3cacffd4f0f003ee0a1fa7942c92d35a40b9e9bb66a458e9f4f77a5022e7c6ac
MATLAB
1,869
55
function I = arrayCrop( I, strLocs, endLocs, padEl ) % Used to crop a rectangular region from an n dimensional array. % % Guarantees that the resulting array will have dims as specified by rect % by filling in locations with padEl if the locations are outside of array. % % USAGE % I = arrayCrop( I, strLocs, endLocs, [...
76c58db7fcb31a599db5e6b1d907a2768e05b82021aeadd0e4fb5411344d09df
MATLAB
1,869
82
function out = read_tobii_tsv(filename, varargin) % READ_TOBII_TSV % % Use as % hdr = read_tobii_tsv(filename) % or % dat = read_tobii_tsv(filename, tsv, begsample, endsample) needhdr = (nargin==1); needdat = (nargin>1); if needhdr % get the original header details fid = fopen(filename, 'rt'); tsv = st...
cd5c2e81c92f4d5ca0acd228e1a6360b57a96b67d2b31396f59b5213be876904
MATLAB
1,869
70
function [model, loglikHist] = linregRobustStudentFitEm(X, y, dof, varargin) %% Fit linear regression with Student noise model by EM % %PMTKauthor Hannes Bretschneider %PMTKmodified Kevin Murphy, Matt Dunham %% % This file is from pmtk3.googlecode.com SetDefaultValue(3, 'dof', []); if dof==0 dof = []; end model....
48e392bfa2044829d393573e15e6da0c2027e9561b0bfbbcec8a23f572ab22d9
MATLAB
1,870
35
function mat = GetAdjMatrix(params, delAfterLoad) % params {AdjMatrixParams}: specify the desired parameters; % delAfterLoad {boolean}: if true, txt file generated by networkX will be deleted after loading the matrix % % performs an external call to Python package networkX, which creates % an adjace...
bae17b762cd8800e5019f1d0b5653b89a92db2cf71efa1427217e529773b008f
MATLAB
1,870
56
function Prep_T1(mri_path, out_path, pid, visitnum) % Prep_T1 will load an MRI T1 into MATLAB and use a FieldTrip helper function % to make the T1 compatible for MEG beamforming (i.e., marking the 3 fiducial % points (nasion, left, and right pre-auricular points). This only needs to be % carried out once for each par...
0f551a92e03a9ba3b14b92cc42c0da972c256be12e7deed2b650f8a61a251563
MATLAB
1,871
77
function [pos, tri] = icosahedron(varargin) % ICOSAHEDRON creates an icosahedron with 12 vertices and 20 triangles % % Use as % [pos, tri] = icosahedron % % See also TETRAHEDRON, OCTAHEDRON, ICOSAHEDRON42, ICOSAHEDRON162, ICOSAHEDRON642, ICOSAHEDRON2562 % Copyright (C) 2002, Robert Oostenveld % % This file is part ...
25fe7f6a4ca8028701dfb25656bb6b14a8defbd77a0f71565c0dadd1caa47c71
MATLAB
1,871
62
ccc; load('shuf-dyna.mat', 'upres', 'dnres'); load('real-dyna.mat', 'res'); upres = upres([1,3,5], :); upres = upres'; dnres = dnres([1,3,5], :); dnres = dnres'; plot(upres(:), 'r'); hold on; plot(dnres(:), 'b'); plot(res(2:end), 'k') ccc; cd '/media/data/data/oldmanu/mine/ref/newtrack/revise/decode'; init_scienc...
44d76efdf0580893e161cd8cf14e78f3d5615ec43420c0eeb1e6884d2e973ba6
MATLAB
1,872
82
function draw_figure4F(p,encRes) % % This code is for drawing figure 4F % % %% settings compPairs = {'category','dimension'}; nSbj = length(p.sbjID); %% draw figures 4F % summarize idnetification accuracy iden_cr_mu = cell(length(compPairs),nSbj); iden_cr_ci = cell(length(compPairs),nSbj); for sbjitr = 1:nSbj for...
74057b2374be1725fdf1f10b4c3e4fe3dfecfb256f2e37c97d19912ce5caac01
MATLAB
1,872
57
function [bouts, lens] = detect_binarybouts(binary_vector) % DETECT_BINARYBOUTS serves to detect the start and end indices of binary events from vectors of zeros % and ones as well as calculate the lens of these events. Importantly, it % corrects for any spurious additional t_starts and t_ends that correspond % wit...
749bd8c9c8c691894ec26f51ef360e7106daa1e57554df8e6dbd6baf6426bc45
MATLAB
1,872
60
% 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 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
ec522a1d784d07b9090587f59779a7ddd10cc05e6161ad7705ee44058fd5a390
MATLAB
1,872
60
function dG = filterDoog( dims, sigmas, nderivs, show ) % n-dim difference of offset Gaussian DooG filter (Gaussian derivative). % % Creates a nd derivative of Gaussian kernel. For all but d==1 use % primarily for visualization purposes -- for filtering better to use the % indvidiual seperable kernels for efficiency p...
025a0d3d42901a3e5f9d2057e26aab4ff87bf7945a65a984ed339973282d6faf
MATLAB
1,873
62
% 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 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
7ab07a8b18f03b6967c4a3c7127caa257480f02f7561b30ce57443d21a58e709
MATLAB
1,873
33
function doc_log_likelihood = CBIG_EM_doc_log_likelihood(w, paradigm, params, q) % doc_log_likelihood = CBIG_EM_doc_log_likelihood(w, paradigm, params, q) % % Compute the log likelihood of a single experiment (document) given an updated % auxillary parameter q. % Note that compared to CBIG_EM_doc_log_likelihood_wc.m...
fea8db58e4a84a54001399764136a1c083d02021f963ab29df74d8fbe917d291
MATLAB
1,873
74
%% Visualize fitting a mixture of Gaussians to the old faithful dataset % reproduce Bishop fig 9.8 %% % This file is from pmtk3.googlecode.com function mixGaussDemoFaithful setSeed(0); K = 2; dataset = 'heightWeight'; dataset = 'faithful'; if strcmp(dataset, 'faithful') X = loadData('faithful'); X = standa...
2c51a105bd14b259d55205285b57167c28d3dbe0ecc25126cde3a3fdd71e76e1
MATLAB
1,874
59
function LAN = lan_from_rhd(srate_new, filename, pathname) % *************DEPENDENCIES************* % - read_Intan_RHD2000_file_.m (Intan Technologies) % (c) 2010, Intan Technologies, LLC % For more information, see http://www.intantech.com % For updates and latest version, see http://www.intantech.com/software.html %...
8d932b436ef7d9d27e8e10c0788a7f62703428117bdbd20e0a98a5c10c6a5f00
MATLAB
1,875
54
function [hdr] = read_brainstorm_header(filename) % READ_BRAINSTORM_HEADER reads the header information from .EEG files % that have been generated by the Nihon Kohden system. The function % constitutes a wrapper around BrainStorm3 functionalities % % Use as % [hdr] = read_brainstorm_header(filename) % % See also ...
6ce8832ca992feb5f7303a620441733c086325968800c3403a9133214f918b32
MATLAB
1,876
104
function map = bw % create red-white-blue colorbar % written by Tomoyasu Horikawa 20160310 %% color configuration : from blue to to white then to red %% color interpolation T = [8,54,105 20,77,138 35,104,173 51,126,184 71,149,196 104,171,207 145,196,221 175,212,230 208,228,239 2...
6d71b048f0ccd99a0461b560703db51c26519444c5e2fc20f901f57857732ab0
MATLAB
1,877
84
% Demo for dummy HRF model inversion. % This demo simulates an HRF using a Fourier basis set and parameters that % have been estimated on real data. % The demo then inverts a model based on a mixture of two Gamma functions, % estimating parameters and deriving the model evidence. close all clear variables %---- HRF...
11cf45ef8e10bef672f3f477976e62f134770dd20b7f3af72e88902b900d8df7
MATLAB
1,878
62
function x=anasing(N,t0,h) ; %ANASING Lipschitz singularity. % X=ANASING(N,T0,H) generates the N-points Lipschitz singularity % centered around T=T0 : X(T) = |T-T0|^H. % % N : number of points in time % T0 : time localization of the singularity (default : N/2) % H : strenght of the Lipschitz singularity (positive ...
6629fd58fdf6b1c274b43a1a5a63d7c63838197790ccdac771e7a55b7ef7b09f
MATLAB
1,878
62
function [y,iflaw] = fmconst(N,fnorm,t0); %FMCONST Signal with constant frequency modulation. % [Y,IFLAW] = FMCONST(N,FNORM,T0) generates a frequency modulation % with a constant frequency fnorm. % The phase of this modulation is such that y(t0)=1. % % N : number of points. % FNORM : normalised frequency. ...
adef770ef02daba800fdf33b9a4e6806b52780248cbe4d75d70c855f19248958
MATLAB
1,878
62
% Copyright Christopher Fricke, University Leipzig Medical Center, % Neurology 2024 basefolder = 'Resting State Connectivity Analysis'; datafolder = 'Resting State Connectivity Analysis\data\HCP\subjects'; targetfolder = 'data\results\Connectivity'; d = load(fullfile(basefolder,'denoisingOptions','unsmoothed_9...
9e52b37acc058432f876b3515575f2d58edd414fb8741c16981c56b90d04c84a
MATLAB
1,879
68
function APT_deployed(varargin) % Entry point for compiled matlab exectuable. try % Parse the command-line arguments [do_test, test_name, is_lbl_given, lbl_file_name] = parse_args(varargin) ; % Either run test code or call StartAPT() if do_test % Run test(s) and exit if strcmp(test_na...
c39c4cce68a8dd5a2e989949e8c0395fb73b3f513d78948f0ad150c87a041311
MATLAB
1,879
64
%%% Interpolated skin voltage plot %%% Author GNP 2024 %%% Given the electrode indices and electrode potentials interpolate the %%% skin potential by taking a weighed average, and plot it. %% read voltages and indices ix = 11; LFM = load(fullfile('data/LFM/LeadField_matrix4000.mat')).LeadField_matrix; % take voltage ...
f2f0e452211591671f2dc396fc8ef5872dd3b64bed3eba5a36b9ce01e5b3d381
MATLAB
1,879
76
function splitDat = SplitTest(spkDat, clust, varargin) minIsi = 1; % in milliseconds Fs = spkDat.Fs; wvFs = Fs * spkDat.upsample; clustList = setdiff(unique(spkDat.id), 0); nClust = length(clustList); [wL, nChan, ~] = size(spkDat.waves); pk = spkDat.peakLoc; wP = spkDat.wavePad; wL = wL - 2*wP; win = 1000 * [1 - pk wL...
96da511355ea14c03f8e726e235ff42ed8231b366ffd914476d92ecd0f6239cd
MATLAB
1,880
46
function Aout = h_quickinfo(header) if header.software.version >=3.8 Aout.zoom = header.acq.zoomFactor; Aout.resolution = [header.acq.pixelsPerLine,header.acq.linesPerFrame]; % maxPower = header.init.eom.maxPower; % PA_power = header.init.eom.boxPowerArray; if ischar(header.init.eom.maxPower...
d0e9d277a32e2d7f95d0e1eb2391ed09192cac3b942d2374af74a3e38e48919b
MATLAB
1,880
71
%% Example % This example illustrates how simple it is to do % continuous wavelet transform (CWT), Cross wavelet transform (XWT) % and Wavelet Coherence (WTC) plots of your own data. % % The time series we will be analyzing are the winter % Arctic Oscillation index (AO) and % the maximum sea ice extent in the Balt...
0a889918ead7c0da6965a4d28c092bdd83144455ac584fc64e59d789da8884d9
MATLAB
1,882
73
%% Interpolate some data using a joint Gaussian % Based on p140 of "Introduction to Bayesian scientific computation" % by Calvetti and Somersalo setSeed(1); D = 150; Nobs = 10; xs = linspace(0, 1, D); perm = randperm(D); obsNdx = perm(1:Nobs); hidNdx = setdiff(1:D, obsNdx); xobs = randn(Nobs, 1); % Make a (D-2) * D ...
1c4554117447ea230037dfd9878066c8dd46574fc793f9587b394260f58e2247
MATLAB
1,882
61
for recCounter = 1:size(data1,2) data1_mdn(recCounter) = median(data1{recCounter})./median(data2{recCounter}); end %colour = lines(length(int)); % colour code for different cells r_all = (zeros(length(pyr),length(int))); distance_all = (zeros(length(pyr),length(int))); for internCounter = 1:length(int) % ...
0391dc4726d077f31ba1bb8c3b4785215667c1b96d272275f96360733b002001
MATLAB
1,883
60
function a = subsref(t,s) %SUBSREF Subscripted reference for a ktensor. % % Examples % X = ktensor([3; 2], rand(4,2), rand(5,2), rand(3,2)); % X.lambda returns the lambda array ([3;2]). % X.U returns a cell array of 3 matrices. % X.U{1} returns the matrix corresponding to the first mode. % X(2,3,1) calculat...
0aed7767953ae8fca9fe6cb996b094dc376bbd0dd69612d713c0ddaa863a1f3c
MATLAB
1,883
61
function NumIters=w_FWHMToNITERS_Surf(FWHM, SurfFiles) % Estimate number of iterations for specific FWHM % %------------------------------------------------------------------------ % Usage: FWHM=w_FWHMToNITERS_Surf(FWHM, SurfFiles) % % Input: % FWHM - Full width half high kernel for smoothing. % SurfFiles ...
709f7e00ab4414aaf9040be50619d9afc8b1c2b0c403b1b79de2feecd1f62a1c
MATLAB
1,883
54
function [grid] = ft_source2grid(source) % FT_SOURCE2GRID removes the fields from a source structure that are % not necessary to reuse the dipole grid in another source estimation. % % Use as % [grid] = ft_source2grid(source); % % The resulting grid can be used in the configuration of another % run of FT_SOURCEANALY...
cd6b985fd9ce8a57eb1b9df1cabc7178fe174cbb30f1c8b19c578235b9b52874
MATLAB
1,883
78
function varargout = centerOfMass(A,varargin) % CENTEROFMASS finds the center of mass of the N-dimensional input array % % CENTEROFMASS(A) finds the gray-level-weighted center of mass of the % N-dimensional numerical array A. A must be real and finite. A warning % is issued if A contains any negative values. Any ...
8838faac9ecf00a32ad7d94dc65dbb7296d495c77964507b681d89333c435915
MATLAB
1,884
50
function M = coarserModel(M, r) %COARSERMODEL Make a brain model coarser by calling reducepatch. % % reducepatch(M, r) reduces the number of faces of the patch identified by M, % while attempting to preserve the overall shape of the original object. % MATLAB interprets the reduction factor r in one of two ...
5cb7542a3432663a74cecfacc8c79f90e2b0176f84665e5b455e7c24fef2b78f
MATLAB
1,885
46
function [data_filter_above,data_filter_below] = loc_list_clusters_filter_no_of_locs(data) answer = inputdlg({'Enter Minimum Number of Points per Cluster:'},'Input',[1 50],{'5'}); if isempty(answer)~=1 min_N = str2double(answer{1}); f = waitbar(0,'Filtering Based on Number of Locs...'); for i=1:length(...
63037a67c643a7a940472cac05d2d70c7c093b29f928b8677322676859e7a557
MATLAB
1,885
56
function CBIG_Plot17NetworksSqCorrMat(fig_num, corr_mat, clow, chigh, color_map) % CBIG_Plot17NetworksSqCorrMat(fig_num, corr_mat, clow, chigh, color_map) % % This function is used to visualize network correlation map. Use axis % lines with equal lengths. Adjust the increments between data units % accordingly. Value...
2f1b9c1f90b5c1f8388356b65fada59e59ca3457e3fd50a0c6a1e56b22211766
MATLAB
1,886
72
function [x,gx,microTime,sampleInd] = VBA_microTime(posterior,u,out) % gets micro-time time series from posterior try inF = out.options.inF{1}; catch inF = out.options.inF; end options = out.options; try dt = options.decim.*inF.deltat; microTime = 0:inF.deltat:options.dim.n_t*dt; catch microTime = 0...
5d449a05cfcbd9a30f0f32145d96e3ea949c259e2bf77c4173f3671c7df3f241
MATLAB
1,886
71
% Author: Birgit Nierula % nierula@cbs.mpg.de %% other (ENG and EMG) preprocessing wrapper script clear; clc delete(gcp('nocreate')) % clear parallel pool %% variables that need to be changed % loop loop_number = 1; disp(['loop number = ' num2str(loop_number)]) % subject, condition, and block info subject_idx = []; ...
7317bf45a14d6699df07335bdb90c7acb8b13ab4d83c94033c025fc233fd295d
MATLAB
1,886
61
function h_dragBoundaryMark3 [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3; boundaryMarkObj = findobj(handles.imageAxes,'Tag','boundaryMark3'); set(boundaryMarkObj, 'Selected','off'); set(gco,'Selected','on','SelectionHighlight','off'); t0 = clock; UserData = get(gco,'UserDa...
dfc7460705611d46f5f5031d8a39528a3dc4cc0b272cc1246c5d4fa8b6a69f53
MATLAB
1,886
81
imgToFilter = double(IafterWithZeros); gValues = [0 0.5 1 2 4 8 16]; N = 200; histTraces = zeros(N,length(gValues),2); figure %subplot(1,2,1); hold on %set(gca,'Ylim',[0 1e5]) %set(gca,'Xlim',[0 100]) %subplot(1,2,2); hold on i = 1; load 'cmapblackandred.mat' [histTraces(:,i,2) histTraces(:,i,1)] = hist(imgToFi...
4e2bba16e76fcd286b306072b2bd9c922faf4960404abb6b62a1d41c3c6e0efa
MATLAB
1,887
53
% IpsaContraAverage % Sarah West % 7/22/22 % Takes a correlation matrix and averages the values of nodes with their % corresponding node on the opposite hemisphere, but keeping ipsalateral & % contralateral relationships intact. Reduces the number of unique % correlations by half. function [parameters] = IpsaContraA...
ed0fe063b21b01cc9b07f3d1d67d3fb2748d8a8f8b710d138f0f9ede6d1246d7
MATLAB
1,887
45
function [imageNames, sourceURLS] = googleDocsSource() %% These are MLBook source files created in google docs sourceURLS = ... { 'https://docs.google.com/drawings/d/1yl54n1fui1Lo-wSPiB81epN9trEmhYFXcpIkvb7QoAk/edit'; 'https://docs.google.com/presentation/d/1uP9ejo_A2LQKJoDoA-GCRiTzIg0o1BAgVjUpslmjJ60/edit'; 'https:/...
fa58309669034e7ff11252a00c442e297182db43e93c99656a0f946f91364f77
MATLAB
1,888
65
function AddFigureLabels(h, label_offset, caps) if nargin == 1 label_offset = [.05 .05]; % annotation margin caps = true; elseif nargin == 2 caps = true; end if caps char_offset = 64; else char_offset = 96; end if isa(h, 'matlab.graphics.axis.Axes') ...
3d1131e132975945ecc1f798207fe270d14522c92cffb54709de20752376aac7
MATLAB
1,889
64
function fg = factorGraphCreate(cliques, nstates) %% Create a factor graph % This is a bipartite undirected graph with two types of nodes, 'round', % and 'square'. Round nodes represent random variables, and square nodes % represent factors. There is an edge from each variable to every factor % that 'mentions' it. % %...
3ecc260c7a2d1ed15f94b0a6cfb92f6b330728ffde7da5502ab8c756aaf85c9e
MATLAB
1,889
60
% Copyright SNM 2012-2024 %% Cluster number if ~exist('main', 'var') main = 1; % Cluster number end %% Define dipoles in the cluster d = 0.4; % dipole length in mm %Idx = Cl.ClusterNodes{main}; % true indexes into cluster nodes cluster_center = Cl.cl_centers(main,:); Idx = knnsear...
5c065b66605ba149d1db0ffdb2eeee52c784a2e22f6d87831d5dfbb43c7c0857
MATLAB
1,889
55
function lan_master_gui_spks_plot(spikes, clu, xax) figure check(1) = uicontrol('style', 'checkbox', 'string', 'c1',... 'units', 'norm', 'position', [.1 .01 .08 .05], 'value', true,... 'callback', @cb_checkbox); check(2) = uicontrol('style', 'checkbox', 'string', 'c2',... 'units', 'norm', 'position', [.2 ...
8840a7f615adf04c0bed5485f361662c17c1eea403c46a3673f60e449f00e822
MATLAB
1,889
84
function synchrot = plot_syncro_s(LAN,algo); % algo = 'PLV' - 'PLI' - 'BOTH' if nargin == 1 Algo = 1; % else if strcmp(algo,'PVL') Algo = 1; elseif strcmp(algo,'PLI') Algo = 2; elseif strcmp(algo,'BOTH') Algo = 3; else Algo = 1; end end %----------------------- ...
920edadf0b2419aba085c7d813c3731ee51809acb0ea5ee50152620ea4941551
MATLAB
1,890
62
%% Image denoising using an mrf and exact inference % This file is from pmtk3.googlecode.com %% Generate Data %input matrix consisting of letter A. The body of letter A is made of 1's %while the background is made of -1's. % We use a small 8x8 image so we can use exact inference setSeed(0); if imagesToolboxInstalle...
c3c12be5496f872b3ea695d5ca29472f8214501c739d106d3f3642ad650090c3
MATLAB
1,890
80
function [res, count] = fiff_transform_meg_chs(chs,trans) % % [res, count] = fiff_transform_meg_chs(chs,trans) % % Move to another coordinate system in MEG channel channel info % Count gives the number of channels transformed % % NOTE: Only the coil_trans field is modified by this routine, not % loc which remains to re...
d9a840427e697c277d3d4f7c77d96f9a47b11955a73813f3bc6b486362e1b39a
MATLAB
1,890
72
function [results, unmatched] = parse_params(args, defaults, varargin) %PARSE_PARAMS Parses a set of name-value pairs. % Usage: % parsed = parse_params(args, defaults) % parsed = parse_params(args, defaults, 'Name', Val, ...) % [parsed, unmatched] = parse_params(...) % % Args: % args: a cell array or structure ...
71cd5800335df5639423911c3893c1a513a71e56694af1876c2449e2ff583e3e
MATLAB
1,891
78
function crop_table = get_crop_from_pickle(pickle_file) %GET_CROP_FROM_PICKLE Load cropping parameters from a DeepLabCut pickle file. % % Parameters % ---------- % pickle_file : char or string % Full path to the pickle (.pickle) file containing DeepLabCut % metadata and cropping parameters. % % Returns % ------...
1f440844434f601d0e85e0c6aaf7fe8be7ddd6cf157a286b885bb21648dd9153
MATLAB
1,892
95
function keys = test_sift_cuda(mode) % simple 1 % img = zeros(3,3,3); % img(2,2,2) = 1; % img(1,2,2) = 0.5; % img(3,2,2) = 0.5; % img(2,1,2) = 0.5; % img(2,3,2) = 0.5; % % kpts = [2,2,2]; % simple 2 % img = zeros(10,10,10); % img(5,5,5) = 1; % img(4,5,5) = 0.5; % img(6,5,5) = ...
271f8c8340a277b3678efb6e3cde60513bb33f76f04e32ce131c5c1c34f84401
MATLAB
1,892
69
function [ Mx ] = transf3Dmatrix( t_struct, s_struct, r_struct, phi ) %TRANSF3DMATRIX Compute general 3D transformation matrix. % % The resulting matrix allows scaling, translation and rotation around an % arbitrary vector. % The resulting 3D transformation matrix dimension is (3 x 4), allowing % translation...
2f0f52dd751972f3152f9f0a6ee110a13d1511ee8682e063a6835fcfb800478f
MATLAB
1,892
65
function afunc_file = slice_timing_correction_4d(func_file,params) % Slice timing correction is applied in the third dimension (Z, often % axial). func_vols=[]; for i=1:length(func_file) [func_p,func_n,func_e] = fileparts(char(func_file{i})); func_vols{i} = cellstr(spm_select('ExtFPList',func_p,['^' func_n func...
5b8269af6177a07e9c692cbdd61b8701f5f2581dfd4040c00a38b2c1ab4ad5b1
MATLAB
1,892
60
% 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 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
5d9cf9d2354ebbdb5ab9d22a68a605ced023a00ce457e5fd1074ce5142a437a5
MATLAB
1,892
52
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef TagEntry < Entry %TAGENTRY Section of an AxisFile that contains TagRevison properties(GetAccess = public, Constant = true) BaseSize = int64(2 + DateTime.Size + 16 + 4); end...
703efa220d5c94192c710eaae4267214a578798e45e80ae93808171bf2012b56
MATLAB
1,892
83
function htmlLink = texifyFormula(str, fname, directory) %% Create a png image of a compiled single line latex mathematical formula % %% Inputs % % str - a valid latex formula, see example % (we surround it with '$' signs automatically if you don't) % % fname - a .png image of the compiled latex...
83e03bbccbc1a19119ddab41a7d2d8a69c323177141c94d2f6eb4fc8af2f2c39
MATLAB
1,892
77
function U2=watsons_U2(A1,A2) % % U2=watsons_U2(A1,A2) % % Computes Watson's U2 statistic for nonparametric 2-sample testing of % circular data, accommodating ties. The code is derived from eq. 27.17 % Zar (1999) and its performance was verified using the numerical examples % 27.10 and 27.11 from that reference. % % In...
0436ce0dea34e08df2c62166e02599e54eeb8111e44d19e854d9a3113397b9d6
MATLAB
1,893
59
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% wrapper_full_calibration.m -- A wrapper for the calibration runtime. %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function []=create_BEM_model(pat_ix, model, inverse_model) pat_cell = {'110411','117122...
0c00831ab534284109d40cfa8185c96b3ac067c00487dd816698cf7a66e30f12
MATLAB
1,894
59
% demo for RFT simulations clear all close all clc %--- RFT: GLM analysis L = 1e3; % size of the 1D field n = 64; % number of GLM data samples k = 8; % number of GLM parameters N = 1e2; % number of Monte-Carlo simulations v = ([1:5:50]/2.355).^2; % smoothing kernel variances verbose = 0; for j=1:length(v) j ...
1ad10f5b6e443f1043c2bb8ca66c2c0662980284325c3670a9940059a35e9cfe
MATLAB
1,894
64
% 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 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
1adad57f987d0ee57e14802482ea41b9c9372984466d4f904304a8d2f9dd5c8a
MATLAB
1,894
63
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % File: PTBStopEyeTrackerRecording.m % % Stop the eyelink eye tracker recording % % Usage: PTBStopEyeTrackerRecording % % Author: Doug Bemis % Date: 10/12/11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function PTBStopEyeTrackerRecording(eyeDir) global PTBEyeTr...
1fd34ceb6a44b8bb5ed33bc6c2fc4fd5cf261f9a6bb2e4882caeaebd02b140de
MATLAB
1,894
47
function [varargout] = isequaln(varargin) % ISEQUALN is a drop-in replacement for the same function that was % introduced in MATLAB R2012a. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % see https://github.com/fieldtrip/fieldtrip/issues/...
45c81f0cb7d65cedcec070002235d86961a194bb6ec31bafd7ce1012f6dc214c
MATLAB
1,894
59
function [output, assign, cost, dice_overlap] = CBIG_HungarianClusterMatch(ref_labels, input_labels, disp_flag) % [output, assign, cost, dice_overlap] = CBIG_HungarianClusterMatch(ref_labels, input_labels, disp_flag) % % A general function of Hungarian matching for clusters. % % Input arguments: % - ref_labels :...
67c8865da8ac444dbf20e5a30e81fbaffa622e269eb2c2014d64dfd358e71dbd
MATLAB
1,894
51
%% SAT - app_input:: %% helper.getTrialIndex % Name: Phone Kyaw % Date: 09/19/2024 % Description: Return the index numbers of rows that has nothing but % char/string inside it % Parameters: data - a 2D cell array % trial_limit - The amount of trials for allocation % Retu...
4ad33b57808f8470023be7f6312580cf6d060b7974c1c547add4e4592550cf6b
MATLAB
1,895
66
%% fnc_SampleInputs: function that samples the input variables of a project % % Usage: % [Set1 Set2] = fnc_SampleInputs(pro) % % Inputs: % pro project structure % % Output: % Set1, Set2 matrix with the input pdfs sampled % % ----------------------------------------------------------------...
5138f4e6e883fe73a9661a37208f7d85ec08be9bc69dd8ab16724d3a7fb53e0e
MATLAB
1,895
35
psthPara.binsize = 10; psthPara.binstep = 10; % ms tIndex = matches({trialAll.Type}, 'Reward'); % spike spkRewardprediction(1).devType = 'first 15'; spkRewardprediction(1).trials = find(tIndex, 15, "first")'; trials = trialAll(find(tIndex, 15, "first")); trialsSPK = trialsSpike(find(tIndex, 15, "first")); spkR...
6b2a257cb232a54179b436d76a0b32cdbc111a286215441f8587d3cef7ba8c99
MATLAB
1,895
62
function [Rnodes,Lnodes]=Adjust_Brain_Pos_for_Vis(meshL,meshR,params,side,ctx) % % This function takes as inputs the meshes for the 2 hemispheres, along % with the inflation and perspective information for plotting. % The function positions the meshes for ideal visualizations. %% Parameters and Initialization if ~isfi...
fa21e3452fe09b40c6a89c0b9d6ffecb87a60833eec7b795e866cde8b71b3e10
MATLAB
1,895
93
function updateISIPlot(self,~,~) if self.verbosity > 9 disp(mfilename) end % first clear all data for i = 1:length(self.handles.isi_plot) self.handles.isi_plot(i).XData = NaN; self.handles.isi_plot(i).YData = NaN; end channel = self.channel_to_work_with; if isempty(channel) return end nerve = self.common.data...
68d49e3bbee3c29c5d6c0dc091b2dc3c0d2ad9e77910e0cadf2146be20a6bf5e
MATLAB
1,896
84
function [posterior,suffStat] = VBA_UNLtemp(y,posterior,suffStat,dim,u,options) % VB update of the inverse tempterature of un-normalized likelihoods if options.DisplayWin % Display progress try STR = 'VB update of the temperature hyperparameter... '; set(options.display.hm(1),'string',STR); ...
b4558dbee030a5b37118f6b942eb6953087afbea5681eac9e79d6e49e0bdce72
MATLAB
1,896
39
%calculate whether the events are significant, based on shuffles function scored_replay=replay_significance(scored_replay, shuffle_type) %extracts the replay event's p value by comparing the replay score with the distrbution of shuffled scores % %scored_replay is a variable of replay scores, %shuffle_type is a vari...
4186a407ff36562d04d173c3f4bf2ea2e7aca10d513212b4d783c1af1b9e1097
MATLAB
1,897
66
function NNintrospect(self, src, event) if nargin == 3 switch event.EventName case 'Close' delete(self.handles.NNdata_inspector) return case 'WindowMousePress' p = get(self.handles.NNdata_inspector_ax,'CurrentPoint'); return end end if isempty(self.channel_to_work_with) return else channel = self.cha...
aa474ad0a7590281e51a0ff2e6b2ec32255413f49729e1a52501133f11decfa1
MATLAB
1,897
72
function v=eeg_forward_3sphere(x,fp); % usage: potential=eeg_forward_3sphere(dips,forwpar); % makes forward calculation for EEG in 3-shell spherical volume % conductors % dips is an Nx6 matrix; the first 3 columns denote locations % of N dipoles, and the last three columns the moments (in nAm) % distances a...
835c8abb079b7275f23b0d3718935f13a458cad7b9f91b83f1180cb3905bd2d4
MATLAB
1,898
66
function [header] = read_ahdf5_hdr(datafile) %read header if nargin ~= 1 ft_error('Wrong number of input arguments'); end if ~isempty(datafile), id = h5readatt(datafile, '/', 'id'); if ~strcmp(id, 'AnyWave') ft_error('This is not the ahf5 format.'); end ch = h5read(datafile, '/channels'); typ...
2d806884de972de323482517948d85da10ee46f3bdea43cab7efed8e37d8d016
MATLAB
1,899
49
function [vi,ind] = interp_vel(V,n,s1,s2,s3,h) %% returns interpolated velocity value v1 = V(s1,s2,s3) % where s1 = row index, s2 = col index, s3 = depth index % interp_vel(u,n,xi,xj,xk) == [interp3(par.Yc,par.Xc,par.Zc,ux,xj,xi,xk),interp3(par.Yc,par.Xc,par.Zc,uy,xj,xi,xk),interp3(par.Yc,par.Xc,par.Zc,uz,xj,xi,xk)] % ...
3cdd395fc99e3be3f59665492f5470a15586bc21edb9b9096cff28166ae638ad
MATLAB
1,899
64
function som=integ2d(mat,x,y); %INTEG2D Approximate 2-D integral. % SOM=INTEG2D(MAT,X,Y) approximates the 2-D integral of % matrix MAT according to abscissa X and ordinate Y. % % MAT : MxN matrix to be integrated % X : N-row-vector indicating the abscissa integration path % (default : 1:N) % Y : M-column-vec...
ac924e1772014fe8a3694e655df5e5f4fa51793c04b51dcb937111c4652d7265
MATLAB
1,899
49
function O_error=bspline_registration_image(O_grid,sizes,Spacing,I1,I2,type) % Function Registration_image. This function will create % an small registration error image after b-spline non-rigid registration % of two images / volumes. % % Ierror=bspline_registration_image(grid,sizes,I1,I2,type); % % inputs, % ...