sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1acc49fbc3420f3cc25d035ea0c239332e779d5f1bb2c6cd5a336688d32e3236
MATLAB
1,316
56
function [d,dvar,dprime,h] = makeDprime(trials, goods, all_S,all_SU,all_index,event,sig,varargin) % Inputs % trials: {:,2} cell array of trials for each good neuron % goods: subset of cells you want to use % all S % all SU % all_index % event % varargin: defaults to signed d', add value to make unsigned ...
5f99530e2fbbb142ce36b2a57986d0cc071bf9a29be00c58034b2b083e8fd876
MATLAB
1,316
18
%----------------------------------------------------------------------- % Job saved on 01-Apr-2016 11:17:08 by cfg_util (rev $Rev: 6134 $) % spm SPM - SPM12 (6225) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{2}.spm.stats.fmri_est.spmmat = cfg_dep...
f9c892ec39db8c60f925f8fb3d20004695431bb33e0941b12b839e1e486d93ad
MATLAB
1,316
44
function CheckAssemblies( filenameCLUSTERS ) %CHECKASSEMBLIES( filenameCLUSTERS ) % % % === Jan Moelter, The University of Queensland, 2017 =================== % if( exist( filenameCLUSTERS , 'file' ) == 2 ) CLUSTERS_mat = load( filenameCLUSTERS ); [ ~ , filenameCLUSTERS_name , ~ ] = fileparts( fil...
047ba2dbb6134526ac57636be60aec56b7b630fd5788f4bc0de416fa98fa3749
MATLAB
1,317
39
function y = vl_nnconcat(inputs, dim, dzdy, varargin) %VL_NNCONCAT CNN concatenate multiple inputs. % Y = VL_NNCONCAT(INPUTS, DIM) concatenates the inputs in the cell % array INPUTS along dimension DIM generating an output Y. % % DZDINPUTS = VL_NNCONCAT(INPUTS, DIM, DZDY) computes the derivatives % of the block pro...
19746eb3e1401b4f290046eca56de8921ceb6a2a8ac23a00d0961ca24cc0fd5f
MATLAB
1,317
33
function preprocess_nsd_structuralinspection(subjix) % function preprocess_nsd_structuralinspection(subjix) % % <subjix> is 1-8 % % write out some orthMID inspections of the T1, T2, EPI, SWI, TOF, DWI. % setup nsdsetup; outputdir = sprintf('%s/ppdata/%s-structurals',nsddir,allnsdids{subjix}); outputdir2 = sprintf('%...
c96904848675a8be5709d67854b9857dc0fb013c56eae399b19dc1cc7c28d714
MATLAB
1,317
41
function varargout = tapas_physio_run_unit_tests() % Executes all existing unit tests of PhysIO Toolbox % NOTE: Unit tests are meant to test small, but critical nuclei of the % code, such as numerical routines (convolution, PCA...) % For more complex workflows (e.g. whole example scripts), use % integ...
ee3fde245d2e564f1b7438335a94a9ba1e8b58fd1345ceb4678f9e95ecbbf928
MATLAB
1,317
52
function [pvec, pstruct] = tapas_hhmm_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Lice...
357c8b1ceb2cbf03d09a84ddef32a2ff3e5ada650d9b6a267057146afadbb495
MATLAB
1,318
45
function nmri_write_dataset(fname, data, subject) %nmri_write_dataset(fname, data, subject) % Function to write a dataset to disk as .mat file % we also generate some "smart" separate structs for fast access % and deal with synchonising subject and data struct % % fname = filename % data = fieldtrip data structure % s...
b3059e3b08a42f126f7b1405c96c3676230c98e9b8ff1179d2136ed711efa31b
MATLAB
1,318
30
%{ # general data about mesoscope scans -> experiment.Scan -> meso.Version --- nfields : tinyint # number of fields nchannels : tinyint # number of channels nframes : int # number of recorded ...
b57504d5692ba196265d9208de21d2aa901b4a17234537c3d584893c596c2d81
MATLAB
1,318
49
function clear(obj) % Recursively sets all non-MrCopyData-objects to empty([]) % to clear default values % % Y = MrCopyData() % Y.clear(inputs) % % This is a method of class MrCopyData. % % IN % % OUT % % EXAMPLE % clear % % See also MrCopyData % Author: Saskia Bollmann & Lars Kasper % Created: 2016-04-19 %...
c10c9c45b35660d9e317d82aa7850113b964bc461cd78a0428e9c7acaabef878
MATLAB
1,318
65
%% TE = readTEfromJSON(filenames) % % Input % -------------- % filenames : json file fullname(s) % % Output % -------------- % TE : echo times % % Description: % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 13 June 2018 % Date last modified: % % function [TE] = readTE_dcm2niix_JSON(fil...
ad22a341d1ee80c0477e54d682e40ecc4db479e8248800a26904464560095acb
MATLAB
1,319
54
function [umxSignal,umxReference]=runFastICA(source,reference) options.savePath=[]; options.figName= '_runFastICA'; options.plotFigure=true; % Make sure M is a row matrix if iscolumn(source) && iscolumn(reference) M=double([source reference]); else M=double([source' reference']); end % run fastICA [icasig, ~...
8f26c2c136a622bcb5a6ed1fcca0394dd0318a15f4cf5490cdde8f6765f413fe
MATLAB
1,320
45
function plot2axes_paraTimes(paraTimes, clrs, fillBand) % plots into current axes vertical bands of paradigm times (RT, ...) % paraTimes = 3D: clz x responseType x "channels" (or repetitions - channels in AA) % clrs = colors % if fillBand = 1, plots band = mean +/- SEM (over repetitions) % if fillBand = 0, plots verti...
9d7039c662b351427c190ee33009b4c878cc82130208b98f9687006f39629bde
MATLAB
1,321
50
function D=sim2dis(S) %function D=sim2dis(S); % %PURPOSE % %To transform elements of a similarity matrix S into %dissimilarities D by D=1-S. % %INPUT % %S (matrix) MxM similarity matrix whose elements must be in [-1,1], % for example, absolute values of linear correlation coefficients. % %OUTPUT % % D (matrix) MxM...
a0421ab8f3f23a119327fe2a9e9d5732758c045ae39e66b86f0d50c3480560e2
MATLAB
1,321
50
function Out=svm_train(J,sFiles,img_dil,ind) % INPUT: % J: number of training subjects % sFiles: a string variable with a list of name for the similarity data of % all the training samples % img_dil: 3-D image (matrix) comprises region of interest and its uncertainty zone % ind: index of all subcortical voxels ...
5df81b984aa4018b3025762157a42c542ec7c57f0cdf5feb1fba6b444ca9721d
MATLAB
1,322
43
function [dat, lab] = read_bham(filename) % READ_BHAM reads the EEG data files as recorded by Praamstra in Birmingham % the datafiles are in a particular ascii format % % [dat, lab] = read_bham(filename) % Copyright (C) 2000, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org %...
0c1c5477dbbb2573584498f6ad6d8aca1cdd8fd4cf623fc8c716ebb798cd0f58
MATLAB
1,323
37
function varargout = covRQard(varargin) % Wrapper for Rational Quadratic covariance function covRQ.m. % % Rational Quadratic covariance function with Automatic Relevance Determination % (ARD) distance measure. The covariance function is parameterized as: % % k(x,z) = sf^2 * [1 + (x-z)'*inv(P)*(x-z)/(2*alpha)]^(-alpha)...
8f82caa9ac28c0096d03e26757d5e7c0f3bab29c875249ec8665994f630fc849
MATLAB
1,323
49
classdef Sum < dagnn.ElementWise %SUM DagNN sum layer % The SUM layer takes the sum of all its inputs and store the result % as its only output. properties (Transient) numInputs end methods function outputs = forward(obj, inputs, params) obj.numInputs = numel(inputs) ; outputs{1} =...
a58da87bc572ea41b1d38e7b76c8f78d2c37d2530794cfd0b89068ead1895de0
MATLAB
1,323
27
%% Working with events eeglab_path = fileparts(which('eeglab.m')); % get EEGLAB path [ALLEEG EEG CURRENTSET ALLCOM] = eeglab; % start EEGLAB pop_editoptions( 'option_storedisk', 0); % Change option to process multiple datasets EEG = pop_loadset( 'eeglab_data.set', fullfile(eeglab_path, 'sample_data')); % load data %% ...
1c6b88461f5788a8caa0284506cf8b57169a854ea846a738329e07bcf056a52e
MATLAB
1,324
42
%% processes matched_frames_aligned to provide a data structure used for model training % Note that the model data files require marker label data, which we will % just set to NaN here. clear all; close all; % paths to matched frames dirname = 'Recording_day7_cafftwo_nopedestal'; basedir = ['.' filesep dirname filesep]...
020ae63a50dcce38115c8c67a5d489ba7d7740ba955428a4a20421c9683c4859
MATLAB
1,325
51
function cellvec = createCellVector(meshvar, cellval) % this function creates a vector field based on the geometry and mesh % size. For instance it can be used to create a gravity field. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % cellBoundary % Copyright (c) 2012-2016 Ali Akbar E...
58f65c518e9061daebed003a65626caf0b5cd9e3c8a28c83e99bf5426ddcde2e
MATLAB
1,325
42
function mat2ades(dat, fileName, Fs, chanlabel, chanunit, dattype, datunit) % write in the current folder ADES and DAT files from matrix in MATLAB workspace % data = matrix of data (nbchannel * time points) - the data have to be in microVolt % fileName = string of the output files without extension ; the ades and dat ...
8d89835eb79b3705b15eb0a78e2a41d6d661787cf1258cdd8beec5ed93a9d09b
MATLAB
1,326
33
function [encoderNet, decoderNet, options, ClusteringData, clustAssign] = create_VAE_model(handles) options.imageSize = [128, 128, 1]; % Creates fixed frequency spectrograms [ClusteringData, clustAssign, options.freqRange, options.maxDuration, options.spectrogram] = CreateClusteringData(handles, 'scale_duration', tru...
f8c0c9a6b8c2d37568c41a5748a86c4b519cd793b2c11765d5ec6cff18a1f45a
MATLAB
1,326
49
classdef Sum < dagnn_bc.ElementWise %SUM DagNN sum layer % The SUM layer takes the sum of all its inputs and store the result % as its only output. properties (Transient) numInputs end methods function outputs = forward(obj, inputs, params) obj.numInputs = numel(inputs) ; outputs{1...
8e44c3c0f89d11d5687b99dbc42e468766532d0da2548378b10781bf9ddbda9b
MATLAB
1,327
47
function getTriggers_carGame_rewsObst(params) % determines & saves trigger times and class labels % (c) Jiri, May16 display('triggering on rewards / obstacles ...'); %% per session: load, get trigger times and assign labels, save for sess = 1:size(params.storage.analyzedSess,2) t_trigger = []; clz_label...
e48eae4521415602bbea2749ea5699db4cfe50d182f584af8b52a10c50314a6a
MATLAB
1,327
53
function [GrpInfo, GrpNames] = GroupingInfo(spikeDetectedData) % this function allows user to input information about groups/categories for the data cd(spikeDetectedData) GrpInfo = []; %% how many types of groupings? GrpNum = inputdlg({'How many group/category types? For example, if categories are age a...
d0d587387f45e46be4b1e8a3b60b62af65bdb46fa9f740c01e1004d0a77c1566
MATLAB
1,328
48
function LCMparam = osp_editControlParameters(LCMparam, key, value) %% LCMparam = osp_editControlParameters(LCMparam, key, value) % This function edits a set of control parameters saved as a struct. % % If the assigned value is '', the key is being removed. % % For now, this is relatively unsophisticated, i.e. th...
0399075844bbe408a197c8bcdae536d0bffc5638e712218ff0377ef42c2b8e32
MATLAB
1,329
41
function update_from_affine_matrix(this, ... affineMatrix) % Updates properties of MrImageGeometry from affine 4x4 transformation % matrix % % Y = MrImageGeometry() % Y.update_from_affine_matrix(affineMatrix) % % This is a method of class MrImageGeometry. % % IN % % OUT % % EXAMPLE % update_from_affine_matrix...
00a7128fa61c88968d53fd4c06d9ad397a613f600405af15e768ec61253681f8
MATLAB
1,330
59
% op_leftshift.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_leftshift(in,ls); % % DESCRIPTION: % Remove leading datapoints from the fid to get rid of 1st order phase % errors. % % INPUTS: % in = input data in matlab strucure format. % ls = number of points to remove from the beginning of the f...
50187ccc7decc01381ff343a8d75fd3032a7b46d4e6fa23f0230aace7324f274
MATLAB
1,330
55
load(...) % load TF maps addpath('slanCM') cmap = slanCM('haline',100) frex = logspace(log10(0.01),log10(5),50); srate=; figure; subplot(141) contourf([1:size(powa,2)]./srate,frex,powa,100,'LineColor','none') ;set(gca,'YScale','log');colorbar; caxis([0 .2*10^(-9)]) subplot(142) contourf([1:size(pown1,2)]./srate,frex,...
79045011d775a284f9bb176a0c7f411c054adfcb4c07b3e53a207888ca653e1d
MATLAB
1,330
32
% define dirs = {'func1mm' 'func1pt8mm'}; res = {[1 1 1] [1.8 1.8 1.8]}; trs = [1 4/3]; % do it for dd=1:length(dirs) for subjix=1:8 % define file0 = sprintf('%s/ppdata/subj%02d/%s/mean.nii.gz',nsddatadir,subjix,dirs{dd}); file0b = sprintf('%s/ppdata/subj%02d/%s/aseg.nii.gz',nsddatadir,subjix,dirs{dd})...
eb3ef5a102fcb17a83146d76052d3e66c7b793edfacb1112f78107f131186f9f
MATLAB
1,330
51
function brewermap_plot() % Simple plot of all ColorBrewer colorscheme nodes in one figure. % % (c) 2014-2020 Stephen Cobeldick % %%% Syntax: % brewermap_plot() % % See also BREWERMAP CUBEHELIX LBMAP PARULA LINES RGBPLOT COLORMAP COLORBAR PLOT PLOT3 AXES SET [scm,num,typ] = brewermap('list'); % persistent cbh axh % xm...
23bb47e9b50b11335c778db8480645a3d7cc08200372178263d8aa7d6957c315
MATLAB
1,331
49
%% chi = myQSM(localField,mask,matrixSize,voxelSize,thres,b0dir) % % Description: compute QSM based on threshold-based k-space division (TKD) % Ref : Wharton et al. MRM 63:1292-1304(2010) % % Input % ----- % localField : local field perturbatios % mask : user-defined mask % matrixSize ...
4e8c3599f66cf969f67c3ea69991b61499b034fce513b41d55f92c1c82fe1577
MATLAB
1,331
32
%CustomDefaults - User-defined custom default values for function properties. % % The behavior of most FMAToolbox functions can be modified using optional % property-value pairs, e.g. GetPositions returns position samples in different % coordinate systems depending on the property 'coordinates'. Such properties % u...
6ffdd5e38c7d04adabcfa2dcc748179c676930c04445612fb51df1b27e72f267
MATLAB
1,331
54
function [scaledImage, oldMin, oldMax, newMin, newMax]... = scale(this, varargin) % Scales to image to a given new (intensity) range (i.e. normalization) % % Y = MrImage() % Y.scale(newRange) % % This is a method of class MrImage. % % IN % newRange defines the new intensity range % defa...
e33b9106813b78ea1903324cec22e41750e382ddd7132c8cddb9e098faf4d33f
MATLAB
1,331
38
function [tf_idf_Rasterbin] = Ras_tf_idf(Rasterbin) % TF-IDF normalization % INPUT: % Rasterbin: N-by-T spike matrix with only significant frames % OUTPUT: % tf-idf_Rasterbin: continuous matrix after tf-idf normalization % % The goal is to normalize the S_index array in such a way % that it is only necessary ...
1b3e1b9d98cbf2702fda41578c0b8c689be4e366bd62ce60e49a541d6aa9ffa7
MATLAB
1,332
49
function play( obj, frames,trace_opt ) keys = fetch(obj); for ikey = length( keys ) key = keys(ikey); disp('Playing movie for'); disp(key); tpr = tpReader(Scans(key)); if strcmp(fetch1(Scans(key),'scan_prog'),'MPScan') gChan = getAlignedImagingChannel( tpr, 1 ); rChan = get...
23d66f8f984892f98ff23088e5a54576d414fda2fbd72e42a80da7ee4459ec5a
MATLAB
1,332
41
function [lp,dlp] = priorInvGauss(mu,lam,x) % PRIORINVGAUSS Univariate Inverse Gaussian hyperparameter prior distribution. % % Random sample from the distribution % r = PRIORINVGAUSS (mu, lam) % % Compute log density at location x and first derivative (w.r.t. x) % [lp, dlp] = PRIORINVGAUSS (mu, lam, x) % % ...
c2f885a55199819da60ba00c5198603bc777c108b6495a21c91140e871945fc2
MATLAB
1,332
49
function [hi, lo, mix, p] = wtcurves(A, varargin) %block 1 is test block. %block 2 = high adaptation block. %block 3 = low adaptation block. A.reward = convertreward(A.reward); rvec = 1:5; hi.wt = nan(1, length(rvec)); hi.er = nan(1, length(rvec)); lo.wt = nan(1, length(rvec)); lo.er = nan(1, length(rvec)); mix.wt ...
f212b29aeab52f635fc84f0bfb2786c01d5d553932518040002ecd6c1854fe1a
MATLAB
1,332
53
function [b, er] = regress_latency_vs_delay(A, nback, z_arg, mixedblock) if nargin<4 mixedblock = 0; % use all blocks by default end % filter outliers using all trials, not just the subset given L = A.ITI; thresh = [1, 99]; cutoff = [prctile(A.ITI,min(thresh)), prctile(A.ITI,max(thresh))]; fprintf('ITI filtered a...
933931206e107e10a8583a4517a168cbc4c08d5196e040bc52c263fc7aafbc59
MATLAB
1,333
37
function varargout = hlp_getresult(idx,f,varargin) % Returns the Result-Idx's output of the function, given the supplied arguments. % Results... = hlp_getresult(Result-Idx, Function, Arguments...) % % In: % Result-Idx : index of the result (output) of the given function application; can also % be a ve...
cc6272653deeeb5d153aa5a45dfa5a25296969049a2f4399a6ee91ccb5dcadb0
MATLAB
1,333
30
function [ensmat_in, enscells_in, nens, time_comp] = get_herzog_ens(raster, param) % Gets the activation sequence and core-cells by Herzog's algorithm. % INPUT: % raster: <logical> N-by-T matrix with the raster, where N is the number of total neurons % and T is the number of total frames. % param: [optional] <s...
4ebd1a5cdf526d48bdfaf4234f99cae34c3b26d23cf44e30614c7fbef01384c1
MATLAB
1,334
46
function vec = tangent2vec(M, x, basis, u) % Expands a tangent vector into an orthonormal basis in the Manopt framework % % vec = tangent2vec(M, x, basis, u) % % The inverse operation is lincomb (see below). % % M is a Manopt manifold structure obtained from a factory. % x is a point on the manifold M. % basis is a cel...
eed43e633851b2a43ba81961e243606740cb1ade57db962cabdac67376fec712
MATLAB
1,334
30
function [spikecountAve, spikecountraw, SCvar] = ... MovieSpikecount(spiketrain, goodcell, imgPara, stimInd, StimTimeIndv,... SpikeCount_Twindow, IgnoreTimeWindow) StimNum = imgPara.stim_time/StimTimeIndv; SpikeCountbin = SpikeCount_Twindow/0.001; spikecountAve = []; spikecountraw = []; SCvar = []; for n = 1:le...
46b8b087408318faf9ab70769f602493808393ae44f6bcc998a2994a85a9e5d8
MATLAB
1,335
37
function [logp, yhat, res] = tapas_gaussian_obs(r, infStates, ptrans) % Calculates the log-probability of response y under the Gaussian noise model % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This ...
4b161e30d9d6fab3eac91311e22a2dc4944727cb366142051ce5b049c589ca3d
MATLAB
1,335
51
function facevar = createFaceVariable(meshvar, faceval) % this function creates a face variable based on the geometry and mesh % size. For instance it can be used to create a gravity field. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See...
0c33e5edceb05af41c055620cd016e5f3b56b04d7ea011adc25fb0e52bc0c30f
MATLAB
1,336
48
function [log2FC, y, txt1, txt2, txt3, stagescompared, stageslfc] =... volcanoplot(MS, comparison, direction) %input: comparison = 1 for diestrus vs proestrus %3 for diestrus vs estrus if comparison == 1 stagescompared = 'Diestrus vs. Proestrus'; stageslfc = 'Diestrus/Proestrus'; tx...
16701419df8a8f34848c6b6131dcfad6047222769f114bd2b5ac81d82853335f
MATLAB
1,336
62
function[Xopt, Y] = testsimplexmatrices() clear all; rng(103) n = 10; k = 5; Y = zeros(n,n,k); for kk = 1:k Y(:,:,kk) = randn(n,n); Y(:,:,kk) = 0.5*(Y(:,:,kk) + (Y(:,:,kk))'); % Y(:,:,kk) = sparse(diag(diag(Y(:,:,kk)'*Y(:,:,kk)))); % Y(:,:,kk) = sparse(((Y(:,:,kk)'...
a11093fb18b293d228a2469bf7e567c503158e1b5e698785bddc966b27a74de0
MATLAB
1,336
51
%% [lambda,magn,tol,maxiter,Kernel_Sizes]=parse_varargin_SSQSM(arg) % % Description: parser for qsmFANSI.m % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 6 September 2017 % Date last modified: 26 September 2017 % function [lambda,magn,tol,maxiter,Kernel_Sizes,b0dir]=parse_varargin_SSQSM(arg) % functi...
a616684af7a836d733aef4ed0c52abecaa40e9a30ac5cdf8301ff2094afebf60
MATLAB
1,337
36
function indC = tapas_physio_check_get_xcon_index(SPM, cname) % returns index of contrasts in SPM.xCon, whose name matches cname % used to find existing contrasts in an SPM.mat % % INPUT: % SPM - SPM.mat-file % cname - name of contrast to be searched for (string) % (works for incomplete names/patt...
acfa78ef5fac639c97bec4c760a9b2a5290da8c96e0b6222bada8dead7a25703
MATLAB
1,337
50
function y = centroid(M, x) % Attempts the computation of a centroid of a set of points on a manifold. % % function y = centroid(M, x) % % M is a structure representing a manifold. % x is a cell of points on that manifold. % This file is part of Manopt: www.manopt.org. % Original author: Nicolas Boumal, Dec. 30, 2012...
d6028a01013ab1abfdc958b89152e87351f46319844fb027e1d3b78869914277
MATLAB
1,337
33
function[] = osp_WriteBIDsTable(Table,OutLoc) %% function[] = WriteBIDsTable(Table,OutLoc) % Function for writing BIDs compliant tables. % % USAGE: % WriteBIDsTable(Table,OutLoc,JSON) % % INPUTS: % Table = Matlab table structure, including json fields in % table properties % ...
dc0384cfa2ce543b31f93027f4c79b670e432957dd37ce8afd46bf00ac028d3a
MATLAB
1,337
60
function [outputArg1,outputArg2] = PlotSubjectRMSError_All(sn, TitleStr, lp_Color, hp_Color, bb_Color) if ~exist('TitleStr','var') % title parameter does not exist, so default it to something TitleStr = ' '; end % --- RGB vector for grey grey = 0.75*[1 1 1]; % --- means & standard deviation per azimuth ...
0647a1f9a024e8fbc0b25c24435e803317266cdbb69f1a2edce53c9c1a2b5cdc
MATLAB
1,338
44
function X=parallelize(X,c) %function X=parallelize(X,c) % %PURPOSE % %To multiply the columns of X by 1 or -1 as necessary so that the %dot-products of column vectors of X are all positive (or zero) %with respect to a reference vector c. % %INPUT % % X (matrix) of size dxN of N d dimensional vectors % c (vector) ...
14b50c26eeb95f5878bdadd7a889851ddd36e9dcb8dd213469f605382f1cb214
MATLAB
1,338
50
function y = linspaceVector(start,stop,n) %linspaceVector - Produce linearly spaced vector with multiple [start stop] points. % % Shorthand for a loop calling the colon operator for each [start stop] pair: % % y = []; % for i = 1 : length(start) % y = [y;(start(i):n(i):stop(i)).']; % end % % USAGE % % y = lin...
4ced76c35e72bff297777e0508e701e0aa76f37fc8febccb1152ca6053f71bf4
MATLAB
1,338
43
function test_suite = test_setDirections %#ok<*STOUT> % (C) Copyright 2021 CPP visual motion localizer developers try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> catch % no problem; early Matlab versions can use initTestSuite fine ...
a02b742f687048062900089a2348e5bf5c28d7c34920172ea2e3b3231ccf4a4d
MATLAB
1,339
42
function [w, state] = adadelta(w, state, grad, opts, ~) %ADADELTA % Example AdaDelta solver, for use with CNN_TRAIN and CNN_TRAIN_DAG. % % AdaDelta sets its own learning rate, so any learning rate set in the % options of CNN_TRAIN and CNN_TRAIN_DAG will be ignored. % % If called without any input argument, retu...
c43b94fccaed0897b67240a1281cef4a0acf24c5bfcd6b9869d480a09386fa0d
MATLAB
1,339
34
function [range, poly] = identify_linear_piece(x, y, window_length) % Identify a segment of the curve (x, y) that appears to be linear. % % function [range poly] = identify_linear_piece(x, y, window_length) % % This function attempts to identify a contiguous segment of the curve % defined by the vectors x and y that ap...
14110b1debd46d39c81081f4f2e7cb2c32a0122e0c106c0a1a3b8a5e6576ab80
MATLAB
1,340
59
% this is subj08 bet MRAangiogramDATECENSORED_121153TOF3Dmultislabs037a1001.nii.gz angio.nii.gz -f 0.25 cd ~/Dropbox/KKTEMP %a = load_untouch_nii(gunziptemp('MRAangiogramDATECENSORED_121153TOF3Dmultislabs037a1001.nii.gz')); a = load_untouch_nii(gunziptemp('angio.nii.gz')); a = double(a.img); skip = 3; skip = 1; [x...
1dadde97ee81b848005535a54ae31f265482991ceef0b1e2e665c4cb084d06d9
MATLAB
1,340
47
function [ match ] = nmri_match_structs( input, filters ) %function [ match ] = nmri_match_structs( input, filters ) % will check if a struct (e.g. subject) matches with filter, allows to % recurse items=fieldnames(filters); match=true; for i=1:length(items) if match && isfield(input,items{i}) % we have it, so...
60ff8cc60efa2a09b079f892c6f4cb53bf096a86938f135b20b9a9347241620f
MATLAB
1,341
45
function [output_file]=Load_CSV_from_blender(csv_file, data_file, START_TIME, END_TIME) % Once the blender output (the traced lines) are exported into .csv files, % below involves importing the .csv files back into matlab, % splicing the traces together, and calibrating the curves to fit the channels. addpath(fullf...
a9ef171301449fba2a0994f3fc6c7bcbb868f04ee3871d3b76f065fcf5b078d1
MATLAB
1,341
32
% Input/output functions (including batch handling) for FMAToolbox. % % NOTE % % Although individual data files can be handled by these 'low-level' functions, % it is generally easier to use <a href="matlab:help SetCurrentSession">SetCurrentSession</a> and related <a href="matlab:help Data">Get...</a> functions % ...
e3b639b7bde40bfb651c2d38dc98ad85283fb7383bb463cc4e59a0637228faca
MATLAB
1,341
39
function notDefined = ieNotDefined( varString ) % % notDefined = ieNotDefined( varString ) % % Author: ImagEval % Purpose: % Determine if a variable is defined in the calling function's workspace. % A variable is defined if (a) it exists and (b) it is not empty. % % notDefined: 1 (true) if the variable is not defined ...
b2c602cb71c0187d66862162a5f422c981151eb834f8c1cdb7df69d3abca0a86
MATLAB
1,342
31
function [pvec, pstruct] = tapas_hgf_ar1_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Publi...
3a7b74d22f42df5451c033e6e18d8fea09d7813b4d1397e7ef9d30bcfe5e5656
MATLAB
1,343
39
%% Constants startTime = [-31000, -21000, -11000, -7000 : 1000 : -1000]; endTime = startTime + 2000; timewindows = [startTime', endTime']; numDataset = size(timewindows, 1); basepath = 'D:\Data\Lobster\Lobster_Recording-200319-161008\Data'; filelist = dir(basepath); workingfile = regexp({filelist.name},'#\S*','match'...
752b9a8b6074e718dafd591ef6eab40c806c9177bf08e850e0cb0578d9e678c0
MATLAB
1,343
42
function [y_sum,y_mean] = tapas_logsumexp(x) %% ------------------------------------------------------------------------------------------- % [y_sum,y_mean] = tapas_logsumexp(x) takes the values in x, exponates % them, then takes the sum over the column, and finally applies the natural logarithm. % The calculation us...
1fcff73a986950960930cbbfdfbe4e132fc3ba78a089bcad9c0f6b2dea5d5bbf
MATLAB
1,345
46
%% get_set_bfr_lbv(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid % ...
592c629d0d06657c5f5c2c4e6e3b07663c967e17ead4ee9d150208ebc226d132
MATLAB
1,345
48
function [indic, nms, condf] = string2indicator(str,varargin) %[indic, nms, condf] = string2indicator(str,varargin) % % Takes a cell vector of string labels and returns an indicator matrix % Optional argument is a cell vector of strings for which values to match. % % Examples: %[indic,nms] = string2indicator(CL{1}(1)....
8fd26ac68cc814c2621fc99678d5c4b3d92e1c63ce424b885d3be6717ba41dc4
MATLAB
1,345
47
function [lar_out] = lar_statistic(hsi_img,tgt_sig,bin_img,bg_ems) % %function [lar_out] = lar_statistic(hsi_img,tgt_sig,bin_img,bg_ems) % % Least Angle Regression Statistic % % inputs: % hsi_image - n_row x n_col x n_band hyperspectral image % tgt_sig - target signature (n_band x 1 - column vector) % bin_img - bin...
17a6776c622083f2cc89f61594980615309df9595c043f34f70d2774547d4e83
MATLAB
1,346
39
function [Mdl] = run_LogReg(params) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % run_LogReg returns Mdl structure including function handles of fit, % predict and score functions for logistic regression. % % Arguments: % params: Structure including following hyperparameters: % lam...
6ad5c6dd56152b4ee1fc1294caa3296c7661fdf4a43da07086f6df789f76d288
MATLAB
1,346
39
function [Mdl] = run_LinReg(params) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % run_LinReg returns Mdl structure including function handles of fit, % predict and score functions for linear regression. % % Arguments: % params: Structure including following hyperparameters: % lambd...
9bf3231203afa41183d4c89a12d35bd8a553c3c52ba6a9e851eb87235175beb1
MATLAB
1,346
31
function [pvec, pstruct] = tapas_hgf_ar1_mab_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General P...
c1af58611d6d6919d538d41f9d003b9bd03eb5c46c66094e9576a4b41ba02f15
MATLAB
1,346
59
function openedge=surfedge(f,varargin) % % openedge=surfedge(f) % % find the edge of an open surface or surface of a volume % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2007/11/21 % % input: % f: input, surface face element list, dimension (be,3) % % output: % openedge: list of edges of the specifie...
36e1adbfe5dfa11cfa84fc24f87a7315be973b088ee70d9c7eaff5685c4aa6a0
MATLAB
1,347
47
%% get_set_bfr_lbv(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid % ...
6d6c77baa5a014899c0bcd9cf709fc3ce743eb7d74f3cd4aa98b3ceee4911a09
MATLAB
1,347
42
function varargout = tapas_physio_run_integration_tests() % Executes all existing integration tests of PhysIO Toolbox % NOTE: Integration tests are meant to check complex workflows, e.g., whole % example scripts % For smaller, but critical nuclei of the code, such as numerical % routines (convolution,...
c5fb9406df954b69d01632ba81103670186c097be299c4854cd5878c59e42a30
MATLAB
1,347
58
function [ctmf_out,cluster_img] = ctmf_detector(hsi_img,tgt_sig,n_cluster) % %function [ctmf_out,cluster_img] = ctmf_detector(hsi_img,tgt_sig,n_cluster) % % Clutter Tuned Matched Filter (ctmf) % k-means cluster all spectra, make a matched filter for each cluster % % inputs: % hsi_image - n_row x n_col x n_band hypers...
110ffbb186c04b1205fbee923d2d58025f2fa04ab06898ef6de0315b4c36c485
MATLAB
1,348
25
function data = BIS(data) %data = BIS(data) %This function combines RTs and PC into a combined measure termed 'Balanced %Integration Score' (Liesefeld, Fu, & Zimmer, 2015, JEP:LMC, 41, 1140-1151; %Liesefeld & Janczyk, in press) %the input data contains the field 'rt' and 'pc' %the function calculates BIS ...
62f8b6aed5ed9cc64a75011b0ec817b7d1da35245544613bc867e3661016f34d
MATLAB
1,348
57
clear all close all clc %% add functions to path addpath('../fcn/'); %% load data load data/structural_connectivity.mat load data/coordinates.mat load data/brain_states.mat %% rescale sc matrix a = sc; a = a/eigs(a,1); a = a - eye(length(a)); %% define input matrices % beta controls the decay rate beta = 0.15; n = ...
fedc2085de8587f4e833af74c6b1a452f4c881d94cb29add8f4d7727355f016c
MATLAB
1,348
77
function [err,CondNum] = CompCondNum (N_tasks, N_basis, Task, N_TR, polort) % % [err,] = CondNum () % %Purpose: % % % %Input Parameters: % % % %Output Parameters: % err : 0 No Problem % : 1 Problems % % % %Key Terms: % %More Info : % % % % % Author : Gang Chen % Date : Wed Aug 20 15:46:08 EDT 2003 % ...
493390cc33557ffe51c9c273dc5033c7bca9b15ff7fd06ff00c66a16f06dd352
MATLAB
1,349
81
%% === compare timings for CHOL R = 20; % number of repeats (to increase accuracy) nn = 1:1:200; K = length(nn); time = zeros(K,3,R); ops = zeros(K,1); fun = { @(a)mmx('chol',a,[]),... @(a)mmx_MMKL('chol',a,[]),... @(a)mmx_C('chol',a,[]),... @(a)ndfun('chol',a) }; names =...
9cf84bff4defb3ba52a3223ab1566a0e29e97f38586c33dd498133bbee93eddb
MATLAB
1,349
47
function make_contrasts_main() % Figure 3 contrasts identified from SPM.xX.name. %% USER SETTINGS spmMat = 'D:\path\to\MRI_project\firstlevel_model1_public\sub-001\SPM.mat'; spmDir = 'C:\path\to\spm'; addpath(spmDir); spm('Defaults','fMRI'); spm_jobman('initcfg'); load(spmMat,'SPM'); names=SPM.xX.name; n=numel(names...
9d7783fbc8cac4fadb8f4f036b780d190ef7d605ae675a6f62dce0dc621f58e0
MATLAB
1,349
54
function f = fig_make(varargin) % creates figure based on aguments in varargin{1}, ..., varargin{end} % returns its handle 'f' % default (no arguments): full screen figure % usage examples: % f = fig_make('fig_W',18.3, 'fig_H',14); % f = fig_make; % (c) Jiri, Mar20 %% settings: backgroud color (bkgclr) bkgclr = 'w';...
aba9e5cdae53780ce3afece803b70310b94ce405dc8f66404d1708d2b4daa849
MATLAB
1,349
50
function this = save(this) %saves MrSeries in different file formats % % MrSeries = save(MrSeries) % % This is a method of class MrSeries. % % IN % parameters.save.format % % OUT % % EXAMPLE % save % % See also MrSeries % Author: Saskia Klein & Lars Kasper % Created: 2014-07-02 % Copyright (C) 2014 Institut...
1cd2578dedaca494dc86f9d5814850b695293cabf5009dea0bb1d56f206c7786
MATLAB
1,350
55
function h = imshow_phase(f, vs, z, slice, palette) if nargin < 5 palette = 'hsv'; end if ischar(palette) palette = str2func(palette); end if isa(palette, 'function_handle') palette = palette(2^10); end if nargin < 4 slice = 3; end dim = [size(f) 1 1]...
3d8a55ded355fe9db90141b4f996bd36276f6e35b7f5aa419faa1bc4052ffee5
MATLAB
1,350
37
function loadAndFilter(params, dataStruct) % loads & filters data stored in session cache files % required structure 'dataStruct' with fields (ex.): % dataStruct = % D_field: 'tracker' % signalType: 'xVel' % excludedChnls: [] % dataProcessing: {'bp_loPass' 'norm2std'} % saveNa...
90b72c241dc1eb7e01f6b239f54d85faceae3d844d86096f093d2f69151319ac
MATLAB
1,350
45
function params = apply_parameter_changes(params, param_changes) % APPLY_PARAMETER_CHANGES - Apply user-specified parameter modifications % % H1 Line: Modify default parameters with user specifications % % Syntax: % params = apply_parameter_changes(params, param_changes) % % Description: % Updates parameter structu...
0306c44994d6c063350deb53821b7a694b669578ce49a618e9a34bc7172cc9d3
MATLAB
1,351
54
%% Generate Figure 6c clear; clc; set_participant_information % Set hemisphere to analyze hemi = 'lh'; % Change to 'rh' for right hemisphere % Load the pre-processed beta values % Path to change betable = readtable(['/oak/stanford/groups/kalanit/biac2/kgs/projects/babybrains/mri/code/morphology_allparameters/REVIS...
455a3bcb2e610870bc263a5489b8761b7fe7ae9f1f5d40d818249083e6ce15a6
MATLAB
1,351
53
function [rho pval ts] = circ_corrcc(alpha1, alpha2) % % [rho pval ts] = circ_corrcc(alpha1, alpha2) % Circular correlation coefficient for two circular random variables. % % Input: % alpha1 sample of angles in radians % alpha2 sample of angles in radians % % Output: % rho correlation coefficient ...
950141ea0387d69561851a619166f06edd6ccb817be44c3290d23043337ca948
MATLAB
1,351
50
function stdshade_sorting(amatrix, astd, alpha,acolor,F,smth) % usage: stdshading(amatrix,alpha,acolor,F,smth) % plot mean and sem/std coming from a matrix of data, at which each row is an % observation. sem/std is shown as shading. % - acolor defines the used color (default is red) % - F assignes the used x axis (def...
48dcb671b9baef79e9298e5719f760c65c167221793cf0724dd8ea97e73d8da6
MATLAB
1,352
38
function this = undo(this, doDeleteLastStep) % restores previous processing step status of MrSeries, with optional deletion % Y = MrSeries() % Y.undo(doDeleteLastStep) % % This is a method of class MrSeries. % % IN % doDeleteLastStep false - last step is kept for possible restore % true ...
a9d470079c23653cbddac7882973f2efd4ab042652aaa2c4ab9422b294a97ef2
MATLAB
1,352
37
% Please cite this paper if you use any component of this software: % D. Cunefare, L. Fang, R.F. Cooper, A. Dubra, J. Carroll, S. Farsiu, "Open source software for automatic detection of cone photoreceptors in adaptive optics ophthalmoscopy using convolutional neural networks," Scientific Reports, 7, 6620, 2017. % Rele...
eb598fd6fca2e3967f75dfc9e2fafadf105b969e65f0945b56ac991d4ff7c083
MATLAB
1,352
44
function [ Ep ] = tapas_rdcm_empty_par(DCM) % [ Ep ] = tapas_rdcm_empty_par(DCM) % % Creates an empty valid parameter structure for a given DCM % % Input: % DCM - model structure % % Output: % Ep - parameter structure % % -------------------------------------------------------------------...
4a9123549cedcac0d15a3685c519117735d687000cd1b3a9ff9a08bfe811844a
MATLAB
1,353
41
% R2 - Calculate coefficient of determination (R^2) % Computes R^2 between measured and estimated time series. % % Syntax % r2 = R2(measured, estimated) % % Input Arguments % measured - Measured time series [time x 1] % estimated - Estimated time series [time x 1] % % Output Arguments % ...
6c865057167623d6208e64daad39cc72ea28efc97348996b46b4b49a5f8bc94c
MATLAB
1,353
31
function [pvec, pstruct] = tapas_ehgf_ar1_binary_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2020 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU Gener...
99bf6912ebed31734ecd9286f8ec49c7d43ab1cdd38143441b7252cad5144860
MATLAB
1,353
51
function plot_fig4d() tau = 2.5; pcatches = [0.15, 0.2, 0.25]; dt = 0.1; maxT = 30.; % approximately top 99 prctile given our task delay distribution bins = 0.5:dt:maxT; mycolor = {'#BCBEC0', '#6D6E71', '#231F20'}; kappa = 0.1; D = 0.85; R = [5,10,20,40,80]; figure; set(gcf, units='inches', renderer='painters', ... ...
d0115db5420e8a2583ff31f674602fb4cdb7714229cc408521dd0707fe74cb6d
MATLAB
1,353
54
function [m] = read_pulse(fname) % [m] = READ_PULSE(fname) % % Reads a matrix from a file in the binary format written by % write_binary_matrix() in miscmaths (FSL library) % % See also: write_pulse (for binary matrices), load (for ascii matrices) if (nargin<1), disp('??? Error using ==> read_pulse'); disp('Not...
fb73606688422e735e7078c7c96fd495e4e0958adc8513b82341668ed528b1e9
MATLAB
1,353
42
function this = apply_deformation_field(this, fileNameDeformationField, varargin) % Applies a previoulsy estimated deformation field % % Y = MrImage() % deformation_field = MrImage; % Y.apply_deformation_field(deformation_field) % % This is a method of class MrImage. % % IN % MrImage object containing the deforma...
19bd501bc10ea19f04dbac0fc98db1e8e31bc087e0b313321bad3c4653e444c7
MATLAB
1,354
36
function crf = tapas_physio_crf(t) % cardiac response function, as described in % % Chang, Catie, and Gary H. Glover. �Effects of Model-based Physiological % Noise Correction on Default Mode Network Anti-correlations and Correlations.� % NeuroImage 47, no. 4 (October 1, 2009): 1448�1459. doi:10.1016/j.neuroimage.20...
1f678873b296e288ede61adff4b6a9d3fa5d908d266741b27c0b446f9c5d53ab
MATLAB
1,354
54
function varargout = semplotGrouped(x,y,color,smooth,solid) %semplot - plot mean (line) +/- s.e.m. (shaded area) of a matrix "y" % semplot(x,y,color,smooth) % % Copyright (C) 2026 by Ralitsa Todorova % % SEE ALSO shadedErrorBar % % This program is free software; you can redistribute it and/or modify % it under the te...
a118c00cb9841883d3a970dbb8dccd69d9b4c07ca3110db08b211872f128775e
MATLAB
1,354
49
function [ subject, data ] = nmri_redefine_trials( cfg, subject, data ) %[ subject, data ] = nmri_redefine_trials( subject, data ) % Will redefine trials (using fieldtrip) and take care of markings / % vigilance scoring, etc... % % 06/2018 by NF data2=ft_redefinetrial(cfg,data); % now rebuild the trialmarkin...