sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d310ecb751820c5a82a9dba03fbd5c783f4a3c7c852acc2c8a5b64e9171533d6
MATLAB
6,471
186
function [pntr, trir, texr] = refine(pnt, tri, method, texture, varargin) % REFINE a 3D surface that is described by a triangulation % % Use as % [pnt, tri] = refine(pnt, tri) % [pnt, tri] = refine(pnt, tri, 'banks') % [pnt, tri] = refine(pnt, tri, 'updown', numtri) % [pnt, tri, text...
329b28bd94ef5692d48485bef09894f9b8f80c8c74ab8f4ef7a51046b545170a
MATLAB
6,473
227
% rd_analyzeTADetectDiscrimGroupBehav.m %% setup exptDir = pathToExpt; % subjects = {'rd','lr','mj','af','xw'}; % startRuns = [211, 211, 221, 221, 221]; subjects = {'mj'}; startRuns = 1; nSubjects = numel(subjects); %% load data for iSubject = 1:nSubjects sessionDir = subjects{iSubject}; behavDir = sprint...
c4dafb6da58d699c913dc0e587b382cbbc4efaac8515f245f2a310c50d9a2cc1
MATLAB
6,474
162
function ft_trackusage(event, varargin) % FT_TRACKUSAGE tracks the usage of specific FieldTrip components using a central % tracking server. This involves sending a small snippet of information to the % server. Tracking is only used to gather data on the usage of the FieldTrip % toolbox, to get information on the numb...
eff5f151ff34000a7b3cf896ed9ec0f84d9783766c063b596c027e868e8eba0c
MATLAB
6,474
195
function gprDemoMarglik() % Make figure 5.5 of Rasmussen and Williams book %PMTKauthor Carl Rasmussen hhh=figure(1) clf set(gca,'FontSize',22) n = 7; rand('state',28); randn('state',28); xs = 15*(rand(n,1)-0.5); K = inline('exp(-0.5*(repmat(p'',size(q))-repmat(q,size(p''))).^2)'); fs = chol(K(xs,xs)+0.01*eye(n))'*ran...
ae45a33e44e390cd04bf642ba1b22e511d3c988e8fcd6a28aca47ecf0ce6b272
MATLAB
6,475
189
function M = grassmanncomplexfactory(n, p, k) % Returns a manifold struct to optimize over the set of subspaces in C^n. % % function M = grassmanncomplexfactory(n, p) % function M = grassmanncomplexfactory(n, p, k) % % Complex Grassmann manifold: each point on this manifold is a collection % of k vector subspace...
afbb800acc4d7a1f88bed41e97a7d8c2d6bf264e53b27916eeacb7352f8b13bd
MATLAB
6,475
223
function [asens, afiducials] = ft_average_sens(sens, varargin) % FT_AVERAGE_SENS computes average sensor array from a series of input % arrays. Corresponding average fiducials can also be computed (optional) % % Use as % [asens, afid] = ft_average_sens(sens) % where sens is a 1xN structure array containing N sensor ...
23a0edad77c717a70fabe3fa4a73189ee86160ad96594bcb6a95c44a5a6b591c
MATLAB
6,476
166
function DecodeAnalysisAction(AllTrialData,Labels,DecodeLabels,TimeWindow,OutDir,Tag,varargin) % Plots confusion matrix (decode analysis) for decoding each (relevant) % condition. % [~,PThresh] = Utilities.ProcVarargin(varargin,'PThresh',0.001); [~,PThresh] = Utilities.ProcVarargin(varargin,'PThresh','fdr'); [...
aeb62456dd7138ee965e176ff2b09fd92d13aceb65feefbf9f42283207a119c9
MATLAB
6,478
152
ind = 1; data = dir('/DATAPOOL/ERRORMONITORING/SEM_mri_data/P*'); %% for i = 1:size(data,1) runs = [1:7]; SPM_file = [data(i).folder, '/', data(i).name, '/mri/SEM_', data(i).name, '/nifti/GLM/SPM.mat']; SPM = load(SPM_file); SPM = SPM.SPM; errorCorr_conWeights = zeros(1,length(SPM.x...
5acd8ec99fce66019c1e573ff6719f48f8ba307b43936a3495e06657c81b7eb1
MATLAB
6,480
183
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % creates self.n_channels new axes, assuming that % the GUI has no already-existing axes or % ass...
6d747319c81307e181cc89c91fed5d4c348757ef9931af40752045fba6c98898
MATLAB
6,481
245
function [data] = fiff_setup_read_raw(fname,allow_maxshield) % % [data] = fiff_setup_read_raw(fname,allow_maxshield) % % Read information about raw data file % % fname Name of the file to read % allow_maxshield Accept unprocessed MaxShield data % % % Author : Matti Hamalainen, MGH Martinos Center %...
f8fee325ad57032ed5e4638954200e33e8d14865e6e96b3918a5b28c11824fae
MATLAB
6,484
209
function [Gx, Gy, Gz] = imgradientxyz(I, method) %IMGRADIENTXYZ Find the directional gradients of a volume. % [Gx, Gy, Gz] = IMGRADIENTXYZ(V) takes a grayscale or binary volume V % as input and returns the gradient along the X axis, Gx, the Y axis, Gy % and the Z axis, Gz. X axis points in the direction of increa...
1837f06715511062f1fef67db311928675b919ff50fa6018d54c0657ea8fc2eb
MATLAB
6,486
180
function [parhat,Q,parerr,nll] = ECMEtdr(stopmode,stopcrit,pars0,Ai,Xi,r,ni,zetai,xbari,Ybar,Xzetai0) % [parhat,Q,parerr] = EMtdr_Slamb(stopmode,stopcrit,pars0,Ai,Ri,zzi,r,ni) % Function to perform expectation maximization to estimate time-varying % basis functions and independant noise variance for the MBTDR model. %...
de84119171d5642c018a9be2120a471b9baf5a61052814e602d48affd885feff
MATLAB
6,487
189
function FilterLabChart(datFile, varargin) % hard-coded parameters bytesPerSample = 2; wname = 'db4'; % specifies Daubechies(4) wavelet filter % set default values for varargs maxLevel = 6; % This sets the (high-pass) cutoff frequency for wavelet filtering. % cutoff frequency = Fs/(2^(maxLevel+1)) ...
d6fd65a1f36bce0584e0bcd32badbb939c784268ece7ccf7ede330d143b26532
MATLAB
6,489
153
% Noam Saadon-Grosman % August 2020 % This code computes laterality in each vertex of each subject in each % stimulus direction that passed the threshold for significant % somatosensory response. Laterality is defined as the normalized difference %between contralateral and ipsilateral response % The output stract...
6a693103b684417b396ac226d9fd86ad5db526ad896e66ad59e78802760797ba
MATLAB
6,490
136
function [Data, VoxelSize, FileList, Header] = y_ReadAll(InputName) %function [Data, VoxelSize, FileList, Header] = y_ReadAll(InputName) % Read NIfTI or GIfTI files or DPABINet Matrix files in all kinds of input formats. % ------------------------------------------------------------------------ % Input: % InputName - C...
963e78bca009b0ca70890ad49ca78ef6cf41e18b5348dd5e5887a1e842165026
MATLAB
6,491
226
function out = scatplot(x,y,method,radius,N,n,po,ms) % Scatter plot with color indicating data density % % USAGE: % out = scatplot(x,y,method,radius,N,n,po,ms) % out = scatplot(x,y,dd) % % DESCRIPTION: % Draws a scatter plot with a colorscale % representing the data density computed % using three ...
92ed35e10ee9dcb76b16f9554f78704b805d71b08dbce0224a6bd0dbf4298a5e
MATLAB
6,496
117
clc format compact; FLIM_main_folders = 'Q:\TBI\LiveData_Injury_2022\FLIM_results\'; ShortNames = {'R1_6hr','R1_24hr','R1_72hr','R2_72hr','R2_24hr','R2_6hr'}; % 'R2_24hr_crash' contains no FLIM. FLIM_Results_folders = {[FLIM_main_folders,'1stRound\6hr_NAM6_06.15.22'],... [FLIM_main_folders,'1stRound\24hr_NAM6_...
886955963472a9634a4b38f69210b9425120b97c78e7bbaeca91168669dff594
MATLAB
6,497
173
function [errors, warnings] = debugDemos(subFolder, exclusions) % Run PMTK3 demos hiding all figures and demo output - displays a report % This function keeps running even if a demo fails. %% Input % % subFolder - all demos are run by default unless a demo subfolder is % specified, e.g. Markov_models % % ...
1436d3b712dc316f4ec287e0baad26843a8b78c3f14818a0e54936a15bb93c2b
MATLAB
6,499
170
function [y, lambda, info] = hessianextreme(problem, x, side, y0, options, storedb, key) % Compute an extreme eigenvector / eigenvalue of the Hessian of a problem. % % [u, lambda, info] = hessianextreme(problem, x) % [u, lambda, info] = hessianextreme(problem, x, side) % [u, lambda, info] = hessianextreme(problem,...
334ca27501f1b7f42bc142a968b955ad85f768f8f7d62a8ec4828742ad0aed73
MATLAB
6,500
218
function y_ClusterReport(data,head,ClusterConnectivityCriterion) % Generate the report of the thresholded clusters. % Based on CUI Xu's xjview. (http://www.alivelearn.net/xjview/) % Revised by YAN Chao-Gan and ZHU Wei-Xuan 20091108: suitable for different Cluster Connectivity Criterion: surface connected, edge conne...
906441b75ddce96142cf68c101223f4f0174042fe43be15dd77b3a714403cac2
MATLAB
6,510
221
function A = convnfft(A, B, shape, dims, options) % CONVNFFT FFT-BASED N-dimensional convolution. % C = CONVNFFT(A, B) performs the N-dimensional convolution of % matrices A and B. If nak = size(A,k) and nbk = size(B,k), then % size(C,k) = max([nak+nbk-1,nak,nbk]); % % C = CONVNFFT(A, B, SHAPE) controls...
cdf4984fecb913b72ed1111374e8fe19529fe62f3b53f4c8b32245346769cb82
MATLAB
6,510
219
function han = showvc_prog_plain(loc,tri,view_dir,para); % Guido Nolte, Stefan Haufe cmap=1; voxelkont=0; colorbars=1; alphaclimPolicy = 'none'; alpha_const = 1; if nargin>3 if isfield(para, 'alpha_const') alpha_const = para.alpha_const; end if isfield(para,'voxelfield') voxelfield=para.voxelfield;...
2b1ffcf4e50dae2150f2afe0768a75383f0e398888794c83780e655eb11bf44d
MATLAB
6,514
122
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
15aa4c76daa376ef1861a44a705990e7b82aa70800d3aa2fdf665eaf9fd2c3d6
MATLAB
6,517
169
function [trialData] = read_sbin_data(filename, hdr, begtrial, endtrial, chanindx) % READ_SBIN_DATA reads the data from an EGI segmented simple binary format file % % Use as % [trialData] = read_sbin_data(filename, hdr, begtrial, endtrial, chanindx) % with % filename name of the input file % hdr ...
b4392b4181cb532ad4a17b2ba153b409cf193f9d1c0d4f184fee4d67456dcfbf
MATLAB
6,519
129
function [Lipofuscin_container, Bright755_container, Cell_NoLipo_container] = generate_Lipo_Apoptotic_RemovalMask(roi_names, file_identifiers, image_array, Masks) % Two levels of Lipo removal, >0.8 for Lipo, <0.02 for EV Lipofuscin_container = containers.Map; Cell_NoLipo_container = containers.Map; Brig...
dce6167ac988dd94dc30b9cb9fc6db77d728c512e1235fdc701cf3861944a52e
MATLAB
6,519
172
% Five-point stencil on the unit square, variable-coefficient Poisson equation, % Dirichlet boundary conditions. % % This is basically the same as FD_SQUARE1 but with a variable quantized high- % contrast random coefficient field that makes the problem especially ill- % conditioned. % % Inputs (defaults are used if not...
8dee71198f627aad0beadb262ff4e3daeb1b869531d3b79df3e9c54694b009a8
MATLAB
6,520
174
function varargout = DPABI_ConcordanceSelect_Surf(varargin) % DPABI_CONCORDANCESELECT MATLAB code for DPABI_ConcordanceSelect.fig % DPABI_CONCORDANCESELECT, by itself, creates a new DPABI_CONCORDANCESELECT or raises the existing % singleton*. % % H = DPABI_CONCORDANCESELECT returns the handle to a new DP...
be70551c842092e3f61b4f45f97596e3f2194fbd1ffc125f26581e62ecb0d149
MATLAB
6,521
211
% Demo for DCM for fMRI (distributed responses) % This demo inverts the DCM for fMRI model, which contains the ballon model % as a generalized observation function (not affected by stochastic % innovations). close all clear variables %----------------------------------------------------------- %-------------- DCM mod...
e613ad6570e132e5dc7225427ba77b7fa241a295e20a65768a89da666128f66a
MATLAB
6,521
177
function Y=ms_bandpass_filter(X,opts) %MS_FILTER - Bandpass filter using smooth roll-offs in Fourier space % %Consider using mscmd_bandpass_filter % % Syntax: [Y] = ms_bandpass_filter(X,opts) % % Inputs: % X - MxN array of raw data % opts.samplefreq - the sampling frequency corresponding to X, e.g. % ...
4da020dea5c5973f8754420f84a138dc705d76f0e70fd284848272c924cfbe61
MATLAB
6,524
129
function [CPup,CPdwn,Wup,Wdwn,rb,rp,ra] = pkoffon(T,pl,MinNum,gran,crit,S,fig) % The complement to the pkonoff function; this finds the loci of pauses in % responding (step-like reductions and resumptions in the rate of responding) % Computes estimates of the onset and offsets of the pauses and the % weight of the evid...
cfc9084a8db7ebb81a1e238ccbfbd381b4956fb6f8bb0d139cbe3105890942e8
MATLAB
6,527
173
function [imdata] = synapse_properties_multiplexed_nopw(params,fovid,nsynapses) % This function extracts multiplexed synapse features (e.g. volume, number % of puncta for each channel WITHOUT pairwise data (much faster) from cropped synaptic ROIs with multiple channels % %Extract parameters parent = params.parentfold...
5aa411fd8c708ad8026e2c5976bd09ff41a077a35fd78858b70fc0e4413fa99b
MATLAB
6,529
258
clc;clear all;close all V = BrikLoad ('ambmc_ori_100+orig'); LABEL = BrikLoad ('Allen_label_AMBMC_R+orig'); LABEL_L= BrikLoad ('Allen_label_AMBMC_L+orig'); LABEL_L(LABEL_L~=0)= LABEL_L(LABEL_L~=0)+865; LABEL=LABEL+LABEL_L; V=reshape(mapminmax(V(:)',0,1),size(V)); az=90;el=90; T = readtable('labels.txt'); ...
3595afb3f0db54e66f735f0429730baa463183c5b6c0ef0cf17879e3ecad29a5
MATLAB
6,530
192
function [DAT,H1]=openedf(FILENAME) % EDF=openedf(FILENAME) % Opens an EDF File (European Data Format for Biosignals) in MATLAB (R) % <A HREF="http://www.medfac.leidenuniv.nl/neurology/knf/kemp/edf.htm">About EDF</A> % Copyright (C) 1997-1998 by Alois Schloegl % a.schloegl@ieee.org % Ver 2.20 18.Aug.1998 % ...
8ee3056bb13ec0964549e7001a5e77b62a071a012ce2f55eecf6398145f188b5
MATLAB
6,539
208
function CrossCorrLimitedConditions(OutDir,Tag,varargin) % Plots confusion matrix (decode analysis) for decoding each (relevant) % condition. % [~,PThresh] = Utilities.ProcVarargin(varargin,'PThresh',0.001); [~,Pmethod] = Utilities.ProcVarargin(varargin,'Pmethod','fdr'); [varargin,saveFig]=Utilities.ProcVararg...
0152a1a616050553c2a8688bd180bbef3da73fc8ee386219576be9e3ac05c58c
MATLAB
6,541
218
% pop_filterp % % PURPOSE : Filters ERP data % % FORMAT : % % >> ERP= pop_filterp( ERP, chanArray, highpasscutoff, lowpasscutoff, % filterorder, typefilter, removemean ); % % EXAMPLE : % % >> ERP = pop_filterp( ERP,1:16, 1, 40, 25, 'fir', 0 ); % % INPUTS : % % ERP - input ERPset % chanArray - channel(...
3f6b74bd162827ff823beb3bfb7fe53730a60e04c3dafe8de3996cf879641c58
MATLAB
6,545
361
clear clc % This M-file creates an animation of individual muscles as well as the equivalent muscles. f = 0; cmap = [[0 1 0]; [0 0 1]; [0 1 1]; ... [0.4940 0.1840 0.5560]; [0.4660 0.6740 0.1880]; ... [0.3010 0.7450 0.9330]; [0.6350 0.0780 0.1840]; [1 0 1]; [0.75, 0.75, 0]]; figure(3) pause(2) for ...
e6b282c25af4c5bcac57eee471ff32c6fdd448442f13aeac974fcd8432512a29
MATLAB
6,546
152
clear;clc;close rdfile='Data_exp2.xlsx'; % File for reading data rdrange='A3:P642'; % Range for reading data wrfile='Results_exp2.xlsx'; % File for writing results wrsheet = 'Each participant'; % Sheet for writing results wrrange1='E2'; % Range for writing TSs wrrange2='E4'; % Range for writing results n_...
601ea44b205a92178447968e9609f855814ec03d8329f7c8d41a015b99605c6c
MATLAB
6,548
137
clear variables close all %% Ensure you stay in the directory of this script as it's running (leave as is) current_file_name = matlab.desktop.editor.getActiveFilename; pathstr = fileparts(current_file_name); cd(pathstr) % Ensure you can access functions related to the image generator addpath(pwd) addpath(...
8e28c116c1043f5910256562ec982cea3dbbdb15e0d0e54be972ce769c3571bb
MATLAB
6,551
172
function [trialData] = read_sbin_data(filename, hdr, begtrial, endtrial, chanindx) % READ_SBIN_DATA reads the data from an EGI segmented simple binary format file % % Use as % [trialData] = read_sbin_data(filename, hdr, begtrial, endtrial, chanindx) % with % filename name of the input file % hdr ...
448586719d7fd35b00872e3f222af7004d62200ef28c5e7044214e5b10d55987
MATLAB
6,555
170
function varargout = FlySongSettings(varargin) % FLYSONGSETTINGS MATLAB code for FlySongSettings.fig % FLYSONGSETTINGS, by itself, creates a new FLYSONGSETTINGS or raises the existing % singleton*. % % H = FLYSONGSETTINGS returns the handle to a new FLYSONGSETTINGS or the handle to ...
12d64fa4fe2db3e30225938f3cd53284c8ec9a61860b44cfd67f9e28ab0640c2
MATLAB
6,556
135
% Get paramters % Edited by Jerry Liu, 09/20/2022 function Parameter = GetParameter_220919(HCstim,savePath) % this function get the suitable parameters for analysis. call this % function before implementing the analysis and pass the output struct % as an argument to functions that need it. if you are to ch...
7363cccd2318315082f12db3b993b52e037431de9b6c2b8986e4b4f54ac61d45
MATLAB
6,556
217
% visualize_distortions % % % A script to run in conjunction with calib_gui in TOOLBOX_calib to plot % the distortion models. % % This is a slightly modified version of the script plot_CCT_distortion.m written by Mr. Oshel % Thank you Mr. Oshel for your contribution! [mx,my] = meshgrid(0:nx/20:(nx-1),0:ny/20:(ny-1));...
1b66fa99350feead8201a5be028bb24bfd0346e6193981ff6bd1dc278a0eeb98
MATLAB
6,561
158
function [Q, dQ] = Q_TDR(par_new,par_old,Ai,Ri,zzi,r,ni,alpha) % Unpack parameters P = length(r); % number of regressors T = length(Ri(:,1))/P; % number of time bins TP = T*P; rtot = sum(r); % sum of ranks n = length(ni); % number neurons lambinew = par_new(1:n); snew = par_new(n+1:end); lambiold = par_old(1:n); sold...
c347db5244e3f69535272d7520f43256d30fee939f30275ad0423b0653252e81
MATLAB
6,561
147
function Step4c_DynamicFC(config, pid, visitnum) % % Step4c_DynamicFC calculates specified functional connectivity metric % across a series of sliding windows, thereby returning dynamic functional % connectivity rather than static (i.e., 1 value for connectivity between % pairwise ROIs). % % INPUTS: % > config: %...
297468169675971612b3b3ca1b3f94749f234a9f33bc6d65fe8c4681a5596487
MATLAB
6,563
227
classdef CropInfo < handle % Note on 'roi', 'posn', and cropping % % roi % This refers to an APT-style roi. This is [xlo xhi ylo yhi] with integer % values. In normal situations, we will want positive integer values, % which are also <= the image size. We call these rois 'proper rois'. % % We imag...
977a9fd006023f536116fd38c44ea21e7d424322845c8d2bcb60acd3a0bff8b5
MATLAB
6,563
168
% 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,...
82488e2d7b2be4fea33512a2d77a121cca2e61e0da296aa6319fa6012b8c1ffa
MATLAB
6,565
180
% Underdetermined least squares on the unit square, regularized Laplace kernel. % % This is like ULS_SQUARE1 except now we use regularized Laplace sources to % match against data on a quasi-uniform grid. This seems to better match the % expected asymptotics for method-of-fundamental-solutions problems. % % Inputs (defa...
7b5f6a6b0b9231b520b2a9f2452856ff014dd07c8890b7aef600d36036a767e7
MATLAB
6,572
252
function CBH = cbfit(varargin) %CBFIT Draws a colorbar with specific color bands between its ticks. % % SYNTAX: % cbfit % cbfit(NBANDS) % May be LBANDS instead of NBANDS % cbfit(NBANDS,CENTER) % cbfit(...,MODE) % cbfit(...,OPT) % cbfit(CBH,....
4a0afa2a2363cfb601ba3d2ded9ff6b0452b802610dbc92413644e0491511bc6
MATLAB
6,573
251
function mne_baby_meg_dig_trig(infile,outfile,threshold,invert,include,want_eeg) % % function mne_baby_meg_dig_trig(infile,outfile,threshold,invert,want_eeg); % % Read and write raw data in 60-sec blocks % % % Author : Matti Hamalainen, MGH Martinos Center % License : BSD 3-clause % global FIFF; if isempty(FIFF)...
6de35bbb5ca2d218aebc74bec97ec6fcb09e7ed33641786ee913f4553f3d7ad1
MATLAB
6,574
165
function [ctxidx, hpidx] = matchidx_acrossep_singleday(animaldir, animalprefix, day, exclude_list) eps = 2:2:16;% RUN Epochs %% tetinfo = loaddatastruct(animaldir, animalprefix, 'tetinfo'); cell = loaddatastruct(animaldir,animalprefix,'cellinfo'); spks = loaddatastruct(animaldir, animalprefix, 'spikes', day); % get sp...
b32655a36b8f1c136ae68a85fbc63ec0034850ec301df8d6fd214a3d66d37fde
MATLAB
6,577
295
% compute f(x) = max_i w_i Gauss(x | mu(i), Sigma(i)) % Code based on %http://staff.itee.uq.edu.au/marcusg/msg.html function maxGMMplot() rng(42) % seed params = initialize (2, 20, 5, -5, 10, 0.8); plotlandscape (5, -5, 50, params); end function params = initialize(dimension,nGaussian,upper,lower,globalvalue,rat...
d2127076fed8cfcb06189d6bf5a845aa50145b6878df139a6fe8b7e481112726
MATLAB
6,577
175
% Plot normalized ITPC TS by att w shaded error bars %% Settings titleVis = 0; % if title vis off, then will plot for appropriate manuscript size showN = 1; % show n = X annotation figFormat = 'svg'; % svg plotErrorBars = 1; % turn off for subject-level plots restrictYLim = 0; % turn on for group-level manuscript...
3a17701148b9b2689c6fcd11b42f2b0fec53ccfbdeb859365995022e640236a9
MATLAB
6,578
212
function varargout = DPARSF_ROI_Template(varargin) % DPARSF_ROI_TEMPLATE MATLAB code for DPARSF_ROI_Template.fig % DPARSF_ROI_TEMPLATE, by itself, creates a new DPARSF_ROI_TEMPLATE or raises the existing % singleton*. % % H = DPARSF_ROI_TEMPLATE returns the handle to a new DPARSF_ROI_TEMPLATE or the hand...
2f5582cc0526c9686d46a738e554b9fe63c3343752a216bf5c3fbcebc7760ee7
MATLAB
6,579
123
function gm = fitgmdist2(X, k, varargin) %FITGMDIST Fit a Gaussian mixture distribution to data. % GM = FITGMDIST(X,K) fits a Gaussian mixture distribution with K % components to the data in X. X is an N-by-D matrix. Rows of X % correspond to observations; columns correspond to variables. FITGMDIST % fits the...
8a48945a8e177d70239705ba2ad56e76362f038b408d5b50195b1a602ba0f6ef
MATLAB
6,580
131
function BSC_LSA(stat_path,sots_path,exp_folder,N,TR,model,q_level,ground_truth) % ======================================================================== % Ruslan Masharipov, October, 2023 % email: ruslan.s.masharipov@gmail.com % ======================================================================== tic % Number...
10366d522f1da45a3febfd02bb3c33762412e36fa239524615c5e65d2e512fb5
MATLAB
6,582
163
function [all] = VBA_classification_display(all) % displays the results of VBA_classification % function [all] = VBA_classification_display(all) % Note: inputs to VBA_classification_display.m are outputs of % VBA_classification.m. % IN: % - pv: cross-validation p-value % - df: effective degees of freedom of the t- ...
1981eb00befa4ca5543f86c1df9c0d567134d63dd60d566c9987c87294e1fd85
MATLAB
6,583
195
function [tfr,t,f,wt]=tfrscalo(X,time,wave,fmin,fmax,N,trace); %TFRSCALO Scalogram, for Morlet or Mexican hat wavelet. % [TFR,T,F,WT]=TFRSCALO(X,T,WAVE,FMIN,FMAX,N,TRACE) computes % the scalogram (squared magnitude of a continuous wavelet % transform). % % X : signal (in time) to be analyzed (Nx=length(X)). Its % ...
e9d8461990eb8f62ba421531f475e01ed954cd268f2db88ba5e73b9750af7d91
MATLAB
6,583
248
function [model, errors] = rbmFit(X, numhid, varargin) % Fit a bernoulli-bernoulli RBM to binary data % optionally with class labels % %INPUTS: %X ... N*d matrix, entries in [0,1] %numhid ... number of hidden units % % %OPTIONAL INPUTS (specified as name value pairs *or in struct*) %y ...
ed5f640f89503dacedeb23e9ef823b135abbe08cc0c45301af2406167487a385
MATLAB
6,583
143
%% Efficient subpixel image registration by cross-correlation. % Registers two images (2-D rigid translation) within a fraction % of a pixel specified by the user. Instead of computing a zero-padded FFT % (fast Fourier transform), this code uses selective upsampling by a % matrix-multiply DFT (discrete FT) to drama...
630b0f15aee4c8517916dc7a8b70220d1b76e89f3b6700657dc89952bb25d0cc
MATLAB
6,588
131
function [grid_tags, palm_seg_present, dors_seg_present] = GetSegmentLabels(SurveyStruct, ChannelMap, pbt_regions, dbt_regions, method, orig_size) if nargin == 5 orig_size = [1200, 1050]; end % Tags for palmar and dorsum grid_locations = ChannelMap.ChannelNumbers(ChannelMap.IsSensory); [grid...
9aaef7b6f02419208d70990f53de32c73de515eeba1b16f4b89da5f1dec229b4
MATLAB
6,590
230
function varargout = tracking( varargin ) %tracking Track anonymized usage data % % tracking(p,v,id) tracks usage to the property p for the product version % v and identifier id. No personally identifiable information is tracked. % % r = tracking(...) returns the server response r, fo...
ce921265b405593f578ca6ff45517b8067ede05e7a4478e8104b47f4291ad27d
MATLAB
6,590
187
%% Plot results of varyDecodeParam.m % plotVariedDecodeParam.m % %% Choose which varied decode parameter result to analyze % Creates Figure 4—figure supplement 2 % Decoding "mainPaperGrid" with 25 random subset replicates at each point variedDecodeFilename = 'grid_2023-07-22T14-50variedDecode2023-09-10T21-04.mat'; ...
4769ebee12d5a9c18e6347664db27304365595fec79a452b1c58ebad84d4ead4
MATLAB
6,593
191
%% Initialise plot parameters function pp = InitPlotParams() % Return struct with plotting parameters to allow for consistent style % across figures % ==== Input === % none % === Output === % plot parameters: pp = struct with fields % - color_xhat = RGB color for xhat % ...
7547c39564d513ca46c3ed612195a46e3a6a7ab28566a56d0fd8c1033e260ca4
MATLAB
6,593
230
%% load weight matrix and declare layer type % lay is layer in network - 0, 1, or 2 % load the corresponding weights - here all weights are random % also load the corresponding input lay = 0; switch lay case(0) weights = cell(1); for i = 1:8 for j = 1:8 weight...
53935a19e1b703e79f8e90973475d24f24dbcdabe379520850396a32755af8d0
MATLAB
6,594
224
function [asens, afiducials] = ft_average_sens(sens, varargin) % FT_AVERAGE_SENS computes average sensor array from a series of input % arrays. Corresponding average fiducials can also be computed (optional) % % Use as % [asens, afid] = ft_average_sens(sens) % where sens is a 1xN structure array containing N sensor ...
4158ae26eadef73bbc2690c34d26f9ecbdb0c7131d4080744f0006d2d914d7aa
MATLAB
6,597
127
clear; clc; %% This script used to perform generalized PPI derived from Go trials % Set up path Para.rootdir = 'W:\All_IMAGEN_DATA\imaging\SST_spm_first_level_GT'; % SPM first level path Para.opdir = 'W:\gPPI_Shen_GT'; % output path Para.Maskdir = 'W:\Shen268_ROIs';% ROI mask path including 268 regions nfiti data P...
992491e968d32606b32cc361f1def69e867d3ed7f3ddde1aabda28931a1943e6
MATLAB
6,604
195
%% significance % % Statistical significance adjusted for multiple hypotheses % % <matlab:open('significance.m') code> % %% Syntax % % sig = significance(pval,alpha,correction) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % pval multi-trial time ...
90b737e5af261e900e2a6c51b9c683da401acbbd26864cebad382d9c73d753b4
MATLAB
6,606
192
function [DAT,H1]=openedf(FILENAME) % EDF=openedf(FILENAME) % Opens an EDF File (European Data Format for Biosignals) in MATLAB (R) % <A HREF="http://www.medfac.leidenuniv.nl/neurology/knf/kemp/edf.htm">About EDF</A> % Copyright (C) 1997-1998 by Alois Schloegl % a.schloegl@ieee.org % Ver 2.20 18.Aug.1998 % ...
123830d567947610ee52a9308638a9a24218f9b4861d0bb2d1c27d13000c78fc
MATLAB
6,608
175
% Noam Saadon-Grosman % August 2020 % This code computes selectivity in each vertex of each subject in each % stimulus direction that passed the threshold for significant % somatosensory response. Selectivity is defined as 1/standard deviation of % a Gaussian fitted to the response Event Related Averaging. The out...
9c457391daa7a6496426a9cf3636bbc1919f82a40dfcb81fb315505d1124b717
MATLAB
6,611
253
function [ fv, normals, name ] = read_stl( file, A, v ) % Modified by William Warriner 22 Aug 2019 % from READ_stl by Adam H. Aitkenhead % Inputs: % - @file, a string containing the path to the desired STL file. % - @format, optional, default "auto", a string containing one of "ascii", % "auto", or "binary". The str...
a57c1fa40f617f67c6e6717973ecaa154f18cb153c85c081c72a2b2b1e276579
MATLAB
6,611
207
function [P,Uinit,output] = cp_als(X,R,varargin) %CP_ALS Compute a CP decomposition of any type of tensor. % % P = CP_ALS(X,R) computes an estimate of the best rank-R % CP model of a tensor X using an alternating least-squares % algorithm. The input X can be a tensor, sptensor, ktensor, or % ttensor. The resul...
d861977327621301ea0da530bec05d0614868f0fd565c6db1d7da30456d904dd
MATLAB
6,612
194
% ======================================================================== % TMFC analysis for event-related design % Requires SPM12 (v7771) % % Beta-Series Correlations based on Fractional Ridge Regression (BSC-FRR) % requires GLMsingle toolbox (https://github.com/cvnlab/GLMsingle) % % ================================...
13b422530719f08ede7ac9737fed72af62f212d72293889b878f64569f2144e1
MATLAB
6,613
241
function [ events auxwaves auxdata ] = wlProc_doSegmentAndParamExtract( ... wavedata, samprate, bpfband, segconfig, paramconfig, wantmultithread) % function [ events auxwaves auxdata ] = wlProc_doSegmentAndParamExtract( ... % wavedata, samprate, bpfband, segconfig, paramconfig, wantmultithread) % % This function p...
bcbc3b689d55be4c9b48249476d33cbedb596512318df6be490df6d222a08c06
MATLAB
6,617
154
function [r, LB, UB, F, df1, df2, p] = ICC(M, type, alpha, r0) % Intraclass correlation % [r, LB, UB, F, df1, df2, p] = ICC(M, type, alpha, r0) % % M is matrix of observations. Each row is an object of measurement and % each column is a judge or measurement. % % 'type' is a string that can be one of th...
3078d18938dcc0b8171e2cc7b3157b16147f42c498f19c85db2698bc54ed0816
MATLAB
6,619
168
function [U] = emfmm3d(eps,zk,srcinfo,targ,ifE,ifcurlE,ifdivE) % EMFMM3D FMM in 3D for Maxwell (frequency-domain electromagnetic) kernels. % % U = emfmm3d(eps,zk,srcinfo,targ,ifE,ifcurlE,ifdivE) % % Frequency-domain Maxwell FMM in R^3: evaluate all pairwise particle % interactions (ignoring self-interactions) and ...
487798cffc504367a7741919f483856616a24082f85a91cce8496ab9a58eb9c3
MATLAB
6,620
194
%% This code is used for creating timeseries and averages following processing on the FlyDisco pipeline %Inputs - %Conditions: dirs containing expdirs for each experimental type. I %sorted the expdirs by genotype. %Behaviors: scores files from the classifier used %Pre: number of frames that is the pre-stimulus perio...
ce04e090c1a225e00fc512e5431f3c0d85bc43e56b6f3293f7d4a6fa01c21a4b
MATLAB
6,621
144
% This code cleans up the seizure data from noisy artefacts and selects the % components that are relevant to seizure (those that demonstrate % correlation with seizure onset time). % data_noise Sohrabpour % 1/9/2018 clear all; close all; clc % This part of the code was to load the data for our data base. We...
bd380c58f1286d9b2b02517661c04c07b79a7a6f844f334d4ddcf8f2afa82389
MATLAB
6,622
260
function [hfigs,savenames,errprctiles] = PlotWorstLandmarkErrorOverX(varargin) [errprctiles,gtdata,nets,legendnames,colors,colorfracprcs,exptype,... n_train,... conddata,labeltypes,datatypes,... maxerr,prcs,... statname,... hfigs,figpos,savedir,savenames,dosavefig,xl,savekey] = myparse(varargin,'errprctiles'...
2e2e918756bde7b6421e7cd7d76584019217ac4bfab0c5a1eb218b427cb5589c
MATLAB
6,623
129
function [Cms,AcqTms,FinDif,USsToAcq,TrlsToAcq,TmToSig,M,FinDifLstN,FinCSpkrate] = ... Cums(tsd,CSon,CSoff,UScode,PkCode,Sesstart,LstN,fig) if nargin<8 fig = false; end Cms = nan(length(tsd),19); % intitializing output Cms(:,1) = tsd(:,1); % cumulative time in context in col 1 LVus = tsd(:,2) == UScode; % flags...
34ec676a556d909aa98dd8c7c3510d641df60fba23ad5418fb175af30f29acaf
MATLAB
6,623
194
function EEG = detect_spindles(EEG,PARAM) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Detect Spindles in EEG data % % INPUT: EEG = EEGLab structure % PARAM = structure of parameters (see below) % % OUTPUT: EEG = same structure with spindle markers (EEG.event) % % Auth...
6e89d9d92b879f11e1a2c5790b91f32d1c28fdcfc5b9ce9818ebd6bbb90e39aa
MATLAB
6,623
173
function DecodeAnalysis(AllTrialData,Labels,DecodeLabels,TimeWindow,OutDir,Tag,varargin) % Plots confusion matrix (decode analysis) for decoding each (relevant) % condition. % [~,PThresh] = Utilities.ProcVarargin(varargin,'PThresh',0.001); [~,PThresh] = Utilities.ProcVarargin(varargin,'PThresh','fdr'); [~,NIte...
6f76cffc2ed974080c460c2ccfd79e94092b3bb4ce619d9d0425892f7a66bae9
MATLAB
6,623
149
function Cfg = y_GetTRInfo(Cfg,WorkingDir,SubjectListFile,StartingDirName) % function Cfg = y_GetTRInfo(Cfg,WorkingDir,SubjectListFile,StartingDirName) % Generate TRInfo.tsv % Input: % Cfg - the parameters for auto data processing. % WorkingDir - Define the working directory to replace the one defined in Cf...
59fd3a7b15d73ca8ae804b84dede9b5a0a99b9fef9f2e411b38890127d2a82b7
MATLAB
6,624
192
function [score splitVal] = Bimodality(dat,varargin) showPlot = false; nBins = 100; quantRange = [0.01 0.99]; smoothFactor = 5; minSampPerBin = 5; if length(dat) < minSampPerBin score = 0; splitVal = nan; return end for i = 1:2:length(varargin) switch lower(varargin{i}) case 'showplot' ...
7719cf9f3e98f18ee41c7f9f310e77c552a79c26f2ed1cd5b33ca33de723b00d
MATLAB
6,628
200
function [all] = VBA_classification(X,y,k,verbose,options,sparse) % performs binary classification using VBA % function [pv,stat,df,all] = VBA_classification(X,y,k,verbose,options) % In brief, this function fits the following logistic regresion model: % p(y=1) = s(X*beta) % where y is the binary data, s is the standa...
1854a921c72a9c1962aa1c1ae6f74ad6a99e495efa16460b5bafd8d00fc07864
MATLAB
6,631
154
function [Obj,Dims] = NETCDFload(filename,flags,varargin) %% NETCDFLOAD % Obj = NETCDFload(filename,'all') reads the SOFA object OBJ with all data from % a SOFA file. % % Obj = NETCDFload(filename,'nodata') ignores the Data. variables while % reading. % % Obj = NETCDFload(filename,[START COUNT],partialDim) re...
73d420528e4abb7a63edba9027206502b28f7352ae30275ede80e5320a6f71e3
MATLAB
6,632
171
function edited = PulseTrainSettings(pulseTrainDetector, varargin) handles.detector = pulseTrainDetector; handles.reporters = pulseTrainDetector.controller.reporters; if isempty(handles.reporters) msgbox('You must find or import pulses before you can detect pulse trains.', 'Pulse Train Detector...
3afc421a7a61a560e2a1ae3d3afe6d27ee1adb5328578aa3b0adb86bc271f8e3
MATLAB
6,633
179
% Covariance matrix on the unit cube, squared exponential kernel. % % This is basically the 3D analogue of COV_SQUARE1. % % Inputs (defaults are used if not provided or set empty): % % - N: number of points in each dimension (default: N = 32) % - OCC: tree occupancy parameter (default: OCC = 512) % - P: cube root...
4c4b7e3869aba506158d9dcf110567b58b591f9203c73a020aa7d9ea490f1136
MATLAB
6,634
186
function CM=nfoldxval( data, IDX, clfInit, clfparams, ... types, ignoreT, fname, show ) % Runs n-fold cross validation on data with a given classifier. % % Given n separate labeled data sets, trains classifier using n-1 data % sets, test on remaining one. Average results over all n such runs. % Shows overall results...
92337b5a8e6160c6b60c838032dafa0c860460f1f9593bc6578b3d2989502555
MATLAB
6,636
187
%parseargs [opts] = parseargs(arguments, pairs, singles, ignore_unknowns) % % Variable argument parsing-- supersedes parseargs_example. This % function is meant to be used in the context of other functions % which have variable arguments. Typically, the function using % variable argument parsing would be written with...
4fd4a6067b5bd0fd7f31acc3fae2d8712e05761aeeb84e0e19f0712a54505351
MATLAB
6,638
223
% demo of Bayesian optimization for "code breaking" function bayesianCodeBreakerSimple() function prior = makeCodePrior(L, A, code) % set code(i) = 0 if unknown (uniform prior for ci) % set code(i) in {1,..,A} to use delta function for that slot cs = ind2subv(A*ones(1,L), 1:A^L); ...
cc4ec2b707440e7ea257e06b25f682a32cccdd152143bcd4f5c121b457471979
MATLAB
6,638
144
function y_IntermediateFilesOrganizer(WorkingDir,SubjectID,OutputDir) % FORMAT y_IntermediateFilesOrganizer(WorkingDir,SubjectID,OutputDir) % Input: % WorkingDir - the directory contains processed data % SubjectID - the list of subject IDs for organize. n by 1 cell % OutputDir - the directory for saving Inte...
16f7318d0b16584fd16eb295d60b7f69fc269bb022783eef316eba2ca5fa8d59
MATLAB
6,644
194
function [posr, trir, texr] = refine(pos, tri, method, varargin) % REFINE a 3D surface that is described by a triangulation % % Use as % [pos, tri] = refine(pos, tri) % [pos, tri] = refine(pos, tri, 'banks') % [pos, tri, texture] = refine(pos, tri, 'banks', texture) % [pos, tri] = re...
dfd9135fd94cd73900613805ca06ee3f28f4cff14291987a079e8863fc5576c1
MATLAB
6,645
103
% RATE REMAPPING _ POST HOC ANALYSIS PIPELINE % get stable cells first/second half of laps, adds to subset_of_cells get_stable_cells(folders,'wcorr'); rate_remapping_TRACK_PAIRS(folders,'wcorr'); plot_rate_remapping_NEW('subset','stable cells laps','epoch',{'PRE','POST'},... ...
7486c525c42ace288ec3126b9afe9c4c7019c119e4819ec6ece4098feb9bdb85
MATLAB
6,649
219
%% Overview % % Here we load in our source parcellated MEG data from the preprocessing stage, % perform some normalisation and compute an Amplitude-Envelope HMM. % % Load in study deails config = utils.get_studydetails; %% % Find preprocessed data files datapath = fullfile( config.analysisdir,'spm_sss_processed' ); ...
f019c8ed986677cbe3ac5c9486b8bcbe18b540bba5b0c420e930e5c76b1fde16
MATLAB
6,649
254
function hdlg = JRCBackEndSettingsDialog(obj) lObj = obj.labeler_; nrows = 6 + 2; h = 30; W = 500; H = h*(nrows+1); hdlg = dialog('Name','JRC Backend Settings',... 'Units','pixels','Position',[300 300 W H]); xborder = 20; xsep = 5; yseprel = .025; wquest = (W-xborder*2-xsep)*.5; wans = (W-xborder*2-xsep)*.5; wbu...
647b903a5462e91f23aea9be3f7efddf2fe110051903b8c6a3697c4856b0b0b3
MATLAB
6,654
186
% Overdetermined least squares on the unit square, thin-plate splines. % % This is the direct analogue of OLS_LINE for quasi-uniform points in 2D. % % Inputs (defaults are used if not provided or set empty): % % - M: number of row points (default: M = 16384) % - N: number of column points (default: N = 8192) % - ...
b417f76df2df35d65123732af387445d7ea6d01223b9df59c5410820a30b06ed
MATLAB
6,655
185
% Underdetermined least squares on the unit square, Laplace kernel. % % This example solves an undetermined least squares problem arising from data % fitting at random points in the unit square by Laplace kernel radial basis % functions on an quasi-uniform grid. The matrix is rectangular (short-and-fat) % and real; we ...
056918b89034cfddd7ccefa9df10cea8c43037eb14c1abddc9f8bdfe9418e61e
MATLAB
6,660
197
function Results=PopAnal_FormatCorrShuffDynamic(AllTrialData,Phase,unit,timeWindow,opts) %% % timeWindow=[-1.5 -.5]; % Task related Firing Rate disp(timeWindow) %% Conditions={ 'NancyPinchCheek','NancyPressCheek','NancyRubCheek','NancyTapCheek',... 'NancyPinchShoulder','NancyPressShoulder','NancyRubShoulder','Nan...
62fb16a53fe0cec6faa6cf5f442b902cb4e7f1e6bb0750abb789c32a3115a46e
MATLAB
6,661
209
function [dat] = read_neuralynx_bin(filename, begsample, endsample) % READ_NEURALYNX_BIN % % Use as % hdr = read_neuralynx_bin(filename) % or % dat = read_neuralynx_bin(filename, begsample, endsample) % % This is not a formal Neuralynx file format, but at the % F.C. Donders Centre we use it in conjunction with Ne...
ec55a3ae34e11d9fd0dceeb5ec4690276a53e31b58c50418e26ab814aee81eba
MATLAB
6,661
231
function [ ftdata, evmatrix ] = wlSynth_genFieldTrip( ... samprate, chancount, trialcount, trialdur, burstdefs, ... channelratevar, channelnoisevar ) % function [ ftdata, evmatrix ] = wlSynth_genFieldTrip( ... % samprate, chancount, trialcount, trialdur, burstdefs, ... % channelratevar, channelnoisevar ) % % T...