sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a4a742ce6ac2b2ae56e75cad8fa8c7ac1d5f88a6e4f4811e9b0e489d71525d75
MATLAB
3,644
190
function RT = rt_read_ev2(cfg) % v.0.0.1.1 % <*LAN)<| % % % % cfg.filename = 'nombredearchivo.ev2' % cfg.ref =[] % cfg.refl = % cfg.delim = [est, resp,resp,resp; % est, resp,resp,-99] %% matriz con estimulos % y respuestas para ...
874719eea66b804b60a2ff653f390ea92d6adf0e59805c9c76cf65394365d8d9
MATLAB
3,646
106
% PlotStridePosition.m % Sarah West % 7/21/23 function [parameters] = PlotStridePosition(parameters) x = parameters.x; y = parameters.y; resampleLength = parameters.resampleLength; MessageToUser('Resampling ', parameters); % Put strides of different instances together on same level x_togeth...
8b072629fb82d3e07d33a3ea9118b9b9e8ee76a73a7a9456c578906f99e76684
MATLAB
3,646
106
% This code loads Results and looks at the peak frequency and determines % SOZ at seizure onset of dominant frequency % Abbas Sohrabpour % 19/3/2018 close all; clear all;clc bad_chan = []; cd('../Grid Location and Defined Parameters') load('UnconstCentLFD.mat') [~, Num_Dip] = size(K); K([bad...
94df5ec7a074c2f56a2c73f8929d61de0367cd7783842fe681da0c8b4312f09c
MATLAB
3,646
125
function t = timeit(f) % Measure time required to run a function % T = TIMEIT(F) measures the time (in seconds) required to run % F, which is a function handle. % % If nargout(F) is 0, TIMEIT calls F with no output arguments, % like this: % % F() % % If nargout(F) is nonzero, TIMEIT calls F with a si...
b70bd5b28285b14f5d8a9c913268de78179a017f1a74c87b6dc79dcba7f1a82f
MATLAB
3,646
109
% Author: Birgit Nierula % nierula@cbs.mpg.de function pot_latency = bs_prepro_loop2(isubject, icondition, srmr_nr, is_min) %% get potential latency %% set variables subject_id = sprintf('sub-%03i', isubject); analysis_path = [getenv('ANADIR') subject_id '/bs/prepro/']; save_path = [getenv('BSDIR') subject_id '/']; ...
2f2486c82decbb09d74e12715c3b198ed04dcc07af1c9b5dc6e98fe464690d2b
MATLAB
3,647
114
function varargout = sccn_xdf(filename, hdr, begsample, endsample, chanindx) % This is a wrapper to the reading function from the XDF MATLAB toolbox. % % Use as % hdr = sccn_xdf(filename); % dat = sccn_xdf(filename, hdr, begsample, endsample, chanindx); % evt = sccn_xdf(filename, hdr); % % See also FT_FILETYPE, ...
6e6e651106bce3dfb1ff84e266ea03338c470478af18a10913127249657a8bd7
MATLAB
3,647
132
function [y,yidx] = weighted_prctile(x,p,w,dim,issorted) % y = weighted_prctile(x,p,w,dim,issorted) % similar to MATLAB's prctile, but takes weights if ~isvector(p) || numel(p) == 0 error('stats:prctile:BadPercents', ... 'P must be a scalar or a non-empty vector.'); elseif any(p < 0 | p > 100) || ~isreal...
6f3b9ad017e6d90c5c9cfae3ca60403be460db627ad4a0f7555fc31fa734ceb1
MATLAB
3,647
114
function ax = animate_template_func(input_file_name,output_file_name) % input_file_name -> for example, the name of the .mat input file containing the trajectory % output_file_name -> true, false, or the name of the output video file % % you function plott goes inside the record_frame function below mouse_track =...
602a96e3b630864fb43a6ea1c4ea562e3641c2db1c2e5552f8f65697e8d19855
MATLAB
3,648
105
function completionReport(yamlfile) %Use a YAML file to load the parameters for a large experiment yamlspecs = ReadYaml(yamlfile); %The YAML files might have extra quotes so remove them BASENAME = strrep(yamlspecs.basename,'''',''); NUM_FOVS = prod(yamlspecs.montage_size); if isfield(yamlspecs,'reg_type') REG_TYPE...
fc23aa730b4b97465bc731e8050d6942bdef0b28d5c53eed3c2bb01da455a038
MATLAB
3,648
108
function grating = buildColorGrating(pixelsPerDegree, sizeDegrees, ... spatialFrequency, tiltInDegrees, phase, michelsonContrast, ... squareWave, colorOption, redWeight, greenWeight) % function grating = buildColorGrating(pixelsPerDegree, ... % spatialFrequency, tiltInDegrees, phase, michelsonContrast, ......
5388fce91294f90da3f5d5ec1aba9c60839c49f3c0b0fa0d946c43cab2f230b0
MATLAB
3,649
112
function [F,sE,sC] = VBA_spm_log_evidence(varargin) % Return the log-evidence of a reduced model (under Laplace approximation) % FORMAT [F,sE,sC] = spm_log_evidence(qE,qC,pE,pC,rE,rC) % FORMAT [F,sE,sC] = spm_log_evidence(qE,qC,pE,pC,priorfun,varargin) % FORMAT [F,sE,sC] = spm_log_evidence(qE,qC,pE,pC) % % qE,qC - p...
be4d139b87fded98d0d414f8e1f05801c59cad5896567102baf5f239de0366ce
MATLAB
3,649
84
function [estimated_position,log_odds]=calculate_log_odds(spikes,place_fields,bin_size, track, opposite_track, shuffles) % Input % - spikes: where spikes(:,1) % - bins: are time bin for spike count and decoding % - % By Daniel Bendor and Masahiro Takigawa 2023 common_good_cells=intersect(place_fields.track(track).s...
03a985d6acf5e07b922ab0076562c0b18e2d49b9e8b1ed3ec606819b360e14d1
MATLAB
3,651
75
function h_resetZoomBox3(handles, syncFlag) global h_img3; if ~exist('syncFlag','var')||isempty(syncFlag) syncFlag = 1; end [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); [x_lim,y_lim,z_lim] = h_getLimits3(handles); horizontal = get(handles.moveHorizontal,'Valu...
edb0e2d8c14c7c86e1a5e7a1d14d19f993c7f621f0983c38cc78f7a1d1da206f
MATLAB
3,651
143
clear all close all clc % Use this script to generate a figure similar to Figure 5C (lower panel) of: %Luna, R., Li, J., Bauer, R., & van Leeuwen, C. (2023). Retinal waves in adaptive %rewiring networks orchestrate convergence and divergence in the visual system. %Network Neuroscience cd '..\scripts\Outpu...
a43b1d611f558491f46545e67a8983b7b78775bffb23e40a063ad3edc716326c
MATLAB
3,652
114
function [F2,po2] = VBA_SavageDickey(po1,pr1,F1,dim1,pr2) % computes the free energy and posterior moments of a reduced model % function [F2,po2] = VBA_SavageDickey(po1,pr1,F1,dim1,pr2) % This function computes the approximate log model evidence and posterior % density of a 'reduced' model, which is defined with respec...
269b9128238b960b9c2448feb41a9523fc00a73ef1f19879186f4f53c90b7643
MATLAB
3,653
151
function M = spheresymmetricfactory(n) % Returns a manifold struct to optimize over unit-norm symmetric matrices. % % function M = spheresymmetricfactory(n) % % Manifold of n-by-n real symmetric matrices of unit Frobenius norm. % The metric is such that the sphere is a Riemannian submanifold of the % space of nx...
32a57019c3d6466b95093b191c36d04e1aafea9c1bd7a825f241473f9e6033c1
MATLAB
3,653
118
function H=w_PlotNode(Vector, ElementLabel, ... HigherOrderNetworkIndex, HigherOrderNetworkLabel,... ColorMap) LineWidth=2; LineColor=[0, 0, 0]; NumNode=size(Vector, 1); if ~isempty(HigherOrderNetworkIndex) && NumNode~=size(HigherOrderNetworkIndex, 1) errordlg('Invalid Length of HigherOrderNetworkIndex')...
4610d9ba91d7aaa48cc60ab74b7f3f846309de5f2a505698b58f4b4e9c78a59e
MATLAB
3,653
101
% This script shows how to process and manipulate loaded datasources and % how to call dataspace module-functions on them. % % The same exact procedures apply to programatically loaded datasources (not involving the GUI). % % % %<PRE> % This file is part of dspace-core. % ...
8c1a493445a2fdb7d4cbcd0034c880318195dfa24b252d988cd20538bdf5f05a
MATLAB
3,654
70
function CBIG_AuthorTopicEM_GenerateDataFromText(text_data_path, ... data_dir, gibbs_data_file_name, em_data_file_name, brain_mask1mm, ... brain_mask2mm, binary_smooth_kernel_rad) % CBIG_AuthorTopicEM_GenerateDataFromText(text_data_path, ... % data_dir, gibbs_data_file_name, em_data_file_name, brain_mask1mm, ...
71232bf06934db48cc87f47d7780a81a10d48282893b4d27f8b3c9c24b06f809
MATLAB
3,656
107
% Demo code for multiple subplots of estimation plots. Original toolbox % written by Adam Claridge-Chang's Lab % % Liangyu Tao June 10, 2019. Can now do multiple subplots clear;close all addpath(genpath(pwd)) % load data load fisheriris % create an extra category (to be used for the pair wise multiple % comparison p...
9e923bd37315105ed4c0581fd069dfea5023b3d54124eaa4e6ee3f8dd1a64e5a
MATLAB
3,656
104
% Author: Birgit Nierula % nierula@cbs.mpg.de function esg_prepro_loop3(subject, conditions, srmr_nr) %% set variables subject_id = sprintf('sub-%03i', subject); analysis_path = [getenv('ANADIR') subject_id '/esg/prepro/']; save_path = [getenv('ESGDIR') subject_id '/']; if ~exist(save_path, 'dir'), mkdir(save_path); ...
f8381e13525dae9325bc3f84412660bb757b2cf8b205c1f12ef9688a67048d7c
MATLAB
3,657
79
fov = zeros(d1,d2); figure % Plot position of interneurons, pyramidal cells and assembly members for assemblyCounter = 1:size(assemblies.CellCl,1) assemblies.cellsInAssembly = assemblies.C0{1,assemblyCounter}; %assemblyN = ['assembly' num2str(assemblyCounter)]; if size(assemblies.CellCl,1) > 1 && size(assem...
4fe52782cbfd25328f170315e7bbf816bde15e9f3b60eec2f2b14b226eb57c2c
MATLAB
3,659
88
function bbs = acfDetect( I, detector, fileName ) % Run aggregate channel features object detector on given image(s). % % The input 'I' can either be a single image (or filename) or a cell array % of images (or filenames). In the first case, the return is a set of bbs % where each row has the format [x y w h score] and...
17c5c53173a897e1c34fce4286775b4406a7e6509041735bf8e259adcd44c920
MATLAB
3,660
98
%timing irregularities location = 'L1'; %'L1' 'laptop' scanType = 'all frames'; % 'all frames' 'irregularity frames' %% Plot timing switch scanType case 'all frames' timeScanNames = {'stimulusSeq' 'targetSeq' 'targetPosSeq' 'trigSeq' 'keyCodeSeq' 'soundSeq'}; switch location case 'lapt...
7e708ef46bde476221d01059bbbff82107595c0228c65a168fab2f07112a9077
MATLAB
3,664
104
%% Screen SDOs (struct) for significance % Simple utility to screen the 'sdo' struct for particular spike-triggered % SDOs which are demonstrate significance on at least SIG_THRESH tests. % % PREREQUISITE: % computeSDO.testStatSig() % % INPUT: % sdo - structure, as generated by computeSDO % SIG_THRESH: % ...
0e0a7634fa4d6dcb5b3146dc446c457c0ecff8092979c4c15c957fdfc973a8d0
MATLAB
3,665
116
function [U]=l3dpartdirect(nsource,source,ifcharge,charge,ifdipole,dipstr,dipvec,ifpot,iffld,ntarg,targ,ifpottarg,iffldtarg) %LFMM3DPARTDIRECT Laplace interactions in R^3, direct evaluation. % % Laplace FMM in R^3: evaluate all pairwise particle % interactions (ignoring self-interactions) and interactions with targs. %...
801e9839e1d145d3264a1fb2ff70eb518a019b783c3e4f4c0595f1dd8e0c55df
MATLAB
3,667
136
function M = complexcirclefactory(n) % Returns a manifold struct to optimize over unit-modulus complex numbers. % % function M = complexcirclefactory() % function M = complexcirclefactory(n) % % Description of vectors z in C^n (complex) such that each component z(i) % has unit modulus. The manifold structure is ...
88b99b44a31a1a786b064330ac55f2c8bac3e82fec5b65408954e5295f92bcee
MATLAB
3,667
87
function [M] = smoothModel(M, smoothrad, origin, mult) %SMOOTHMODEL Smooth a brain model. % % For every vertex vx of a given model M, this function finds all the % vertices vxd for which distance(vxd, vx) < smoothrad; from these vertices % vxd, only those vertices vxd2 that are far enough from the origin ...
d4ab33fe3c86079d50a2dee0948aca9aa8459296c83df0ab43dd1cffbd5e967b
MATLAB
3,667
166
% 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,...
495b1be64f38e5aad3a0eb23da3fdb51c8662ece5be09d040e4a47119e5d4fa9
MATLAB
3,669
102
function[region, region_lap, initiation_id, cell_id] = grab_samples(analysis_out, samples, measure, grab_lap, range) session_names = fieldnames(samples); initiation_id = {}; region_lap = {}; norm_region_lap = {}; idx = 1; id = []; for session = 1: length(session_names) num_rois = length(samples.(session_names...
66c125c1fb00780eb0c45e53eafd712a7539a83c699af4fe39ca93d8b0247091
MATLAB
3,669
110
% Kernel PCA toy example for k(x,y)=exp(-||x-y||^2/rbf_var), cf. Fig. 4 in % @article{SchSmoMue98, % author = "B.~{Sch\"olkopf} and A.~Smola and K.-R.~{M\"uller}", % title = "Nonlinear component analysis as a kernel Eigenvalue problem", % journal = {Neural Computation}, % volume = 10, % iss...
290a7fe9d53523ad0c5adac12c9248e7d85f04d16275d8c6f7931599660d182c
MATLAB
3,670
65
function [censoredVolumes,lpffdCensoredVolumes,lpfdvCensoredVolumes] ... = getCensoredVolumes(timeSeries,brainMask,MPs,TR,LPF_FD_Threshold,DV_GEV_d) % This function returns a boolean (logical) vector of censored volumes % using combined LPF-FD and GEV-DV based volume censoring, given a time % series ...
3ea896da497697b9ae39dd92b173f5fb99fd20e84b60ecfd8e3669702deb06e9
MATLAB
3,670
90
function s = fromcoco(cocos,varargin) % s = fromcoco(cocos,...) % Create a Labels structure for one movie from input cocos struct. % If the coco structure contains information about which movies were % used to create labels, then this will create a Labels structure % from data corresponding only to movie imov...
8fa558fe0f6d2aa09c538e956b9907fd8ab470cbf5a2364205104f18a1042d3a
MATLAB
3,670
165
% 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,...
6a398457ed2c6c0e66a67929184f850f0651479d7ea1cbd4c99830c42a60e5b6
MATLAB
3,672
119
%TTENSOR Class for Tucker tensors (decomposed). % %TTENSOR Methods: % disp - Command window display of a ttensor. % display - Command window display of a ttensor. % double - Convert ttensor to double array. % end - Last index of indexing expression for ttensor. % full - Convert a ttensor ...
22bcb0b5b207ab544b1465cd7cb9730ddc7eecc609098779c6e8e9f0bcd6dce0
MATLAB
3,674
65
function correlational_analysis2_rmoutlier %%The within and across task correlation code subjects=[]; data_info='/gpfs51/dors2/gpc/JamesBooth/JBooth-Lab/BDL/jinwang/PlausGram_9-10/scripts/5mvpa/data_info.txt'; if isempty(subjects) M=readtable(data_info); subjects=M.participant_id; end root='/gpfs51/dors2/gpc/Ja...
dad297b051cff8208eed739295c11d2ec5d7ca14a660a396fdf12cdeda7fb792
MATLAB
3,674
144
% dummy susceptibility analysis % this demo evaluates suscpetibility analyses in the following input-output % scenario: % o = P1*u1 + P2*(u1+u2) + u3*(P3+P4) + u4*P5 + P6. % In other words: % - u1 flows through two parallel branches: u1 --[P1 P2 ]--> o % - u2 flows through one branch: u2 --[ P2 ...
40c3ad20428d15560ae42b271d8683c250ee73600d8ca22e96ebe16ec41c5a02
MATLAB
3,675
115
function LoadIntan(datDir, varargin) % Used to load Intan data files in the "all-channels-in-one-file" format % Will save select channels in .hsd (version 4) format % hard-coded parameters bytesPerSample = 2; saveChan = {'C-108'}; % ECog = C-108 saveChan = {'S23_E04'}; % default parameter settings timeRange = [0 In...
690d44adcd563a14bd1f5c8196715785b5092cff088a4ef845bf1797ccaa4b39
MATLAB
3,680
155
% 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,...
a8b2a6284ea9279b99ff97906488368049cbabf84938c2c9636e2d92d43eaae3
MATLAB
3,680
73
function [tps3dwarp_max_run_jobs,tps3dwarp_max_pool_size] = concurrency_size_in_TPS3DWarping(cond) loadParameters; num_rounds = params.NUM_ROUNDS - 1; if ~isfield(params,'TPS3DWARP_MAX_RUN_JOBS') round_list = 1:params.NUM_ROUNDS; round_list(params.REFERENCE_ROUND_WARP) = []; avr_n...
746817e68473824febd9363248c6d46526809e0e34721670e109cda3f7ff5fa1
MATLAB
3,685
117
function meg_msFigs_ITPCbyITI_TS % function meg_msFigs_ITPCbyITI_TS % load groupITPC_ITI %% 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; saveFigs = 1; cueLevel = {...
7717468dea0cefd8d32a1b83647642874c7ef36c5dafaebce33e1889e6fef7ee
MATLAB
3,685
86
function [EEGperiods] = DS_getEEGperiods(EEG,PARAM) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Extract EEG periods of a certain sleep stage label % % Part of detect_spindles toolbox: % % Authors: Stephane Sockeel, PhD, University of Montreal % Stuart Fogel, PhD, Universi...
3076a548e90c8288bed4c852eaae3ba748035ea41f945e0cfac70b6f5bedf235
MATLAB
3,686
112
function [elec] = read_bioimage_mgrid(mgridfile) % READ_BIOIMAGE_MGRID reads BioImage Suite *.mgrid files and converts them % into a FieldTrip-compatible elec datatype structure with electrode % positions in xyz coordinates (equals voxel coordinates in mm) % % Use as % elec = read_bioimage_mgrid(filename) % where th...
91f463ab5aa0753619d5e461988c28691851efcb31a13dd0d425a1ea3f2eb319
MATLAB
3,686
99
% Source-target evaluations on the unit sphere, Laplace kernel. % % This example computes the interactions between random source and target points % on the unit sphere via the Laplace kernel. The associated matrix is % rectangular and real. % % This demo does the following in order: % % - compress the matrix % - ch...
cbe28765c4e7b7f557e4a824d9cba40ad09e3d8100121e799e78b6bbc389a5ca
MATLAB
3,686
110
%% SAT - app_input:: %% concatenateFile % Name: Phone Kyaw % Date: 09/19/2024 % Description: Transferring multiple XT/PP files into one single concatenated file % If input as 1, it will create "xt.csv" % If input as 2, it will create "pp.csv" % Parameter: file_type - Ac...
f03e733aca362a257f194759541dadcc4e5bc8aac3dae3ee2348b36f79cab9a1
MATLAB
3,686
119
function [W, varargout] = jacobian_stnd_BLT(mesh, varargin) % Same format as femdata_stnd_BLT % % Part of NIRFAST package. % S. Wojtkiewicz and H. Dehghani 2018 %% check in/out narginchk(1,3); nargoutchk(0,2); %% get optional inputs, handle variable input % default solver = get_solver; OPTIONS = solver_option...
4015f16c5a334efda02967b6821e7b7939520bbcfd5151758a30780cba254a4a
MATLAB
3,687
88
% Compute the within-area shared dimensionality, by performing Factor % Analysis to get the shared covariance matrix, and then assessing % dimensionality (1) through the participation ratio measure, and (2) by % determining how many dimensions are needed to explain >95% of the shared % variability. % INPUTS: % data ...
8ab6304b42a1d0ded8876f502935db51cd0cb857f3721a39ccea41392598be9f
MATLAB
3,687
117
function [proj] = elproj(pos, method) % ELPROJ makes a azimuthal projection of a 3D electrode cloud % on a plane tangent to the sphere fitted through the electrodes % the projection is along the z-axis % % [proj] = elproj([x, y, z], 'method'); % % Method should be one of these: % 'gnomic' % 'stereographic' ...
b1801f9a70193194086dffbb6ecfd90683d8cf01209d4ab979fb15c3a4e87e25
MATLAB
3,687
118
%%% Scope: Calculating participation coefficient and within-module degree z-score %%% Author: Jonas A. Thiele %%% Date: 18.07.2023 %%% Uses functions from the Brain Connectivity Toolbox from: %%% Complex network measures of brain connectivity: Uses and interpretations %%% Rubinov M, Sporns O (2010) Neur...
e5977e1d505c7a95588aa1cebb5c6b92895ee5e804906b1d28f9f038610d9410
MATLAB
3,687
101
% registration_across_days.m % Sarah West % 8/23/21 % Modified from SCA_manual_masking.m, just the registration across days % parts function []=registration_across_days(parameters) % Assign parameters their original names dir_exper = parameters.dir_exper; mice_all = parameters.mice_all; transfor...
f8d587a6ccfd29a329522ee47159883d663c75bedb8db07d1039e396c902aba1
MATLAB
3,687
117
function [proj] = elproj(pos, method) % ELPROJ makes a azimuthal projection of a 3D electrode cloud % on a plane tangent to the sphere fitted through the electrodes % the projection is along the z-axis % % [proj] = elproj([x, y, z], 'method'); % % Method should be one of these: % 'gnomic' % 'stereographic' ...
99ae9662a4ef1e97bd3679f0f92a972d5b7af9b6661b20f21601179c8286f760
MATLAB
3,688
115
function model = depnetFit(X, varargin) %% Fit structure of a dependency network % % Input: % X is an N*D matrix of binary (0/1) or {1,2} % Optional args % 'method' - {'ARD', 'MI', 'L1CV', 'L1MB'} % maxFanIn - only used by MI % % Output: % model.G(s,t) = 1 if s depends on t (sparse) % model.W(s,t) is some measure of th...
1e0494d79e071641d8b1e02d2a0b61548f3bf698665cdd0a249008a18973b052
MATLAB
3,690
82
function results = EstimateStmFromPhotocurrent(params) % The EstimateStmFromPhotocurrent function inverts the photoreceptor model to % estimate the stimulus that would cause a given photoreceptor output. This is % achieved by using the impulse responses and model parameters to % reverse-engineer the stimulus from the p...
840792391ae79dbadef3175fa16011b1756a631472015a67f7ab07f2450b5d8e
MATLAB
3,691
88
function varargout = jbm_patchTemplate(varargin) % JBM_PATCHTEMPLATE M-file for jbm_patchTemplate.fig % JBM_PATCHTEMPLATE, by itself, creates a new JBM_PATCHTEMPLATE or raises the existing % singleton*. % % H = JBM_PATCHTEMPLATE returns the handle to a new JBM_PATCHTEMPLATE or the handle to % ...
65ce50b6e8ae6762c094f5e3b2e9fd893b8932d46ea2bf5206092cc8decfd44e
MATLAB
3,693
121
function CorrMatrix(spkDat, varargin) clustList = setdiff(unique(spkDat.id), 0); clustListIn = clustList; timeRange = [0 Inf]; plotRange = [-100 100]; binWidth = 1; showAuto = false; nSamp = 1000; for i = 1:2:length(varargin) switch lower(varargin{i}) case 'nSamp' nSampTarget = varargin{i+1}; ...
7a4a4ebb146905d73413fd6bfd61d400717bf0ef38bded6e247da9fb6fb79cc9
MATLAB
3,693
102
function [dat] = read_nex_data(filename, hdr, begsample, endsample, chanindx) % READ_NEX_DATA for Plexon *.nex file % % Use as % [dat] = read_nex_data(filename, hdr, begsample, endsample, chanindx) % % See also READ_NEX_HEADER, READ_NEX_EVENT % Copyright (C) 2007, Robert Oostenveld % % This file is part of FieldTri...
d2bde500ccac7615f87aac78c505759a88db9a443f9c64ea9fa3b11af9a4b408
MATLAB
3,694
161
% 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,...
1c0ca5beff482fd24b2a0a7bbfce2c4196270edb3012048d4e08ea8ad1c1b71d
MATLAB
3,695
130
function [estimates,posterior,out] = SEM_analysis0(Y,A,B,C,flag) % structural equation modelling (bayesian stats) % FORMAT: function [estimates,posterior,out] = SEM_analysis0(Y,A,B,C) % This function assumes a GLM of the following form: % Y' = A*Y' + sum_i B{i}*Y(i)*Y' + C + e % where e are normal iid residuals. % IN: ...
fb16a32c318f4a535e59f156bb1a7e694eb04c0de8f63516ad9f81a34a4e0400
MATLAB
3,695
68
% IntgradFgradG_tet4_CPU carries out a spatial convolution of gradients 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] = IntgradFgradG_tet4_CPU(MESH,DATA_1,DATA_2) % [J_BORN] = Intgra...
df5db52d4d22441c0a13875f2a1f7fe6cb0b362b861a09a44eb63cf9ff48ca15
MATLAB
3,696
166
% 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,...
68c63b92c8b70c08daaeec93c27ca28db4d4daa33a3c7f7d8bd2911155cc1bbf
MATLAB
3,697
105
%----------------------------------------------------------------------------------------- % Plot odor decoding performance per recording session % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 2e % Author: Marcel Kehl % License: MIT License %-----------------------...
80930fcd9732ed2d89b71fa9888a0887bcbf846cf3e7c424471920222a88ad63
MATLAB
3,697
82
function TSsequencer(arg1,arg2) % This function is called by the timer. It calls the DailyAnalysis function % for each experiment in ActiveExperiments. Dr = cd; clear global Experiment load('ActiveExperiments.mat') % This is a cell array created and updated by % TSstartsession. It has one row of cells for e...
b2310fbf59018ccc0f15b3105d9b6438bd19c7f21c215f4f7843b825cc6331bd
MATLAB
3,697
116
%% THIS WORKS ONLY FO 2x2 MATRICES! %% 1) X1 figure('Position', [50, 50, 700, 450]); % X1: A1 e A3 neuron_index1 = 1 ; % A1 neuron_index2 = 3 ; % A3 % estrai indici e calcola matrice cluster_indices = [ find(som_clusters == neuron_index1) ; find(som_clusters == neuron_index2) ]; cluster_matrices = connect...
80f0e64ebcea211e7ab6074115a5b5689b304f6d95fbc6057653c3cfca0c86ac
MATLAB
3,698
117
function nRuns = rd_segmentSqd(fileName) % % function nRuns = rd_segmentSqd(fileName) % % Chunk data into smaller segments. Segments data between runs, based on % triggers. % % Rachel Denison % September 2014 %% setup % file in % exptDir = '/Local/Users/denison/Data/TAPilot/MEG'; % sessionDir = 'R0890_20140806'; % da...
d3a1ffafc9d7d92440a19d0308c67a3e840f4f345a47c1369ddee4e46f7d920d
MATLAB
3,698
117
% read_eeglabevent() - import EEGLAB dataset events % % Usage: % >> event = read_eeglabevent(filename, ...); % % Inputs: % filename - [string] file name % % Optional inputs: % 'header' - FILEIO structure header % % Outputs: % event - FILEIO toolbox event structure % % Author: Arnaud Delorme, SCCN, INC, ...
5b613d9a48cd17e97f226e81e25c31a4ada3013b9fec9ebbfdfdbbe605ef789b
MATLAB
3,699
96
% RestoreSources.m % Sarah West % 3/30/22 % Plots all the sources you removed with the RemoveArtifacts.m code and lets % you restore some that you might have removed by accident. function [parameters] = RestoreSources(parameters) % Inputs: % sources -- a 3D matrix (pixels, pixels, source #) of all the sources you dr...
25778d04f2b909fde53d5fd2db9fe73a06da672fea4827431b62681745c9f74f
MATLAB
3,701
96
function [EEG,com] = pop_PAA(EEG) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % EEGlab GUI for Period Amplitude Analysis (PAA) on EEGlab data to % detect and measure slow waves. % % Copyright, Sleep Well. https://www.sleepwellpsg.com % % Method adpated from: % % Feinberg et al, 1978....
4809e9608059c51e767e17c9e16cf4eead7ce610af4bc957869d531ac03fb65e
MATLAB
3,701
105
% Second-kind integral equation on the unit square, Laplace single-layer. % % This is the same as IE_SQUARE2 but using HIFIE2X. % % Inputs (defaults are used if not provided or set empty): % % - N: number of discretization points in each dimension (default: N = 128) % - OCC: tree occupancy parameter (default: OCC =...
d82db4fd8d913a1f65c4d54b367c102d723028da621bc0684770948518fa8f5f
MATLAB
3,701
117
function [scalo,f,T,a,wt,wavescaled] = contwtgn(x,fmin,fmax,N,wave); % CONTWTGN [scalo,f,T,a,wt,wavescaled] = contwtgn(x,fmin,fmax,N,wave) % computes a continuous wavelet transform. % % Input: % x signal (in time) to be analyzed % [fmin,fmax] respectively lower and upper frequency bounds of % ...
ee7ff4dda1db7ee708156021c747c8eb08d9e00d5d6bbfe121b0ea952e10cedd
MATLAB
3,701
97
function lrstats = lme_LR(lrmlfull,lrmlred,q) % lrstats = lme_LR(lrmlfull,lrmlred,q) % % Likelihood ratio test for the random effects. It can be used to test if a % model with q+1 random effects is significantly better than a model with q % random effects. % % Input % lrmlfull: Maximum value for the restricted log-like...
6345ca109ed1893344f45ad20337943e4a107b35dcc65f78847cd43f9fbcceb9
MATLAB
3,703
169
% chunks data into segements % ignores data that is smaller than the chunk size % % usage % data = crabsort.analysis.chunk(data) % data = crabsort.analysis.chunk(data, neurons) % data = crabsort.analysis.chunk(data, neurons, ChunkSize) % data = crabsort.analysis.chunk(data, neurons, ChunkSize, dt) % function cdata = ...
7c405abc1b3495471d910360b3f115f865d37ec2faa2488f04d149b997b6dbdd
MATLAB
3,704
151
function [pls_repro,splitflag]=split_half_PLS_TestTrain(x,y,n_con,numsplits,null_flag) %[pls_repro,cca_repro,splitflag]=split_half_PLS_TestTrain(x,y,n_con,numsplits,null_flag) %n_con= number of conditions %numsplits: number of split half samples %null_flag: save distributions 1=true default=0 % % Uses a test-train loop...
a7ba53d789982c6c80670138a84b5c9ac62ae0157948ecc7f29f824f77c93970
MATLAB
3,704
122
% Tot pyr figure [data] = extract_variables ('pair_corr','tot',resultsPath, 'pyr'); for recCounter = 1:size(data,2) data_mdn(recCounter) = median(data{recCounter}); end data1 = data_mdn(contains(layer,'deep')); data2 = data_mdn(contains(layer,'sup')); subplot(331) arrange_boxplot(data1,data2) title('Whole recording...
c94529f5f297bad5d26c4ada08fd4199d5162474e18baa6083eb1c63e7a29d12
MATLAB
3,704
154
function [verbose,verboseI,debug,doPlot,maxFunEvals,maxIter,tolFun,tolX,method,... corrections,c1,c2,LS_init,LS,cgSolve,qnUpdate,cgUpdate,initialHessType,... HessianModify,Fref,useComplex,numDiff,LS_saveHessianComp,... DerivativeCheck,Damped,HvFunc,bbType,cycle,... HessianIter,outputFcn,useMex,use...
2688a860c92a1285a658c18e58774582342302fb6a97bbbfb87d11a3c4eab976
MATLAB
3,705
126
function data = fixsampleinfo(data) % FIXSAMPLEINFO checks for the existence of a sampleinfo field in the % provided data structure. If present, nothing is done; if absent, % fixsampleinfo attempts to reconstruct a sampleinfo based on either an % trl-matrix present in the cfg-tree, or by just assuming the trials are %...
2a022f3adc7c0c177d43c01d9ca463ccb5801040572794262aca3d6d7d3796e1
MATLAB
3,707
117
function meg_Fig5c_TE_byPrecue_mdlFit_freq_bar % function meg_manuscriptFigs_TE_byPrecue_mdlFit_freq_bar % Plot model fits (linear+periodic) free frequency by precue (All trials, % precue T1, precue T2) % Plots Fig 5c %% Load data filename = 'figData/ModelFit_freeFreq_session.mat'; load(filename) %% Figure settings...
dbf9767c34322a2d2b1b8ef65a87d78dad97e6e40ff3750199042fcfe42d7818
MATLAB
3,707
1
function [ SUCCESS , ExperimentID, SubjectID, Phase, Box, MatlabStartDate,... Duration, TSdata, Notes, Weight, Program, FileReportedUnits ]... = TSload2ColAndHeader (filename,delimiter) % % Assumptions: % File is tab delimited % Dlm file forms a 2 column matrix % First 12 rows are various session fields w...
f8686ff2d6cdb77e67a89aa6af98401027396bf58c1eb709ff7414d68142e031
MATLAB
3,707
85
function [s, cfg] = ft_statfun_diff_itc(cfg, dat, design) % FT_STATFUN_DIFF_ITC computes the difference in the inter-trial coherence between % two conditions. The input data for this test should consist of complex-values % spectral estimates, e.g. computed using FT_FREQANALYSIS with method=mtmfft, wavelet % or mtmconv...
e7d206e2d145475d36b83a66cae3177c0e524fc4e96bc3e316ab7ff6cb478630
MATLAB
3,708
122
function [] = measurementErrorPruned(F,mask) mask = double(mask); nanMask(mask==0) = NaN; nanMask = cat(3,mask,mask); sizeImg = size(F); F = F.*nanMask;%Ignore transform vectors that map from parts of specimen with no features n = 0; Freshaped = NaN(size(F,1)*size(F,2),4); for i = 1:size(F,1); for j = 1:size(F,...
1a62f8715218a2bd25b1f5cfec23e9ec7922a454619994b9d7bbe720a2753ed6
MATLAB
3,709
121
function meg_manuscriptFigs_sessionPhaseConsistency % Polar plot of the fitted phase difference by precue % Session 1 v Session 2 % Mean phase difference ± 1 SEM % % thetaregion requires Matlab R2024a or above %% Load data user = 'kantian'; % Model fit data filename = sprintf('/Users/%s/Dropbox/github/ta-meg-ana...
9c74b6b2accdbd9f646be81dd428faa77f6c36c0b492d07594b2dd30f249d557
MATLAB
3,709
160
function newmatrix = wlAux_splitEvMatrixByBand(oldmatrix, bandlist) % function newmatrix = wlAux_splitEvMatrixByBand(oldmatrix, bandlist) % % This function sorts an event matrix's events into a new set of frequency % bands. Old per-band lists are merged and repartitioned. Event matrix format % is described in EVMATRIX...
d9de743f437f99919f3ed0cac532c504946ea051352d354404da29771f87d47b
MATLAB
3,709
97
function[slope,intercept,pvalue,IJ,slopevar,intervar] = SSMMDIJ(datasource,datatarget,indexsource,indextarget,itertime) %% The only difference from subsamplingMMD.m is IJ in output that records information needed for calculating IJ variance. slope = 0; intercept = 0; %% This step determines the subsample size. tmp = t...
b1d65df6fbf2e39a7becd17e2babef9a1bf71e5c9bf505ddf8e5877d9b870a16
MATLAB
3,714
99
%function [xml, rxml] = LoadXml(FileBase) % % loads the xml file using xmltools (have to have it in the path) % rxml returns it's original layout - very messy structure but contains all % the xml file contents. % xml - is the ouput structure which is backwards compatible to LoadPar % output, so you can use it instead ....
42160aab34acc6d117ffa1719b6e2d8e8c3177abc8d3fbffd45d91a4118d5782
MATLAB
3,715
116
% Hypothesis 3: STA % Perhaps this is the 'change' of state? (i.e. spike-effects); %_______________________________________ % Copyright (C) 2024 Trevor S. Smith % Drexel University College of Medicine % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Pub...
a77861692284a1d49b402586578cae5add1f046cdeb670c9927a3b620a685088
MATLAB
3,715
106
function [mvar] = ft_datatype_mvar(mvar, varargin) % FT_DATATYPE_MVAR describes the FieldTrip MATLAB structure for multi-variate % autoregressive model data. % % The mvar datatype represents multivariate model estimates in the time- or % in the frequency-domain. This is usually obtained from FT_MVARANALYSIS, % optiona...
a9369fd5d42c57929f16da575e11d9168207deec0f061bae2f69050759c2f299
MATLAB
3,715
169
% 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,...
c769c9bff690fee745c13a9b7159069514f023e9f5105bf3206fd2060f471ab7
MATLAB
3,715
105
function 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 GNU General ...
d833ae866ff00e200f5af4013e61f3c5e834f8d91ae8b4f1e005ac9fd9f4d18b
MATLAB
3,716
153
% 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,...
0d0294e2e48dc2f3dc719856dd9eb11f87b2ced2fdc28ac89e6aff021d2c9c43
MATLAB
3,720
105
% Description: % This script initiates a full biophysical model for a specified type of photoreceptor. % It generates the photoreceptor's response to a small, or dim, stimulus. % This response is then used to fit a linear model of the photoreceptor, % and to extract the coefficients for the linear model of the photorec...
83b91483d50b28efb6f4bf39d19d0ea486a324b957878a684428f4148be04950
MATLAB
3,720
96
function M = GeoMedian(X, Precision) % M = GeoMedian(X, Precision) % % Calculate the geometric median: the point that minimizes sum of % Euclidean distances to all points. size(X) = [n, d, ...], where n is % the number of data points, d is the number of components for each point % and any additional arr...
eb5696c20151a2d46a4a9abb96f595adb2c0783824e9620f4c83fb7677232775
MATLAB
3,720
94
function [spectrum, freqoi] = ft_specest_neuvar(dat, time, varargin) % FT_SPECEST_NEUVAR computes a time-domain estimation of overall signal % power, having compensated for the 1/f distribution of spectral content. % % Use as % [spectrum,ntaper,freqoi] = ft_specest_neuvar(dat,time...) % where % dat = matri...
3dbae1d320dc92f6cf17f9db4f8238169d2b244565da3d21cce76baa28e3939c
MATLAB
3,721
126
function [] = sam_svl2spm_command_smd(mrilist, svllist, num) % sam_svl2spm_command(mrilist, svllist, num) % mrilist(ii).names contains full path to mri % svllist(ii).names contains full path of each svl file to be normalized % If there is more than one svl file per mri they should be organized into % an mXn matrix whe...
3f5f601b0818fd1ccb9dceaa2b07405faed054b29bbd515d733da8d95e7279f3
MATLAB
3,721
122
function [magn] = read_ctf_sens(filename) % READ_CTF_SENS reads MEG sensor information from CTF configuration file % % magn = read_ctf_sens(filename) % % where the returned structure meg has the fields % magn.pnt position first coil % magn.ori orientation first coil % magn.pnt2 position second coil % m...
571f9b57a05bdfba403c86df1379f80f4348c7ccfd86ac7a24c3f059da13e5ea
MATLAB
3,721
114
function [datout, tim, Fnew] = ft_preproc_resample(dat, Fold, Fnew, method) % FT_PREPROC_RESAMPLE resamples all channels in the data matrix % % Use as % dat = ft_preproc_resample(dat, Fold, Fnew, method) % where % dat = matrix with the input data (Nchans X Nsamples) % Fold = scalar, original sampling freque...
abced38ad89e199860cbf8f10311420d0d4b5fb4f5533a3300d3095399fa4e8d
MATLAB
3,721
112
function [newbnd] = mesh2edge(bnd) % MESH2EDGE finds the edge lines from a triangulated mesh or the edge % surfaces from a tetrahedral or hexahedral mesh. An edge is defined as an % element that does not border any other element. This also implies that a % closed triangulated surface has no edges. % % Use as % [edge...
4cde3aa5e8b731215f23c6b4bf3befb0ed4785e6de126c52fb5cc4391a9aaf48
MATLAB
3,722
96
function [ALLEEG] = PAA_batch() %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Build EEG structure from multiple EEG datasets to batch run PAA % % Contact: sfogel@uottawa.ca % % Date: May 6, 2020 % % Citation: Ray, L.B., Sockeel, S., Soon, M., Bore, A., Myhr, A., % Stoja...
bbe913c5e8d7479b5cf3397dbc258c9b5aa3b560a97dce387000dabb3c9576b8
MATLAB
3,722
66
function [Data, VoxelSize, Header] = y_ReadRPI(FileName, VolumeIndex) %function [Data, VoxelSize, Header] = y_ReadRPI(FileName, VolumeIndex) % Read NIfTI image in RPI orientation -- for NIfTI files without rotation in affine matrix!!! % Will call y_Read.m, which does not adjust orientation. % --------------------------...
3fcdaf3044e4ddc3f3a11a1e8bc743d8953062a1d0f856298ca8ce7f41ef496c
MATLAB
3,723
106
% Plot SVM Performance %---------------------------------------- % Description: % This function visualizes the SVM performance for AI-optimized non-invasive % brain stimulation dosing and treatment response prediction for major depression. % It provides plots for ROC curves, AUC comparisons, and confusion matrices. % ...
d845ad54cb7ec9a22718cba63e29adb86b13f8bb16234d9eb0b630dc6176fdf4
MATLAB
3,723
114
function [datout, tim, Fnew] = ft_preproc_resample(dat, Fold, Fnew, method) % FT_PREPROC_RESAMPLE resamples all channels in the data matrix % % Use as % dat = ft_preproc_resample(dat, Fold, Fnew, method) % where % dat = matrix with the input data (Nchans X Nsamples) % Fold = scalar, original sampling freque...
78e412c1938475c021a7e282b26b22f185d0b78ecc6c4509c8dbe4f43cd8e366
MATLAB
3,725
1
function [ SUCCESS , ExperimentID, SubjectID, Phase, Box, MatlabStartDate, Duration, TSdata, Notes, Weight, Program, FileReportedUnits ] = TSloadstdxls ( filename ) % % Assumptions: % File is readable by Matlab's xlsread command % Data are in 1st & 2nd cols of the spreadsheet % First 12 rows are various session f...