sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fb16b3e6b725b125b20e703bb1482b6a30a076e2cfcf3d44ee4640bfacfe6709
MATLAB
3,567
98
function [cfg, artifact] = ft_artifact_nan(cfg, data) % FT_ARTIFACT_NAN identifies artifacts that are indicated in the data as nan (not a % number) values. % % Use as % [cfg, artifact] = ft_artifact_nan(cfg, data) % where the input data is a structure as obtained from FT_REJECTARTIFACT with % the option cfg.artfctde...
feff319b1e1ac0031f15c6f105c0e7b7f674d488e4a55a4dc954f37bd8329e0d
MATLAB
3,567
136
%% Demo of L2 regualrization of a piecewise constant function (splines) with fixed knots % Based on code by John D'Errico % http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8553&objectType=fileY %% % This file is from pmtk3.googlecode.com function ridgeSplineDemoCV() if 0 randn('state',0); ...
d7e181ffd04ec893ea5ea9e44dbf2ad8642ac7ee86409de051d4e8e7b4854d52
MATLAB
3,568
92
function s1_prepare_rest_input_lists(id_list,rs_data_dir,ABCD_table_dir,rs_proc_dir) % s1_prepare_rest_input_lists(id_list,rs_data_dir,ABCD_table_dir,rs_proc_dir) % % This function prepares input lists required for the rest fMRI preprocess pipeline % % Inputs: % - id_list % A string. Path of a text file containin...
05e550ad7b0bdc32945c1ed62584139910c88d779b3e10bd4add2aff8eead0c1
MATLAB
3,569
101
%% Learn the structure of a small CRF using group L1 regularization % We compare our resutls to 'example_UGMlearn' from % http://www.cs.ubc.ca/~murphyk/Software/L1CRF/index.html clear all close all display = 1; % Set to 0 if you don't want to draw the graphs %% Parameters of Experiment rand('state',0); randn('state',...
4211322e857b662acd908ea50c933ce267476d3f89d3cd83fe719e76dd41b042
MATLAB
3,569
109
function write_serial_event(filename, event) % WRITE_SERIAL_EVENT % % changed A.Hadjipapas 2010 % % write to phyiscal serial port % serial port on windows or linux platform % Copyright (C) 2007, Christian Hesse % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details...
4dcd4708480025105e0dd4ec9915825dea253666aa15896a980770301a140566
MATLAB
3,569
125
% function to calculate the non-affine displacements in a sheared 3d system function [eps D2Vec] = Dmin_3D_opt(a0,a1) %calculates local strain in an amorphous system. % INPUT : % a0 - (x,y,z) coordinates of N = size(a0,1); NNacceptance = 1.3; %first minimum of g(r) NNsq = NNacceptance*NNacceptan...
5491f99859b9e02613fac724ad7815036afbc9bc04a35a55bda8173c9b02b520
MATLAB
3,569
129
% http://se.mathworks.com/help/vision/examples/digit-classification-using-hog-features.html %% % Load training and test data using |imageDatastore|. syntheticDir = fullfile(toolboxdir('vision'), 'visiondata','digits','synthetic'); handwrittenDir = fullfile(toolboxdir('vision'), 'visiondata','digits','handwritten')...
d4e4ef114344a9b56197a7980caddc9bc0534ee7633db08f06e2c4947b81d517
MATLAB
3,569
87
function [X, Y_true] = simulate_cv_generatetc(datadir, hmmdir, outputdir, HMM_name, n_train, n_test, betwgroup_diff, Y_noise) % [X, Y_true] = simulate_cv_generatetc(HMM_name, n_train, n_test, betwgroup_diff, Y_noise) % % simulate timecourses where the target variable is related to one HMM % state's means, but with a gr...
e8e30b1987a2ae27b814ac1e32400f6ecef32874ff5eb3e3d8153e97479c1e32
MATLAB
3,569
120
function [ bestvec longestprobe endtotal ] = ... wlProc_doAnneal(scalevec, errfunc, maxprobes, maxtotal) % function [ bestvec longestprobe endtotal ] = ... % wlProc_doAnneal(scalevec, errfunc, maxprobes, maxtotal) % % This function performs simulated annealing, searching for a perturbation % vector about a known s...
32dfb6a2efeeff1bfcedcc073d674ec67e7d918646dc93f709c67aea1423f8a1
MATLAB
3,570
104
function xout = stdrcdf1(q, v, r, upper) %STDRCDF Compute c.d.f. for Studentized Range statistic % F = STDRCDF(Q,V,R) is the cumulative distribution function for the % Studentized range statistic for R samples and V degrees of % freedom, evaluated at Q. % % G = STDRCDF(Q,V,R,'upper') is the upper tail probabili...
8302a2806ba47cf6932e7f89e40f4601ff8b894530ba0f200866976d5465ebfa
MATLAB
3,570
131
function obj = fit(X,k,varargin) % Not intended to be called directly. Use FITGMDIST to fit a GMDISTRIBUTION. % % See also FITGMDIST. % Copyright 2008-2013 The MathWorks, Inc. % Copyright 2008-2014 The MathWorks, Inc. if nargin < 2 error(message('stats:gmdistribution:TooFewInputs')); end checkdata(X); if...
bbb133195afda59285f35004c5b930209eb70c8d17803778e2de7cb3ce22f598
MATLAB
3,570
147
%% Demo of Simulated Annealing % for finding the most probable point of a peaky 2D surface %PMTKneedsStatsToolbox hist3 %% % This file is from pmtk3.googlecode.com function saDemoPeaks() requireStatsToolbox findMAX = true; [XX, YY]=meshgrid(1:49,1:49); Z = peaks; % 49x49 surface surface m = min(Z(:)); Zpos = Z+abs...
01c147acd0e2ba6e1193688850df0b3e11642b846e22306d4d049debd784d834
MATLAB
3,571
66
function ks_traj = create_ks_trajectory(seq,adc,params) [ktraj_adc, t_adc, ktraj, t_ktraj, t_excitation, t_refocusing, slicepos, t_slicepos] = seq.calculateKspacePP(); j = 1; if params.gen.ro_type == 's' plane_samples = adc.numSamples; elseif params.gen.ro_type == 'c' plane_samples = ad...
655a004d071774150dca4b94e568d01f6b9a8d729c010c51e63a25cebd89867f
MATLAB
3,571
139
% 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,...
0ceb87c087fba63a9c49cf95c42c196d9ea320d5b0801068b2e4aea2224b6550
MATLAB
3,572
129
% 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,...
87569272195df4f1b9f186619e3a975addaa009a9d07671771ef82f51c411381
MATLAB
3,572
83
function [rddiff,cilohi,p] = rddiffci(r13,r23,r12,n,alpha) % function [rddiff,cilohi,p] = rddiffci(r13,r23,r12,n,alpha) % % computes a confidence interval (CI) for the difference of two DEPENDENT Pearson % correlation coefficients and tests whether they are significantly different % % In this case, we compare two corre...
f6182dd70e38d75c2fcbf454aec66df62f29453f8ea885fbc59074e5d9361cdd
MATLAB
3,573
106
function [freq] = ft_freqinterpolate(cfg, freq) % FT_FREQINTERPOLATE interpolates frequencies by looking at neighbouring % values or simply replaces a piece in the spectrum by NaN. % % Use as % freq = ft_freqinterpolate(cfg, freq) % where freq is the output of FT_FREQANALYSIS or FT_FREQDESCRIPTIVES and the % configu...
e389189502fdf735d01278f23856f715f9a1f168e8b53519602b4b60338fc809
MATLAB
3,575
97
function [tfr,t,f] = tfrparam(x,t,N,p,L,trace,Rxtype,method,q); % [tfr,t,f]=tfrparam(x,t,N,p,L,trace,Rxtype,method,q) parametric time-frequency % representation. % % X : signal % T : time instant(s) (default : 1:length(X)). % N : number of frequency bins (default : max(256,length(X)) ). % p ...
8421d887fdc1374cf0e16b9e0faa71ffac32b06e2dbbd01a4c0e92d9cf09bb19
MATLAB
3,576
73
function CBIG_ASDf_FC2doc_infFactorComp_wrapper(corrMat_ASD_path, corrMat_con_path, ref_path, sub_info_file, output_dir) % CBIG_ASDf_FC2doc_infFactorComp_wrapper(corrMat_ASD_path, corrMat_con_path, ref_path, sub_info_file, output_dir) % % Wrapper function to compute Z-normalized, discretized FC (Z-normalization % w.r.t...
40f25dc627ec60d112414b8dbff1e750c364265b58e4e283bdb91c40a7bb9a48
MATLAB
3,577
110
% Taken from: http://www.mathworks.com/matlabcentral/fileexchange/4917-skeleton-in-3d/content/fspecial3.m % Written by user G Sken at MATLAB Central, in 2004 (updated 2007) % This is used instead of the 3d filtering in proprietary MATLAB packages function h = fspecial3(type,siz) %FSPECIAL3 Create predefined 3-D filter...
472af08c74db01da93e8284488300583c5ed0509455fd6051bbadb5d12ddf8d8
MATLAB
3,581
110
function Z = palm_gtoz(G,df1,df2) % Convert a G-statistic (or any of its particular cases) % to a z-statistic (normally distributed). % % Usage: % Z = palm_gtoz(G,df1,df2) % % Inputs: % G : G statistic. % df1, df2 : Degrees of freedom (non-infinite). % % Outputs: % Z : Z-score % % If df2 = NaN and df1 = ...
15e36c3d29af7f63b966e111b00a2d71358930172f62da7f74cbd041b21fa166
MATLAB
3,582
94
% Applies the homography defined by H on the image I. % % Takes the center of the image as the origin, not the top left corner. % Also, the coordinate system is row/ column format, so H must be also. % % The bounding box of the image is set by the BBOX argument, a string that % can be 'loose' (default) or 'crop'. When ...
9d2b82110f3e255b2ae92a50e72d7bc79e1464ef81e002c15993e77e41e35b03
MATLAB
3,582
105
function mix = gmminit1(mix, x, options) %GMMINIT Initialises Gaussian mixture model from data % % Description % MIX = GMMINIT(MIX, X, OPTIONS) uses a dataset X to initialise the % parameters of a Gaussian mixture model defined by the data structure % MIX. The k-means algorithm is used to determine the centres. The % ...
86f8aecdf65f20ba378b21143c973996a0bd9631864b82916f8b450a00434458
MATLAB
3,584
93
function [Obj] = SOFAsave(filename,Obj,varargin) %SOFASAVE % [] = SOFAsave(filename,Obj,Compression) creates a new SOFA file and % writes an entire data set to it. % % filename specifies the name of the SOFA file to which the data is written. % Obj is a struct containing the data and meta % data to be writte...
5780410ae154419052e37cf8a618d9bd3e3fb4cb1061e04d8a10c8bdcf30655d
MATLAB
3,585
128
% Re-select te corners after calibration if ~exist('n_ima')|~exist('fc'), fprintf(1,'No calibration data available.\n'); return; end; check_active_images; flag = 0; for kk = ind_active, if ~exist(['y_' num2str(kk)]), flag = 1; else eval(['ykk = y_' num2str(kk) ';']); if isnan(ykk(1,1)), ...
929f6001856217085ab048906dd400c30dcb619db2eeaadd0f3bdb1a11cff127
MATLAB
3,585
126
function draw_figure3FG(p,decRes) % % - This code is written for performing emotion identification analysis % based on region-wise decoding accuracy % % % called from emotion2020_analysis_BATCH % %% settings % score index dimIdx = 1:14; catIdx = 15:48; emoIdx = 1:48; colcat = [216,31,73]/255; coldim = [250,120,210]...
335a3c520ab42fc515b2a4d948c2b2662d1b08ee368cdc9e7748ced82c5a7e70
MATLAB
3,586
96
function [SphereData, Header] = y_Sphere(Center, Radius, RefFile, OutFile, Unit) %function [SphereData, Header] = y_Sphere(Center, Radius, RefFile, OutFile, Unit) % Create a Sphere ROI % ------------------------------------------------------------------------ % Input: % Center - the coordinates of the center of a shper...
508a3204b5bad43cb3d59e249e3d5975e231cd83cfa2dc0e3d79d10a57fe883c
MATLAB
3,586
85
function [DF_norm, DF_MAD] = FP_DEBLEACHED(DeltaFlour,Window,Fs, ITERATIONS) %% By David Estrin & David Barker for the Barker Laboratory % Code is written for ____ et al., 2020 % The purpose of this code is to take a calcium trace from fiber % photometry and detrend/debleach the trace. %% The following are Input...
b76ad7bed9ad378b2968ca1e82340bacf1102ae333f1558c30256ccd7526055a
MATLAB
3,586
59
function X0 = getStartingState_ToRORd(varargin) if (~isempty(varargin)) if (strcmp(varargin{1}, 'm_endo')) X0 = [-88.6369922306458,11.8973412949238,11.8976610470850,... 141.234464714982,141.234423402713,7.26747296460659e-05,... 6.33786975780735e-05,1.53265306371970,...
bcfb1607f83f4f0ed8d418630d1a82aba829963f008ab21fe1104729a49bab7b
MATLAB
3,586
1
function [ SUCCESS , ExperimentID, SubjectID, Phase, Box, MatlabStartDate, Duration, TSdata, Notes, Weight, Program, FileReportedUnits ] = TSloadstdtab ( filename ) % % Assumptions: % File is tab delimited % Dlm file forms a 2 column matrix % First 12 rows are various session fields with indicator numbers on the ...
5a0dfbdde66b9de13fe868ac451dfa264be8cfd045a96f06cfc9572cd2c39e83
MATLAB
3,588
99
function [cfg, artifact] = ft_artifact_nan(cfg, data) % FT_ARTIFACT_NAN identifies artifacts that are indicated in the data as nan (not a % number) values. % % Use as % [cfg, artifact] = ft_artifact_nan(cfg, data) % where the input data is a structure as obtained from FT_REJECTARTIFACT with % the option cfg.artfctde...
6f0f92ebb805bf6801073fc80c2ca534eed2a18d5b8cac152a557380aa944ed6
MATLAB
3,588
92
function all_mapper_opts = parse_mappers(mapper_opts) all_mapper_opts = {}; for i=1:size(mapper_opts) mopts = mapper_opts(i); if ~isa(mopts, 'struct') mopts = cell2mat(mopts); end switch mopts.type case {'BDLMapper', 'NeuMapper'} for ki = 1:length(mopts.k) for...
eecfef3dde9f2879b44af4a32e932fea055dc7838ea79cea16d1712ab65bcab7
MATLAB
3,588
123
function stamp=find_adaptive_event(data,th,id_type,th_type,reject) % this function find points bigger than pre defined threshold % id_type 1: find the first crossing point. % 2: if a succesive serie of timestamps are found, get the peak. % 3: if a succesive serie of timestamps are found, get the ...
27257657c78a9fd4dd6a77b5e32b7b6d026c8e8a67309073bbf2346f67e6caf1
MATLAB
3,589
137
function [im,header,timestamp,bb,mu] = ufmf_read_frame(header,framei,interruptible) if nargin < 3, interruptible = false; end FRAME_CHUNK = 1; fp = header.fid; % read from the current location if no frame input if nargin < 2, loc = ftell(fp); framei = find(header.frame2file==loc,1); if isempty(framei), ...
a47c00933bb6bb7ffb3d353559a9de61e74ebf2f8a1e9e4954a7f00c6bcd6ee8
MATLAB
3,589
93
function readlogOutput = importlog(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % ARDUINOOUTPUT20190611130423 = IMPORTFILE(FILENAME) Reads data from text % file FILENAME for the default selection. % % ARDUINOOUTPUT20190611130423 = IMPORTFILE(FILENAME, STARTROW, ENDROW)...
b10a8dceed63da6775cc81a56294cbc744583fe28c9e95efb81747577129ea41
MATLAB
3,592
82
classdef Ust<handle % AUTHORSHIP % Primary Developer: Stephen Meehan <swmeehan@stanford.edu> % Math Lead & Secondary Developer: Connor Meehan <connor.gw.meehan@gmail.com> % Bioinformatics Lead: Wayne Moore <wmoore@stanford.edu> % Provided by the Herzenberg Lab at Stanford University % License: BSD 3 cla...
614c2e0fc80be322fb5cdb4e683d21ec2250f19cbeff5aa636fe58caf4df612b
MATLAB
3,593
105
function CBIG_VonmisesSeriesClusteringMultioptions(mesh_name, mask, num_clusters, output_file, profile1, profile2, num_smooth, num_tries, normalize, max_iter) % CBIG_VonmisesSeriesClusteringMultioptions(mesh_name, mask, num_clusters, output_file, profile1, profile2, num_smooth, num_tries, normalize, max_iter) % % Von ...
fb3988ec39e1e080f09efb5144c534ead66c80ad56238bcfaa0ddd94d0d75daf
MATLAB
3,594
61
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
608cbf806e6307e3b66b67304ad8177f4721b0ba6319639b5049c54a70d9c6db
MATLAB
3,595
96
function tiemask = generate_tiemask_ed(x, dim, dly, differences) % GENERATE_TIEMASK_ED(X, DIM, DLY, DIFFERENCES) returns a matrix that masks difference % patterns that contain ties. % % The function returns a matrix of the size of the matrix of columnwise % encoded difference patterns (dimension DIM, time lag DLY) fo...
c4f7b5c68798bd16c9b1050a552d0a8e21f8f708880d5d1a018487401fa5e8c7
MATLAB
3,598
97
% Source-target evaluations on the unit square, Laplace kernel. % % This example computes the interactions between random source and target points % on the unit square via the Laplace kernel. The associated matrix is % rectangular and real. % % This demo does the following in order: % % - compress the matrix % - ch...
d99bfe70557eec10f4bb60b3b1c1e5ad33a0b8a8ee290293f5c35749b7b857c5
MATLAB
3,598
115
% meg_plotUpDown % June 29, 2020 % load group channels % load('groupC_TANoise_20Hz.mat') nChOI = 5; saveFigs = 1; fieldNames = {'cueT1','cueT2'}; p = meg_params('TANoise_Analysis'); t = p.tstart:p.tstop; [sessionNames,subjectNames,ITPCsubject,ITPCsession] = meg_sessions('TANoise'); %% high pass filter % hi...
0273eaab8cbc737d9fcd950c84ae1c3ae84a32579e373aec565c2157fc3922d2
MATLAB
3,599
103
function [connectivity] = channelconnectivity(cfg, data) % CHANNELCONNECTIVIY creates a NxN matrix that describes whether channels % are connected as neighbours % % See also FT_PREPARE_NEIGHBOURS if (isfield(cfg, 'avgoverchan') && strcmp(cfg.avgoverchan, 'yes')) || isempty(cfg.neighbours) if nargin < 2 nchan = ...
027c01711a27685c6a79d8a8a73b86ee8a8dc29da5817a1e587a8321ecab9e90
MATLAB
3,599
105
function xout = y_stdrcdf(q, v, r, upper) %STDRCDF Compute c.d.f. for Studentized Range statistic % F = STDRCDF(Q,V,R) is the cumulative distribution function for the % Studentized range statistic for R samples and V degrees of % freedom, evaluated at Q. % % G = STDRCDF(Q,V,R,'upper') is the upper tail probabil...
7349963a8bd2a6bed551e92695618099c5a77f348470f4afbfc4ec77211f0231
MATLAB
3,600
97
% Source-target evaluations on the unit circle, Laplace kernel. % % This example computes the interactions between random source and target points % on the unit circle via the Laplace kernel. The associated matrix is % rectangular and real. % % This demo does the following in order: % % - compress the matrix % - ch...
0015b87beff05960fbff6a78356709a3ded0e785dc39c43673587697abac93ae
MATLAB
3,601
118
function meg_Fig4c_ITPCbyITI_TS % function meg_Fig4c_ITPCbyITI_TS %% Load data load('figData/ITPC_byITI.mat') %% Figure settings titleVis = 0; % if title vis off, then will plot for appropriate manuscript size showN = 0; % show n = X annotation figFormat = 'svg'; % svg annotateMean = 0; annotateStats = 1; saveF...
304574989e7cc1685ac26abd4af6b69e5a84b7a83d7bb186fda1b0bf35c99e29
MATLAB
3,601
117
function [wakeTimes swsTimes] = WakeTimes(sleepLog, unit) % define time intervals (in seconds) between "disenaged wakefulness" and major events postSni = 10; preCni = 5; postUs = 10; preCs = 0; postHvs = 10; preHvs = 10; postSws = 10; preSws = 10; minWake = 30; % unpack behavior data taskList = unit.taskList; tmpLis...
9935b521b87ebda2ee5f76131cbd9dfaff416bd4fb827a8dec805383862e2281
MATLAB
3,601
106
% Birgit Nierula % nierula@cbs.mpg.de %% SRMR2: Import data from BIDS folder % This script % 1) imports all stimulation stimulation blocks from the bids folder % 2) removes the stimulus artifact iv: -1.5 to 1.5 ms % 3) downsamples the signal to 5000 Hz % 4) exclude all channels and saves only ECG channel %% Prep s...
a2de4a8fbfd39e5f9166309737826cdce7595ffe596c6675fb90e73c1ef26ce2
MATLAB
3,601
112
function [model, loglikHist] = mixGaussFitOverrelaxedEM(data, nmix, overRelaxFactor, varargin) %% Fit a mixture of Gaussian using over-relaxed EM % % By default we lightly regularize the parameters, so we are doing map % estimation. To turn this off, set 'prior' and 'mixPrior to 'none'. See % Inputs below. % %% Inputs...
145aa5edfc0b9b13fa71049f48b3be6a87053fd789e5c86c38e74d5a7bd03f0a
MATLAB
3,602
107
function output = antsFlip(dimension, files, axis, always_new_reflection, reused_reflection_mat ) %% This file uses ANTs to filp an image and adjust the corresponding header % dimension = the image dimension (2 or 3) % input = the input file (should be N4 corrected if using to create a symmetric template) % output_pat...
910a39e3a5fdf7f7386c5c9a664aaa9e54dcc3bc48520d73f244002649fff190
MATLAB
3,604
185
function cls = correction_3D(carta,elec_adj) % busca cluster en cartas de valor p 0 y 1 % carta = [frec x tiempo x electrodo % % % 3.Septiebre.2009 % P.Billeke % warning('Limite rango de frecuencias a analizar para no caer en insufuciencia de memoria'); [yc,xc,zc] = size(carta); if xc == 32%min([yc,xc,zc]) for x ...
0dfc713b28ff24960afe760ab5131edaebcc9b4ec4275bc76c41096e21c8b010
MATLAB
3,605
94
%% Simple/traditional Kalman filter function state = SimpleKF(u, z, params) % This is an implementation of a Kalman filter model for 1-dimensional % state estimate with m-dimensional control input across n time steps. % Prior state estimation (xhat_) is computed based on control input u and % the generative model p...
eea4204e70050a48b616ab78def2aeb4ff1665405f480ab833632c87951ba8b1
MATLAB
3,605
158
function wlPlot_plotEventsAgainstTrialDebug(cfg, evlist, samprate, ... wavelist, figtitle, filelabel) % function wlPlot_plotEventsAgainstTrialDebug(cfg, evlist, samprate, ... % wavelist, figtitle, filelabel) % % This function plots a series of events, showing the reconstructed signal's % waveform against the band-...
3d8012b7da57ad6ee11e34cdbf96925ebd93e5b8f8932f406f472e5898a0c0b0
MATLAB
3,606
56
function [results,prams]=CBIG_gwMRF_build_data_and_perform_clustering(input_fullpaths,output_path,start_idx,end_idx,num_left_cluster,num_right_cluster,smoothcost,num_iterations,num_runs,start_gamma,exponential) % This function reads in the data, computes the multiplication matrix and performs the clustering % ...
c6474846db21dc699cd0110be35c806d9d5b7746fcbf8aac8c4f3678418ce4d9
MATLAB
3,606
95
function HillOutput = Hill(x,y,noParam,maximum,slope,halfActiv,intercept); % Fits data (x and y) using a Hill function. The Hill function is % either a 3- or 4-parameter Hill function. The 3-parameter Hill % function is of the form: % (maximum*xData^slope) / (halfActiv^slope + xDa...
1c349610e12e48a2e2238036f4c224b9ecf602fddd44ff010daaa11725fc9294
MATLAB
3,607
138
%% PCA Image Demo % Based on code by Mark Girolami, but uses eig instead of svd to save memory %% % This file is from pmtk3.googlecode.com setSeed(0); if 0 loadData('mnistAll'); % mnist structure %train_images: [28x28x60000 uint8] 0 to 255 % test_images: [28x28x10000 uint8] % train_labels: [60000x1 uint8...
82e09c590c63e48d387f154d1fc65c2f0a8fb660b9a863899e33ae992167a9ea
MATLAB
3,607
115
function [D,P] = dijkstra(A,s,t) %DIJK Shortest paths from nodes 's' to nodes 't' using Dijkstra algorithm. % [D,p] = dijk(A,s,t) % A = n x n node-node weighted adjacency matrix of arc lengths % (Note: A(i,j) = 0 => Arc (i,j) does not exist; % A(i,j) = NaN => Arc (i,j) exists with 0 weight)...
ca52295f56e829c6d442c58d52bc622a8e21e360b74406d5cc6a32e66199a6bb
MATLAB
3,607
127
%% Variational bayes for univariate Gaussian % %% % This file is from pmtk3.googlecode.com function unigaussVbDemo() % PMTKauthor Robert Tseng % PMTKmodified Kevin Murphy %% Make data with mean 0 and unit variance setSeed(0); N = 10; D = 1; data = rand(N, D); data = standardizeCols(data); m = mean(data); s = sum(dat...
5fce1cb505d1b199e78591dce64139368b8cc89b746de810ca99d6a007656614
MATLAB
3,608
119
function [clustLabel, varType] = dbscan(x, MinPts, Eps) %#codegen % DBSCAN computes the clustering for a dataset using the dbscan algorithm % % Input: % x - data matrix (rows observations, columns variables) % MinPts - minimum number of neighbors to define a core point % Eps - range of the neighborhoo...
75bdb625c887c5be711400ba6e3956c4f69b7022bf5af183adca10eb2870ede2
MATLAB
3,608
126
function output = memtic(action, counter) % MEMTIC start a MATLAB memory recorder % % MEMTIC and MEMTOC functions work together to measure memory usage. % MEMTIC, by itself, saves the current memory footprint that MEMTOC % uses later to measure the memory that was used between the two. % % Use as % MEMTIC % ...
b2aaf21ef557c1b0f629c81e2b580519ba8c7c70b6138cf4c189e4cf53bbdba5
MATLAB
3,608
108
classdef LabelerGT % GT-related utils for Labeler. Labeler.m is getting very large; nav is % getting difficulty, GH blame breaks etc. This 'friend class' has only % access to public props atm but in future could theoretically use access % specifiers etc. methods (Static) function generateSuggestio...
e40fa4bdf2dddcace112e407a9066e9836560ee2f7d0fe094c85f6f21ee05c11
MATLAB
3,608
86
function [] = plotTime2PeakComparisons(pkLocOn_all,fNum) lims = []; % y limits to set (example: [0 1]) isPaired = 'N'; % equivalent to paired t-test circleSize = 60; % size of scatter plot points barstate = 'off'; % 'On' = bar graph, 'Off' = scatt...
540e74c982b7edf369f697382e224b1f34b1154fcd50da90dbb85bf911d07e46
MATLAB
3,609
135
function Fear_TrialFR(basename,tet2use,unit,session) SR=20000; SR_trk=50; resofs=load([basename '.resofs']); sessionfile = [basename(1:9) '_' num2str(session,'%02.f') '_trkRun.mat']; load(sessionfile,'trk'); whl = trk; res=load([basename '.res.', num2str(tet2use)]); %spike times of all the units in the s...
7ce04b55c10dc53ec3322e543fa315e8108b4cb1ae942bfb56fc64d7e2387510
MATLAB
3,609
133
function draw_figure4BC_S2B(p,encRes) % % This code is for drawing figure 4BC and S2B % % %% settings drawPairs = {... {'category','dimension'} {'category','vision'} {'category','semantic'} }; drawNames = {... {'cat','dim'} {'cat','vis'} {'cat','sem'} }; nSbj = length(p.sbjID); %% dra...
833b1d2283aba7e61028744f373494a85c4f471b2272ae16875b166cc7aa6efc
MATLAB
3,609
116
%% Fit the local CPDs of a lattice mrf given a noisy image and its underlying % discrete labels %% % The model has the following form % y1<- h1 - h2 -> y2 % | | % y3 <- h3 - h4 -> y4 %% % where there are undirected edges between the hidden labels, % arranged in a 2d grid, and each hidden node has a dir...
991c232ea8ed6cbd0dd31214ad256d55b487911ab43e2fc166d717764d48e5bb
MATLAB
3,609
80
% Motion correction according to DeltaX, DeltaY of individual boutons. % BoutonArray(BoutonNumber).DeltaX, .DeltaY contain the deltas for some of % the images. The indices of these images are in DeltaXY_ImageNumbers % (and should be also in BoutonArray(1).DeltaXY_ImageNumbers). % ImageArray_NoStim contains more ima...
231c8eee6e06adf8c2692bd4a6f0eedfc66162302cce096181c822bd8966fba7
MATLAB
3,611
109
%%%% TrihexyTrioAllAnalysis % This contains details on how to replicate the analysis from the paper: % Grogan et al., 2021. Muscarinic receptors mediate motivation via % preparatory neural activity in humans. % Anonymous data are available here (https://osf.io/zuq5c/) % The paths in the scripts given here will need ...
0cdeae03e12597b96a5beae03d39e50392e08358b2d04bc073b57f3a6f9003a0
MATLAB
3,612
126
function meg_runPreproc(sessionDir) % meg_runMEGPreproc.m %% setup % exptDir = '/Volumes/DRIVE1/DATA/rachel/MEG/TADetectDiscrim/MEG'; % exptDir = '/Local/Users/denison/Data/TANoise/MEG'; % exptDir = '/Local/Users/denison/Data/TA2/MEG'; % exptDir = pathToTA2('MEG'); % exptDir = '/Users/kantian/Dropbox/Data/TA2/MEG'; % ...
fe10391ac67a172ee73f5b033b480a9798e25f2a82893f1f5df6019520dc3c71
MATLAB
3,613
106
function [ structout ] = bz_CollapseStruct( structin,dim,combine,NEST ) %structout = CollapseStruct( structin,dim,combine,NEST ) Combines elements in a %structure array % %INPUT % structin struct(N).fields structure array with N elements where each % of the N elements has the same fields and field st...
326930a44d06cbac8334ffe7e455fccc9db4d94b2596af5b1064753513327c3d
MATLAB
3,616
114
classdef StringList < handle % % % %<PRE> % This file is part of dspace-core. % % Copyright (C) 2020 University Zurich, Sepp Kollmorgen % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU Affero General Public License as pub...
7f5920dc919a24e85a7a36c01da9da374dfa8004ad68e53d16cc198c7aa73273
MATLAB
3,617
111
%% pxTools_getMarkovFromXt() % % Estimate first-order Markov transition matrix between subsequent % observations of discrete state, captured as column vectors. % % If multiple independent observations (columns) are used, find average % transition matrix over all points. % % Because script is designed for SDO...
517ba271d2b54421e31b2d0b51dcf1727f6327f78d4f31fc8ea51be6ed48d306
MATLAB
3,619
119
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% wrapper_full_calibration.m -- A wrapper for the calibration runtime. %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function []=wrapper_single_dipole(pat_ix, model, inverse_model, dipole_name) pat_cell ...
42b4b9a85b8f03d31c1eb916229d60fe3d5e9319e88aca1aadb466b5a92a6221
MATLAB
3,621
66
% IntFG_tet4_CPU carries out a spatial convolutions of fields within a FEM % mesh. This function runs on parallel on the CPU threads and is % parallelized over the data pairs undergoing the convolution. % % SYNTAX: % [J_BORN] = IntFG_tet4_CPU(MESH,DATA_1,DATA_2) % [J_BORN] = IntFG_tet4_CPU(MESH,DATA_1,DATA_2,SOUR...
2d9d2d5ff9f5d972e0b0da0d8fcefc968b945c8d2435b8aed85c7da0ea311ae9
MATLAB
3,622
99
% Source-target evaluations on the unit cube, Laplace kernel. % % This example computes the interactions between random source and target points % on the unit cube via the Laplace kernel. The associated matrix is rectangular % and real. % % This demo does the following in order: % % - compress the matrix % - check ...
4540a0a4d231f63c53f45063c5fc9d6551ee1f01359469e00d217b47b1095e59
MATLAB
3,624
81
function y_Call_bet(InputFilename, OutputFilename, Option, WorkingDir) % function y_Call_bet(InputFilename, OutputFilename, Option) % Call FSL's bet under Linux or Mac OS % Call Chris Rorden's revised bet (distributed with MRIcroN) under Windows. ('eval' is not suitable for 'parfor') % Input: % InputFilename - The ...
958fbd83daf34e1b9fd6d2987091086602460cdc0fdd40300e12288e84f9f32b
MATLAB
3,624
118
function Y = ttm(X,V,varargin) %TTM Tensor times matrix. % % Y = TTM(X,A,N) computes the n-mode product of tensor X with a % matrix A; i.e., X x_N A. The integer N specifies the dimension % (or mode) of X along which A should be multiplied. If size(A) = % [J,I], then X must have size(X,N) = I. The result wil...
a428b75b616391291e268a69526ea7f8485e894162fcf8856ffc3abac7c5490d
MATLAB
3,624
102
%% decodeType=1; % typeID={'DecodeTest_corrNM'}; % % cvAccuracy=DataConvert.embCell2mat(Analyze.returnFieldValues(PlotData,typeID{decodeType})); % % FigHandels(1)=plt.fig('units','inches','width',8,'height',8,'font','Arial','fontsize',12); % % imagesc(mean(cvAccuracy,3)) % % plt.vline([.5:5:20.5],{'k...
c9617d9a08e4fe13b95356358f6d0f83ea4dea40bb586dfc977b53d5465176f0
MATLAB
3,624
91
function egrad = getEuclideanGradient(problem, x, storedb, key) % Computes the Euclidean gradient of the cost function at x. % % function egrad = getEuclideanGradient(problem, x) % function egrad = getEuclideanGradient(problem, x, storedb) % function egrad = getEuclideanGradient(problem, x, storedb, key) % % Ret...
0b491b0a6db735344e9774af522b5eb7826f4e63e8a95fa1dee6be496578f58c
MATLAB
3,625
79
classdef SquareTensorPatch < diffgeometry.TensorPatch & diffgeometry.SquareMatPatch % A tensor that is also a square matrix, i.e. something whose % components transform as a tensor but of which we can take determinant % and trace etc. E.g. metric or second fundamental form (curvature) L %-------...
44da3dd936647487434f207adaeaf44cd8cbd5ee56652f2911fedc13cde896da
MATLAB
3,625
120
function ccor_matrix(LAN_var, RT_var, W, maxlag, time_max) % ---%DEPENDENCIAS%--- % - rt_del global LAN; LAN = LAN_var; if nargin < 5 time_max = true; end len = length(W); RT = cell(1,len); for w = 1:len RT{w} = rt_del(RT_var, RT_var.est~=W(w)); if ~time_max RT{w}.OTHER.time_max = zeros(1, length...
21ce62c61fa7f54f7e5331d00e356017f4e76299484266630a5d836a209f2044
MATLAB
3,626
95
% Source-target evaluations on the unit sphere, Helmholtz kernel. % % This is basically the same as MV_SPHERE1 but using the Helmholtz kernel. The % associated matrix is rectangular and complex. % % Inputs (defaults are used if not provided or set empty): % % - M: number of row points (default: M = 16384) % - N: nu...
ae564bd577332dadec1dbc50273d31d9d69108e6d1948af9082b9b54ae97d3e8
MATLAB
3,628
103
%% Fig. 2G. Wave speed across animals clear;clc %sampling rate Fs = 2500; %path to TW results from generalized phase load('D:\InVivo\TravelinWave\GP-Results-Wideband.mat') %% concatenate all wave speeds and times across animals trialWaveTimes = []; allWaveSpeeds = []; allTrialSpeeds = []; y=0; tcount ...
6e20877e904975af3f5041838d640bc565a6d38ac05d31292c7cf15d1fe5a024
MATLAB
3,629
141
%% This code allows complete manual reselection of every corner in the %% images. %% This tool is specifically useful in the case of highly distorted images. %% %% Use it when in standard mode. %% In memory efficient mode, use manual_corner_extraction_no_read.m if ~exist('n_ima'), fprintf(1,'No image data availabl...
45a92eea7c325f5f5e38bdb4b35d4287b612dbaef2e2b9466630685b8b1c0110
MATLAB
3,630
80
function J = rgbConvert( I, colorSpace, useSingle ) % Convert RGB image to other color spaces (highly optimized). % % If colorSpace=='gray' transforms I to grayscale. The output is within % numerical error of Matlab's rgb2gray, except ~10x faster. The output in % this case is hxwx1, and while the input must be hxwx3 fo...
9512b5b35539bca7efe51aa34f2040ea326bd204bbfdc1002804a329887c379b
MATLAB
3,630
101
function [summary] = ft_test_compare(varargin) % FT_TEST_COMPARE % Copyright (C) 2017, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: you can redistribute it and/or modify % it under the terms of the ...
d04c0f810fe8d0d2cbd6ea51fc51e83852658a073aaf5bdc57eb8873cb4eb38a
MATLAB
3,631
117
%%% Scope: Reading preprocessed BOLD-signals, calculating FCs %%% (functional connectivity) %%% Author: Jonas A. Thiele %%% Date: 24.06.2022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Read behavioral data of subjects behavioralData = readtable('families_all_train.csv'); subjec...
3909d0933342d2ee2c17758ad7f56ea15c1e361fe308589b6c523baef6b029af
MATLAB
3,632
73
function [cinterp, P, t, normals, Center, Area, Indicator, percentage] = meshadapt(c, P, t, normals, Area, Indicator, tissue, refinement, alpha) % Adaptive mesh refinement of a composite multicompartment mesh % SNM 2021-2022 charge_face = abs(c).*Area; ...
4e934cdb6d660c957b75acb1819d5b167ed22dce5259bcf489a9a6066fda0d67
MATLAB
3,632
120
function hfig = tightfig(hfig) % tightfig: Alters a figure so that it has the minimum size necessary to % enclose all axes in the figure without excess space around them. % % Note that tightfig will expand the figure to completely encompass all % axes if necessary. If any 3D axes are present which have been zoomed...
f30bd2525edc5a664e51a2f1c9ce99701b64f35d7f7affa462962e0c2753e1a5
MATLAB
3,632
124
function simpletrack(imgVar,trkSetVar,trkSetCol,viewIdx,prmVar,... xyLblVar,resID,rcFile,varargin) % % imgVar: varName of image cell array I to use. mat.(imgVar) has size [NxNvw] % trkSetVar: (optional) varName of set array to use. mat.(trkSetVar) is a logical of size [NxNsplit] % trkSetCol: col index into mat.(trkSe...
f08fcf82b8cdc99f65f4a70096e5c6e3c57dd409f8050752100c8b0244caff84
MATLAB
3,634
78
clear close all clc %% Load atlas % path to MRI template - must include hdr and img files atlas = niftiread('/Users/jstrohl/Documents/20230908 Pipelines for neural data analysis/Dependencies/ATLAS-MICE 2/2011-10-30_MRI-template3.hdr', ... '/Users/jstrohl/Documents/20230908 Pipelines for neural data analysis/D...
6d0ba52c3f921efcbeebdc6eb51d1c42a66e376b6107f6edb4b6f2a1873a23b2
MATLAB
3,635
96
% readbdf() - Loads selected Records of an EDF or BDF File (European Data Format % for Biosignals) into MATLAB % Usage: % >> [DAT,signal] = readedf(EDF_Struct,Records,Mode); % Notes: % Records - List of Records for Loading % Mode - 0 Default % 1 ...
8e20759a2d486a6bc5df3db312c2b134b9ad0c687efbdbcc81996574fdd6a540
MATLAB
3,636
105
function FADE = calc_FADE2_score(SPM_mat, con_vec, ref_pos, ref_neg, do_plot) % _ % Calculate two-sided FADE score for a single subject using reference maps % SPM_mat - filepath to SPM.mat of estimated GLM % con_vec - the memory contrast vector (e.g. [+1 -1 0]) % ref_pos - filename of reference map for p...
a3f76f800a420e6490f58092a0e0db3ca61672a7fca712881acbf105678072e7
MATLAB
3,637
93
function UnitIDs = FindSignificantUnitsAction(TaskLabel,varargin) %FindSignificantUnits Returns list of significant units, by pval [varargin,PThresh]=Utilities.ProcVarargin(varargin,'PThresh',.001); [varargin,Labels]=Utilities.ProcVarargin(varargin,'Labels',{}); [varargin,Labels2Incl]=Utilities.ProcVarargin(varar...
c4fc79af12bcb23ff466773910bcf3c43c312b14062400201b7b8956023fcb9f
MATLAB
3,638
103
%% DF/F uncued % Tot figure [data1,data2] = extract_variables ('dff','dfftot',resultsPath, 'pyr', 'int',conditionType,conditionValue); for recCounter = 1:size(data1,2) data1_mdn(recCounter) = median(data1{recCounter}); data2_mdn(recCounter) = median(data2{recCounter}); end subplot(241) arrange_boxplot(data1_md...
14ac3628da739c6e1f8186555682a8fe5b1551b78f7fd21bdfcc84ffffae354b
MATLAB
3,639
108
function toolboxGenDoc % Generate documentation, must run from dir toolbox. % % 1) Make sure to update and run toolboxUpdateHeader.m % 2) Update history.txt appropriately, including w current version % 3) Update overview.html file with the version/date/link to zip: % edit external/m2html/templates/frame-piotr/overv...
d6a0f2bcd8e9fea116abb9f866dc29a55fae88b46b97496d157f05df3bf745b3
MATLAB
3,639
95
function [EEG,PARAM] = DS_complexDemodulation(EEG,PARAM) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % ComplexDemodulation % % Part of detect_spindles toolbox: % % Authors: Stephane Sockeel, PhD, University of Montreal % Stuart Fogel, PhD, University of Ottawa % T...
741fc938ab83c2d3575766365b6accb7f3003563bba9c8c21300eca7e2eff73e
MATLAB
3,640
120
% [thresh,lower,cost] = onedim2class(x,l,costmatrix,weights,lower) % inputs: % x is the N x 1 matrix of N unidimensional data points % l is the N x 1 matrix of N corresponding labels, where l(i) can % be either -1 or 1 % thresh is the best threshold such that almost everything on one % side of the threshold is of one c...
a9df5b552c91be953dbd1a9fb2f8310524a006413422f127053fea7478ced750
MATLAB
3,640
171
function [a,res_out,k,field_theo]=lm_field_general(astart,f,forwpar,lambda) %[dips,c,res_out,c_theo,a,k,astart]=lm_comp_general(c,forwpar,ndip,xtype,astart) if nargin < 4 lambda=0; end [npar,ndum]=size(astart); astart=reshape(astart,npar*ndum,1); [npar,ndum]=size(astart); if npar==1 astart=astart'; npar=...
9093a366e3fc76aa66fa992de3e0f2d5837720d22dca51cbc08f0c945658db76
MATLAB
3,642
105
function x = VBA_spm_invNcdf(F,u,v) % Inverse Cumulative Distribution Function (CDF) for univariate Normal % FORMAT x = spm_invNcdf(F,u,v) % % F - CDF (lower tail p-value) % u - mean [Defaults to 0] % v - variance (v>0) [Defaults to 1] % x - ordinates of N(u,v) at which CDF F(x)=F %_____________________...
1a225a9f766da8d74d15da880b9e44cb97a1e3793929b21815799bb032ad98e6
MATLAB
3,643
133
function h_setupMenu3(handles, flag) global h_img3 if ~exist('flag', 'var') || isempty(flag) flag = 'upper'; end [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); if strcmpi(flag, 'upper') % Note if making a new GUI menu, set the size to be 330(x) by 151(y) pixels, ...
2f9d17eeae83aa35109d76afaebcc3038e54abbc2c0d77ae84beca36f086e8ff
MATLAB
3,643
100
% registration_SaveRepresentaiveImages.m % Sarah West % 8/25/21 % Loads individual images for differentiating between light channels, then % saves a representaive image for the day. function [] = registration_SaveRepresentativeImages(parameters) % Assign parameters their original names dir_d...