sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c5344bbb2ebb8af84b1b262a8807f1b996d7bfc9b54fdf8972a0c9b8059140dd
MATLAB
3,184
99
function [urlConnection,errorid,errormsg] = plugin_urlreadwrite(fcn,urlChar) %URLREADWRITE A helper function for URLREAD and URLWRITE. % Adapted by A. Delorme from % Matthew J. Simoneau, June 2005 % Copyright 1984-2011 The MathWorks, Inc. % $Revision: 1.1.6.7 $ $Date: 2011/10/22 22:05:21 $ % Default output a...
f99dce584a186e9d2dae4e4ff885f449801627ee885c26e3d1316e431de23f83
MATLAB
3,184
87
function str = mean2str(m,s,n,varargin) %mean2str - Convert mean or median and SEM (or confidence interval) to string. % % USAGE % % s = mean2str(m,s,n,<options>) % % m mean or median % s standard error (see <a href="matlab:help sem">sem</a> or <a href="matlab:help semedian">semedia...
2227f35ff26f18c629fd2594c67fab8be90487eca7892988fe0b1fd4a07f5e46
MATLAB
3,185
109
function [cost, info, x, A] = test22(n) % Test for the preconditioner support of RCG and RTR. % % % This file is part of Manopt: www.manopt.org. % Original author: Nicolas Boumal, Dec. 30, 2012. % Contributors: % Change log: clc; % reset(RandStream.getDefaultStream); % randnfoo = randn(123456, 1); %#ok...
3f27e3f7ff232cf9e03df65f285d8cf42f34983abbbf7a258f86c523ce6e435d
MATLAB
3,186
88
function task_clean_b(sii, PATH, cfg) % Further clean ICA decomposed data by only rejecting eye and muscle ICs % >.9 % (IClabel default) % with single subject ICA decomposed EEG data PATHIN named file_in % % INPUT % - sii: vector of subject IDs to be processed % - PATH: structure with all paths leading to diff...
7bef68cd3f1d377b3a212f319b5e71a75b7698974249f44afd6af587741bcc8a
MATLAB
3,189
103
function [pval,perlow] = uncertainty_exploratory(all_SU, all_index, all_S) %% christine's version of MLB alignto = {'Rew'}; for m = 1:5 map1{m} = []; map2{m} = []; end ul = .8; % probability for mix block ll = .05; %probability for adapt block params = [1, 1.2, 0.8, .3, 1]; ctr1 = 0; ctr2 = 0; for yy = 1:length...
c1b3ca0b47a770f04e93ed73bc8ed22d6e25474c31455e10d143608b6258793b
MATLAB
3,189
121
function mat2nii(img,file_name,varargin) %Writes an image intensity matrix to an nii file %Input: image matrix in either matrix or vectorized form and nii file name %Optional inputs: image dimensions vector, data precision and reference volume %Image dimensions are required if image matrix is vectorized %Default ...
0dd3b18f8865d4354893ea4c58710627e7181dfb6884fea2d967e34cd3ccc82b
MATLAB
3,190
97
% pop_firpmord() - Estimate Parks-McClellan filter order and weights % % Usage: % >> [m, wtpass, wtstop] = pop_firpmord(f, a); % pop-up window mode % >> [m, wtpass, wtstop] = pop_firpmord(f, a, dev); % >> [m, wtpass, wtstop] = pop_firpmord(f, a, dev, fs); % % Inputs: % f - vector frequency band edges % ...
0415d7d05eb6fd46b07282eadf00cf0454bc21ba6a22aa1e89c4235414381673
MATLAB
3,191
102
sig_time_points = find(true_size_sig_mask(4,:) == 1); for i = 1:length(bc_corrected_pupil); temp_amplitudes = bc_corrected_pupil(i,sig_time_points); mean_amp(i) = mean(temp_amplitudes,'omitnan'); temp_amplitudes = []; end Y = mean_amp'; formula = 'Y ~ 1 + cohMatrix + condition_Matrix +(1|subje...
d94a8c64d10da231161788877a0caf2672e0592777e22467f323736f1dcceb1b
MATLAB
3,191
82
% BIDS_WRITEELECTRODEFILE - write electrodes.tsv and coordsystem.json from single EEG dataset % % Usage: % bids_writeelectrodefile(EEG, fileOut, flagExport) % % Inputs: % 'EEG' - [struct] the EEG structure % 'fileOut' - [string] filepath of the desired output location with file basename % e....
9ce72426bb2f469474caa4211eb1eea4469e6b9be7ecbdc3220bd99635716195
MATLAB
3,193
58
% EEG_HELPHELP - How to use EEGLAB help. % % EEGLAB MENU: % Each EEGLAB menu item calls a Matlab function from the commandline. If this % function pops up a graphic interface window, the figure title usually % contains the name of the function that the window will call. EEGLAB help % files are thus simply the colle...
0694a97ae4f7c758b136a08d1e3848c61168eb2be46401da053cdd4b0195bead
MATLAB
3,194
115
function fh = tapas_physio_plot_retroicor_regressors(R, order, ... hasCardiacData, hasRespData, verbose) % Plots RETROICOR regressors split into cardiac/resp and interaction % % fh = tapas_physio_plot_retroicor_regressors(R, order) % % IN % R [nVolumes, nRegressors] physiological nuisance regressor % ...
281459e8533dd04fcd7eb88849ab5a2cc2a0b1b040bc6f8164c77a92292ee9e9
MATLAB
3,197
109
function [] = PlotFigure1(datadir, codedir) %PlotFigure1 - Plots Figure 1. Must be run after ProcessData_Figure1. % INPUTS: % datadir - Directory where output from ProcessData_Figure1 was saved % codedir - Directory of code (e.g., published/dynamic_learning_rate/) %% Set Path and Load Data s = pathsep; pathStr = ...
8ed7967b9922d30ae3ef3a692fe420e239903cc09efbb53cf5d5e8be6c2b013b
MATLAB
3,197
106
function shuffled = shuffle(x,method) %shuffle Shuffles raster data using various different methods % Shuffles spike data (0 or 1) using three differnt methods % assumes rows are individual cells and columns are time frames % % 'frames' - shuffles the frames in time, maintains activity pattern of % each frame % % 'tim...
54805243c60fab89d1c339b039512bfcb2de9b38bb14cdd614092f5d32644f7b
MATLAB
3,199
83
function distance = Distance(positions,reference,varargin) %Distance - Compute instantaneous distance to a reference point. % % USAGE % % distance = Distance(positions,reference,<options>) % % positions position <a href="matlab:help samples">samples</a> % reference reference point (same coordinates...
8b7b46593fa555adda383e7641ef91c29cf7dbba107ef5d506773f3c3c886935
MATLAB
3,199
106
function [patchHandles textHandles] = hlp_vrect(x, varargin) % Tim Mullen, 2011, SCCN/INC/UCSD g = finputcheck(varargin, ... {'yscale' 'real' [] 1; ... % vertical scaling (relative to ylimits) 'dock' 'string' {'bottom','top','none'} 'top'; ... % whether to 'd...
da8e308ed7a058ec33debdf0596c96f551d1bd7185faf9484e098307c033c2dc
MATLAB
3,199
56
%----------------------------------------------------------------------- % Job saved on 22-Jul-2024 11:54:27 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- %% load libraries, I think run('set_library_paths....
188909a0816d4170aab06142a725be638e6ba8065478904a9741d154b459c438
MATLAB
3,200
74
classdef McsSegmentStream < McsHDF5.McsStream % Holds the contents of a SegmentStream, either spike data or averages % % (c) 2016 by Multi Channel Systems MCS GmbH properties (SetAccess = protected) % (struct) Information about the source channel(s) of the segment. % Same as the McsAnal...
26c6d292458e61b1b98a8908f1ded2739072df352e20e27b98161277d2924292
MATLAB
3,200
103
%% io_writelcmBASIS % This function creates a LCM usable .BASIS file from an Osprey Basisset. % MMs are not included in the output % % % USAGE: % RF=io_writelcmBASIS(in,outfile,vendor,resample); % % INPUT: in = Osprey BASIS file % outfile = path and name of the LCModel .BASIS file ...
fd3d45857729bb9441ecd40f749e4d9ebb8d106200176dfd55de996ea1c13e55
MATLAB
3,201
101
function [ax,h]=suplabel(text,whichLabel,supAxes) % PLaces text as a title, xlabel, or ylabel on a group of subplots. % Returns a handle to the label and a handle to the axis. % [ax,h]=suplabel(text,whichLabel,supAxes) % returns handles to both the axis and the label. % ax=suplabel(text,whichLabel,supAxes) % returns ...
cf9a871344f4c642b613eb84e46b797433c1cad1d9569616ca0e60b167aa7bc7
MATLAB
3,202
96
function [C2 thetaout] = mahiem_trialwise2(dat,theta,thetabasis,foldvar,inclusion,covtime,exclusion,recenter) % [C2 thetaout] = mahiem_trialwise2(dat,theta,thetabasis,foldvar,inclusion,covtime,exclusion,recenter) if nargin < 3 thetabasis = -pi:pi/8:(pi-pi/8); end thetabasis = thetabasis(:); %make sure the...
7180212d1383c18e5a5d00a564620d21421e997ac0f64e8394b08cc7c61a8eb2
MATLAB
3,205
80
function out = MF_AR_arcov(y, p) % MF_AR_arcov Fits an AR model of a given order, p. % % Uses arcov code from Matlab's Signal Processing Toolbox. % % ---INPUTS: % y, the input time series % p, the AR model order % % ---OUTPUTS: include the parameters of the fitted model, the variance estimate % of a white noise inpu...
2a6069a2382b850481ac999f34a473d76601880b1970e16dc1d311b42de7fb07
MATLAB
3,206
120
function [WTOpt, WTMdl, BlkInf, Belief, Prior, Kappa] =... GenerateSynthData_Bayes(params, ratTrial,... noise_arg, gen_arg, noise_params) %GenerateSynthData_Bayes - generates synthetic wait times %for optimal Bayes model. % Inputs: % params - Parameter vector. [kappa_mi, kappa_hi, kappa_lo, D, lambda] % ...
6c835f47043165602f42a216170a62bad33a15bc29b0c2588720a0d4188b1df8
MATLAB
3,206
106
function shuffled = shuffle(x,method) %shuffle Shuffles raster data using various different methods % Shuffles spike data (0 or 1) using three differnt methods % assumes rows are individual cells and columns are time frames % % 'frames' - shuffles the frames in time, maintains activity pattern of % each frame % % 'tim...
28e3b3c05702883eb82492c7c13808a509084b0b5460f8e164be1dde9d681824
MATLAB
3,207
88
function [newvol,newvolsize] = changevolumeres(vol,volsize,newdim,wantlabel) % function [newvol,newvolsize] = changevolumeres(vol,volsize,newdim,wantlabel) % % <vol> is a matrix X x Y x Z. All dimensions must be > 1. % <volsize> is a 3-element vector with the voxel size % <newdim> is the desired matrix dimensions % <w...
2829013f867f1c6de587e20b3821a78983a700175757ba689cb9038d39751d25
MATLAB
3,209
68
% turn off advanced expression facilities and load a dataset exp_eval(Set(@disable_expressions,1)) eeg = io_loadset('data:/christian/Demo/imag.vhdr'); % run a filter on some data with some arguments using positional syntax (rest using defaults) eeg = flt_fir(eeg, [], [5 10 25 30], 'bandpass'); % run a filter on some ...
4a16bf47f2708462810cd9eb9a1000d0b883f6c06153b0cce6e04010598171d9
MATLAB
3,209
102
function interpolated = fillnans(matrix,coefficients) % coeffifcients are vertical and horizontal kernel size (like in Smooth): % how much should each dimension weigh in the interpolation? % This function is an usage of John D'Errico's method 2 in % INPAINT_NANS (dowloaded from FileExchange on 01/02/2016) % e-mail ad...
78b417d098fed79835b587b8b60d72624daaa238bea191b7d1ead6c8efde17f9
MATLAB
3,211
125
function simulate_DA_release %Dopamine simulation for Golden et al. (Figure 5g-h). T = -.05:.001:.100; %time vector tstart = find(T==0); rew = 1:3; mycolors = [0 0 1; .55 0 .8; 1 0 0]; gammas = [.7 .85]; %terms specifying reuptake timeStepS = 0.001; durationS = .015; ntrials = 500; evoked_FRs = [0 1.5 3]; %evoked DA ...
b442148c0924d64534019dfa99f513e6e123ad17434e83ba9c18aaa7648e305b
MATLAB
3,211
94
function outputImage = reslice(this, targetGeometry, varargin) % Reslices nD MrImage in 4D chuncks via SPM functionality % % Y = MrImage() % rY = Y.reslice(targetGeometry, 'splitDimLabels', ... % 'echo', 'splitComplex', 'ri') % % This is a method of class MrImage. % % IN % targetGeometry object of MrImageGeome...
31dbfcdde3a2fb2c1743cecf999ea6ea7f433c3566ca9e98a06a63dfd858e319
MATLAB
3,212
51
%----------------------------------------------------------------------- % Job saved on 14-Jul-2014 18:18:40 by cfg_util (rev $Rev$) % spm SPM - SPM12b (5672) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{1}.spm.spatial.preproc.channel.vols = {'/Use...
ac3ec38366dfeb06536fccdc86840f5b437f292d9a0dfeaa2f10602e788c10ca
MATLAB
3,212
117
% HELPFOREXE - Write help files for exe version % % Usage: % histtoexe( mfile, folder) % % Inputs: % mfile - [cell of string] Matlab files with help message % folder - [string] Output folder % % Output: % text files name help_"mfile".m % % Author: Arnaud Delorme, 2006 % % See also: EEGLAB % Copyright (C) 200...
08dded5cfe45782d64f602b3d81eb9a5d555aaef72898e9f7f7657de114e86e0
MATLAB
3,213
89
function grp_out_dist = init_sd_param(infnames,outfname) %% LOAD DATASET %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% grp_out_dist=[]; for i=1:length(infnames); infnames{i} %Load the .set file (this will need to be BIDS data file format compliant) EEG = pop_loadset('filename'...
981c0b4e9a32557e29592bb011aa3476d97600c31560b4c933a9c7fdf5a1b727
MATLAB
3,213
90
function [output, outputPrxDst, outputD2S, outputRes, outputWc, outputWa] = loadDecode(dataPath, mouse, session, kinematicField, neuralField, fitModels) % Runs all decoding model configurations for one dataset, for specified % data fields if nargin < 6 fitModels = [1,1,1,1,1,1]; % fit all 6 model configurations en...
c342013d1adb0d5fe7b483172692943d0481cef2163907140b94bc5c600c88cd
MATLAB
3,214
135
%% [r2s,t2s,m0] = R2star_NLLS(img,te,mask,isParallel,NUM_MAGN) % % Input % -------------- % img : multiecho images, time in last dimension % te : echo times % mask : signal mask % isParallel : parallel computing (i.e. parfor) % NUM_MAGN : no. of phase-corrupted echoes % % Output % ...
29228b81063968ae3b89e98bf0c9af0c24c4376c9c36121eee26cfb00ae2f84d
MATLAB
3,215
108
%firws() - Designs windowed sinc type I linear phase FIR filter % % Usage: % >> b = firws(m, f); % >> b = firws(m, f, w); % >> b = firws(m, f, t); % >> b = firws(m, f, t, w); % % Inputs: % m - filter order (mandatory even) % f - vector or scalar of cutoff frequency/ies (-6 dB; % pi rad / sample) % % O...
a3407ab46e31961984ca3c5649b65c0697bcb709a59e5ad4c72396e38feb569d
MATLAB
3,215
100
clc; clear; atlas = cifti_read('C:\Users\lihon\Desktop\abcd_study\atlas\Schaefer\Schaefer2018_400Parcels_17Networks_order.dlabel.nii'); atlas_parcel = atlas.cdata; atlas_label = unique(atlas_parcel(atlas_parcel>0)); num_parcel = length(atlas_label); % load regional brain development (RBD) index patterns K = 3; cen_...
ae5ebc4bde2c34bdf45835d8e321fefe4fb7097702d0c6aa4c0d92eaa231c028
MATLAB
3,215
84
% POP_AVEREF - Convert an EEG dataset to average reference. % This function is obsolete. See POP_REREF instead. % % Usage: % >> EEGOUT = pop_averef( EEG ); % % Author: Arnaud Delorme, CNL / Salk Institute, 22 March 2002 % % See also: EEGLAB, REREF, AVEREF % Copyright (C) 22 March 2002 Arnaud Delor...
0ba28321ed8bdd86cf8fafe9689a842a3349c720546000ad022e23b1e5b15358
MATLAB
3,216
94
function [K,dK] = covScale(cov, lsf, hyp, x, z) % covScale - compose a covariance function as a scaled version of another % one to model functions of the form f(x) = sf(x) f0(x), where sf(x) is a % scaling function determining the function's standard deviation given f0(x) % is normalised. % % The covariance function i...
a74edf43bfe981cb6dfb3b557426089b2df1221eb43f3363c575806b34b35dea
MATLAB
3,217
75
function r=raeSpearmanCorr(x,y,toleratedStandardError) % This function computes the "random-among-equals" Spearman correlation % (RAE-Spearman r), which is the Pearson correlation applied to ranks with % random ranks assigned to sets of entries in either variable that have % equal values. In case there are no ties, th...
bacd4e238b2b38c4c3c33b442a1e2e92d66e2c4523bff68d1f4a634dad973531
MATLAB
3,217
127
function phiBC = cellBoundary3D(phi, BC) % function phiBC = cellBoundary2D(MeshStructure, BC, phi) % It creates the matrix of coefficient based on the BC structure provided % by the user. It also generates the right hand side vector of the linear % system of equations % % SYNOPSIS: % phiBC = cellBoundary2D(MeshStruct...
7a8c966aaca34fbcb808b0a87ac43e4da94368f4eb46af9427a3e11cf1db1d9e
MATLAB
3,218
88
function CS=surfing_nodeidxs2coords(cs1,cs2,idxs,linedef) % maps vertex indices from two surfaces to coordinates % % CS=SURFING_NODEIDXS2COORD(C1,C2,IDXS,LINEDEF) % INPUTS: % C1,C2: 3xN coordinates for N nodes for the two surfaces. % OPTIONAL INPUT % IDXS: Px1 node indices to be used (default: all nodes) %...
ddd5d77d7acbc45517d6da87ad36dddbc54faa42ecd5dccb43318f0fd406c5c2
MATLAB
3,218
101
function [ax,h]=suplabel(text,whichLabel,supAxes) % PLaces text as a title, xlabel, or ylabel on a group of subplots. % Returns a handle to the label and a handle to the axis. % [ax,h]=suplabel(text,whichLabel,supAxes) % returns handles to both the axis and the label. % ax=suplabel(text,whichLabel,supAxes) % returns ...
fe5ed7bd48c865ae283bb23da18ed16ec72039f2f9f669007e5378d21274672a
MATLAB
3,218
120
function [WTOpt, WTMdl, BlkInf, Belief, Prior, Kappa] =... GenerateSynthData_Bayes_BeliefState(params, ratTrial,... noise_arg, gen_arg, noise_params) %GenerateSynthData_Bayes_subopt_onlylambda - generates synthetic wait times %for optimal Bayes model. % Inputs: % params - Parameter vector. [kappa_mi, kappa_hi...
5c2913b85d367d1a59a4238921cf252d510737f17e1b028ebe2bd6ada7979e68
MATLAB
3,219
100
function Y_rgb = sd_slice_to_rgb(Y, layer, settings) % SD_SLICE_TO_RGB Converts 2D slice data to 3D RGB color coding % % DESCRIPTION % This function uses the pr_scaletocmap function, which is part of SPM's % slover toolbox, to convert image data to RGB color using the color coding % scheme specified in the layer's co...
204254afeaa00325a6b62d727c6df47bcbefbba7cd6077c196b6c6da88381c49
MATLAB
3,220
43
matlabbatch{1}.spm.tools.physio.save_dir = {'physio_out'}; matlabbatch{1}.spm.tools.physio.write_bids.bids_step = 4; matlabbatch{1}.spm.tools.physio.write_bids.bids_dir = {''}; matlabbatch{1}.spm.tools.physio.write_bids.bids_prefix = 'sub-control01_task-YOURTASK_run-1'; matlabbatch{1}.spm.tools.physio.log_files.vendor ...
3928431f2364b47eb930f69938783d685c91c623bfa178348f33e566e865c658
MATLAB
3,222
94
function grad = getPartialGradient(problem, x, I, storedb, key) % Computes the gradient of a subset of terms in the cost function at x. % % function grad = getPartialGradient(problem, x, I) % function grad = getPartialGradient(problem, x, I, storedb) % function grad = getPartialGradient(problem, x, I, storedb, key) % %...
4262b7b4c293a145b3b51b3b6393ea1ca77a182e7e9bf82244740955986b0fba
MATLAB
3,223
68
%% Scripts to calculate spectral entropy in different frequency bands % Eline Schaft, 2025 % Code corresponding to Schaft et al. - Spectral Entropy Variability of % intra-operative electrocorticography predicts outcome after epilepsy % surgery in people with focal cortical dysplasia. %% Set paths addpath('\path...
f146a48e7ffc4159e8bab2f7aa1eb8c5a603bb54946b58fc260df61db11b5705
MATLAB
3,223
118
%% chi = NDI(localField,mask,voxelSize,varargin) % % Usage: chi = NDI(localField,mask,voxelSize,'b0dir',B0_dir,'weight',weight,... % 'iteration',200,'stepsize',1,'tolerance',0.5); % % Input % -------------- % localField : local (tissue) field % mask : signal mask % voxelSize : spatial ...
57d655aab3e1095e92d7bfae01a7efc8a105b6266ce5628f708780df2e41016d
MATLAB
3,226
80
% Compute empirical p-vals under the null hypothesis that observed samples % come from a given surrogate distribution. P-values for Type I error in % rejecting the null hypothesis are obtained by finding the proportion of % samples in the distribution that % (a) are larger than the observed sample (one-sided test) % (b...
5985377e4207ec740f248f89355a1da520eb25f7b55d34b5f3b070a9ac29fdfc
MATLAB
3,226
76
%{ # quantal size in images -> preprocess.Prepare -> preprocess.Channel -> preprocess.Slice --- min_intensity : int # max value in movie max_intensity : int # max value in movie intensities : longblob # intensities...
cd6b47ea76cb2fef7b024394a25e042e3a45fc746d3761c3a42a4a95e569daf3
MATLAB
3,226
84
function [X, info] = dominant_invariant_subspace_complex(A, p) % Returns a unitary basis of the dominant invariant p-subspace of A. % % function X = dominant_invariant_subspace(A, p) % % Input: A complex, Hermitian matrix A of size nxn and an integer p < n. % Output: A complex, unitary matrix X of size nxp such that tr...
48ca5e7561736959da4ba88f8d2adfe4de98dc221e92f90053c489323233d134
MATLAB
3,227
89
function pathOut = tapas_uniqc_get_path(folder) % Returns absolute paths for given folder % % pathOut = tapas_uniqc_get_path(folder) % % IN % folder default: 'code'; returns full path of given folder within % UniQC Repository % options: % 'code' % 'utils'...
032b30d8d30450fdc28aebc7cc9489992e3c61ff1b9ef017445f54d86f192d34
MATLAB
3,229
89
function x = arg_extract(args,names,position,default) % Extract arguments from Args; simple version, see notes. % Value = arg_extract(Args,Names,Position,Default) % % In: % Args : the varargin of the calling function % % Names : name by which the argument is referenced, or a cell array of names % % Position: the ...
7174c9c8820e8dc0da0633bbd960f4e6e07760004e73f03f0000fbb0969e8c17
MATLAB
3,229
86
%% read csv file fileName = fullfile('data', 'Data S1.csv'); rawDataTable = readtable(fileName); % load Excel file [input.Odor, ~, input.indOdor] = unique(rawDataTable.Odor, 'stable'); %ORN name input.ORN = rawDataTable.Properties.VariableNames(4:end); input.concList = rawDataTable.Concentration; input.expID = raw...
7f60155ca59759816586aeef64b7148f74aceee61a939dc4da95aa2abad0b18b
MATLAB
3,230
82
function plot(frameStream,cfg,varargin) % Plot the contents of a McsFrameStream object. % % function plot(frameStream,cfg,varargin) % % Produces plots of the individual FrameDataEntities (one figure per % entity). % % Input: % % frameStream - A McsFrameStream object % % cfg - Either ...
dca9d1f2d368c23ac246d63f2f5c24dfddfbc5568a5f37c932fb3d4dff3a7a57
MATLAB
3,230
94
%% clear all load fig3Fdata cccc = get_seaborn; f = figure('Position',[680 558 540 420]); H1 = cplot(selected_resp_times,patwise_context_decoding,{'color',cccc{3}}); hold on,plot([-2000 1000],[.2 .2],'k--') H2 = cplot(selected_resp_times,patwise_im1_decoding,{'color',cccc{8}}); H3 = cplot(selected_resp_times,pa...
e1fb263fdc0789f88de45ba2bf831e991403c522fe96846405e100e45ba7580e
MATLAB
3,230
120
%% draw a regular polygon to approximate a circle: nside=5; pgon = nsidedpoly(nside); %% model = createpde("thermal","transient") %% model = createpde; g = geometryFromEdges(model,@circleg); pdegplot(model) %% mesh = generateMesh(model) % ---------------- %% Create a decomposed geometry matrix, with line segments gi...
d8a8c3c1e44107f4d1ab17d9d06b8ee67ebc7db835bef08830aabd2b5910bcb9
MATLAB
3,231
118
function [dp,dpshuff,dp_raw] = dprime(hmat,mask1,mask2,varargin) %dprime: discriminability in firing rate between two conditions % %INPUTS: % hmat: (ns, nt) heatmat for a single neuron.ns trials. nt time points % mask1: (ns,1) boolean for condition 1. true if trial satistfies cond. % mask2: similarly to mask1. Ty...
012c5f2097cd2ceb1f44e24916e3f5f157a2ce02cfa4ee1e3e820328b86cf906
MATLAB
3,232
90
function this = load(this, fileName, varargin) % loads object from struct in .mat-file, different variable names possible % % % Y = MrCopyData() % Y.load(filName) % Y.load(filName, variableName) % % Options for variable name % 1) variableName is given in varargin - load if available % 2a) no variableName is...
a7ab85c5d9a2c3065e0b8d56fb1448bbb452f7676c6a9d3a065a77646a3e24ee
MATLAB
3,232
96
function [stim_new] = add_covariate(cnew,stim_old,covops) %adds a covariate to an existin stimulus sctruct %inputs: cnew: new test covariate. size ntest x nt (if timde dep), % or ntest x 1 if a constant covariate % stim_old: old stim structure for testing/training data % covops: options for c...
34eadab30d5c8083b0d9a2832f8b542144ffe30119323c72646d0cc1ebcc155f
MATLAB
3,236
115
function PlotCCG(t,ccg,varargin) %PlotCCG - Plot auto/cross-correlograms of point processes. % % USAGE % % PlotCCG(t,ccg) % % t time bins obtained using <a href="matlab:help CCG">CCG</a> % ccg data obtained using <a href="matlab:help CCG">CCG</a> % <options> optional list of p...
fd7edc97502b14fb72a89c7608970a9a1a2aa99553683d9ef90e9f342570d016
MATLAB
3,237
73
%{ # pixelwise cosine fit to directional responses -> tuning.OriMapy --- cos2_amp : longblob # dF/F at preferred direction cos2_r2 : longblob # fraction of variance explained (after gaussinization) cos2_fp : longblob ...
9071f48e9d7ddbaea264c72898ecf25a1192d72a01ac70fb746877da3bf3416e
MATLAB
3,238
108
function [rows, cols, entries, rep, field, symm] = mminfo(filename) % % function [rows, cols, entries, rep, field, symmetry] = mminfo(filename) % % Reads the contents of the Matrix Market file 'filename' % and extracts size and storage information. % % In the case of coordinate matrices, entries refer...
a12751957f0a219c75f87f39d46bf578cc05a292932a82681a8e1ef17e28cb50
MATLAB
3,238
66
function preprocess_nsd_TOF(subjix) % function preprocess_nsd_TOF(subjix) % % <subjix> is 1-8 % % Use ANTS to use a BSplineSyN to match the TOF image % to the T1 1.0-mm resolution. We use some carefully crafted parameters. % % We then create a final 0.5-mm TOF image and some other resolutions (0.8 mm, 1.0 mm). % % No...
49dd230bdccee295b3a451ce152709fafb011f9a557878ce59a5dd03667845b0
MATLAB
3,242
77
%{ tuning.Cos2Map (computed) # pixelwise cosine fit to directional responses -> tuning.OriMap --- cos2_amp : longblob # dF/F at preferred direction cos2_r2 : longblob # fraction of variance explained (after gaussinization) cos2_fp ...
f2de26505d9f46ac410245f7acea7a9ae80a065d024f2dea28465ae31edae436
MATLAB
3,242
104
function analyzebehavior_prf_visualize(ppdirs,outputdir) % load alldata = {}; for p=1:length(ppdirs) alldata{p} = load([ppdirs{p} '/behavioralresults_prf.mat']); end % internal constants expectedtriggers = 188; % look at tricky trigger stuff totaln = []; mdf = []; realstart = []; for p=1:length(ppdirs) for q=1:l...
1d79ad19aa5e393edb157f0b71ff134be160bf6e1d55c5ebbf1a6b2620801dde
MATLAB
3,243
97
function rebuild(obj) %REBUILD Rebuild the internal data structures of a DagNN object % REBUILD(obj) rebuilds the internal data structures % of the DagNN obj. It is an helper function used internally % to update the network when layers are added or removed. varFanIn = zeros(1, numel(obj.vars)) ; varFanOut = zero...
d4364c867ea5a2b1311c44098a884e2d5bccd471d701eda1b10892b9c6bf8e91
MATLAB
3,243
104
function check_func_imgs(func_imgs) % _ % Checks functional image files before or after preprocessing % FORMAT check_func_imgs(func_imgs) % % func_imgs - an R x 1 cell array where each entry is the % filepath to a 4D NIfTI filepath from one run % % FORMAT check_func_imgs(func_imgs) loads the imag...
022bf01d02ebbae18dfad6478452045ab5e66cdb8ac5c8b183aafc4e6df403f7
MATLAB
3,244
102
function MS = createMesh2D(varargin) % MeshStructure = buildMesh2D(Nx, Ny, Lx, Ly) % MeshStructure = buildMesh2D(facelocationX, facelocationY) % builds a uniform 2D mesh: % Nx is the number of cells in x (horizontal) direction % Ny is the number of cells in y (vertical) direction % Lx is the domain length in x directio...
85e9c1947e6e9a05a8a5402e125f64eb96b22bb91b6e3495d162d7f2f1305b54
MATLAB
3,244
102
function m = Bright(n,varargin) %Bright - Bright colormap (similar to HSV or JET, but brighter). % % USAGE % % m = Bright(n,<options>) % % n optional number of rows in output matrix (default = 100) % <options> optional list of property-value pairs (see table below) % % ==================...
8d80f6fd59859eab80fa2d6615f54512696e17871efb39803631365fbe4a8e7d
MATLAB
3,244
90
%% Testing the ensembles detection method using subsampling % 1.- Generating synthetic data T = 50000;% recording time N = 300; % number of neuron nens = 10; % number of ensembles fr = 0.2; % maximal neuron firing rate ncellsperens = repmat(N*0.05,[1 nens]); % cells per ensemble ntimesperens = repmat((0.7)/nens,[1 nens...
a763270db1921e1b2bfe8d69fc69e2ede97aafb3d7f0c5fbcd2be00a2367c49b
MATLAB
3,244
97
function [correlation,x,y] = tapas_physio_corrcoef12(x,y, isZtransformed,precisionThreshold) % computes correlation coefficient (i.e. entry (1,2) of correlation matrix) % quickly between two time series % The speed-up is mainly due to in-line re-implementation of costly % statistical functions, i.e. mean, std, cov, and...
a81523980d1768bc43071d012fc34fd7de492cd8765e1f635730627829887f71
MATLAB
3,244
98
% ICAACT - compute ICA activation waveforms = weights*sphere*(data-meandata) % % Usage: >> [activations] = icaact(data,weights,datamean); % % Inputs: % data = input data (chans,frames) % weights = unmixing matrix (RUNICA weights*sphere) % datamean = 0 or mean(data') (default 0); % % Note: If datame...
09080624077c43fb89eb1634b1a1f759c6bd613cdfe19f94b4a12b83fcd4b1df
MATLAB
3,246
90
function [sensorDataSumGPU, p_max_all_cut, target_point] = forwardSimulation(medium, Element, sim_vol, kgrid, sensor, input_args) %% Forward Simulation - Single Emission, Single Focusing % One transmit with all array elements focusing at a single target point Nx = kgrid.Nx; Ny = kgrid.Ny; Nz = kgrid.Nz; % Element pos...
3cf4da40843565b70974edab479451d03ebd39dbf4c68cda652e75240520a742
MATLAB
3,246
75
function output = loadAllUnitData() %% LoadAllUnitData % Load all unit data with corresponding behavior data %% Define table variable for output output = table('Size',[0, 9],'VariableTypes',["string", "string", "string", "double", "cell", "cell", "cell", "cell", "cell"],... 'VariableNames', ["Subject", "Session", ...
4b0c29b3a3c6df2b344f116b3bf6d9ea4b5b19cfef332b3b8a9d2e5ccc545f6b
MATLAB
3,247
127
% test the ICLabel EEGLAB plugin function run_tests() %% set up % load test data EEG = pop_loadset('tests/eeglab_data.set'); % calculate sphereing matrix try icasphere = pca(EEG.data')'; catch % BCILAB (unfortunately) shadows pca from the stats toolbox. flist = which('pca.m', '-all'); fpath = flist{fi...
0a5711596adde5b3968deb5b65bea2e931859135099822463541491194e71143
MATLAB
3,248
70
%% cluster based rois % follow the methods here to manually find and save your clusters % marsbar and spm save a .mat file % this script reads the .mat file and the base space image that you select % manually to create rois, based on the resolution of the image you cretaed % step 1: % we can open marsbar and choose th...
7db0ee453b7c60d78c894a0e558fc636c7923181aea138234cfc4b887f48e5a4
MATLAB
3,248
88
function [Calls,audiodata,ClusteringData] = loadCallfile(filename,handles) data = load(filename); Calls = table(); audiodata = struct(); ClusteringData = table(); %% Unpack the data if isfield(data, 'Calls') Calls = data.Calls; elseif nargout < 3 % If ClusteringData is requested, we don't need Calls warning(...
ace279a6dd93068d49e7c93e7b8816fd281b441cc0c0b566e000f8714bb21993
MATLAB
3,249
94
function fear_frzTrigTripleAct_optMeanShift(basename,varargin) load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) param.binSize=0.02; param.halfWindow=5; param.varName='frzTrigCoactChamber'; param.saveFile=[basicMetaData.AnalysesName '-frzTr...
b8c92e8a6da351fb3e54c7f71759694ed5a086d302642d7ca25ca0790b16ce8f
MATLAB
3,250
65
function osp_pop_whichcorrOvCorr_Call(src,~,gui) %% osp_pop_whichcorrOvCorr_Call % This function is triggered when the correlation overview choice popup menu is changed. It refreshes % the figure. % % % USAGE: % osp_pop_whichcorrOvCorr_Call(src,~,gui); % % INPUT: src = handle of the fit tabs % ...
26918e1f36e8c3d3f3e834dd3a5a8e7539c1f574d712a834e54ed7cd197e271f
MATLAB
3,252
89
function c = tapas_rw_binary_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the Rescorla-Wagner (RW) learning model for binary inputs. % % The RW model was introduced in : % % Rescorla, R. A., and Wagner, A. R. (1972). "A th...
18c7fd5dabbc6da9d0a73f80a5fde3923957dd053a10cc9dd293bebc9f04912a
MATLAB
3,253
88
function [node,elem]=meshcheckrepair(node,elem,opt,varargin) % % [node,elem]=meshcheckrepair(node,elem,opt) % % check and repair a surface mesh % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2008/10/10 % % input/output: % node: input/output, surface node list, dimension (nn,3) % elem: input/output, s...
9273b344af94bc6f0bd16a07eafb653728881f08a5eae33a57180a14bfa35f44
MATLAB
3,253
83
function [nirs, windowMotion, windowTimes, windowCount, windowSizeSamples] = pruneWithCV(nirs, params, numChan, arrayChans) % Prunes channels using coefficient of variation (CV) thresholds. Analyses % data in windows, marks motion artifacts, and calculates CV values to % determine which channels should be retaine...
9d5d0288559173d16dfb9cda984566bb1488bd97a2d86917ed1d9ca4a765104a
MATLAB
3,253
125
function OUT = fuzzy_conf_cluster(im,xyz) % OUT = fuzzy_conf_cluster(im,xyz) % % tor wager % % input: % this function takes a set of indicator vectors (im) % coded as 1's and 0's, and a list of varables (xyz) % % output: % a permutation test for whether there are separate regions % of the space defined by the colum...
e1c4b0bee6b51cec7628ea32f38410d7b0ee52fda3d40d60d605b068db46b79c
MATLAB
3,256
119
function FigureS8(datadir, codedir) %FigureS8 - Model comparison for wait times favors inferential over % retrospective model, but does not distinguish between inferential and % belief state models % datadir = directory of dataset % codedir = director of code %% Set up paths s = pathsep; pathStr = [s, path, s];...
837a8604ef6e3bce8f345fd3f1520a62a6b206813e95aa63c6aa0e9402d049bb
MATLAB
3,257
92
% checking subjects responses during the fMRI session % both catch questions and last question in each block clear all close all clc exp_root = 'C:\Users\User\Documents\fMRI_EXP\'; data_path = fullfile(exp_root, 'alon', 'beh'); n_catch = 5; num_subjects = 28; num_runs = 4; num_maps= 4; num_blocks = 5; all_responses ...
311179878bb3af158ee342d5032210497e1e24f197e70fb5d768b6e4e304651f
MATLAB
3,258
104
function ft_regress_physio(input, regressor, TR, cutoff_highpass, ... path_output, cleanup) % Regress physio % % ft_regress_physio(input, regressor, TR, cutoff_highpass, ... % path_output, cleanup) % % Inputs: % input - input time series % regressors - multiple regressors as separate columns in a ...
9635eebc5fbfec71a7f00302b38a64cdec0fae488966eb8b71cc194aa0bd345a
MATLAB
3,259
92
function statsfun = statsfunhelper(inp1, inp2) % Helper tool to create a statsfun for the options structure of solvers. % % function statsfun = statsfunhelper(name, fun) % function statsfun = statsfunhelper(S) % % Usage with (name, fun): % % Input 1: name is a string which is a valid field name (no spaces, starts % wit...
980f63a8016b587a55376077ed626e4e9138168c3697fff171547568706f77f1
MATLAB
3,259
94
function varargout = openvibe_mat(filename, hdr, begsample, endsample, chanindx) % OPENVIBE_MAT reads EEG data from MATLAB file with OpenVibe data that was converted % according to http://openvibe.inria.fr/converting-ov-files-to-matlab/ % % Use as % hdr = openvibe_mat(filename); % dat = openvibe_mat(filename, hdr,...
7d4e9e80df72101b3e725883ac9070dff6f75e37a4b629b315d5229fb81c87ac
MATLAB
3,261
92
function plotApertureEventHists(kinematics) % Plot the histograms of aperture-related event timings across all mice % Figure [~, tl] = fig([2,1]); % Params liftCol = [130, 235, 118]/255; collectCol = [72, 188, 255]/255; extendCol = [230, 40, 151]/255; bins = min([kinematics(find([kinematics.nPeaks] == 1)).collectTime...
a1e42332a3db87209d819389d6b34c38606507ed5d27976fb5b801e19d28ae5f
MATLAB
3,261
110
function [d, nfnn] = MS_unfolding(y,th,de,tau) % Estimate the minimum unfolding dimension by calculating when the % proportion of false nearest neighbours if first below th. % % The number of false nearest neighbours are calculated for the % time series y embedded in dimension de with lag tau. % % For each pair of valu...
29a69bb7c1e0f0f46f6e16fe6f31ca41a986dae6b8d606a9c400bb0b49c0ee18
MATLAB
3,262
99
% GAUSS3D - generate a 3-dimensional gaussian matrix % % Usage: % >> [ gaussmatrix ] = gauss2d( nX, nY, nZ); % >> [ gaussmatrix ] = gauss2d( nX, nY, nZ, ... % sigmaX, sigmaY, sigmaZ, ... % centerX, centerY, centerZ, mask) % % Example: % >> gauss3d(3,3,3); ...
91f6cc0e3d2594473ec66ddd065f5a375c320a0efa9f3cabbaff8f265baed099
MATLAB
3,262
92
% POP_DELSET - Delete a dataset from the variable containing % all datasets. % % Usage: >> ALLEEG = pop_delset(ALLEEG, indices); % % Inputs: % ALLEEG - array of EEG datasets % indices - indices of datasets to delete. None -> a pop_up window asks % the user to choose. Index < 0 -> it'...
173294b939a6479e09913dc385f4f6adc47a5c8f0148f29a4af51abc0b2fb03e
MATLAB
3,263
77
function outputMeasure = BF_LossFunction(yTest,yPredict,whatLoss,classLabels) % BF_LossFunction gives a measure of classification performance % % All labels are expected to be integers, ranging from 1 to the total number % of classes in the classification problem % %---INPUTS: % yTest, the test set labels % yPredict, t...
2cfe51b2bdb9b785f8b82520204bd254ec4141de298d132dc6e6f236892303a5
MATLAB
3,265
82
% -*- mode: matlab; -*- % Neurophysiology Analysis Toolkit http://sourceforge.net/projects/nphys/ % Authors : Chris Higginson (original author) and Josh Tasman % Copyright (C) 2002-2005 by the authors and the Mizumori Lab % (at the University of Washington, Seattle) % % This program is free software; you ca...
4c717c577acd74e1a694137e643e6680499a697d788353fcf7e4becebc56febf
MATLAB
3,265
68
% Optimize inducing inputs for the VFE approximation (not FITC). % % One can perform a gradient-based optimisation of the inducing inputs xu by % specifying them via hyp.xu rather than through {@apxSparse,cov,xu}. % % An alternative way of optimising xu (in order to overcome local minima) is % to simply compute the exp...
a7b4469cc4c7588a1e81ac427afde00370996ea28eebbae78fef1f64119c1e71
MATLAB
3,265
105
function ni = dtiWriteNiftiWrapper(imArray, matrixTransform, filename, sclSlope,... description, intentName, intentCode, freqPhaseSliceDim, sliceCodeStartEndDuration, TR) % See also niftiGetStruct and niftiCreate % We think this should go away and be replaced by a proper niftiCreate % % dtiWriteNiftiWrapper (imArra...
d0a0821ccc4698720cf2825c723b59f5f7b90810aca060e3c30131fd5b1bcd12
MATLAB
3,265
79
%% Bytediv = 4; %% number of bytes to average over nn = -1 ; %% sets the tetrode you want to investigate samplingRate = 30000; start = 1; %% sample stop = 900; %% sample fac = 1.5; min_length_of_burst = 2; local_length = 0; surprise_cutoff = 5; continu...
078020fc80663d244e2c7d56b5baf02ee7950b29cf069ae950714a1d372e0e65
MATLAB
3,267
95
function [stepsize, newx, newkey, ssstats] = ... stepsize_sg(problem, x, d, iter, options, storedb, key) %#ok<INUSD> % Standard step size selection algorithm for the stochastic gradient method % % Given a problem structure, a point x on the manifold problem.d and a % tangent vector d at x, produces ...
f8c1c80e3f49b11ddd4d490acec6baeafa215816f13f49387310c06c5e0a1e0e
MATLAB
3,267
84
classdef toolsFillSmallHolesTest < matlab.unittest.TestCase %TOOLSFILLSMALLHOLESTEST Unit tests for petraToCT.tools.fillSmallHoles. % % DESCRIPTION: % Verifies that fillSmallHoles fills enclosed holes whose voxel % count is at most ceil(radius2measure(MaximumHoleRadius, 3)) and % lea...
c486b1799a44b7de33bccadfbedde2fe86a6a76ff6d52daad86011698f7d2de1
MATLAB
3,269
127
function [xvec,spikes_binned] = binspikes(spiketimes, handles, alignment,dt,tmin,tmax,wndw,varargin) %BINSPIKES put spikes into equalbins % %input: % spiketimes: long array of spike timings % % handles: handle of trial timings % % alignment: string handle for what event to be aligned % % dt: bin size (...