sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
dcd9bd454b4dda1c43afaa3b3ee9ca3e1ea19e35cfbdd94e12bd874b8606e6a4
MATLAB
4,278
141
function [F] = VBA_FreeEnergy(posterior,suffStat,options) % computes free energy of the sDCM generative model % function [F] = VBA_FreeEnergy(posterior,suffStat,options) % This function evaluates the free energy associated with the nonlinear % state-space model inverted by the main inversion routine % VBA_NLStateSpaceM...
7b862c4947771618f30001ee08ed7484529287d79f64550cc38c8e7e0008c559
MATLAB
4,281
92
function CBIG_AuthorTopic_RunExample % CBIG_AuthorTopic_RunExample % % Example of performing coordinate-based meta-analysis with the author-topic model % to discover cognitive components of self-generated thought % The inference was performed with the following hyperparameters % - K = 2:3 - number of cogni...
0e4920f90ac5f4f3ee3b962eaf00c6d256c3afe7a57e2b5b94570cc591172f76
MATLAB
4,282
89
function parallel_calculate_FIR_PPIs_no_centering(stat_path,exp_folder,N,N_ROIs) % ======================================================================== % Ruslan Masharipov, July, 2024 % email: ruslan.s.masharipov@gmail.com % ======================================================================== tic for subji = ...
2d54ff82ff864b789932d9737d16c83c7a3b84739161fce0764a394f5bfd4f56
MATLAB
4,282
115
%% Plot Figure 4 a) and b) function figureOut = PlotFigure4ab(condData, BhatArr, figNr) % Plot the evolution of Bhat for placebo (low cue) and nocebo (high cue) % trials across conditioning (suplot 1), and the expected pain for each % trial (subplot 2) % ==== Input === % conditioning data: condData = 1xnParticipant s...
18796d0e1c4735baa17a1f347768c8b6442c7487cd20c94ba5980a77619b7bfb
MATLAB
4,283
118
function [basis,gradbasis]=legs(x,dir,n) % usage: [basis,gradbasis]=legs(x,dir,n) % % returns the values and directional derivatives of (n+1)^2 % spherical harmonics at locations given in x and, for the % gradients, for (in general non-normalized) directions given in dir. % % input: x set of N locations giv...
9bc9b4b6772547eec5d65deb7ca63b716d879499d1e8f5122f62ab43e9d2ad89
MATLAB
4,283
100
% 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 script computes a sensitivity analysis of the mean maximum muscle-tendon (MT) moment to changes in % muscle para...
42f2b11b8d0330e546cab795e99c8f60c96b22f6458d1201ceec201d8f0651ab
MATLAB
4,285
102
function [name, tissue, cond, enclosingTissueIdx] = tissue_index_read(index_name, mesh_path) % This function reads a tissue index file, and extracts the name, conductivity, % and enclosing tissue of each tissue listed in the tissue index file. % Copyright WAW/SNM 2019-2020 %Attempt to open index file in...
31bb7d686a497f5c5f70ef459e599b429600242705f1614f5a3064884dc84b48
MATLAB
4,288
99
% 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 script computes a sensitivity analysis of the mean maximum muscle-tendon (MT) moment to changes in % muscle para...
77fb13620a6c3d3d75b0d74eca9f70445a6e5ae9d2c019715810b49656df7160
MATLAB
4,288
94
% Author: Birgit Nierula % nierula@cbs.mpg.de function eeg_prepro_loop4(subject, condition, srmr_nr) %% loop 4: further automatic processing: re-reference, filter, artifact rejection subject_id = sprintf('sub-%03i', subject); analysis_path = [getenv('ANADIR') subject_id '/eeg/prepro/']; % define stimulation condit...
e2921aa5395cd58af236ea18e6cb816017e238b503a70a31f6c46e4f3ac9a7e5
MATLAB
4,288
105
function varargout = DPABI_Analysis(varargin) % DPABI_ANALYSIS MATLAB code for DPABI_Analysis.fig % DPABI_ANALYSIS, by itself, creates a new DPABI_ANALYSIS or raises the existing % singleton*. % % H = DPABI_ANALYSIS returns the handle to a new DPABI_ANALYSIS or the handle to % the existing singleton...
ed698415591b6ea6ac5dce806f2237f59185bd09b5320ca26029600f6f45d03c
MATLAB
4,288
173
function cfg = pregunta_lan(cfg,campos, opciones,label) % Para conficuraciones no explicitadas % v.0.1.3 % % Pablo Billeke % % % 26.08.2010 % 04.05.2010 % 26.11.2009 % function cfg = gui_cfg(cfg,text) % % % % end LAN = cfg; if nargin < 4 label = [' ']; else label = [ ' para ' label ]; end %----...
23efa4c20cb896e9606616022bd0a79eeb809bb94a97521ba3c5a2f457321562
MATLAB
4,290
134
function [] = plotRaster(spikenums,rasterOptions); %% >>> OPERATION >>> % Plots spike raster for a 2D array in which rows are cells and columns % are data points. % Options: - plot time vector as x % - highlight specific cells in red % - highlight specific time windows (e.g. behavi...
1d0fae757cd0b3840cf87f7e40dcd2f2e7ec2a8545166967e9aca9ffa8024880
MATLAB
4,291
82
% GET_FIELD_FD_CPU Solves sparse system of linear equations using BiCGStab % solver and FSAI preconditioning. Parallelized for multithreading with % OpenMP. Uses all available CPU power. % % SYNTAX: % [PHI] = GET_FIELD_FD_CPU(I_INDEX, J_INDEX, S_VALUE, QVEC) % [PHI] = GET_FIELD_FD_CPU(I_INDEX, J_INDEX, S_VALU...
9b81a3fe270c45cedaacef369706309877116d47a9aa92989b97fa87cb90fd53
MATLAB
4,291
138
function [count edges mid loc] = histcn(X, varargin) % function [count edges mid loc] = histcn(X, edge1, edge2, ..., edgeN) % % Purpose: compute n-dimensional histogram % % INPUT % - X: is (M x N) array, represents M data points in R^N % - edgek: are the bin vectors on dimension k, k=1...N. % If it is a scalar ...
8071c4b419b1202bba7d26da8770d5fa26db132d283160cde6c6eaf0833bdf6a
MATLAB
4,292
213
% crabsort.database.build % builds a database in a xlsx sheet % function T = build(varargin) try data_loc = getpref('crabsort','data_loc'); catch error('data_loc not set! ') end % get a list of all experiments in the crabsort spikes folder spikesfolder = getpref('crabsort','store_spikes_here'); all_exps = dir(...
3809d603a21cbba6bf80f179644f93e567d39c9cf84a6fab9334cd2da4254092
MATLAB
4,296
103
% FT_POSTAMBLE_PROVENANCE is a helper script that reports the time and memory used by % the calling function and that stores this information together with user name, MATLAB % version and other provenance information in the cfg structure. This script is to be % used together with FT_PREAMBLE_PROVENANCE, which records t...
61e1acc7fcdcc62e8683dc3a0d1915b684c4d13c4896b1c88c7a305f7222ae45
MATLAB
4,296
138
function [mellin,beta]=fmt(X,fmin,fmax,N); %FMT Fast Fourier Mellin Transform. % [MELLIN,BETA]=FMT(X,FMIN,FMAX,N) computes the Fast Mellin % Transform of signal X. % % X : signal in time (Nx=length(X)). % FMIN,FMAX : respectively lower and upper frequency bounds of % the analyzed sign...
61fe66cfbc67f1803a349e07bebdfd938a060cc1540dd69cd0d4b8e7d3016d78
MATLAB
4,297
150
function [xyz_final,matrix_first_flag,matrix_second_flag, mat_IDIF_final, peaks,number_of_final_voxels]=voxels_select(mask,PET_dyn,t_IDIF_emi,number_of_final_voxels) n_sampling = size(PET_dyn,4); for t=1:n_sampling curr_PET=PET_dyn(:,:,:,t); PET2D(:,t)=curr_PET(:); end matrix=PET2D(find(mask),:); %...
fa66fac13458d186cb5590f9fbb911c6a16c5cbbb2a53688f1cc72bcdab4a462
MATLAB
4,299
182
function [DCM] = VBA_spm_sdcm_estimate2(P) % Estimate parameters of a stochastic DCM for fMRI data (deconv HRF) % FORMAT [DCM] = spm_sdcm_estimate2(DCM) % % DCM - the DCM or its filename %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroi...
255e518a5adca9607d710cc7e3c84918bbf6b935cdcc4c12407634b747739201
MATLAB
4,300
116
classdef Set < handle_light % Square subset of R^n %--------------------------------------------------------------------- % license %--------------------------------------------------------------------- % Copyright 2015 Idse Heemskerk and Sebastian Streichan % % This file is part of...
3a4692c9a6e77ef3f30fde02718ae20658c9b607260e9ce0ec0fcd6543f674c1
MATLAB
4,300
120
classdef NavigationTable < handle % A row-selectable table that fires a callback when the user clicks a % row. Wraps a uitable; the parent passed to the constructor should % ultimately be rooted in a uifigure, since the modern uitable % properties used here (SelectionType, Selection, SelectionChangedFcn) % r...
a4cd89b34044fc2d0890fd7d80cfc4f9aa9e1167c52fd1ee730f416e84bc4407
MATLAB
4,302
120
% Second-kind integral equation on the unit circle, Laplace double-layer. % % This example solves the Dirichlet Laplace problem on the unit disk by using a % double-layer potential, which yields a second-kind boundary integral equation. % The integral is discretized with the trapezoidal rule; the resulting matrix is % ...
942412eba0770aee214b037221bb066e8036ed75e13c89f6aeecb9cc16a49d28
MATLAB
4,303
156
% header = ufmf_read_header(filename) function header = ufmf_read_header(filename) MAXNMEANSCACHED = 5; header.filename = filename; % open the file for reading, binary, little-endian fp = fopen( filename, 'rb' , 'ieee-le'); if ~exist(filename,'file'), error('File %s does not exist',filename); end if fp < 0, erro...
0b0c8cd96b4d43ef80ac30c5f4f83af52bbedcc6892d8300e709d34da4184d71
MATLAB
4,304
90
function CBIG_AuthorTopicEM_RunEMwithRandInitExample % CBIG_AuthorTopicEM_RunEMwithRandInitExample % % Wrapper function to unit-test a coordinate-based meta-analysis with % the author-topic model and expectation-maximization (EM) algorithm. % The inference was performed with the following hard-coded hyperpara...
27c89d60114cc2b61b43c5aa8d82ec30df4cf0c17e3eab4c31a3fc23654c46c0
MATLAB
4,305
128
function [info] = prepare_agent(model,game,role) % set basic params for different sorts of agents engaging in dyadic games % function [info] = prepare_agent(model,game,role) % info: structure containing the following fields: % .f_p = handle of evolution function % .g_p = handle of observation function % .theta = ev...
5af78292a88273725d9cd7d4d630c546020a0dbc7d34a44000d03a72a6a0cab7
MATLAB
4,305
131
function ax = animate_trial(input_file_name,output_file_name,Tmax,show_target,show_holes,arena_bg_color,real_time,hole_check_data,fig_prop) % 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 % Tmax ...
97b9120dd903f905a89adf9e55ef431957e654e8e893000e30e172f9f941626f
MATLAB
4,305
162
% This is a simplified version of 'discreteDensityModelsShootout' % It should give the same results as 'exptKevin2' % Stop it from being included in list of automatic demos %PMTKinprogress %% Data % data.discrete is D*N where discrete(d,n) in {1..nClass(d)} clear all seed = 1; dataName = 'ases4'; pcTrain = 0.5; pcT...
77fa9bad4819657a1a972cdf6ec553621b126c4abfe6b9d164e2bc7fd12b86b8
MATLAB
4,306
161
%%% INPUT THE IMAGE FILE NAME: graphout = 0; if ~exist('fc')|~exist('cc')|~exist('kc')|~exist('alpha_c'), fprintf(1,'No intrinsic camera parameters available. Maybe, need to load Calib_Results.mat\n'); return; end; KK = [fc(1) alpha_c*fc(1) cc(1);0 fc(2) cc(2) ; 0 0 1]; disp('Program that undistorts a whole s...
3359a5b90db8e6a72b858684c88cf20cadbe5e59de312add5e28473741dacea9
MATLAB
4,307
205
function [DAT, StudyTable] = struct2canlab_dataset(data_struct) % Take an ad hoc data structure data_struct and return a Table format % object (StudyTable) and a canlab_dataset object DAT. % % - field names become variable names % - Column vectors of numbers or text becomes Subj_Level data % - Cell vectors containing c...
257d68016a19adc6939e7a4aab97986d5e6d6cd8dda8a6ba18c94d736bde70f8
MATLAB
4,308
137
%% Compare L1, L2, allSubsets, and OLS linear regression on the prostate data set % Approximately reproduces table 3.3 and fig 3.7 on p63 of "Elements of statistical % learning" 2nd edn % According to http://statweb.stanford.edu/~tibs/ElemStatLearn/datasets/prostate.info.txt % "The features must first be scaled to h...
73c271f615a908d4a639a601ce88357b9fa762dfc01bfc8d5161bc49bacfcdd7
MATLAB
4,309
119
function F = VBA_spm_Fcdf(x,v,w) % Cumulative Distribution Function (CDF) of F (Fisher-Snedecor) distribution % FORMAT F = spm_Fpdf(x,df) % FORMAT F = spm_Fpdf(x,v,w) % % x - F-variate (F has range [0,Inf) ) % df - Degrees of freedom, concatenated along last dimension % Eg. Scalar (or column vector) v & w. Then...
9f08b65bbe601acc1e1d11742c6d0451610d2c006bd643f5b25ceddbcb9db24d
MATLAB
4,309
100
function y_ICC_Image_ReML(Rate1Dir,Rate2Dir,OutputName,MaskFile) % function y_ICC_Image_ReML(Rate1Dir,Rate2Dir,OutputName,MaskFile) % Calculate the Intraclass correlation coefficient for brain images. % Note: the ICC calculation is based on Xi-Nian Zuo's LFCD_lmm0 % Use ReML Model; Zuo, X.N., Xing, X.X., 2011. Effe...
b8ed4e0c0eecf70f054f196359543f003ab342aa5635a1f4c14f8cbb276c3bef
MATLAB
4,310
81
function y_WarpByANTs(SourceFile,OutFile,RefFile,TransformFile,Interpolation,Dimensionality,InputImageType,DefaultValue,IsFloat0,DockerName) % FORMAT y_WarpByANTs(SourceFile,OutFile,RefFile,TransformFile,Interpolation,Dimensionality,InputImageType,DefaultValue,IsFloat0,DockerName) % Warp a file with ANTs' antsApplyTr...
b5497287aff987b784a338e0dbf7f9a82e34b00f72dc2d98137eead43ac4d185
MATLAB
4,311
87
% Written by Xiuming Zhang and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md % IMPORTANT This file is specific to our PNAS paper and our computing cluster. As a result, % you need to modify the paths at places with comment "please change" close all; clear; clc; cd ../lib/ %% Pre...
04551b60cfbb76d87a96b859b2273d841c368cbb77c5cdbc8f3ca6a7cda1680c
MATLAB
4,312
148
function [ csd ] = bz_CSD (lfp, varargin) % [ CSD ] = bz_CSD (lfp, varargin) % Calculates the 1D approximation of current source density (CSD) from a % linear array of LFPs % INPUT % lfp a buzcode structure with fields lfp.data, % lfp.timestamps % ...
6fb6f8c769e4623cc622e41f3c00b7be8e753eb10064b3052fd067b04190a04d
MATLAB
4,313
169
function [ projdata ] = fiff_read_proj(fid,node) % % [ projdata ] = fiff_read_proj(fid,node) % % Read the SSP data under a given directory node % % % Author : Matti Hamalainen, MGH Martinos Center % License : BSD 3-clause % % % Revision 1.7 2006/05/16 00:39:32 msh % Fixed error in mne_ex_read_raw: All proje...
11848f10328cc4957d8659c2c290b33a2ba9021c378069f407698ad8052f253c
MATLAB
4,315
115
function [ha,hf,lr] = unwrapVBvolatileOTO(posterior,out) % OTO: recovers posterior sufficient statistics from VB inversion if isempty(posterior) ha =[]; return end [n,n_t] = size(posterior.muX); if n==5 ka = out.options.inF.lev2* VBA_sigmoid(posterior.muTheta(1), 'scale', out.options.inF.kaub); o...
328a5590bd0196c5efe8f92bd2d6a118fc6c02ed54e3c8622b979a8d0c8a9ea3
MATLAB
4,315
152
function CPD = condGaussCpdCreate(mu, Sigma, varargin) %% Create a conditional Gaussian distribution for use in a graphical model % % mu is a matrix of size d-by-nstates % Sigma is of size d-by-d-by-nstates % % 'prior' is a Gauss-inverseWishart distribution, namely, a struct with % fields mu, Sigma, dof, k % Set 'prio...
b139adc8ac4fee02fbf817924283dd0953a5d76ec7afda215ae569867386a8f0
MATLAB
4,315
145
% meg_plotTopo % MEG_PLOTTOPO % % Karen Tian % August 2020 %% input expt = 'TANoise'; saveFigs = 1; figDir = '/Users/kantian/Dropbox/Data/TANoise/MEG/Group/figures/ITPCUpDown'; user = 'karen'; [sessionNames,subjectNames,ITPCsubject,ITPCsession] = meg_sessions(expt); %% load data % average data avgData = nanmea...
ec908032bd88a7d933917f8d2a1e8578e99350cac06bd6d31f0e989a7c97e27e
MATLAB
4,316
113
function dataout = ft_globalmeanfield(cfg, datain) % FT_GLOBALMEANFIELD calculates global mean field amplitude or power of input data % % Use as % [gmf] = ft_globalmeanfield(cfg, data) % % The data should be organised in a structure as obtained from the % FT_TIMELOCKANALYSIS function. The configuration should be acc...
c8c6a1ccd75f940387204fffbae01d82aea35eb1bf2ed2cee3bf6fb49574dec5
MATLAB
4,317
180
% [param1,param2,...] = read_ann2(filename,'param1','param2',...) % % params: % % trx: trajectories % % version, bg_type, n_bg_std_thresh, n_bg_std_thresh_low, bg_std_min, % bg_std_max n_bg_frames, min_nonarena, max_nonarena, arena_center_x, % arena_center_y, arena_radius, do_set_circular_arena, bg_algorithm, % backgro...
3e31ad3f9d1d0ad00f80bc83f4f52f793a1df3466b03aa8062bf20bcb0f10f5b
MATLAB
4,318
113
function [dataout] = ft_globalmeanfield(cfg, datain) % FT_GLOBALMEANFIELD calculates global mean field amplitude or power of input data % % Use as % [gmf] = ft_globalmeanfield(cfg, data) % % The data should be organised in a structure as obtained from the % FT_TIMELOCKANALYSIS function. The configuration should be a...
a9569d0bc6afcb2f201abe3a3b725075aab57539d98540d7c032d16daa97e4be
MATLAB
4,319
127
function [KendallWBrain, GHeader] = y_KendallW_Image_Surf(RaterImages, MaskData, AResultFilename) % Calculate Kendall's W for sets of images. (e.g., different raters or Test Re-Test) % FORMAT [KendallWBrain, GHeader] = y_KendallW_Image_Surf(RaterImages, MaskData, AResultFilename) % Input: % RaterImages - C...
16cb3888fa925d90d9aaebbd48710d80c503be8d44b420a4d8bfa0b8a30d1db2
MATLAB
4,320
170
datRoot = '/Volumes/LaCie/Farries recordings/'; rat = 'IM1025'; sesList = dir([datRoot rat '/20*']); sesList = arrayfun(@(x) x.name, sesList, 'UniformOutput', false) iSes = 6; sesDir = [datRoot rat filesep sesList{iSes} filesep] load([sesDir 'behavior - RL.mat']) rwd = TrialFilter(tsRL, 'x1', 'L'); fileDat = dir([ses...
765ac34ad47bc095150b6e5b2921116658e7ce8b8fb4c9dd6ebc2a60b3a631a1
MATLAB
4,321
115
function mat_rs = resizeMatrix(varargin) %RESIZE Resize a matrix. % DESCRIPTION: % Resize a matrix to a given size using interp2 (2D) or interp3 % (3D). % Use interpolation to redivide the [0,1] interval into Nx, Ny, Nz % voxels, where 0 is the center of first voxel, and 1 is the center % ...
41904454d77715492c9f15710363871a61c42682c101b785d819cf96bea93798
MATLAB
4,323
103
function h_autoMakeMovie3(handles) global h_img3 [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); if isfield(currentStruct.state, 'movieContentOpt') movieContentOpt = currentStruct.state.movieContentOpt.value; else movieContentOpt = get(handles.movieContentOpt, 'v...
b7d3aa90510fb228fa700a385883d6aca484b1a3dd1c9ec8bc662715f20ba893
MATLAB
4,325
139
function [fx,J,dfdP] = VBA_evalFun(flagFun,Xt,P,ut,options,dim,t) % smart wrapper for evolution and observation functions % function [fx,J,dfdP] = VBA_evalFun(flagFun,posterior,u,options,dim) % % This function evaluates the evolution or observation function (eof) at % the mode of the posterior densities of hidden state...
fb49f3165dc3b3230217a04e78ed12132867a31967a3bc640b215f0fdf4a95b8
MATLAB
4,326
110
function [Xsol, Ssol] = generalized_eigenvalue_computation(A, B, p) % Returns orthonormal basis of the dominant invariant p-subspace of B^-1 A. % % function [Xsol, Ssol] = generalized_eigenvalue_computation(A, B, p) % % Input: A is a real, symmetric matrix of size nxn, % B is a symmetric positive definite ...
e26ee8f3235b533b3bec8e532efabfa9c34e0086b0d5217a81d3128f72f707d3
MATLAB
4,329
116
function y_ICC_Image_LMM_CallR(RateDir,OutputName,MaskFile,CovWCell, CovBCell) % function y_ICC_Image_LMM_CallR(RateDir,OutputName,MaskFile, CovW, CovB) % Calculate the Intraclass correlation coefficient for brain images. % Note: the ICC values were derived by linear mixed models (LMMs) as in Zuo et al. (2013): Zuo,...
babcf2c286bf850fcce70b3d394d2147f3130a882550f548a3e0ca481fad9158
MATLAB
4,330
82
% Example 1 % % % Citation: Cannavo' F., Sensitivity analysis for volcanic source modeling quality assessment and model selection, Computers & Geosciences, Vol. 44, July 2012, Pages 52-59, ISSN 0098-3004, http://dx.doi.org/10.1016/j.cageo.2012.03.008. clear all home % create a new project pro = pro_Create(); % ad...
6fa40219de8fa72f882c33f1034992b7b128139c7d4a840add534535ee66e0db
MATLAB
4,331
154
%% cpsd_to_var % % Spectral factorisation: calculate VAR parameters from cross-power spectral density % % <matlab:open('cpsd_to_var.m') code> % %% Syntax % % [H,SIG,iters] = cpsd_to_var(S,G0,maxiters,numtol) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % ...
bccd4c299eb3ea6e410304e2426b4949e601ed69bd1ca89461569979f09c69ee
MATLAB
4,331
104
function make_NBS_ready(paths, group_names, conn, nickname) % To make data matrix and design matrix for NBS exercise % modified from NBS_sam by Sonya - May 9, 2018 % modified by Liz - Sept 2018, Jan 2020 % function-ified by Julie - March 2020 % INPUT-------------------------------------------------------------------...
f821100c13f283241e859e45ab8fe498be1d9a1e83dccbc0d75bc337a86ae03f
MATLAB
4,332
153
function [beta,R2,beta_ts,R2_ts] = CircularRegression(x,angles,slope) %CircularRegression - Non-parametric linear-circular regression. % % Fit 'barber-pole' lines to the data. The model consists of three parallel lines % y = a.x + b + k*2pi (k in {-1,0,1}). The distance of a point to the model is % defined as the m...
71389914ec9f955f6f934ccf9ce730cdcb8b1e8de33d3cd9df35a617449aa82e
MATLAB
4,335
89
%General: % To visualize e.g. a cross-spectrum or coherence in a 'head-in-head', % plot you need some functional data (e.g. a cross-spectral matrx cs) % and the locations of the channels. A location-variable for N channels % is either an Nx3 matrix, if the locations are given in 3D, or a % Nx2 matrix if they are g...
9f1013b0584c6b7c532a23d299c1de67dcafad324687d6676975dced7b7d13f2
MATLAB
4,337
179
%% Visualize soft thresholding behavior of different log priors % PMTKauthor Francois Caron % PMTKmodified Kevin Murphy %% % This file is from pmtk3.googlecode.com function normalGammaThresholdPlotDemo() %z=-10:.1:10; z=-10:0.5:10; x=-10.005:.05:10; function out=generalizedStudentPenalty(w,a,b) %out = -log(a) + lo...
ff9a89cfeca1a5b2085e7d5fd390adcb88d9c03a62bf87191673dc7297222160
MATLAB
4,337
140
function [param,stat]=sigm_fit(x,y,fixed_params,initial_params,plot_flag) % Optimization of parameters of the sigmoid function % % Syntax: % [param]=sigm_fit(x,y) % % that is the same that % [param]=sigm_fit(x,y,[],[],[]) % no fixed_params, automatic initial_params % % [param...
5062b9c85594b64a8654a3573863fe0071dd48d742f45a99d58bb0a2e4d8e7af
MATLAB
4,338
104
% Function: PLS and do bootstrape. % Updata date: 2022.09.18 % Updata date: 2022.11.5 % Updata date: order the gene symbol!!!!2023.04.12 % Updata date: order the gene symbol!!!!2023.05.19 % Email:luolongcao@163.com function test2 = Method_PLSbootstrap(X,Y,dim,max_dim,boot,geneSymbol,out_path,fig_name) % X: the p...
8a63bbac08c77d74eca9b42f39a91a227bad196c5055238a367332d96634db98
MATLAB
4,340
131
function [wbest, hbest, normbest, dbest] = nnmf_modified(a, k, tries, options, specfx, concfx) % NNMF Non-negative matrix factorization with fixed spectra and concentrations. % This function attempts to decompose matrix A into W and H, minimizing the Frobenius norm. % Arguments: % a: non-negative N-by...
3be27734dbc17bac543984931bd19183cd9667349f88981d56baba310e233142
MATLAB
4,341
126
function [zest, xest, zsamples, w] = rbpfSlds(N, par, y, u, resamplingScheme) % Rao-Blackwellised particle filtering for switching linear dynamical system % See Doucet, Gordon, Krishnamurthy % "Particle filers for state estimation of Jump Markov Lienar Systems", 2001. % % N: num samples % par: parameters of SLDS (se be...
1c6640ec6110db1ae434b6c0c81d50126fd2a82b32ebd11f111d3ab4507bba2c
MATLAB
4,342
130
%% Ridge and lasso regression: % visualize effect of changing lambda on degree 14 polynomial % % This is a simplified version of linregPolyVsRegDemo.m %ns = [21 50]; %for n=ns(:)' n = 21; setSeed(0); [xtrain, ytrain, xtest, ytestNoisefree, ytest, sigma2] =... polyDataMake('sampling','thibaux','n',n); deg = 14...
be7331bf6dacf64f52baf9eba27ea9ab12b58ee2f2c600e8e3c94287eb41a325
MATLAB
4,342
118
function CBIG_ABCD_rest_proc_compute_motion_outlier(id,output_dir,raw_path,manufacturer,FD_th,DV_th,discard_run,discard_seg,motion_filter) % CBIG_ABCD_proc_compute_motion_outlier(id,output_dir,raw_path,manufacturer,FD_th,DV_th,discard_run,discard_seg,motion_filter) % % Inputs: % - id: % subject id % % - output...
2b08eeba29045155685b9a283eb16f58bf6b708f8c984bfb2e583d5486daed40
MATLAB
4,344
102
% KMEANS K-means clustering. % IDX = KMEANS(X, K) partitions the points in the N-by-P data matrix % X into K clusters. This partition minimizes the sum, over all % clusters, of the within-cluster sums of point-to-cluster-centroid % distances. Rows of X correspond to points, columns correspond to % variables. KMEANS ...
b2ea99c9919d025790eb9b6be852fa2eb6f4f00e6394211a841b1e84e9f652f6
MATLAB
4,344
131
function [V] = ft_write_mri(filename, dat, varargin) % FT_WRITE_MRI exports volumetric data such as anatomical and functional % MRI to a file. % % Use as % ft_write_mri(filename, img, ...) % where img represents the 3-D array with image values. % % The specified filename can already contain the filename extention, b...
f0f76781f23fef6cee7a59f364b37ff5fe2dc8bcd003c0fac4ba7ea511d361a7
MATLAB
4,345
159
function draw_figure3D(p,decRes) % % This code is for drawing figure 3ABC and S1C % Umap analysis (umap_on_emotion_scores.ipynb) must be finished before executing this script. % % %% settings mapPath = [p.rootPath,'res/umap_on_emotion_scores/']; % prepare label inf. for score based coloring dpath = sprintf('%s%s/rois/...
735b97c12d170c55b65798adf29c7a341dbd49802d6e26675a5c931faf3221f9
MATLAB
4,346
165
function wlPlot_plotEventFreqQAmp(cfg, events, f1, f2, figtitle, filelabel) % function wlPlot_plotEventFreqQAmp(cfg, events, f1, f2, figtitle, filelabel) % % This function makes a scatter-plot of frequency and duration (in periods) % for detected bursts, and a scatter-plot of frequency and detected % amplitudes. % % P...
35703a62861bca9072c06202da6edb2f0347fa153a51f8dc764d5cacc056c604
MATLAB
4,347
137
function [P, P0, output] = cp_opt(Z,R,varargin) %CP_OPT Fits a CP model to a tensor via optimization. % % K = CP_OPT(X,R) fits an R-component CANDECOMP/PARAFAC (CP) model % to the tensor X. The result K is a ktensor. The function being % optimized is F(K) = 1/2 || X - K ||^2. % % K = CP_OPT(X,R,'param',value,.....
d86ccf4ed404c9415f22549e06667b886d3e8a8329cacd668f9182afccb3c274
MATLAB
4,348
127
%% (Predict Spike Plotter -- Plot) Error rate vs. State % % Plots the average prediction error by states, as calculated from the % prespike components % % The errorStruct, 'Lx_x_state' components are the total cumulative error, % normalized by the number of predictions from that state; effectively a % mean. If w...
3417f474f3aadb885fbd91cc2828129f65c9438f735579a13f5c9e171ea4b0d5
MATLAB
4,349
127
%Load the set of all pixels of all puncta across all rounds from the filename_pixels = sprintf(fullfile(params.punctaSubvolumeDir,sprintf('%s_punctavoxels.mat',params.FILE_BASENAME))); load(filename_pixels) fprintf('Loaded.\n'); %This is the size of the cropped images, corresponding to ~15um pre-ExM filename_punct...
fbe06014b5211782ed8a509d50972699c5eb4729787a5ca3b7dadd62a3701d3f
MATLAB
4,349
113
function [ titleStr, settings, results ] = localGraphAnalysisFeatures( dataview, settings ) % This function can compute graph based density estimates. % % This function is meant for k-NN graphs. % % The parameter k determines which neighbor to consider. % % Depending on the dimension...
86619a200214a2df863d6a0a90346e2ad4dd4c65307d50733c100f4d7dea1161
MATLAB
4,350
120
function [dgm, loglikHist] = dgmTrainEm(dgm, data, varargin) %% Fit a dgm with partially observed data via EM % % See dgmTrain %% % This file is from pmtk3.googlecode.com [localEv, EMargs] = process_options(varargin, 'localev', []); if ~isempty(localEv) && ndims(localEv) < 3 && dgm.nnodes > 1 localEv = insertSingl...
7c112f49477f0f62cafbc6a8c5cae32fe2c1991fc3b147625a28d394b72d32a8
MATLAB
4,357
136
%% MVGC Multivariate Granger Causality Toolbox - Function Reference % %% Toolbox initialisation % % * <startup.html startup> % %% Demonstration scripts % % * <mvgc_demo.html mvgc_demo> % * <mvgc_demo_bootstrap.html mvgc_demo_bootstrap> % * <mvgc_demo_GCCA.html mvgc_demo_GCCA> % * <mvgc_demo_nonstationary.html mvgc_demo...
0bc5ab78ec41a33cdf09b71cc0b20889c20c730df8f974a1bc02ea290a2ba7d6
MATLAB
4,359
170
function [p2,W2] = violinPlotsStats(data,opts) % significant box of violins % setup commonly used values nCond = size(data,2); nObs = size(data,1); nPt = 200; if ~isfield(opts,'yl') || isempty(opts.yl) yl = [min(data(:)) max(data(:))]; opts.yl = yl+diff(yl).*[-0.1 0.1]; end if ~isfield(opts,'sigLe...
7abbf077587cdccb84ab1542ec9f7a3a4e2e96722ff7ba7ad5efc9578c1d4d7e
MATLAB
4,359
104
% Subtract first response before correlation to second response, iterate until no more responses: % while max value is larger than Corr_Thresh: % get first (largest) max value. % check that index is within range (lags range 0-23) % shift TemplateResponse and subtract from sequence % Run correlation again and look ...
a4a1adedc8d12f7d91fe5a1a6fdb202db3b2ff239d8410936f3d781300f5adb7
MATLAB
4,359
163
% FADE-SAME: Table S5 % clear % close all %%% Step 1: load data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % set results files FADE_file = '../FADE_scores/FADE_SAME_scores_2021_01_11_FADE_only.xls'; vols_file = 'covariates/HC_volumes_FADE.xls'; % load results files [num, txt, raw1] = xlsread(FADE_file); ...
ae4515b46f7c693fa91a090845e219164e268755c909569293b41d418af69cdf
MATLAB
4,360
121
%% movingstat - will summarize up a vector based on N values specified % Well....talk about reinventing the wheel, only slower...turns out there % was a function in matlab to do most of what I was attempting. Using the % median as a summary statistic seems to be the only function not doable % using conv or filt...
3181a8129f51fe8edf75beae7aeacba4099d030dfd2034e30274c3ab7e8f5673
MATLAB
4,361
101
function lan_master_gui_filt(LAN_var, mainfig, parent_) LAN = LAN_var; if nargin < 2 mainfig = figure; end figure(mainfig); cfg_control(1) = uicontrol('style', 'text', 'units', 'norm',... 'position', [.04 .92 .6 .05], 'string', 'channel(s) : ',... 'horizontalalignment', 'right'); cfg_control(2) = uicontro...
ff18eab9bf85f7e435b3d7a35c79614441e89f7f05a2935f9016029a9a740d6d
MATLAB
4,362
171
function c = ttt(varargin) %TTT Sparse tensor times sparse tensor. % % Z = TTT(X,Y) computes the outer product of tensors X and Y. % % Z = TTT(X,Y,XDIMS,YDIMS) computes the contracted product of % tensors X and Y in the dimensions specified by the row vectors % XDIMS and YDIMS. The sizes of the dimensions spe...
45bd4cb0c8342e277fa3293bbca6756e64947c76aaebf7246452f5655e729cc0
MATLAB
4,363
163
function varargout=shadedErrorBar(x,y,errBar,lineProps,transparent) % function H=shadedErrorBar(x,y,errBar,lineProps,transparent) % % Purpose % Makes a 2-d line plot with a pretty shaded error bar made % using patch. Error bar color is chosen automatically. % % Inputs % x - vector of x values [optional, can be left em...
aa5bfd86d1787a4406ff3e4761d58b484fa14e25104ab3cb6b57af8731dbcf9c
MATLAB
4,363
200
% this function adds the spikes in some channel % to a global dataset that a global network can be trained on % % usage: % C.addToGlobalTrainingData() % where C is your crabsort object function addToGlobalTrainingData(self, nerve_name) arguments self (1,1) crabsort nerve_name char end if isempty(self.channel_to...
0556d55cc98f879e7f3037fb2c32814dca8527d021f87950a1722c166c36affc
MATLAB
4,364
152
% Author: Birgit Nierula % nierula@cbs.mpg.de function prepro_applyCCAfilters(subject, nerve, srmr_nr, is_eeg) %% set variables subject_id = sprintf('sub-%03i', subject); if is_eeg save_path = [getenv('EEGDIR') subject_id '/']; else save_path = [getenv('ESGDIR') subject_id '/']; end cfg_path = getenv('CFGDIR...
362e267981dadeed7e3dbcf35c873733d6835a0b7578aa6270b1d086ddf85b24
MATLAB
4,364
132
function uv = conformalParametrization(mesh, constrVidx, constrV) % compute conformal parametrization % % SCP minimizes a functional u'*L_C*u + lambda*(u'*B*u-1) % where the first term is the conformal energy with L_C the Laplacian % minus the the area matrix % and the second adds a constraint ...
cfe5566fa3eff0208eb052b76e7603479899fb1a229c800422d1b1df8d0bd38f
MATLAB
4,365
144
function [count edges mid loc] = histcn(X, varargin) % function [count edges mid loc] = histcn(X, edge1, edge2, ..., edgeN) % % Purpose: compute n-dimensional histogram % % INPUT % - X: is (M x N) array, represents M data points in R^N % - edgek: are the bin vectors on dimension k, k=1...N. % If it is a scalar ...
5fc227b9a48bf9588d62e49bec8c2cb8356be37745e8931ba3b32a70b97e79be
MATLAB
4,367
161
function wlPlot_plotAllMatrixEventsDebug(cfg, evmatrix, ... figtitle, figlabel, plotsperband, trialstride, channelstride, eventstride) % function wlPlot_plotAllMatrixEventsDebug(cfg, evmatrix, ... % figtitle, figlabel, plotsperband, trialstride, channelstride, eventstride) % % This function plots all or some of th...
2c7fb2c9bd01ba4b2314b70b9b57248a6a7daf81a7c52a385b49afd74c17a00f
MATLAB
4,368
125
function [tfr,t,f] = tfrspwv(x,t,N,g,h,trace); %TFRSPWV Smoothed Pseudo Wigner-Ville time-frequency distribution. % [TFR,T,F]=TFRSPWV(X,T,N,G,H,TRACE) computes the Smoothed Pseudo % Wigner-Ville distribution of a discrete-time signal X, or the % cross Smoothed Pseudo Wigner-Ville representation between two % signals...
774927e3ac3b62d3a79b952542d8406bbab357738161a8a24f2a0a8f826dd9b9
MATLAB
4,369
122
function s = reorganizeDLParams(s) % s = reorganizeDLParameters % called by lblModernize if isfield(s,'trackParams'), return; end % KB 20190212: reorganized DL parameters -- many specific parameters % were moved to common, and organized common parameters sPrm_common = APTParameters.defaultParamsStructDeepTrack(); f...
9d3f539868330b8b64b5f7638cce6c1f12d032059587072ba095e59072b43469
MATLAB
4,371
136
function complete_bool = check_lfp(basepath, varargin) %check_lfp Verify completeness of LFP file relative to the DAT file % This function checks whether a downsampled LFP file (.lfp) is complete % by comparing it against the corresponding raw wideband data file (.dat). % If an LFP file exists, the function reads...
6496625d8724dd5c2c293429cf360808df71cfcdba59e7d316e51f35313f784d
MATLAB
4,372
110
%% This file performs a simulation and saves the data used in figure 4 and table 1. % This simulation computes R^2 values for all combinations of reduce b values % to determine the optimal b-values to use in the b-value reduction. %% Machine and simulation parameters N = 1000; % Number of simulations NDirs = 64...
b86eab14cebdd4b6c37f3a0b6d5ee9ea6792f3fad983372febb2e8e1d8e88b74
MATLAB
4,373
107
function [cluster, total] = findcluster(onoff, spatdimneighbstructmat, varargin) % FINDCLUSTER returns all connected clusters in a 3 dimensional matrix % with a connectivity of 6. % % Use as % [cluster, num] = findcluster(onoff, spatdimneighbstructmat, minnbchan) % or ar % [cluster, num] = findcluster(onoff, spatd...
d967e93e10cf2cba73c45e85ba47cdf9101d9866de68d01cc4e0f5e91d15c53f
MATLAB
4,374
163
function varargout=shadedErrorBar(x,y,errBar,lineProps,transparent) % function H=shadedErrorBar(x,y,errBar,lineProps,transparent) % % Purpose % Makes a 2-d line plot with a pretty shaded error bar made % using patch. Error bar color is chosen automatically. % % Inputs % x - vector of x values [optional, can be left em...
f9ce7156f4c3f25ea52633c1113971c9bcfad86c96d30fe6cf38cfc5c549e8db
MATLAB
4,377
100
function [cfg] = ft_movieplotER(cfg, data) % FT_MOVIEPLOTER makes a movie of the the event-related potentials, event-related % fields or oscillatory activity (power or coherence) versus frequency. % % Use as % ft_movieplotER(cfg, timelock) % where the input data is from FT_TIMELOCKANALYSIS and the configuration % ca...
50c9adca0aa68d66f9854b61900acfa2cdbf8a4b688270fbfbb793b4dfdddf16
MATLAB
4,378
154
scrsz = get(0,'ScreenSize'); scrWidth = scrsz(3); scrHeight = scrsz(4); datRoot = '/Volumes/LaCie/Farries recordings/'; % choose rat rat = 'IM1153'; sesList = dir([datRoot rat '/20*']); sesList = arrayfun(@(x) x.name, sesList, 'UniformOutput', false); for i = 1:length(sesList) fprintf('%d) %s\n', i, sesList{i}) en...
0b0876e31304e6e2ac72f249cacbf07614f8e1324c1421f098a7f9c3d624273a
MATLAB
4,380
123
% DoG then threshold then zscore % but also watershed and then use max zscore stuff on watershed components %% get imgs % change RUN_NUM to not overwrite files.. RUN_NUM = 321; filedir = 'C:\Users\Maryann\Desktop\leBoyden\imgRegistration\DATA\'; ns = {'C1-PL(L)', 'C2-PL(L)', 'C3-PL(L)', 'C4-PL(L)'}; % cell ...
392bc2ab00de2f34475097b307608b92c53ad058a506ca1d5d90be983869d996
MATLAB
4,384
171
function [E, D] = multivariate_decomp(C,x,y,method,realflag,thr) % MULTIVARIATE_DECOMP does a linear decomposition of multivariate time series, % based on the covariance matrix. % % Use as: % [E, D] = multivariate_decomp(C,x,y,method) % % Input arguments: % C = covariance matrix (or csd) between input time series ...
0f6cd3e05da0a40cf00978e15ebd00c98fd702e57eac7c77ac8f8ee65ccf0071
MATLAB
4,385
157
% Demo for (stochastic) DCM for fMRI. % This demo inverts the DCM for fMRI model, which contains the ballon model % as a generalized observation function (not affected by stochastic % innovations). % NB: currently, there is a ratio 1e2 between the expected standard % deviations of neural versus hemodynamic (states) noi...
bb66ecfb8911cf8862a7022818ce6ea97e6565487b30ff09bda77604b0e444c3
MATLAB
4,385
100
function h_loadProteinGelImg3(handles) global h_img3; [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); channelToLoadForGelOpt = get(handles.channelToLoadForGel,'value'); [fname,pname] = uigetfile('*.tif','Select an imaging file to open'); fname = fullfile(pname,fname...
9ba0ba52135e5a0c6590919e463196119787d9e2d96c9b01929747e472e92bcf
MATLAB
4,386
98
function rt_all = reactionTime_MSIT_correct(cfg) %% LOAD METADATA % here's the header hdr = ft_read_header(cfg.dataset); % create functions to calculate: timeToSamp = @(t) round(t * hdr.Fs); % time x sampling rate = sample sampToTime = @(s) s / hdr.Fs; % sample / sampling rate = time % extract list of eve...
94ecbd0ee2575537eac7baa31600b1a902dd18b9c88d5b9fd284d1c5fe4c043a
MATLAB
4,387
125
function [lf] = eeg_leadfieldb(dippos, elc, vol) % EEG_LEADFIELDB computes the electric leadfield for a dipole in a volume % using the boundary element method % % Use as % [lf] = eeg_leadfieldb(dippos, elc, vol) % with the input arguments % dippos = position dipole, 1x3 or Nx3 % elc = electrode positi...
eb2081d898adae178451c4fb8ff1cb2b5fa12edf49f64ae95e6e3d798aecd837
MATLAB
4,387
138
function [lf] = eeg_slab_monopole(rd, elc, vol) % EEG_SLAB_MONOPOLE calculate the strip medium leadfield % on positions pnt for a monopole at position rd and conductivity cond % The halfspace solution requires a plane dividing a conductive zone of % conductivity cond, from a non coductive zone (cond = 0) % % [l...
de3a0a595277564703a4ee98df82c4d783b37ccb68910872bfa63f7d80124b3b
MATLAB
4,388
129
% 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] = PlotMiceStrideAverages(parameters) ...
0a7bc93fa4a946d74ea7fd9071afdc82f417bef61d449e5e2a8f1b6eb671d88e
MATLAB
4,389
115
%% filterSpiketimeContinuous % // A collection of methods to convert a set of impulses, input as a point % process, into a continous function by convolving with a selected finite % inpulse response (FIR) function % % INPUTS: % timestamps = (1xN) array of event times (in Sec) % SIG_HZ = Int. Sample frequency...