sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
992b54869dd1e23603ed1ed10c26d0cb4aa9a73f7008246990cc873586135e16 | MATLAB | 5,718 | 181 | function digitalIn = make_events(varargin)
% make_Mergepointscreates a CellExplorer event file for each folder in a
% basepath, or for each video file in a basepath (behavior only studies).
% input parser
p = inputParser;
addParameter(p,'basepath',pwd,@isfolder); % by default, current folder
addParameter(p,'event_typ... |
3d067be0ce53f160d35d02c5a9c25c38db874faebe2929561ce33e625fd91a9a | MATLAB | 5,719 | 142 | function [MeanTDvox, MeanFDvox, Header_Out] = y_VoxelSpecificHeadMotion(RealignmentParameterFile,ReferenceImage,OutputDir,GZFlag)
%function [MeanTDvox, MeanFDvox, Header_Out] = y_VoxelSpecificHeadMotion(RealignmentParameterFile,ReferenceImage,OutputDir,GZFlag)
% Generate the voxel specific head motion
% Input:
% Reali... |
04febc566e67acfa1d3366c58e1e81337ba296a2f41d4c3e6121b11fdc50f372 | MATLAB | 5,720 | 236 | % 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,... |
4b1c0174e7e98eeacd6aa17c33f2e4b5370009dcda72d9d11b3eff96d2c161e5 | MATLAB | 5,720 | 156 | % Covariance matrix on the unit circle, Matern 3/2 kernel.
%
% This is basically the same as COV_CIRCLE1 but using the Matern 3/2 kernel.
%
% Inputs (defaults are used if not provided or set empty):
%
% - N: number of points (default: N = 16384)
% - OCC: tree occupancy parameter (default: OCC = 64)
% - P: square ... |
cb6d44009e374a81fb6d5b7b025e68319041810731ae33cd247c108e4d8bfd64 | MATLAB | 5,721 | 206 | % Demo: Comparison of asymmetric reinforcement learning models.
close all
clear all
% Basic settings
n_t = 128; % number of trials
f_fname = @f_rwl2; % modified Rescorla-Wagner learning rule
g_fname = @g_goNogo; % -> 'go' choice probability
% simu parameters
feedbacks = [-1; 0; 1]; % feedbacks: negative, neutral, ... |
dad0ea37036c9d1689a8260f1d820063b7031daa55525c764e7004ad83043b55 | MATLAB | 5,721 | 147 | %% Kruskal tensors
% Kruskal format is a decomposition of a tensor X as the sum of the outer
% products a the columns of matrices. For example, we might write
%
% $${\mathcal X} = \sum_r a_r \circ b_r \circ c_r$$
%
% where a subscript denotes column index and a circle denotes outer
% product. In other words, the tens... |
4cf9bd4aaae277fe6700c5ca7eae0fd4d7f77b0c0f63df3b2d52f5f4965396cc | MATLAB | 5,722 | 107 | function [pnt, tri, srf] = read_bv_srf(filename)
% READ_BV_SRF reads a triangulated surface from a BrainVoyager *.srf file
%
% Use as
% [pnt, tri] = read_bv_srf(filename) or
% [pnt, tri, srf] = read_bv_srf(filename)
% Copyright (C) 2005, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtr... |
c58880039aab6cfa4264f96f8553d4972314b832e09fe5fbf39c4b57f92c4f06 | MATLAB | 5,722 | 130 | function lan_master_gui_sfco(LAN_var, mainfig, parent_)
LAN = LAN_var;
figure(mainfig);
cfg_control(1) = uicontrol('style', 'text', 'units', 'norm',...
'position', [.04 .92 .6 .05], 'string', 'output var. name : ',...
'horizontalalignment', 'right');
cfg_control(2) = uicontrol('style', 'edit', 'units', 'norm'... |
0d3c89d3d253f07657a20c78ccc2b042600c32cd375179204ae6c9d37eeb08e8 | MATLAB | 5,727 | 176 | function pval = FindClustersLikeGND(trueTVals, permTVals, chan_hood, tail, df)
% Function to find significant clusters after having already run a set of
% permutation tests, using the resulting null t-value distribution
% The code below is copied from the Mass Univariate Toolbox (DMGroppe)
% functions clustGND.m & clus... |
913ad498559fc30e1246966498756a4538e112c6c97fa538a41fd9134d869a76 | MATLAB | 5,730 | 192 | function [errcode, times, wave, mag, freq, phase] = ...
wlSynth_makeOneBurst(duration, rollon, rolloff, samprate, ...
f1, f2, ftype, a1, a2, atype, pstart)
% function [errcode, times, wave, mag, freq, phase] = ...
% wlSynth_makeOneBurst(duration, rollon, rolloff, samprate, ...
% f1, f2, ftype, a1, a2, atype,... |
dea2060fd20ba3327d67c862f419bc9375de7ba04e178d03870330f79901d63f | MATLAB | 5,730 | 197 | function eventftdata = wlFT_getEventTrialsFromMatrix( eventmatrixdata );
% function eventftdata = wlFT_getEventTrialsFromMatrix( eventmatrixdata );
%
% This function converts an "event matrix" structure as described by
% EVMATRIX.txt into a Field Trip data structure.
%
% "eventftdata" uses Field Trip's format, storing... |
784774a1354c08267260ef6d57406ac1d918d9068ada2cd94ed314961750887b | MATLAB | 5,735 | 211 | function [m_data,m_events,v_label_selected,s_fs,s_nb_samples_all,s_nb_channel_all,v_label_all,v_channel_type_all,v_channel_unit_all,str_ori_file1,str_ori_file2] = eeg2mat(filename,s_sample_start,s_sample_stop,v_channel_list,varargin)
%% function
% [m_data,m_events,v_label_selected,s_fs,s_nb_samples_all,s_nb_cha... |
d466d89f9d4072802e1f066f9c744b989170217580ac9f759ba453d241944de4 | MATLAB | 5,735 | 146 | function [out] = read_tmsi_poly5(filename, varargin)
% READ_TMSI_POLY5
%
% Use as
% hdr = read_tmri_poly5(filename)
% dat = read_tmsi_poly5(filename, hdr, begblock, endblock)
%
% This implementation is as closely as possible based on the original "tms_read",
% which contains the comments
%
% Changed on 08-10-201... |
7ff45c6bf0c424fd3138d797d676a053add148d9c93a2e720afcadf1c090ef30 | MATLAB | 5,738 | 163 | % Data analysis for FADE-SAME
% _
% This script performs the entire data analysis for the FADE-SAME study.
%
% written by Joram Soch <Joram.Soch@DZNE.de>, 11/01/2021, 16:53
clc
clear
%%% Step 0: analysis parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% directories and subjects
stud_dir = 'C:\Joram\proje... |
f3247e7647d935233e5c109d5f8e0615a4cf6070fcb4250dfdc2e2c452030a7f | MATLAB | 5,741 | 167 | function [dataout] = ft_channelnormalise(cfg, data)
% FT_CHANNELNORMALISE shifts and scales all channels of the the input data.
% The default behavior is to subtract each channel's mean, and scale to a
% standard deviation of 1, for each channel individually.
%
% Use as
% [dataout] = ft_channelnormalise(cfg, data)
%... |
1a8e74b26215b5b4ebc880be6c90ce8792d50beae29137753e61c14a00a646a9 | MATLAB | 5,742 | 84 | clearvars
close all
set(0, 'defaulttextfontname', 'Arial')
set(0, 'defaultaxesfontname', 'Arial')
mouse_dir_ft = '../step_prob_matrices/fixed_target_jackknife';
mouse_dir_rt = '../step_prob_matrices/relative_target_jackknife';
mouse_dir_l1 = '../step_prob_matrices/two_target_no_cues_tgt1_ja... |
924a8b33c75ae53fd917d5ea7bb93e9d47ab7ce632a7981ea6461d81ca8d6179 | MATLAB | 5,744 | 146 | function [out] = read_tmsi_poly5(filename, varargin)
% READ_TMSI_POLY5
%
% Use as
% hdr = read_tmri_poly5(filename)
% dat = read_tmsi_poly5(filename, hdr, begblock, endblock)
%
% This implementation is as closely as possible based on the original "tms_read",
% which contains the comments
%
% Changed on 08-10-201... |
409a18c4cf6514a4ed20cdd59ca82fef825aa09cf97631a8c4bbf083b4844cbb | MATLAB | 5,746 | 152 | % Nine-point stencil on the unit square, constant-coefficient Poisson equation,
% Dirichlet boundary conditions.
%
% This is basically the same as FD_SQUARE1X but using a fourth-order
% approximation with stencil radius two. Correspondingly, the nested dissection
% separators have width two.
%
% Inputs (defaults are us... |
e168382cea555dcb73bba9e6dccfe304e84c6eb5b479719444ae110fae0f2cfd | MATLAB | 5,746 | 179 | function update_behavior_from_metadata(metadata_path,varargin)
% updates animal behavior file using info stored in metadata.csv
% input parser
p = inputParser;
addParameter(p,'basepath',pwd);
parse(p,varargin{:});
basepath = p.Results.basepath;
% read in metadata csv
df = readtable(metadata_path);
basename = basenam... |
a0f861081a73542326513c2cc7d0fadda5676ef1bbf72894416e160230126081 | MATLAB | 5,747 | 172 | function M = stiefelstackedfactory(m, d, k)
% Stiefel(k, d)^m, represented as matrices of size m*d-by-k.
%
% function M = stiefelstackedfactory(m, d, k)
%
% Points on this manifold are matrices Y of size n x k, with n = m*d.
% Y is thought of as m matrices of size d x k each, stacked on top of each
% other. Call... |
a1d7b56ff4210b11d686bae4edd4e9b4846d9aa0c45a80a772e5bd9dbbf9a0e6 | MATLAB | 5,747 | 182 | function [C,Ceq] = Constraint_Function (xopt)
% 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 provides an equality constraint that ensures the joint mo... |
0479fcc2894fcfcd5c4b096d14794ab890b57fce63c88fc9b72e553d7290f5a1 | MATLAB | 5,750 | 168 | %% Modified from trimOutlier() %%
function [EEG, artifact_info] = trimOutlier_esg(EEG, amplitudeThreshold, pointSpreadWidth)
if ~(nargin==3)
error('trimOutlier_adjust() requires 3 input arguments.')
end
% return if 3-D
if length(size(EEG.data))==3
disp('Epoched data detected: datapoint rejection will not be ... |
0e1315350bd09a4907d5be0740584be5cab4e14fd4d3b2d0bb15a10562e177f5 | MATLAB | 5,750 | 152 | function colors = distinguishable_colors(n_colors,bg,func)
% DISTINGUISHABLE_COLORS: pick colors that are maximally perceptually distinct
%
% When plotting a set of lines, you may want to distinguish them by color.
% By default, Matlab chooses a small set of colors and cycles among them,
% and so if you have more than ... |
7fa1061ffac1ca08e659b491d5c5e266e6be663a1848c19500f4edea5091a8bd | MATLAB | 5,751 | 179 | function [index] = ft_documentationindex(filename)
% FT_DOCUMENTATIONINDEX is a helper function to maintain the online documentation.
%
% Normal users will not be calling this function, but will rather look at
% http://www.fieldtriptoolboxorg/reference/index where the output of this
% function can be found.
%
% See al... |
d27d6112fc3a54156637fc4360d56c0db1ae7ac93155eedb9445a19fe42e9fad | MATLAB | 5,752 | 151 | % This file implements Phase Coupling Optimization
% Written by Gunnar Waterstraat and Iara de Almeida Ivo
% Please obey the Licens file, supplied with this software.
% If you use this code in scientific work, please give proper reference
function [vlen, wy] = PCOa(a, y, nu, bestof)
% Phase Amplitude Couplin... |
5bba35217819b5eb5e2a63e3a5735bdae52aa363ba3011c614117b1b2f8bd422 | MATLAB | 5,754 | 199 | % IFMM_MV Multiply using interpolative fast multipole method.
%
% Typical complexity: same as IFMM.
%
% Y = IFMM_MV(F,X) produces the matrix Y by applying the compressed matrix F
% to the matrix X. This assumes that all required interactions are stored in
% F (i.e., IFMM was used with option STORE = 'A').
... |
511406c3d2603924c11949e745171cf58e0050de4ecd44ce5b283a2e054e6439 | MATLAB | 5,755 | 108 | %% Description
% In this introductory example, a block of "standard tissue" (mu_a = 1,
% mu_s = 100, g = 0.9) is illuminated by a pencil beam (infinitely thin
% beam). A small slice of air is present in the top of the simulation
% volume. nx and ny are set to odd values so that when the pencil beam is
% launched at x =... |
b1e61a5643ff6ce8efa143968100852fd8e967deae9de26cc52ac7f257c18e53 | MATLAB | 5,756 | 157 | function [M, TF] = padcat(varargin)
% PADCAT - concatenate vectors with different lengths by padding with NaN
%
% M = PADCAT(V1, V2, V3, ..., VN) concatenates the vectors V1 through VN
% into one large matrix. All vectors should have the same orientation,
% that is, they are all row or column vectors. The ve... |
56f6390591617b6e58450d0b431d1e5135e582e154b5de90036030dae5880e0c | MATLAB | 5,760 | 186 | % RSKELF_DIAG Extract diagonal using recursive skeletonization factorization
% via matrix unfolding.
%
% This is a variant of the selected inversion algorithm for sparse matrices
% via the multifrontal factorization, generalized to account for additional
% ID-based sparsification operators. The p... |
880893d134ca70c1c7171719c07bdc5cce45778eb833457ec4eeca0c224ba786 | MATLAB | 5,763 | 148 | function methodReport(varargin)
% Generate a report showing which classes implement and inherit which methods.
% Does not inlcude class constructors. By default, it only shows
% classes that are either abstract or contribute a new method.
% This file is from pmtk3.googlecode.com
%
% LEGEND
% 'A' for Abstract ... |
56cdaa4bdb70f889c66c9409b54a45a201a45b5c37505a1d44fdf1bde6041b08 | MATLAB | 5,765 | 169 | function [O_penalty, O_grad]=penalties_smoothness(O,sizeI,Scaling)
% This function calculates the 2D or 3D equivalent of the 2D
% bending energy of thin sheet of metal, for a 2D or 3D transformation
% grid of cubic spline control points.
%
% [O_penalty, O_derivative]=penalties_smoothness(O,sizeI,Scaling);
%
%... |
fc76ac2bf6461abbff34281b37f7a2b69128234015e0d14f2fc24dfc1c040cef | MATLAB | 5,768 | 179 | function M = stiefelgeneralizedfactory(n, p, B)
% Returns a manifold structure of "scaled" orthonormal matrices.
%
% function M = stiefelgeneralizedfactory(n, p)
% function M = stiefelgeneralizedfactory(n, p, B)
%
% The generalized Stiefel manifold is the set of "scaled" orthonormal
% nxp matrices X such that X... |
6be87af77852d4ca862a56ba8b95ecf81719f8f50126c117fede758ac6fc9603 | MATLAB | 5,770 | 172 | function [ ywinrange ] = bz_MultiLFPPlot( lfp,varargin )
%bz_MultiLFPPlot(lfp). This function plots multiple lfp channels from a
%buzcode lfp structure with the channels appropriately spaced.
%
%USAGE
% figure
% bz_MultiLFPPlot(lfp)
%
%INPUT
% lfp a buzcode lfp structure. channels are assumed to be ... |
d877bdc5da1820f6318296e7557f6bc78ef412cc91d5f90e1b7ebef10cfc3786 | MATLAB | 5,771 | 114 | % compute_navigation_efficiency
for init_project = 1
% set directories
GH = '/Users/cpaquola/Documents/GitHub/'; % github repo location
homeDir = [GH '/DMN']; % home directory
bbwDir = [GH '/BigBrainWarp']; % BigBrainWarp lo... |
7e96b00c0fd8815bf1ddf5197e5e0aeffd43e51a903fdfd10154bfc5b7155018 | MATLAB | 5,774 | 114 | % function [G,H] = GetGH (M, m)
%
% Modification of GetCSD.m to obtain the G- and H-matrices, which are
% invariant for a given EEG montage, which are then used as input with
% the EEG/ERP data to the CSD.m routine
%
% Usage: [G,H] = GetGH (M, m)
%
% Input parameter:
% M = a MatLab structure for an ... |
079994769e822197cfa88f437762d518e8a3dc7c0bac99102ac136d0ee83398a | MATLAB | 5,775 | 200 |
clear
% close all
Monkey = ['Monkey1']; % ['Monkey1' or 'Monkey2']
%---------------
AlignBase = ['PER_ON'];
%---------------
Align = [{'PER_ON'} {'GO'} {'MOV'} {'Touch'}] ;
%---------------
nPERM = 1000;
for al = 1:length(Align)
clear nWindStart bbb p_value differences_false difference_original... |
e36e0d5a5399e6f42d43debdaf7ca809e4fae8e15792c8396b25be6e451a4c42 | MATLAB | 5,777 | 216 | %epa_capture Analyzes responses in the capture range
%
% This script analyzes data generated by epa_win_pc, which computes,
% for each participant in the endogenous pro/anti task, the
% probability of a correct choice for all the trials within a given
% rPT window. Here, we compare the strength of the exogenous ca... |
93e9c0d294c36db8318fcb933b2c691fe807bba857c6c2b0974aaaa29687e523 | MATLAB | 5,779 | 162 | function [res_x, idx_of_result] = knee_pt(y,x,just_return)
%function [res_x, idx_of_result] = knee_pt(y,x,just_return)
%Returns the x-location of a (single) knee of curve y=f(x)
% (this is useful for e.g. figuring out where the eigenvalues peter out)
%
%Also returns the index of the x-coordinate at the knee
%
%Paramet... |
d002e97bac7a6b50c89df01ee89cea846e8467e822f6c0b22ba6f90da280c2ad | MATLAB | 5,779 | 148 | function varargout = DPABI_SelectROIIndices(varargin)
% DPABI_SELECTROIINDICES MATLAB code for DPABI_SelectROIIndices.fig
% DPABI_SELECTROIINDICES, by itself, creates a new DPABI_SELECTROIINDICES or raises the existing
% singleton*.
%
% H = DPABI_SELECTROIINDICES returns the handle to a new DPABI_SELECTR... |
3392d3fcfa1bca905ac08bd2bfaf4c0ccd700c8f2e982a5f328ac9364a17cc89 | MATLAB | 5,781 | 266 | %%% Example for T1 and T2 estimation plus display of maps, for one example
%%% neonatal dataset
addpath('lib');
%%% data has been pre-saved into .mat to ensure anonymized
load data/neonate_data_example.mat
%%% Flag to either compute the maps, or load from data
saveresults = 0; % 0 - don't calculate, 1 - calculate an... |
b4106bfbe9a4cccbe627bde760aca06a8a581937b33b1b9b8df9e4c393f391c9 | MATLAB | 5,781 | 209 | % Detect red and blue LEDs position in a video file and creates a 'led' file
%
% USAGE
%
% Process_DetectLED(videoFile,<options>)
%
% videoFile path to Basler video file, including the '.avi'
% extension or not
% <options> optional list of property-value pairs (see table below)
%
%... |
de919d249e9f5d62c4974ca42fd795bcf3314c8a75a0aff9ab7719eb93678361 | MATLAB | 5,781 | 166 | % Seven-point stencil on the unit cube, constant-coefficient Helmholtz equation,
% Dirichlet boundary conditions.
%
% This is basically the 3D analogue of FD_SQUARE3.
%
% Inputs (defaults are used if not provided or set empty):
%
% - N: number of points + 1 in each dimension (default: N = 32)
% - K: wavenumber (def... |
1a3fa223f9e540256cc5f1c4a4ff5a0e00d8158f168e033e4852e77f725b6ede | MATLAB | 5,782 | 212 | function [mix, options, errlog, post] = gmmem_weighted(mix, x, w, options)
%GMMEM EM algorithm for Gaussian mixture model.
%
% Description
% [MIX, OPTIONS, ERRLOG] = GMMEM(MIX, X, OPTIONS) uses the Expectation
% Maximization algorithm of Dempster et al. to estimate the parameters
% of a Gaussian mixture model defined b... |
e1f1b05895992eed14ff68e86d4df0805b6e9daef6b397e399228f255ce17c83 | MATLAB | 5,782 | 179 | function varargout = unparcellate(data, parcellation, parameter, parcelparam, varargin)
% UNPARCELLATE performs the reverse of a parcellation, by assigigning each
% parcel's activation to the vertices that contributed to that parcel.
%
% Use as
%
% fun = unparcellate(data, parcellation, parameter, parcelparam, varar... |
efca6f519561acd5cd92b7cee73b7a5524b913577be679c2300667cd30170261 | MATLAB | 5,783 | 181 | function hfig = tightfig(hfig)
% tightfig: Alters a figure so that it has the minimum size necessary to
% enclose all axes in the figure without excess space around them.
%
% Note that tightfig will expand the figure to completely encompass all
% axes if necessary. If any 3D axes are present which have been zoomed,
% ... |
41ce472faa5bbba2938031f90273b50ff99cf7e73effe987e522fccb45bc549d | MATLAB | 5,784 | 148 | function [timelock] = ft_datatype_timelock(timelock, varargin)
% FT_DATATYPE_TIMELOCK describes the FieldTrip MATLAB structure for timelock data
%
% The timelock data structure represents averaged or non-averaged
% event-releted potentials (ERPs, in case of EEG) or ERFs (in case
% of MEG). This data structure is usual... |
e3e1a00f81f7e7271f6bfa2239c422c1a7d96c6e485d5e0ea148b5241da956fc | MATLAB | 5,784 | 126 | function h_loadAnnotatedRoiData3(handles, flag)
[currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles);
currentFilename = get(handles.currentFileName,'String');
[pname, fname, fExt] = fileparts(currentFilename);
analysisNumber = currentStruct.state.analysisNumber.value;
objs = [f... |
e0e1e24922a60a1397edc4b523162632fcd9216e36abea4483fe00f347f2d03b | MATLAB | 5,786 | 149 | %% Loading StepMiner/ANOVA results
load(strcat('../',projectId,'/',bioMarker,'/',bioMarker,'_name_pool.mat'))
name_pool = cellstr(name_pool'); % genes pass StepMiner/ANOVA test
load(strcat('../',projectId,'/',bioMarker,'/',bioMarker,'_bind_info.mat'))
load(strcat('../',projectId,'/',bioMarker,'/',bioMarker,'_stemness.... |
3b9f82c073c9455871116a49ee5676cd5842ca74077898bc98db772c02e1e617 | MATLAB | 5,787 | 125 | function [tree,data,err] = binaryTreeTrain( data, varargin )
% Train binary decision tree classifier.
%
% Highly optimized code for training decision trees over binary variables.
% Training a decision stump (depth=1) over 5000 features and 10000 training
% examples takes 70ms on a single core machine and *7ms* with 12 ... |
406ef1cff2c56687250594f275e69d3ee0ebd5c4fa372c0d48734e010fb16f8b | MATLAB | 5,787 | 166 | function spm_boney(expertgui)
%spm_boney. Toolbox wrapper to call boney functions.
%
% spm_boney(expertgui)
%
%
% Creation of a global variable "boned" for default settings.
% Setting of GUI level (0-default, 1-expert, 2-developer)
% _________________________________________________________________________
%
% Rober... |
ad0f57b1c5a9212012265900702395892d213a5a558fc135add1f333dac2f743 | MATLAB | 5,789 | 114 | function AssemblyTemplates = assembly_patterns(SpikeCount,opts)
% Patterns = assembly_patterns(Activitymatrix,opts): extracts assembly patterns from the spike matrix.
%
% Description of inputs:
% Activitymatrix: spike matrix. Rows represent neurons, columns represent time bins. Thus, each element of the matrix ca... |
b89119d32356a3faf27865ceea2ec9878fd59319130f0ee09710771ab781f104 | MATLAB | 5,789 | 183 | function [msi] = read_bti_m4d(filename)
% READ_BTI_M4D
%
% Use as
% msi = read_bti_m4d(filename)
% Copyright (C) 2007, 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 modi... |
1a421be7c1d76648716e5b9e7000a0dd0851641c785f6e8a52a4aab378ec9ea3 | MATLAB | 5,790 | 157 | % Covariance matrix on the unit circle, squared exponential kernel.
%
% This is essentially the same as COV_LINE1 but on the circle instead of the
% line. The resulting matrix is square, real, positive definite, and circulant.
%
% Inputs (defaults are used if not provided or set empty):
%
% - N: number of points (def... |
53f3b8ff3fcbdc37247b6ab477b8aecdaf7b5551f234ef2926b2d6720d235375 | MATLAB | 5,790 | 189 | function [model, loglikHist] = studentFitEm(X, varargin)
% Fit multivariate student T distribution usign EM or ECME.
%
%% Inputs
% X(i, :) is the ith case
%
%% Optional named inputs
%
% dof - if known, specify the degrees of freedom, otherwise this is
% estimated using either EM, (see Liu and Rubin Statis... |
89d8227db36398c8bf26a0cae42aafba6e2352ab697163a2b76ddf4cca716392 | MATLAB | 5,790 | 169 | function [pval, hh, stat,rval] = parametric(a,b,alpha,m,means,texto,ifv,METHOD)
%
%
% e.g --> [Wil,Wilh] =nonparametric(objetos4,controles4,0.05)
% a , b --> matrices a comparar en la ultima diemcion, siendo esta los sujetos
% (hasta 4 dimenciones)
% aplha --> nivel de significancia
% m --> relaci?n entre la... |
a2f5f2b1b4ebb87efacfdce1204078937cfa1752358403b502977d6e7e6e03e4 | MATLAB | 5,791 | 163 | function [freq] = ft_datatype_freq(freq, varargin)
% FT_DATATYPE_FREQ describes the FieldTrip MATLAB structure for freq data
%
% The freq data structure represents frequency or time-frequency decomposed
% channel-level data. This data structure is usually generated with the
% FT_FREQANALYSIS function.
%
% An example o... |
2bab58141e667206fbd14921b2838e984a041a33da717f2548ce8838a51fb6be | MATLAB | 5,796 | 156 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% dlt_computeCoefficients
function [c, rmse, X, camPts, Muv] = dlt_computeCoefficients(frame, camPts)
% function [c,rmse] = dlt_computeCoefficients(frame,camPt... |
1449a822b407a2945445830a212d1b3ed3b11c75e4dbc3c6f9bb469b2f1ebcd6 | MATLAB | 5,797 | 202 | function FigureStandardizer_FixTicks(axishand,FontSizes)
%use this in code to set axes size/font and remove box
% FigureStandardizer_FixTicks(gca,[22 20]);
% axishand=gca;FontSizes=[22,20];
if isempty(FontSizes)
AxisLabelSize = 22;
AxisTickSize = 20;
else
AxisLabelSize = Fo... |
2118dafebbb015326bfde094cd5ca35c26943ca4cf3e09a0bdc995e513affb33 | MATLAB | 5,800 | 208 | %% Compare different linear kernel classifiers on several datasets
% We need to use CV/ARD to pick lambda/C
% but at least the kernel has no hyper-params to tune...
%PMTKslow
% This file is from pmtk3.googlecode.com
% See also classificationShootout and classificationShootoutCvLambdaOnly
clear all
setSeed(0);
%% D... |
aac20c66867333379d08eaedba63696b6de93552c56edfaf882d6c5a300ede56 | MATLAB | 5,800 | 244 | function wlPlot_plotEventsAgainstWideband(cfg, evlist, evstride, ...
samprate, timestamps, bpfwave, widewave, figtitle, filelabel)
% function wlPlot_plotEventsAgainstWideband(cfg, evlist, evstride, ...
% samprate, timestamps, bpfwave, widewave, figtitle, filelabel)
%
% This function plots a series of events, showi... |
d1f00e5cf3d7f62344e47cf0d0dce7abecad71dfde04d631c24d0e99e5b847d6 | MATLAB | 5,801 | 146 | % CheckSizes.m
% Sarah West
% 6/21/22
% Function that searches through your iterators for the inputted file
% names. Does NOT use RunAnalysis, but has similar input structure.
function [] = CheckSizes2(parameters)
% Make a loop list from iterators.
looping_output_list = LoopGenerator(parameters.loop_list, p... |
db0f79e67d1d9795dcc22dc1d8ce5309f46c1a142018049af548b4cb684fce98 | MATLAB | 5,803 | 154 | function fix_lines(fname, fname2)
%FIX_LINES Improves the line style of eps files generated by print
%
% Examples:
% fix_lines fname
% fix_lines fname fname2
%
% This function improves the style of lines in eps files generated by
% MATLAB's print function, making them more similar to those seen on
% screen. Grid l... |
eecd580881aaa5ffe692d1266f138b0fdbdd7b481fe7c0bf654f8ce51637d8a9 | MATLAB | 5,803 | 178 | function publishFolder(folder, wikiOnly, linkToPml)
% Publish a single demos directory, (called by publishDemos)
%
%% Example
%
% publishFolder bookDemos\bayesDemos
%
% PMTKneedsMatlab
%%
% This file is from pmtk3.googlecode.com
SetDefaultValue(2, 'wikiOnly', false);
SetDefaultValue(3, 'linkToPml', true);
warnState ... |
7e7985ff0a9473b0478163ef4008d3ffc4037f11129f52f3ff27378711299e60 | MATLAB | 5,805 | 116 | clear;
clc;
%% This script used to perform generalized PPI derived from Go trials
% Set up path
Para.rootdir = 'W:\All_IMAGEN_DATA\imaging\spm_new_first_level';
Para.opdir = 'W:\gPPI_Shen_SS';
Para.Maskdir = 'W:\Shen268_ROIs'; % ROI mask path including 268 regions nfiti data
Para.subjfolder = dir([Para.rootdir,'/00... |
feb00b2ecac2546490189e9ce4ff6e2be33f61fff6086ceb41f90bf3b77a9b89 | MATLAB | 5,806 | 169 | %% Multitask regression demo
% PMTKslow
%%
% This file is from pmtk3.googlecode.com
function multitaskRegDemo()
seeds = [1 2 3];
plotFns = true; % set to false to reduce number of plots
for seedi=1:length(seeds)
seed = seeds(seedi);
%% Generate training data
setSeed(seed);
Ds = [1 50];
for Di... |
f196d229d7b8ce28a5da77ab21e86be2b96810c0d224279924b4b69ab94e5482 | MATLAB | 5,808 | 48 | function ColorMap = y_AFNI_ColorMap(SegmentNum)
% Generate the color map like AFNI.
% Input: SegmentNum - the number of segments. it should be 2,4,6,8,9,10,11,12,13,14,15,16,17,18,19,20 or 256
% Output: ColorMap - the generated color map, an x by 3 matrix.
%______________________________________________________________... |
796e85f4cd2c7160908d74983ef2bb83906267832221e3062c51213b810cd1fc | MATLAB | 5,809 | 111 | % GET_FIELD_TR_MOMENTS_CUDA Solves sparse system of linear equations in a
% following iterative manner:
% A * x_{0} = b; => x_{0} = A\b;
% q*A * x_{q} = B * x_{q-1}; => x_{q} = (qA)\(B * x_{q-1});
% using BiCGStab solver and FSAI preconditioning. Parallelized for
% multithreading with NVidia CUDA. Uses al... |
b32ae1b4aa4ffdef2b5a2787f72298529cfd374246e9ed499a31b4f641b19bd5 | MATLAB | 5,809 | 200 | % 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 creates MuscleLengthVelocityMomentArm corresponding to the musculotendon length, velocity and moment arm... |
2cf53a37f8738238cc86f159e95572fbcbf598f4f8d6132b42e0122c5a691233 | MATLAB | 5,813 | 178 | function demo_sparsityPrior ()
% // VBA toolbox //////////////////////////////////////////////////////////
%
% demo_sparsityPrior ()
% demo of penalized regression (Bayesian LASSO)
%
% This demo shows how to perform a GLM regression using a L1-norm, L2-norm,
% or an adaptive norm regularization.
% Critically, we vary ... |
6d027dc4cc44c81914b60f6d0653a8da2e25a52d85e48b94337d49c898141496 | MATLAB | 5,813 | 159 | function [U, cost] = robust_pca(X, d)
% Computes a robust version of PCA (principal component analysis) on data.
%
% function [U, cost] = robustpca(X, d)
%
% Given a matrix X of size p by n, such that each column represents a
% point in R^p, this computes U: an orthonormal basis of size p by d such
% that the c... |
bcae795bda4508413e194e4be076b5b3ec93b405400ec75614888c893d6df114 | MATLAB | 5,813 | 149 | %% loading StepMiner/ANOVA results
load(strcat('../',projectId,'/',bioMarker,'/',bioMarker,'_name_pool.mat'))
name_pool = cellstr(name_pool'); % genes pass StepMiner/ANOVA test
load(strcat('../',projectId,'/',bioMarker,'/',bioMarker,'_bind_info.mat'))
load(strcat('../',projectId,'/',bioMarker,'/',bioMarker,'_nonstemne... |
3bb79bcabf74bde911dd3fa99cf91c149ed78fd8efcc85f365dcd79296fb0d91 | MATLAB | 5,815 | 183 | function meg_manuscriptFigs_normPeak_bar
% function meg_manuscriptFigs_normPeak_bar
%% Load peak data
user = 'kantian';
filename = sprintf('/Users/%s/Dropbox/Data/TANoise/fromRachel/itpcNorm_TS_Peaks_N10_20211225_workspace.mat',user);
load(filename)
%% Figure settings
titleVis = 0; % if title vis off, then will plot... |
771537aed1b19db3cda6bc802516c87dc059eb98b0499677d158abedd8a36c48 | MATLAB | 5,815 | 103 | %%bootstrap and plot lap binned novel data.
%Chad Heer
%INPUTS
%analysis_out = output of axon_analysis for all rois
%above_SNR_thresh = ids of rois above threshhold
%ids = ids of rois
%OUTPUTS
%axons above bootstrapped baseline
function [out2] = axon_lap_binned(analysis_out, above_SNR_thresh, ids)
%%
session_nam... |
c0eb7d510e97b43c0e0242ca02fbda9b727e9b3b23dbade6c27bfa9a8447ad03 | MATLAB | 5,815 | 128 | function [ScratchDir,dc]=ScratchDir_Lookup(varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
70a2931a728878712be78cf7e0177e2f130072a0928b38ecb0a9aa15a7e57a79 | MATLAB | 5,817 | 150 | function performAffineTransforms(moving_run,do_downsample)
loadParameters;
if do_downsample
filename_root = sprintf('%s-downsample',params.FILE_BASENAME);
image_type = 'DOWNSAMPLE';
else
filename_root = sprintf('%s',params.FILE_BASENAME);
image_type = 'ORIGIMAL';
end
%params.MOVING_RUN = moving_run;
... |
921d34c591ab769ec4391e192a21fd29ded113c34c12f2b0044e7ce58f6725dc | MATLAB | 5,820 | 163 | function [spikeHist_edges,spikeProb,spikeZscore,signPosBins,signNegBins,excitResponse,inhibResponse] = responseToEvent (spikeCount,eventTimes,PSTHwindow,nBins,si, option, plotting, offset)
%% >>> OPERATION >>>
% Define responsive and non responsive cells with z-score analysis of PSTH.
% >>> INPUTS >>>
% NAME ... |
b62d225725bede49740168ddc06dd9acc85496da737d5c7ebc915607967510af | MATLAB | 5,820 | 110 | function [DegreeCentrality_PositiveWeightedSumBrain, DegreeCentrality_PositiveBinarizedSumBrain, GHeader] = y_DegreeCentrality_Surf(InFile, rThreshold, OutputName, AMaskFilename, CUTNUMBER)
% [DegreeCentrality_PositiveWeightedSumBrain, DegreeCentrality_PositiveBinarizedSumBrain, OutHeader] = y_DegreeCentrality_Surf(InF... |
a14579cac6499db008b6d9b8686c3ced6f37e155dbd9d9794d3556f47a5e4390 | MATLAB | 5,821 | 139 | function [data, info] = get_field_TR_bicgstab_matlab(i_index, j_index, value_1, value_2, qvec, t, dt, OPTIONS)
% GET_FIELD_TR_BICGSTAB_MATLAB Solves sparse time-varying system of linear
% equations using MATLAB implementation of BiCGStab solver and incomplete
% LU or Cholesky factorisations for preconditioning. The... |
109c08df418d4595195dfa7f6f77e3591804877940c1decf9451fe0ca2585513 | MATLAB | 5,822 | 205 | function [s_all,vmax_all,imax_all,dips_mom_all,dips_loc_all]=rapmusic(patt,V,ns,grid,para);
% calculates n dipoles with RAP-Music
%
% usage: [s,vmax,imax,dip_mom,dip_loc]=rapmusic(patt,V,ns,grid,para);
%
% input:
% patt nxm matrix for n channels;
% each column in patt represents a spatial patte... |
429899572ba332cd3b40e5e4cb8ab5c139f9ee9dcf8ec1ccf587e15ec7b819ca | MATLAB | 5,824 | 169 | function [ft_cleandata, WorkFlow, pcStr, ft_PCA] = meg_pca_ica(dataset, badChannels, trialDef, rejectPC, rejectIC)
%
% function [ft_cleandata, WorkFlow] = meg_pca_ica(dataset, badChannels, trialDef)
%
% Performs PCA then ICA, allowing the manual rejection of components at
% each stage. PCA first sorts components accord... |
582dabdb9b1b8888b990b04f153d5178869cca82dc94bb865aceb1c12b9ff1d0 | MATLAB | 5,825 | 152 | % Second-kind integral equation on the unit square, Helmholtz single-layer.
%
% This example solves the Lippmann-Schwinger equation for Helmholtz scattering
% on the unit square, which can be ill-conditioned even though it is formally
% second-kind. The problem is discretized as in IE_SQUARE1. We assume that the
% pote... |
0802823c3fca159e58247114341710350a25fefd4d4e7b416509f868f99b2d5e | MATLAB | 5,827 | 152 | function STATS=wilcoxon2t(varargin)
%This file execute the non parametric Wilcoxon test to evaluate the difference between paired (dependent) samples.
%If the number of difference is less than 15, the algorithm calculate the exact ranks distribution;
%else it uses a normal distribution approximation.
%Now, the M... |
83ebaa3d9dde0f1aa274916571a2d4c01be7eb11299e4966442cae363212a32b | MATLAB | 5,827 | 153 | function [stepsize, newx, newkey, lsstats] = ...
linesearch_adaptive(problem, x, d, f0, df0, options, storedb, key)
% Adaptive line search algorithm (step size selection) for descent methods.
%
% function [stepsize, newx, newkey, lsstats] =
% linesearch_adaptive(problem, x, d, f0, df0, options, storedb, ... |
193072f84346990e17845c84e344c5725369e1e966e2afb8500b3b364012a326 | MATLAB | 5,829 | 158 | % ========================================================================
% TMFC (gPPI) analysis for event-related design with
% asymmetric synaptic weight matrices
% Requires SPM12 (v7771)
% ========================================================================
% Ruslan Masharipov, July, 2024
% email: ruslan.s.mas... |
ed6c36d21a5eec0c4a2ad8b9ec523b0b4812058a672de7be93dc39449045e57e | MATLAB | 5,829 | 130 | function Step4b_Connectivity(config, pid, visitnum)
%
% Step4b_Connectivity estimates functional connectivity (i.e., analyzes
% the synchrony of signals from two regions) between regions of interest
% and over a given time period.
%
% The most common functional connectivity metric used is "wpli_debiased"
% (see the f... |
9ddb8b308b6190352c9fd1bffe4e5e4fa9e5714c2cdb73465efe876e2c3a69ce | MATLAB | 5,831 | 140 |
function CBIG_preproc_FCmatrices_UnitTestCmp(preproc_out_dir, test_file_stem)
% CBIG_preproc_FCmatrices_UnitTestCmp(preproc_out_dir)
%
% Description of the function:
% This function is primarily used after running the
% CBIG_preproc_unit_tests_call_fMRI_preproc.csh (to generate the FC
% matrices of a single subject) ... |
320f6652c0b8462379580bdec707f48b14367319c763f892392c173ac5f93fcf | MATLAB | 5,832 | 120 | function Xmatrix = Method_Gene_matrix(atlas_img,brain_sphere,interpolation,out_path)
% Function: Pre-procession of AHBA gene expression
% Updata date: 2022.09.20; this code contains Combination/Normalization. Get geneExpression matrix from [AAL or coordinates corresponding Y].
% Email:luolongcao@163.com
% atlas_img... |
66782e5838a6d0d80f4d84918d3b801a1fced01322ab3f10b674b4897b376ca0 | MATLAB | 5,833 | 115 | function [] = spearman_analysis(folders)
for nfolder = 1:length(folders)
cd(folders{nfolder})
% spearman correlation
load extracted_place_fields_BAYESIAN
load scored_replay
load('decoded_replay_events.mat');
data=decoded_replay_events;
% % Median Spike Spearman Correlation
% ... |
6e82c996020adaf0f89d548fc9c6d8eef4e8f55939b00765ac930b1b9d340fcd | MATLAB | 5,833 | 210 | % Function to assess the robustness of SEPs at the level of individual
% subjects (for varying number of trials) and also at group level (for varying number of trials x subjects).
% Merve Kaptan, mkaptan@cbs.mpg.de, 2022 (now at mkaptan@stanford.edu)
%% INPUTs
% dataPath = string, path to data directory
% matName ... |
0ec6d2e361e062e7422a88ec3b079cf556c6ef237df66fd72f0d52b4aeec5f85 | MATLAB | 5,834 | 144 | clear
close all
%% Importing nifti files
% Import atlas
addpath('/Users/jstrohl/Data/PET - ATLAS-MICE 2')
MRI_atlas = niftiread('2011-10-30_MRI-template3.hdr', ...
'2011-10-30_MRI-template3.img');
% Import PET scan file
file = '/Users/jstrohl/Data/20240216 Sepsis Fear PET data/20240216 preprocessed nifti files/03... |
a64b525b8d0a417b0e8484aee1af09a80bf768431b36b2e77a30f308482667f9 | MATLAB | 5,836 | 185 | % DELCODE-SAME, Table "ApoE genotypes"
% _
% original paper: Soch*, Richter* et al., HBM, 2022
% Figure S3: Analysis of FADE scores as a function of ApoE genotype
%
% DELCODE paper: Soch et al., medRxiv, 2023
% Table 3: Comparison of ApoE genotypes to population distribution
%
% written by Joram Soch <Joram.Soch@DZ... |
a44dfa55a770bae1d5ab25cc3acc1fd208d159a3f46c2dd11cb26391d8ca849c | MATLAB | 5,838 | 149 | function [X, HMM, features, Kernel, err] = simulate_transprobs(datadir, hmmdir, HMM_name, n_subj, betwgroup_diff)
% [X, HMM, features, Kernel, err] = simulate_transprobs(HMM_name, n_subj, betwgroup_diff)
%
% simulate timecourses for two groups where the group difference lies in
% the transition probabilities, then ... |
c2d768bc44e30b85bd3fab2037e0a4f092e072cc23c93fb0745faba159be126f | MATLAB | 5,839 | 150 | % Seven-point stencil on the unit cube, constant-coefficient Poisson equation,
% Dirichlet boundary conditions.
%
% This is basically the 3D analogue of FD_SQUARE1.
%
% Inputs (defaults are used if not provided or set empty):
%
% - N: number of discretization points in each dimension (default: N = 32)
% - OCC: tree... |
0e35d4301428c5ab90c0825ca79b6a5659e2b5516cb89666c9c2aeabc405af62 | MATLAB | 5,842 | 149 | function h_makeTracingMark3 (handles, mark_size)
% to make a white cross mark on h_imstack image and find the x, y, z
% position of the central point. These marks will be used in
% h_traceDendriteSkeleton.m.
global h_img3
[currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles);
... |
43637409d71a76b232379731b58cb6e8dbeccc06c62eb0b957b1caf2b402c203 | MATLAB | 5,843 | 218 | function [lambda,x,flag,its,x0] = eig_sshopm(A,varargin)
%EIG_SSHOPM Shifted power method for finding real eigenpair of real tensor.
%
% [LAMBDA,X]=EIG_SSHOPM(A) finds an eigenvalue (LAMBDA) and eigenvector
% (X) for the real tensor A such that Ax^{m-1} = lambda*x.
%
% [LAMBDA,X]=EIG_SSHOPM(A,parameter,value,...)... |
02b876f2ad48a2ce71855302ff36502f9b77bb96b484ed5ed1b97bfe91109829 | MATLAB | 5,844 | 162 | % VariabilityByVariable.m
% Sarah West
% 10/3/23
% Is called by RunAnalysis.m
function [parameters] = VariabilityByVariable(parameters)
MessageToUser('Variability of ', parameters);
% Inputs
responseVariables = parameters.dataset.responseVariables;
comparisons_continuous = parameters.comparisons_cont... |
3d5eed62adb27f49d920af3339029d25054be2dd18028770645025be9d0d5527 | MATLAB | 5,846 | 149 | function alarm = envelop_hilbert(y,Smooth_window,threshold_style,DURATION,gr)
%% function alarm = envelop_hilbert(y,Smooth_window,threshold_style,DURATION,gr)
%% ======================= Inputs ================================ %%
% y = Raw input signal to be analyzed
% Smooth_window :this is the window length used for s... |
87c4b669d4d210efa271546b65c0106836add6e11777d17b373631db704178ed | MATLAB | 5,847 | 149 | %% mvgc_cdf
%
% Sample MVGC thoretical asymptotic cumulative distribution function
%
% <matlab:open('mvgc_cdf.m') code>
%
%% Syntax
%
% P = mvgc_cdf(x,X,p,m,N,nx,ny,nz,tstat)
%
%% Arguments
%
% See also <mvgchelp.html#4 Common variable names and data structures>.
%
% _input_
%
% x vector of MVGC values... |
8527e27c33e2d77c4144143de15e8e0f50d39b54133542123a6da5fda0d0c1b2 | MATLAB | 5,852 | 168 | function [obj] = ft_determine_units(obj)
% FT_DETERMINE_UNITS tries to determine the units of a geometrical object by
% looking at its size and by relating this to the approximate size of the
% human head according to the following table:
% from 0.050 to 0.500 -> meter
% from 0.500 to 5.000 -> decimeter
% ... |
601c94debfaa29f924ac60a7246c494faece72e4ac2ceffd7c55ad9edd16541d | MATLAB | 5,857 | 156 | function [vertices, faces] = freesurfer_read_surf(fname)
% freesurfer_read_surf - FreeSurfer I/O function to read a surface file
%
% [vertices, faces] = freesurfer_read_surf(fname)
%
% Reads the vertex coordinates (mm) and face lists from a surface file.
%
% Surface files are stored as either triangulations... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.