sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2b0c3c950e6af9cfea080cc6d103ca6061908696e4c55d2515bd1f33b1c37b68
MATLAB
3,726
91
% Written by: Adam Wright % Last modified: 20241008 % This is the main script to run the data-driven segmentation of the major % cerebral arteries and the SSS. % Make sure that all the functions in the package are all added to your % matlab path. Including: % freesurfer from: https://github.com/freesurfer/freesurfer...
637cd7996f9009cffcbc510931575a612b0fbba5ab4a043b1dd359679c197759
MATLAB
3,726
77
%% Description % In this example, we show that MCmatlab can launch excitation photons from % a user-specified spatial and spectral distribution of sources, similar to % how fluorescence photons are launched. The distribution may be wavelength % dependent. It is stored in model.MC.sourceDistribution and must be 3- or % ...
c1a51d8c3552b9a737ba5cda59dd3e75169dcbf928eec1ab7508df7cd6ab4ff2
MATLAB
3,727
146
function [xmax,imax,xmin,imin] = extrema(x) %EXTREMA Gets the global extrema points from a time series. % [XMAX,IMAX,XMIN,IMIN] = EXTREMA(X) returns the global minima and maxima % points of the vector X ignoring NaN's, where % XMAX - maxima points in descending order % IMAX - indexes of the XMAX % ...
cfa6bb4336da14b3be24de8f25c4d473b0081f7a7702bbdec36faa1addb893d5
MATLAB
3,727
117
function mappedX = gda(X, Y, no_dims, varargin) %GDA Perform Generalized Discriminant Analysis % % mappedX = gda(X, Y, no_dims) % mappedX = gda(X, Y, no_dims, kernel) % mappedX = gda(X, Y, no_dims, kernel, param1) % mappedX = gda(X, Y, no_dims, kernel, param1, param2) % % Perform Generalized Discriminant Analys...
9b97064fc7d505e646b76905dc9335bfda1600fdcf80903f934c0d2294520298
MATLAB
3,729
118
% 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, ...
25b4f7d149818489599bcac5da43583ac214cb9a88a141ec36bb15767832efd1
MATLAB
3,730
115
function tag = TagCheck(laserResponse, varargin) altIsi = []; sampPerSec = 500; responseWin = 10; % milliseconds makePlot = false; ctrlIsi = []; fig = []; for i = 1:2:length(varargin) switch lower(varargin{i}) case 'isi' altIsi = varargin{i+1}; case 'responsewin' responseWi...
2b57cde96f0e6a5d595aef3f98412f45aa87c0b1e16833a324a60400c22a4148
MATLAB
3,730
100
function plot_paths_for_dataset(dataset_path, save_path, varargin) %PLOT_PATHS_FOR_DATASET Generate and save behavioral path plots for each session. % % plot_paths_for_dataset(df_path, save_path, exclude_task_string) loads session % metadata from the given df_path, filters out sessions containing the specified % ...
3157c1c420d7db7791baa429a5b4af04b056a44c0510439ae8a7f9703b8a65bf
MATLAB
3,730
101
function [phaseamplitudemap,ampfreqs,phasecenters] = bz_PhaseAmplitudeDist(lfp,phaserange,amprange) % [phaseamplitudemap,ampfreqs,phasecenters] = bz_PhaseAmplitudeDist(lfp,phaserange,amprange) %This function calculates the mean amplitude of higher frequency bands at %a the phase for a given lower frequency band signal ...
fd4c949cb53aa6e1976d33f67a5cf89cc169f93ad317e3b6f211991913ecd32e
MATLAB
3,731
132
function good_idx = manual_trackerjumps(ts,x,y,StartofRec,EndofRec,basepath,varargin) % manual_trackerjumps: Allows you to manually cut out xy coordinates that % are outside the bounds of your maze. These can be caused by unplugs or % if the rat jumps out. If you do not remove these points, your ratemap % will be messe...
8c1623c68d489cc955c9cd3f43d9e6bff3a28c9a7e4fec09435da64360d359f6
MATLAB
3,732
114
% AUTHORSHIP % Primary Developer: Stephen Meehan <swmeehan@stanford.edu> % Math Lead & Secondary Developer: Connor Meehan <connor.gw.meehan@gmail.com> % Bioinformatics Lead: Wayne Moore <wmoore@stanford.edu> % Provided by the Herzenberg Lab at Stanford University % License: BSD 3 clause % function [ uma...
ca8d4cca746cb17da1285a8b6d890471c0c3f86251d6341e4ca78a5eaa7e70f1
MATLAB
3,732
122
% Author: Birgit Nierula % nierula@cbs.mpg.de function esg_prepro_loop5(subject, condition, srmr_nr) %% set variables subject_id = sprintf('sub-%03i', subject); analysis_path = [getenv('ANADIR') subject_id '/esg/prepro/']; cfg_path = getenv('CFGDIR'); % get condition info [cond_info] = get_conditionInfo(condition, ...
111a4b475d39081b78a586288318382d39b6ba0251e8b8c127fd9ef006447ab4
MATLAB
3,733
65
function [PC, integralpd] = meshneighborints_Pn(P, t, normals, Area, Center, RnumberP, ineighborP, Indicator, numThreads) % Accurate integration for electric potential on neighbor facets % Done for a selected interface only ("Indicator" variable is used) % Copyright SNM 2018-2022 N = size(t...
41e7f3fe24c48512638f3569a084392d5e407fa77aa4a34854a837a0ef6e11c3
MATLAB
3,733
1
function [ SUCCESS , ExperimentID, SubjectID, Phase, Box, MatlabStartDate, Duration, TSdata, Notes, Weight, Program, FileReportedUnits ] = TSloadstdcsv ( filename ) % % Assumptions: % File is tab delimited % Dlm file forms a 2 column matrix % First 12 rows are various session fields with indicator numbers on the ...
4ba94bcabf9bd66b45f85e2c2c078418e09d51fc75b06f17569c0803f0931b6e
MATLAB
3,735
110
% FADE-SAME: Table S3 % clear % clc %%% Step 1: load data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % set subjects file subj_file = 'subjects/subjects.xls'; str_cohs = {'young', 'older', 'middle-aged', 'replication'}; % load subjects file [num, txt, raw] = xlsread(subj_file); clear num txt tab_hdr = ...
c743847877bded394750ff72d87a7d1a2e58d8d6881424c5fae987eb916d39a3
MATLAB
3,735
91
% MATLAB code provided by Seyed Mohammad Ali Rahmati % Affiliation: Biomechanics and Motor Control Lab, Department of Biological Sciences, Georgia Institute of Technology, Atlanta, GA. % % Description: % This M-file calculates the maximum musculotendon forces and moments % resulting from maximum activation during loco...
a53733c07d556e84b502ee099f691fe9f65fef0112dc8edc06e4620beb8abefd
MATLAB
3,736
133
% This script visualized the quality of the transcripts and creates a mask % that can be applied to puncta to remove registration+experimentnal % errors in the base calling %% Load all necessary data %load the flags_vector mat file load('slice.mat'); %Load transcript files that contain pos, transcripts, %transcri...
24b4149ceb1008cac22fbd1db5b1be6cea9b8df9dcfb6c9535c0045e139861cc
MATLAB
3,737
132
% [mu,idx,mu_idx,Dall,mindists] = furthestfirst(x,k,p1,v1,...) % % x: N x D matrix of data to be clustered. N is the number of data % points, D is the number of dimensions % k: number of centers % Optional PVs: % - Start. Either [1xD], 'mean' (default), or empty. first center. If % empty, a random point is used ...
64c606afe117ff5da81d2fea26ee5ad17a0aba8a770738e8b285f570eb58c749
MATLAB
3,737
101
function Aout = h_generateLineProfile3(handles) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); % state = currentStruct.state; data = currentStruct.image.data; if isfield(currentStruct, 'lastAnalysis') && isfield(currentStruct.lastAnalysis, 'tracingData') tracingDat...
8b28564937c09c4fc9642212f9bf32ffe3832ca62067f69f954df3ce2e5c749a
MATLAB
3,737
94
function segmentation = fixsegmentation(segmentation, fn, style) % FIXSEGMENTATION is a helper function that ensures the segmentation to be internally % consistent. It is used by FT_DATATYPE_SEGMENTATION and FT_DATATYPE_PARCELLATION. % % % See also CONVERT_SEGMENTATIONSTYLE, DETERMINE_SEGMENTATIONSTYLE switch style ...
da1f25a78f535869a5b83ecaaed9c7155a10e433b1bf22ad756482f37937137f
MATLAB
3,737
121
% function [im_post_pystripe] = pystripe(input_img,sigma_background,sigma_foreground,threshold) % % p = inputParser; % addOptional(p,'sigma_background',1024); % addOptional(p,'sigma_foreground',128); % addOptional(p,'threshold',-1); % addOptional(p,'crossover',10); % addOptional(p,'wavelet','db5'); % addOptiona...
ddb35ed569c28601e258a1f4ea7189016d20818d51d364df2f6482416e067785
MATLAB
3,737
87
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% step1_charge_engine.m %%% %%% Perform the forward field computation for the selected dipole %%% %%% Please make sure that the patient, model, and dipole are loaded %%% %%%%%%%%%%%%%%%%...
de726df16d22e052527399d6cf0b9f40551e34f83709cc1ea9b14b0167c83fdf
MATLAB
3,737
124
%% plot_px_v_x_waterfall % % Accessory plotter used to help visualize the mapping between an prespike % and postspike distribution, using average p(x|x,s). Here, visualized as a % ribbon plot/waterfall % % This function could be applied to observed or predicted distributions; % all which is requried is p(x|(s-d...
1d1489a310151e40b1934f1631dd0ea91f316b975b55e7be25687080d3b09089
MATLAB
3,740
116
function stats = compute_stats(res, args, resdir) % STATS get stats from the Mapper Graph % % :param res: the results from running Mapper % :type res: Mapper struct % % :param args: extra details to help create the stats % :type args: struct % % :param resdir: where to save the resulting plots and matrices % :type resd...
fd36b4f12112dbd86e406875fa9e0aab600131a86175546f2f932d11a6ebdb4f
MATLAB
3,741
94
% Fix possible splitting of responses between two consecutive frames % Version 2 - accumulate everything from one frame to the next function ImageArray_2 = FixSplitting3(ImageArray) ImageArray_2 = zeros(size(ImageArray)); FirstIndex = 1; LastIndex = size(ImageArray,3); First...
02f5919a97fe2447412488494a5e03553aedf6e32f4a7f8adc5ab929426e4b77
MATLAB
3,743
99
function vargout=subplot_tight(m, n, p, margins, varargin) %% subplot_tight % A subplot function substitude with margins user tunabble parameter. % %% Syntax % h=subplot_tight(m, n, p); % h=subplot_tight(m, n, p, margins); % h=subplot_tight(m, n, p, margins, subplotArgs...); % %% Description % Our goal is ...
3c79f22c02974fdfae56cd13c3be84ac1f8b1ef92413e721ef4b6cff67914f29
MATLAB
3,743
108
function varargout = DPARSF_ChooseGUI(varargin) % DPARSF_CHOOSEGUI MATLAB code for DPARSF_ChooseGUI.fig % DPARSF_CHOOSEGUI, by itself, creates a new DPARSF_CHOOSEGUI or raises the existing % singleton*. % % H = DPARSF_CHOOSEGUI returns the handle to a new DPARSF_CHOOSEGUI or the handle to % the exis...
a29989ffb9f68d8a1dca9df875ccd0bc97b6c84dc88e1c917c93f6eec3fe4dd8
MATLAB
3,743
116
% Calculating Correspondences % This is the code that calculates the keypoints and descriptors at % varying scale levels % % INPUTS: % moving_run: which expeirment do you want to warp accordingly? % OUTPUTS: % no variables. All outputs saved to params.registeredImagesDir % % Author: Daniel Goodwin dgoodwin208@gmail.co...
50c3150234502bb12e3dd3c3fc089fe750fe5a9496f636540b9f5f0943bfc6d3
MATLAB
3,744
80
function h_pasteROI3(handles) global h_img3; roiobj = findobj(handles.imageAxes,'Tag','ROI3'); annotationROIObj = findobj(handles.imageAxes, 'tag', 'annotationROI3'); bgroiobj = findobj(handles.imageAxes,'Tag','BGROI3'); h = vertcat(roiobj, annotationROIObj, bgroiobj); textHandles = zeros(1, length(h)); fo...
e44e4fb93bf0ef4dad1afabcc4f4f30f3ddd33112825e5f5ab64a685a9369146
MATLAB
3,745
109
function [fx] = f_metaToM(x,P,u,inF) % evolution function for meta-learning (k-ToM vs sequence) % function [fx] = f_metaToM(x,P,u,inF) % This function update the belief of an agent who has to identify whether % he faces an intentional agent (k-ToM) or an inanimate patter (sequence). % Learning here derives from VB-Lapl...
5c1f9713fcc7f5453b658d89275775f1d0c51a522a510240cc553c39d469e3e4
MATLAB
3,746
104
function dspaceApp = start(varargin) % START Starts an instance of the Dataspace GUI. Use this to start % Dataspace. Can also be used to add all paths required to the MATLAB search % path. % % It is recommended to use the function dspace() instead. It allows for % more flexible data imp...
9ddfce32fc087fd89b2285f41217fe39eea7b597c8bfb9502512230dabe6f27d
MATLAB
3,746
131
% Author: Birgit Nierula % nierula@cbs.mpg.de function [cond_info] = get_conditionInfo(condition, srmr_nr) %% return info of the different conditions if srmr_nr == 1 % conditions: % 1 = rest, % 2 = median stimulation, % 3 = tibial stimulation, % 4 = alternating median and tibial stimulation s...
2f80fd4a468c454d864ec13edd830edea11ede7d74a8da953c0630ca47219352
MATLAB
3,747
74
if ~exist('save_name'), save_name = 'Calib_Results'; end; fprintf(1,'Generating the matlab script file %s.m containing the intrinsic and extrinsic parameters...\n',save_name) fid = fopen([ save_name '.m'],'wt'); fprintf(fid,'%% Intrinsic and Extrinsic Camera Parameters\n'); fprintf(fid,'%%\n'); fprintf(fid,'%% ...
c59fdf7c13dda357c13f9f7aa2ff52898af353230fe75a3e7e288a45097c1cca
MATLAB
3,747
156
clear;close all;clc; %pkg load image %foldername='new_data_10_30_lin'; foldername='new_data_10_300_lin'; mainfolder=cd(foldername); % Read vascular structure Iv=imread('vessels.png'); Iv=rgb2gray(Iv); mask=Iv>250; % Read leakage source I0=imread('source.png'); I0=rgb2gray(I0); cd(mainfolder); % ima...
d32a78e7ff29fb67bc2e5e8254ad73fbd89a179341bb0c3c987fc5ec12ccb87e
MATLAB
3,747
108
function [EEGdec]=decoding_time(subject) % EEG decoding of Braille letters within-hand and across-hand % Marleen Haupt and Monika Graumann % 22.02.2024 % Input: % subject: string, e.g. '02' % start timer tic % paths addpath(genpath('../code/')); addpath(genpath('../toolboxes/libsvm')); % load timepoints in data t...
0eeca6b6818ddb863c0238be9b28a600b5bcdeabc8972e79f433578254caea45
MATLAB
3,749
84
function params = CBIG_AuthorTopic_InitializeParams(params, alpha, eta) % params = CBIG_AuthorTopic_InitializeParams(params, alpha, eta) % % Initialize the parameters of the Collapsed Variational Bayes (CVB) % algorithm for the author-topic model % % Input: % - params : struct containing parameters of the author-t...
a2a604601c5f13b4c08724c32a47c1156b4e411cf080889f686f2ef50f0c9567
MATLAB
3,750
89
function [ panelfcn, figureId ] = bda_figure( name, design, aspectratioYoverX, widthOnPaper,... figureId, horizontalSpacing, verticalSpacing) % BDA_FIGURE Funtion to simplify the creation of multi-panel figures. % % % --- % Copyright (C) 2020 University Zurich, Sepp Kollmorgen % ...
5f19e2735d69a5eb9e54b1fc319179d93038db49f446422d3285dffc8f897360
MATLAB
3,753
89
function [delta,err] = diffTracker( I0, I1, sig, ss ) % Fast, robust estimation of translation/scale change between two images. % % Approximates the translational offset between two images by assuming the % images lie on linear manifold. Specifically, assumes that if I0 and I1 % are a pair of images related by a transl...
6b88e9fca8d05c9e047171d04f4884f709ddcaaa825b6fabd304c8754c7afe5b
MATLAB
3,753
132
function [beta,r,J,converge] = h_nlinfit(X,y,model,beta0,tol) %NLINFIT Nonlinear least-squares data fitting by the Gauss-Newton method. % NLINFIT(X,Y,FUN,BETA0) estimates the coefficients of a nonlinear % function using least squares. Y is a vector of response (dependent % variable) values. Typically, X is ...
71b97d840de9d1d7cb19e5d23054df347cc5bb83ada5fd44739ce84166e26e6f
MATLAB
3,753
158
function [posterior,out,simulated] = demo_behaviouralDCM() %%% ---------------------------------------------------------------------- %%% ---------------------------------------------------------------------- % close all %----------------------------------------------------------- %-------------- DCM model specificat...
dab65dffd158f569d850c740855c2b87cad17319c1631b49e552c20b90c28e87
MATLAB
3,753
118
function [U]=h3dpartdirect(zk,nsource,source,ifcharge,charge,ifdipole,dipstr,dipvec,ifpot,iffld,ntarg,targ,ifpottarg,iffldtarg) %HFMM3DPARTDIRECT Helmholtz interactions in R^3, direct evaluation. % % Helmholtz FMM in R^3: evaluate all pairwise particle % interactions (ignoring self-interactions) and interactions with t...
50e8d9c7388388f5471618da4a3e67d55032de2c97a83900f97c0662e9edbe10
MATLAB
3,755
130
function spkDat = ManualSplit(spkDat, clust, varargin) signal = 'snle'; timeRange = [0 Inf]; nChan = size(spkDat.waves, 2); chan = []; time = 0; splitThr = 'auto'; bimThr = 0.1; split = false; pol = 1; valRange = [0.005 0.995]; % in quantiles of signal value nYbins = 100; tBinWidth = 10; % seconds tOverlap = 2; % #...
8b0097cbe6322ad7dc0165000800d28b1eab1092a3840425f9e0bf93b0aed90d
MATLAB
3,755
109
function [colormap]=cbrewer(ctype, cname, ncol, interp_method) % % CBREWER - This function produces a colorbrewer table (rgb data) for a % given type, name and number of colors of the colorbrewer tables. % For more information on 'colorbrewer', please visit % http://colorbrewer2.org/ % % The tables were generated fr...
4b6c93abeca417466e28ef50fd55b61bde949dbc5ad4e893948218d03d3cd717
MATLAB
3,756
110
loadParameters; chan_strs = {'ch00','ch01SHIFT','ch02SHIFT','ch03SHIFT'}; for round_num = 1:params.NUM_ROUNDS for chan_num = 1:params.NUM_CHANNELS chan_str = chan_strs{chan_num}; filename_in = fullfile(params.punctaSubvolumeDir,sprintf('%s_round%.03i_%s_puncta.tif',params.FILE_BASENAME,round_num,ch...
648e65a4952e9699461db23be8b20bb27890cc9467d0b67a4f7ef403cb5f9d62
MATLAB
3,758
117
%% This file shows how to use 'saveastiff' function. clearvars; [~,~,Z] = peaks(100); Z = single(Z); Z_index = uint8((Z - min(Z(:))) * (255 / (max(Z(:)) - min(Z(:))))); Z_color = uint8(ind2rgb(Z_index, hsv(256)*256)); Z_alpha = Z_color; Z_alpha(:,:,4) = repmat(0:1/100:1-1/100, 100, 1)*255; Z_color_multiframe = reshape...
e7c2b24b788594ddd91626e64527f5f3e9b5ed57b1ac0fe8d7afdbd549c7830b
MATLAB
3,758
119
function pos = ApproxMedianFilter_RB_LED(file) % This code tests an approximate median filter for separating out the red % and blue leds mounted on top of the subjects head % I was using the DataMax system, which was synced using a red LED. Hence, % I am tracking the x,y position of the animal as well as when the sync...
ec08aa23945b2805346b827b944e5c31509eb835aacfdb3d6c98da54fe21e833
MATLAB
3,758
103
function [s,tBalCats,gPartCatsAdd,prtCat2Split] = stratifiedGroupSplit(... nFold,gBal,gPart,varargin) % Stratified/Partitioned k-fold splitter % % Split data for k-fold xval, trying to balance gBal (approximately equal % numbers of each gBal value in each split), while fully partitioning % gPart (each value of gPart...
86c8852d00c1eaa6c18a5531250d81ce4894b3b56823d5352060a6aad844df2d
MATLAB
3,759
162
% 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,...
c4f8d3401a8302044b51801b35c3d63fa3414ab9926c2031a2ced61d8ea53d32
MATLAB
3,759
187
function [v,diags,parout]=graddiag(M,para); % diagonalizes matrices stored in M(:,:,f) for all f % simplest version: % Input: M NxNxM tensor with N channels and M matrcies to be % diagonalized % para is an optional structure. % para.nite is the number of iterations (default: 1000) % p...
2b40586d257cc747cb7d772a622ee407ac4350c42ff9b2f01d43d94c22a9bb93
MATLAB
3,760
81
% DEFINE_BIFF script to define the known BIFF chunk types % % This function should not be called seperately, it is intended to % be used from withing read_biff and write_biff. % % See also READ_BIFF, WRITE_BIFF % Copyright (C) 2000, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbo...
4bcbe2fd4d50e3755c51aa684f1953f61f91aaca817ce4ccf990a035f44cd950
MATLAB
3,760
127
%% (predictSDO) assignPlotterProperties % % For use within the SDO Analysis Toolkit. % Generates the 'plotProp' struct, a structure which contains information % about -how- to plot different hypotheses on common plots. This allows the % common plotters to be less strictly defined in -how- they generate plots % intrinsi...
73cd3f2682ec5304d9f1606acbac554344f1de18df9d4bf2214bc48ca631ac88
MATLAB
3,760
94
function TSorderfields(lvl,NwOrder) % Syntax TSorderfields(lvl,NwOrder) % Reorders the fields at the level of the Experiment hierarchy specified by % lvl (must be either 'Experiment' or 'Subject' or 'Session' or 'Trial'). % NwOrder must be a cell array containing in each cell one field name that % exactly matches a...
b03c73e302e51619bd5918052c648d0e11c52ff808e24406657bb3e720d0b1ea
MATLAB
3,761
92
% JPSTH calculates jpsth for two spike counts aligned around an event % jpsth.m % % Copyright 2008 Vanderbilt University. All rights reserved. % John Haitas, Jeremiah Cohen, and Jeff Schall % % This file is part of JPSTH Toolbox. % % JPSTH Toolbox is free software: you can redistribute it and/or modify % it under ...
7370e9fbb30d9103850cff137577ceca4ddc72074801e8f44a7a12e254f91506
MATLAB
3,762
161
function [ params_x, params_y, params_z ] = dlt_2D_to_3D( DLT, u, v ) % DLT_2D_TO_3D: get equation for line in real wolrd coords given DLT % parameters and image pt coords. (Note, not vectorized) % % Usage: % % [ params_x, params_y, params_z ] = dlt_2D_to_3D( DLT, u, v ) % % Inputs: % % DLT = set of 11 D...
63f398125f08e8c9ef1b54afcf9d7eccf2df030a5f53b205b8fb5e9edb6d30e3
MATLAB
3,763
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 % c...
6edd7ca0e588cf7d4cb4903e63684bdf9a6ba29eb4d384827f695e9bc286f396
MATLAB
3,763
119
%% Plot 2d sigmoid functions for various values of w1, w2. % i.e. sigmoid(w1*x1 +%w2*x2) %% % This file is from pmtk3.googlecode.com function sigmoidplot2D % Plot sigmoids with these parameters %w_1 = [-2 ; -2 ; 0 ; 1 ; 1 ; 2 ; 2 ; 3 ; 5 ; 5]; %w_2 = [-1 ; 3 ; 2 ; 4 ; 0 ; 2 ; -2 ; 0 ; 4 ; 1]; w_1 = [-3 ; -3 ; ...
702ceebac5772732b3f471c941af746823b0d9fc6e8b33248fadbd1c3d0a05c4
MATLAB
3,764
91
function process_clusters % extracts cluster data from cluster_data.mat, and stores this into two % variables (SUA for single units, and MUA for multiunits). The variable % lists the contributing unit id and the timestamps/index of the spike. an % id conversion variable maps the unit id to the original id in the % clus...
3a5b3083080c35652cfb878781ee0bd4a5ca1383f0b62416a81f9319c537ded9
MATLAB
3,765
74
if ~exist('save_name'), save_name = 'Calib_Results'; end; fprintf(1,'Generating the matlab script file %s.m containing the intrinsic and extrinsic parameters...\n',save_name) fid = fopen([ save_name '.m'],'wt'); fprintf(fid,'%% Intrinsic and Extrinsic Camera Parameters\n'); fprintf(fid,'%%\n'); fprintf(fid,'%% ...
8ea5edd20cb12b84896389d945434e62c0736418a455ea0eb58dd3fe250dc94e
MATLAB
3,765
129
function [logZ, nodeBel, edgeBel] = treegmInferNodes(model, localFeatures, softev) % Compute marginals on a tree structured graphical model % using an up-down sweep of belief propagation % % INPUT % model is created by treegmCreate % localFeatures is an optional D*Nnodes matrix containing local evidence % If present...
2dfbdbd90ac5de40e2a0bb69f067cb367b0df85a0a7c2232aab84329095286d1
MATLAB
3,766
98
function vertIm = calcVertImage(im,im_ecc,im_pol,im_x,im_y,ecc,pol,sigma,varea,area_val,binary) %{ This is a helper function for the convertBinaryToSurface function for converting a binary image to surface space. If binary is false, it loops through each vertex in the supplied surfaces, creates a gaussian weight matr...
abf64943359a5ca2b4108449c9d19c93858168412f461498e54d5cb8526657bf
MATLAB
3,767
112
%% warn_test % % Test for (suppressed) Matlab warning message % % <matlab:open('warn_test.m') code> % %% Syntax % % [waswarn,msgstr,warnid] = warn_test(oldstate, false) % [waswarn,msgstr,warnid] = warn_test(oldstate, warnmsg, warnfunc,rwarnid) % %% Arguments % % _input_ % % oldstate old warning state to r...
4b49bf72c9da7a9c15dc7da491e45011136d59c25a28392d29df3c2ccded95ba
MATLAB
3,768
95
%-------------------------------------------------------------------------- % Title: Random Forest Model Creation using leave-one-subject-out cross % validation % Author: [Behrang Fazli Besheli] % Email: FazliBesheli.Behrang@mayo.edu % Institution: [Mayo Clinic, Department of Neurosurgery] % Date: [09/07/2024] %...
24d7311c0aa5ec6c6ef24b777a026afc94441b6280f352fc3926a07630d964d5
MATLAB
3,772
132
%% Compare % In the spirit of reproducible research, % we created a simpler demo, called % linearKernelDemo.m , % which only uses linear kernels (so we don't have to cross validate % over gamma in the RBF kernel) and only runs on a few datasets. % This is much faster, allowing us to perform multiple trials. % B...
451f4ebb8a2cddca833151aaba3a27d9793c33d05d5abf1b014160480218171e
MATLAB
3,772
96
function [ALLEEG] = detect_spindles_batch() %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Build EEG structure from multiple EEG datasets to batch run detect_spindles % % Contact: sfogel@uottawa.ca % % Date: May 6, 2020 % % Citation: Ray, L.B., Sockeel, S., Soon, M., Bore, A., Myh...
c590c1411feabe6b15a38ddff8d77acf03d4df01436787abe7231319d450c5bb
MATLAB
3,773
104
% PlotMiceStrideAveragess.m % Sarah West % 7/18/23 % For a given behavior period plots the average, resampled stride % (normalized to be 10 data points long) across mice. Uses the standard % error of the mean as error bars. % Runs with RunAnalysis function [parameters] = PlotMiceStrideOneMotorAndSpon(parameters) ...
da4116ccb78605f3fb8f78accee740721a5da81b20369a09df493c0b3abed6b3
MATLAB
3,773
130
function [gx,dgdx,dgdp] = g_HRF3(Xt,P,ut,in) % T2* contrast observation function for HRF Balloon model (log space) % function [gx,dgdx,dgdp] = g_HRF3(Xt,P,ut,in) % This function evaluates the hemodynamic static observation equation % function. HEMODYNAMIC STATES ARE IN LOG SPACE. n = size(Xt,1); % Get parameters and ...
dc827c5c67d08d8ccbb607056784cbdebd807931599111e877bda9ced42fd42a
MATLAB
3,776
94
function checkgradient(problem, x, d) % Checks the consistency of the cost function and the gradient. % % function checkgradient(problem) % function checkgradient(problem, x) % function checkgradient(problem, x, d) % % checkgradient performs a numerical test to check that the gradient % defined in the problem s...
3a68e65882752456c5c48cf8bf368caef3021384b4eeaf3b1dc3980e46f553e7
MATLAB
3,778
124
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% wrapper_full_calibration.m -- A wrapper for the calibration runtime. %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function []=wrapper_amr(pat_ix, model, inverse_model) pat_cell = {'110411','117122','1...
638796342dddc08bf519415a6bd21255e070b7474754ac5a751566b5f5c37a38
MATLAB
3,779
89
%% Example script: running MCMC chains in parallel % This example illustrates how to call JAGS and run a number of MCMC chains in parallel. It requires that you % have the Matlab Parallel Computing Toolbox installed <http://www.mathworks.com/products/parallel-computing> % %%% Model definition % The BUGS example was ta...
141392ffbed75aa67893f6aab5dad172a5f200cf1e521237b55036c2c1692565
MATLAB
3,780
99
addpath C:\code\spm12 addpath D:\ECoG_Atlas\functions addpath C:\code\wjn_toolbox spm('defaults','eeg') %% Load Table % clear all %% load('D:\ECoG_Atlas\MC\ECoG_Atlas_Table.mat') load('C:\Users\ICN_guest\Charité - Universitätsmedizin Berlin\Interventional Cognitive Neuromodulation - PROJECT ECoG Atlas Connectomics (1)\...
1f73ceb8762eaeb7bdee8926bcee3275677ca0f60c5cf1e7f9e0a4b1f8615925
MATLAB
3,780
104
% Author: Birgit Nierula % nierula@cbs.mpg.de function eeg_prepro_loop2(subj_inspect, subject, condition, block, srmr_nr, make_plot) %% loop 2: "manually" look at datasets that showed noisy spectra %% (not necessarily bad channels), mark and reject bad channels if needed % define path and subject id subject_id = ...
2795ec74569c7fa1cbcac98d8aa9bf8118174f0356297c51d768ae0d3d9478b2
MATLAB
3,780
98
% Seven-point stencil on the unit cube, Poisson equation. % % This is basically the 3D analogue of FD_SQUARE. % % Inputs (defaults are used if not provided or set empty): % % - N: number of discretization points in each dimension (default: N = 32) % - OCC: tree occupancy parameter (default: OCC = 64) % - RANK_OR_...
74bdf19e1c60597ad947a15f4c39ec06479162a7758c379c37c8e10eba4dbbfd
MATLAB
3,780
104
%% computeSDO_new() % Construct an empty 'sdo' structure array and populate it with the % relevant fields; %_______________________________________ % Copyright (C) 2023 Trevor S. Smith % Drexel University College of Medicine % % This program is free software: you can redistribute it and/or modify % it under the terms...
b328aa85c63e7735e119ad9eeb6fb1a22def07743dea35722d336bd27cf1a559
MATLAB
3,780
97
% SubtractContinuousVariables.m % Sarah West % 6/13/22 % Removes Beta * continuous Y response variable from X explanatory variables % after continuous variable regressions. function [parameters] = SubtractContinuousVariables(parameters) MessageToUser('Subtracting ', parameters); % Find the location & value ...
bac228bfa7a9fc1c45856ecbd85ef8fa7162a6cde7a7bd9eb6d4dcd9f5c805fd
MATLAB
3,780
70
function fcn_GenVisualSchaefeTian(Data, OutDir, Prefix, Mode) % fcn_GenVisualSchaefeTian: Visualization mapping for Schaefer-Tian parcellations. % ------------------------------------------------------------------------------------------- % Used to demonstrate the usage of the function fcn_GenVisualSchaeferTian. % ...
c34804ad080c0253bfebbc7b7dc1a878e73e37639111f42a34472f1e111e8934
MATLAB
3,784
111
% Based on Chengcheng Huang code function [Corr, Cov, rate2, rate1, var2, var1]=spkCntCorr(s1,s2,N1,N2,dim,Nc) % s1, s2: spike times of neuron Pop1 & Pop2, respectively, 2xN (1st row contains spike times, 2nd row contains indices of neurons that spike) % N1, N2: total # of neurons in Pop1 & Pop2, respectively % Nc: 1...
09c70db750b444c11c3180925de32b5dc88b98c0b2c9f2114b4bbac69f6a4372
MATLAB
3,785
98
function [Kernel, features, corr_test] = predict_simcv(datadir, hmmdir, outputdir, HMM_name, n_train, n_test, betwgroup_diff, Y_noise, cv) % [Kernel, feat, corr_test] = predict_simcv(HMM_name, n_train, n_test, betwgroup_diff, Y_noise, cv) % % constructs kernels and predicts from HMMs run on simulated timecourses % for...
1522f20452fe9de5f1a0b0c1877f494e025267cacedf26609f55aca6e1f847ce
MATLAB
3,785
103
% FT_PREAMBLE_LOADVAR is a helper script that optionally loads one or % multiple FieldTrip data structures from mat files on disk, as an % alternative to the user specifying the data structures as input variables % to the calling function. This makes use of the cfg.inputfile variable. % % Furthermore, this function com...
354ed10fcd937e499e6725fc77c7b44f25223d1f8f1132a56e0405ca6a8bc3f7
MATLAB
3,785
132
addpath('./functions') load('../data/FIG3_mnist_classification.mat') %% figure; hold on; for i = 1:10 plot(i-1.1+out2(i,1:100)'/2,'color',[1 0 0 1],'linewidth',1.5) plot(i-1.1+datasc(i,1:100)'/2,'color',[0 0 0 0.7],'linewidth',1.5) end set(gca,'linewidth',2) ylabel('Class output') xlabel('Input num...
56f7911cd08caca40890cff7c432703f9b075b00d33381144e430ab808d63ba0
MATLAB
3,787
105
% Initial electrode voltages prior to final subdivision step cd ..; cd(fullfile('3_create_electrode_data')); run('set_electrodes_amr.m'); cd ..; cd(fullfile('2b_forward_simulation')); Vold = ElectrodeVoltages; %% Global subdivision tic [cinterp, P, t, normals, Center, Area, Indicator, percentage] ... = meshadapt...
867f5211042153a6cc091d65b48aa1890079754f8fb6189b583e262ca8b234ef
MATLAB
3,787
128
function [Zica, W, T, mu] = fastICA(Z,r,type,flag) % % Syntax: Zica = fastICA(Z,r); % Zica = fastICA(Z,r,type); % Zica = fastICA(Z,r,type,flag); % [Zica, W, T, mu] = fastICA(Z,r); % [Zica, W, T, mu] = fastICA(Z,r,type); % [Zica, W, T, mu] = fas...
9d8a94a1c4ce612d5f4b4d370b339db12eadb65c963a570ace13ca91c992f8fe
MATLAB
3,788
110
hfig = figure(1234); %% make a video that just shows the frame number assert(exist('videotest','dir')>0); outmovfile = 'videotest/FrameNumber.avi'; writerobj = VideoWriter(outmovfile,'Uncompressed AVI'); writerobj.FrameRate = 30; open(writerobj); nframeswrite = 1000; hfig = figure(1234); set(hfig,'Position',[10,10,...
bf58877b90ddd351c590db21e10d8633fcb69e06963a6a6b0775ee19070d23fb
MATLAB
3,788
104
function extractProbeData(fname) %function written by Kira, August 2017, updated May 2018 %updated Nov 2020 %function searches through experimental directories for excel files %containing oxyprobe/LDF data %it will then extract the data as a .mat file, and save into the directory % % %INPUTS- %fname = directory which...
8aab80b7d24f0a1f9c0b3c26a4339f416a91645d3f2968f61a92aa7e141381e6
MATLAB
3,789
73
function [ modules, modules_initialPositions, modules_initialStates] = define_modules( ) % This function defines the list of modules available in the dataspace % GUI. % % <a href="matlab:edit dspace.app.define_modules">Edit dspace.app.define_modules</a> % % Edit with care. Dataspace might...
351d5ce4418abbe458f46ddd52f393814c6f8e74364593f62af1125a11f738fd
MATLAB
3,790
144
function [h,ep,stat] = bayesian_ttest(x1,x2) % function [h,ep,stat] = bayesian_ttest(x1,x2) % bayesian_ttest - performs a statistical test of mean comparison under a % bayesian inferential procedure. The test can be: % 1-sample or 2-sample. % % Syntax: % [h,ep,stat] = bayesian_ttes...
8f696e45ca485a8625fb5f90f517c0af8b52756276a9d133494cb7a927e18cb8
MATLAB
3,790
101
gen = 'R22D03AD_R20E08DBD Retinal Female';trial2Cons = '221214_Afternoon1_BS';frames2Cons = 100:300; %gen = 'L320 Retinal Male';trial2Cons = '210308_Evening1_BS';frames2Cons = 6175:6175+100; gen = 'L320 Retinal Female';trial2Cons = '210316_Afternoon2_BS';frames2Cons = 100:350; %gen = 'L320 Retinal Female';trial2Cons = ...
955749b9690bee0dbd2f86d050d5b6765dbb67614d4fd5fed7abdb39dd513f24
MATLAB
3,790
74
% CSD - Current Source Density (CSD) transformation based on spherical spline % surface Laplacian as suggested by Perrin et al. (1989, 1990) % % (published in appendix of Kayser J, Tenke CE, Clin Neurophysiol 2006;117(2):348-368) % % Usage: [X, Y] = CSD(Data, G, H, lambda, head); % % Implementation of algo...
7bbea9b481c7bb4a16c9954415c4dd8c3494e3905a7e439cf2adc9abc692e653
MATLAB
3,793
135
function data = analyze_camkii(params,roi,camch,AB_chs) %calculates correlation and volume overlap between different AB channels folder = params.parentfolder; %Extract parameters xystep = params.xystep; zstep = params.zstep; %thresholds = params.thresholds; chsplits = split(camch,"-"); roundno = chsplits{1}; chno = ...
79bb3ea7fcf6e1c752500bf594f6d7e55f1e0455779f1612717ccb56d1dc7ec4
MATLAB
3,794
106
% Second-kind integral equation on the unit square, Laplace single-layer. % % This is basically the same as IE_SQUARE1 but with the identity added to the % system matrix in order to create an artificial second-kind volume integral % operator. It skips the preconditioned GMRES comparison since the problem is % well-cond...
f51295bfddde4333653e32d5a5a8f4e0a22bffe25498419bb5ee687828ec4629
MATLAB
3,796
110
function [ x, er ] = checkNumArgs( x, siz, intFlag, signFlag ) % Helper utility for checking numeric vector arguments. % % Runs a number of tests on the numeric array x. Tests to see if x has all % integer values, all positive values, and so on, depending on the values % for intFlag and signFlag. Also tests to see if ...
c7a6086d8a3ca1493458d3ec7b39f3e5e3709d0a0bc34dccca6df2145a22e869
MATLAB
3,797
117
function meg_manuscriptFigs_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) %% Load data user = 'kantian'; filename = sprintf('/Users/%s/Dropbox/github/ta-meg-analysis-model/model_...
fa2d0ab368d85273e2e4304a599dbc3e3804883c66d08fbd232152f24861bc8d
MATLAB
3,797
99
function [Qn_bin, Qtb, QmscUsP, QmscnoUsP] = Calc_Newman_ModularityIM(fc,IM,params) % This function calculates Newman's Q (2004) and Traag and Bruggeman Qtb (2009) based on a predefined network % structure (Infomap solution saved in IM.key). % This code also calculates Newman's Q on unbinarized matrix using a % functi...
09b1363e285b18c12c1ea7a7b7e9daf97e745dd974be6352bdcdfc04677ca87a
MATLAB
3,798
122
% function [im_post_pystripe] = pystripe(input_img,sigma_background,sigma_foreground,threshold) % % p = inputParser; % addOptional(p,'sigma_background',1024); % addOptional(p,'sigma_foreground',128); % addOptional(p,'threshold',-1); % addOptional(p,'crossover',10); % addOptional(p,'wavelet','db5'); % addOptiona...
2fa715a69837b9bcff4c9e5c3f1b7602cb62b69bab9881429d7aafbae4ada7bf
MATLAB
3,798
80
% Distance int-pyr in assembly vs int-pyr out assembly figure [data1,data2] = extract_variables ('pos',[],resultsPath, 'distIntPyrInAssembly', 'distIntPyrOutAssembly',conditionType,conditionValue); % find recordings with no assemblies (distIntPyrInAssembly set on zero) noAssemblyRec = find(cell2mat(data1)==0); data1 ...
3252e9dd4e6a922e7deaf4f2c956fca0c3f963cf30b566a4e9076d5c20e0a406
MATLAB
3,798
94
function CBIG_Yeo2011_ProjectSplitLabels2MNI1mm % CBIG_Yeo2011_ProjectSplitLabels2MNI1mm % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md cortex_mask = MRIread(fullfile(getenv('CBIG_CODE_DIR'), 'data', 'extras', 'surf2surf_gui_data', 'CorrespondenceFreeSurferVolSurfSpa...
c971eeebcfda0c4eaf524d2e675fdcc40628e4a4072ccfee96d2310f277b7566
MATLAB
3,798
117
function h = ft_plot_line(X, Y, varargin) % FT_PLOT_LINE helper function for plotting a line, which can also be used in % combination with the multiple channel layout display in FieldTrip. % % Use as % ft_plot_line(X, Y, ...) % % Optional arguments should come in key-value pairs and can include % 'color' ...
7aaf638adba6e36b48ef635253a9fa86de44c633eba9ba8abb905fb1df020948
MATLAB
3,801
121
%data = randn(1000,10); %batch = [1 1 1 1 1 2 2 2 2 2]; %mod = [1 2 1 2 1 2 1 2 1 2]'; function bayesdata = combat(dat, batch, mod, parametric) [sds] = std(dat')'; wh = find(sds==0); [ns,ms] = size(wh); if ns>0 error('Error. There are rows with constant values across samples. Remove these ro...
e2d11fb46ab4734b56aada96434c5eefbb09f285582b48e55633f9024c8b0405
MATLAB
3,801
114
%% |crameri| documentation % |crameri| returns perceptually-uniform scientific colormaps created % by <http://www.fabiocrameri.ch/colourmaps.php Fabio Crameri>. % % <<crameri.png>> % %% Syntax % % crameri % cmap = crameri('ColormapName') % cmap = crameri('-ColormapName') % cmap = crameri(...,NLevels) % cma...
165fce5ec8f9f89d910a8e36729a0bee75c0c1e932b85719e1baac3c4d1762af
MATLAB
3,804
123
clear main; clc; main() function main disp("Let's get started..."); mouseID = input("Enter Mouse ID: "); experimentName = input("Enter Experiment Type (SI, Def, SDT): ",'s'); sectionNum = input("Enter Section Number (If none exists, press Enter): "); if isempty(sectionNum) segmentFilename ...
2882e17aff988cc8498aa82714244dfa68387272c72074f6383d8bf71f62c371
MATLAB
3,804
141
function [y,ntrimmed,allw] = trimts(y,sd,X,varargin) % 1. Adjusts for scan effects (unless X is empty) % % 2. Windsorizes timeseries to sd standard deviations % - Recursive: 3 steps % % 3. Adds scan effects back into timeseries % % :Usage: % :: % % function [y,ntrimmed,allw] = trimts(y,sd,X,[do spike corre...
1c6f3532956f7da4050d01e04267c5378343fa4cc5a665a7ee7fb1b5460cad99
MATLAB
3,805
132
function [stats,st] = lme_FSfit(X,Zcols,y,ni,e) % [stats,st] = lme_FSfit(X,Zcols,y,ni,e) % % Linear mixed-effects estimation by the Fisher scoring algorithm. % % Input % X: Ordered (according to time for each subject) design matrix (nmxp, nm % total # of maps, p # of fixed effects). % Zcols: Vector with the indices o...