sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3537739d8a8f1cb8cf6da1e50cc326d4fee736d6106ff5fbe9735f8ca609d84b
MATLAB
1,220
65
function epochs = MergeEpochs2(epochs, mergetouching) % merge epochs of arbirary precision without creating binary vector % % epochs = CMBHOME.Utils.MergeEpochs2(epochs, mergetouching) % % % returned sorted % % andrew 10/13/2011 % Updated: Ehren Newman, 19th November 2012. Sped-up. OE = epochs; if ~exist('mergetouchin...
78f275a4c7e3badb36d203e50a106d511f603923dd2c482646592089727583e0
MATLAB
1,220
29
%% plotIntensityProfileAndPeaks % % Andreas Husch % Centre Hospitalier de Luxembourg, Dep. of Neurosurgery / % University of Luxembourg - Luxembourg Centre for Systems Biomedicne % 2017 % mail@andreashusch.de, husch.andreas@chl.lu function plotIntensityProfileAndPeaks(intensityProfile, skelScaleMm) filterIdxs = find(sk...
7c95e69f8eb60fc63a143e70ba2f33353d7ec8b1966fb0bda28af886a39ccab0
MATLAB
1,220
36
function halfWidth = calculateHalfWidth(spikeWidth) % CALCULATEHALFWIDTH Calculate half-width for spike extraction % % This function calculates the appropriate half-width (samples before/after peak) % based on the total spike width. % % Input: % spikeWidth - Total number of samples in the spike waveform % % Output: %...
c4519f719ef37239e7d6b18235cfff6cf8d107fc9a2c92e33a15c39741b3ddc6
MATLAB
1,220
40
function [D,P] = floyd_warshall_all_sp(A,varargin) % FLOYD_WARSHALL_ALL_SP Compute the weighted all-pairs shortest path problem. % % The Floyd-Warshall algorithm for the all-pairs shortest path problem % works only on graphs without negative edge weights. This method should % be used over the Johnson algorithm for de...
203e804696689bf0df1330ceb2d4f17d59dcda23889af4c3c2cd5af0091ded60
MATLAB
1,221
26
function ea_add_discfiber(~,~,leadgroup,resultfig) % small function to open ea_discfiberexplorer. lead group can be a path to % either lead group analysis file or saved fiber explorer. if ismember('M', who('-file',leadgroup)) % Add new discfiber analysis exp = ea_discfiberexplorer(leadgroup,resultfig); tractId...
3f020dc72d065f0eb4be0b46722c6c1ad7655c3af9857b95b7e98cc432dae0fb
MATLAB
1,221
26
function a = gt( x, y ) %Disciplined convex programming information for GT (>): % The right-hand side of a less-than constraint must be convex. The % left-hand side must be concave. Of course, real constant and affine % expressions are both convex and concave and can be used on either % side as well. % %Discip...
609de24c53d05b8c43b876d3eba23368454bc59cf2ca6ead8afac1d35cf7c909
MATLAB
1,221
44
% Euclidean projection on the semidefinite cone % Sec. 8.1.1, Boyd & Vandenberghe "Convex Optimization" % Joelle Skaf - 10/07/05 % % The projection of X0 on the proper cone K = S+^n is given by % minimize ||X - X0||_F % s.t. X >=0 % where X is a nxn matrix and ||.||_F is the Frobenius norm...
4d2820253134c88e8567d8e690bff0a05779e14f566dcd810dabe0ab1ff9e809
MATLAB
1,222
36
function padded = padmatrix(input, wherepad, padval) %PADMATRIX Pad a matrix. % PADDED = PADMATRIX(INPUT, WHEREPAD) adds zero rows/columns to the % matrix INPUT. WHEREPAD is a four element vector specifying the number % of pad rows/cols beyond [left col, right col, top row, bottom row]. % % PADDED = PA...
6694e08da1388ca804bd3415d0d08fcb36e46dc785068738b904713df04708e1
MATLAB
1,223
36
function uid = root(tree) % XMLTREE/ROOT Root Method % FORMAT uid = root(tree) % % tree - XMLTree object % uid - UID of the root element of tree %__________________________________________________________________________ % % Return the uid of the root element of the tree. %_______________________________...
d195ae5a123068cb2f7333e26dac1ac0a376fd5fa1224cb47400708ad7d39eb0
MATLAB
1,223
31
function Y = CORE_leadingedges(X) %CORE_LEADINGEDGES Core computational routine for LEADINGEDGES. % Y = CORE_LEADINGEDGES(X) takes an M x N matrix X and returns a M x N % matrix Y, containing a logical 1 in each location Y(j,k) such that % X(j,k) AND ~X(j,k-1) for k>1 and X(j,k) for k==1. % % The matrix Y is of...
e97fd0dbb643421857b600a24743a73564aa51ddec8454a8c99b7fbb0bcafff6
MATLAB
1,223
43
addpath bva-io-master/ addpath (genpath('eeglab2022.1/')); eeglab load("dataset_ds005284.mat"); folder = 'EvokedPotentialPlots'; htmlGray = [128 128 128]/255; channelLabels = {data{1}.chanlocs.labels}; for figi=1:length(channelLabels) gcf= figure(); hold on averagedERP = zeros(size(data,2),1200); for ...
4e6d08e9d6802a421d6bf1f453fffdb9eafe5dcabd34636bfc932dac36004418
MATLAB
1,224
26
function a = ge( x, y ) %Disciplined convex programming information for GE (>=): % The right-hand side of a less-than constraint must be convex. The % left-hand side must be concave. Of course, real constant and affine % expressions are both convex and concave and can be used on either % side as well. % %Disci...
86e7fa1835614aab8b09b59aa1ee47e422ec69bda3fd18e34c57c6ea0a833612
MATLAB
1,224
58
% This is a demonstratin of FRID framework using a simulated dataset %% Clear all clc; clear; close all; %% Add path addpath('./util/'); addpath('./FRID/'); %% Load data and pre-process dataset_path = './Sim3_p0.1_mini.mat'; load(dataset_path); [nN,nT]=size(Fr); ns=length(unique(id_true)); % Number ...
31f8cdef8330949b914385e4f9858513a88ed5d93dfe895f92623fdbe2eaa945
MATLAB
1,225
36
function tree = delete(tree,uid) % XMLTREE/DELETE Delete (delete a subtree given its UID) % % tree - XMLTree object % uid - array of UID's of subtrees to be deleted %__________________________________________________________________________ % % Delete a subtree given its UID % The tree parameter mus...
44c147568fc03a75cda4c2b6e287e58ad4e98dbbe78a057be30fee194b9fc82d
MATLAB
1,225
40
function p = PlotXY(X,varargin) %PlotXY - Plot two columns of a matrix against each other. % % Plot the second column of a matrix as a function of the first column. % Optionally, alternative pairs of columns can be plotted against each other. % % USAGE % % p = PlotXY(X,columns,<options>) % % X the ...
96939aaf652d64f3f2f8d85ec3c6f975ed49ca2b73ab2452edcddd8ebb8dc652
MATLAB
1,226
37
function maxLV = capLV(maxLVopt, Xtrain) % capLV Cap the number of PLS latent variables to what the data support. % % maxLV = capLV(maxLVopt, Xtrain) % % Returns the largest latent-variable count that is valid for this training % fold: min(requested, rank(Xtrain)-1, nTrain-2), floored at 0. % % Inputs % ma...
b824f0ce8ce1561a5fcb5592f6adb7fd6101b229c6a4644797cc662b42251449
MATLAB
1,226
46
function [A xy] = cycle_graph(n,varargin) % CYCLE_GRAPH Generate the cycle graph of order n % % The cycle graph is a simple cycle with n vertices. % % [A xy] = cycle_graph(n) generates a cycle graph with n vertices and % returns the adjacency matrix in A. The matrix xy stores two-dimensional % coordinates for ...
cbf4220e923757ab7e475a19d86e64ba03ba19f6547ae76b572924624f59543a
MATLAB
1,226
35
function varargout=ea_explorer_stats_meanmap(varargin) % Function to estimate a certain mass univariate test (see below) as used % in explorer apps. % - Expects valsin as V x N matrix where % V is the number of % voxels/streamlines/etc and % ...
2cf42b9ae83b85a1214b6eb83920059afb19969fc69985a25c86ebd6c3b6f394
MATLAB
1,227
38
function yp = swapWithinSubjectLabels(y, subjIdx) % swapWithinSubjectLabels Restricted permutation for a paired design. % % yp = swapWithinSubjectLabels(y, subjIdx) % % Independently and with probability 0.5 swaps the two class labels within % each subject. This is the exchangeability-correct null for a within-s...
dcc77a37ffb7be64b356187758a25c469bb5f9a3791a6f9411d3f1b304bfe12b
MATLAB
1,227
43
function value = get(tree,uid,parameter) % XMLTREE/GET Get Method (get object properties) % FORMAT value = get(tree,uid,parameter) % % tree - XMLTree object % uid - array of uid's % parameter - property name % value - property value %______________________________________________________________________...
967fc05c29c64b392ac124c76a2e0f6a7c99094074a4d4853c9a66d94c6db67b
MATLAB
1,228
47
function obj = geom_interval( obj,varargin ) p=inputParser; my_addParameter(p,'geom','area'); my_addParameter(p,'dodge',[]); my_addParameter(p,'width',[]); parse(p,varargin{:}); obj.geom=vertcat(obj.geom,{@(dobj,dd)my_ci(dobj,dd,p.Results)}); obj.results.geom_interval={}; end function hndl=my_ci(obj,draw_data,param...
97c766a8e471e545c902fdd824f81cd5af2b30baeb984dfc5257b83bcda1eb31
MATLAB
1,228
26
function ft_struct = Trinh_happe_wavThresh(ft_struct,wavLvl,wavFam,ThresholdRule) % function uses the wavelet thresholding algorithm from HAPPILEE % needed input: ft_struct from ft_preprocessing % wavelevel 10 for sampling rate higher than 500, 9 for 250-500, 8 for % lower than 250 % Set the wavelet family dependi...
0c5a5275d2adc18b26eebae55b6f083fb0d5f48d4a00d52a30b942e58c40b060
MATLAB
1,229
33
function obj3 = binaryopp(f, obj1, obj2) if isa(obj2, 'mmo'), tmpobj = obj2; obj2 = obj1; obj1 = tmpobj; clear tmpobj; end; if ~isequal(size(obj1), size(obj2)) && prod(size(obj2)) ~= 1 error('Matrix dimensions must agree.'); end; data1 = memmapfile(obj1.dataFile, 'writable', obj1.writable, 'for...
4f7f41037da263ed350347d98ed5bb09fa6fea967740b23c8c2ef9466ba51448
MATLAB
1,229
54
% Demonstration of comparison between two independent groups % % SF 2014 clear all close all Ntrials = 500; Nsub = 30; c = 0; c1 = [-1.5 -1 -0.5]; c2 = [0.5 1 1.5]; group_d = 2; % same dprime across groups sigma = 0.5; group_mratio(1) = 1; group_mratio(2) = 0.6; % group 2 has worse metacognition than group 1 j...
c1bff72bea446002119e0a75b8a3f5c2fb057dd085ccc43ada6f7c03818b3925
MATLAB
1,229
48
function [rrois, rlookup]= create_rrois (rois, n, Sa, Va, off_set, bind, bl_dir, nz); % Create a null model == rois with all spatial information removed. % Compute correlation index for full matrix % Note that when you start to rotate, the max index of correlation is not necessarily the same any more % Total number of...
05ab8c4aca7dc9b2166a97e2af0c515a340efb99d4d4a6a85c5de781993a1a09
MATLAB
1,230
54
function f=processBiopac4(bio,tt,desres,skpii) % Usage ... f=processBiopac4(bio,tt,desres,skpii) % % Processing applied to all trials in structure do_aux=1; if do_aux&isfield(bio,'AUX3'), do_aux=1; else, do_aux=0; end; original_flag=0; dt=tt(2)-tt(1); tmpii=find(tt>=0); if isempty(tmpii), ii0=1; else, ii0=tmpii...
5cbb5561ef04ec84b620dddc08f1befb82d5828a6e0461d632aed9865023c01d
MATLAB
1,230
46
function [p alpha] = circ_vmpdf(alpha, thetahat, kappa) % [p alpha] = circ_vmpdf(alpha, w, p) % Computes the circular von Mises pdf with preferred direction thetahat % and concentration kappa at each of the angles in alpha % % The vmpdf is given by f(phi) = % (1/(2pi*I0(kappa))*exp(kappa*cos(phi-thetahat) % %...
6febf4a48b1607b3143468d264c483db6de793fb64163b3e12d3826d8f8fda31
MATLAB
1,230
36
function [vals,p_vals] = ea_discfibers_weightedLinearRegression(activ_prob, outcome, expected_outcome_metric, output_stat) % by Till Dembek, publication TBA % Warning: this metric takes time to be calculated expected_outcome = zeros(size(activ_prob)); if strcmp(expected_outcome_metric,'mean') expected_out...
84411465deca99159234c1e9aadba6ed0108949adb16baeccd3df2e44c938fb3
MATLAB
1,230
38
% Closest Toeplitz SDP search. % % This script finds a Toeplitz Hermitian PSD matrix that is closest to a % given Hermitian matrix, as measured by the Frobenius norm. That is, for % a given matrix P, it solves: % minimize || Z - P ||_F % subject to Z >= 0 % % Adapted from an example provided in the SeDuMi docum...
9ca7e0b1b14baa112aef0a09b2a887dcf5978d3bae3704e31e1646fa14974842
MATLAB
1,230
27
%%************************************************************************* %% sqlptermcode.m: explains the termination code in sqlp.m %% %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%***************************************************************...
256342248147c335001db5dc1c20e744d5e119bd315c6b9c0621f3727acd5f69
MATLAB
1,232
56
function y = Insert(x,lines,where) %Insert - Insert lines in a matrix. % % USAGE % % result = Insert(matrix,lines,indices) % % array matrix where the lines should be inserted % lines list of values to insert % indices list of (possibly repeated) matrix line numbers % ...
f2d6f1cf6938960bc57c9404ceb1f95ceec3608d922ea7be1aaac50978fdb50c
MATLAB
1,232
37
function SaveRippleEvents(filename,ripples,channelID) %SaveRippleEvents - Save hippocampal ripple (~200Hz oscillations) events. % % USAGE % % SaveRippleEvents(filename,ripples,channelID) % % filename file to save to % ripples ripple info as provided by <a href="matlab:help FindRipples">FindRippl...
91215cfdc51e9d9cef28065e8ed311563cf48a7607c1e671e54cbaab6b3087ea
MATLAB
1,233
47
%%% Figure 1A: 10-ms zoom-in spectrogram, log-frequency display clear; clc; close all; %% Parameters f0 = 245; % base frequency, Hz nHarm = 7; harmonics = f0 * 2.^(0:nHarm-1); % 245 to 15680 Hz amp = 1/numel(harmonics); dur_ms = 100; t_ms = linspace(0, dur_ms, 700); % Use log2 frequency co...
aa8378df0aec144b7b60d7f7c07e13bce1f3904cfcf30ef44c36229dca4b2262
MATLAB
1,233
43
%%% export MUA - THINGS dataset % 2022 P. Papale fecit clear all addpath(genpath('\_code\code_utils_v2\')); % constants monkey = 'monkeyF'; datadir_gen = '\'; reliab_th = .3; arrays_to_export = 1:16; % arrays_to_export(5) = []; % filename = [datadir_gen,monkey,'\THINGS_normMUA.mat']; load(filename) ...
7e914bcb6f283c519f1a0f4312d31dd2a481beaa8b5b1f56b221588561238f18
MATLAB
1,234
31
function [values, oldmin, oldmax] = rescale(values, newmin, newmax) %RESCALE Rescales a data set. % [VALUESOUT, OLDMIN, OLDMAX] = RESCALE(VALUESIN, NEWMIN, NEWMAX), given % a VALUESIN array of arbitrary dimension, will return a VALUESOUT of % the same size and linearly rescaled to the range NEWMIN:NEWMA...
38c31828c4d4c95fdba26e07173903ae499b8680b02ae445b698590699236fb1
MATLAB
1,235
58
function out = filterAudio(trialdata,ord1,ord2,range) % load a trial of mic data % 1000 Hz sample rate assumed % load(trialname); % figure; set(gcf,'Position',[200 50 1000 700]); hold on; % subplot(3,2,1); plot(trialdata); ylim([-0.05 0.1]); % subplot(3,2,2); spectrogram(trialdata,500,250,'yaxis') [b...
6e22083651e056cd3f5d94b49851c745129b597333045876282d7aefa7399ec9
MATLAB
1,236
37
function [peak,sprofil] = ea_diode_intensitypeaksFFT(intensity,noPeaks) %% this function detects 'noPeaks' number of intensity peaks. peaks are constrained to be at 360°/noPeaks angles to each other. %% Function runs a noPeaks * (360°/noPeaks) array over the intensity-profile and finds the angle at which the su...
31ea13410707e80c94146f32338c9e406d8a615c619f2a85b376f2859b2a37ce
MATLAB
1,237
34
function [imgRGB, imgMask, xBounds, yBounds, combinedGrads, cmap] = makeCombinedGradientMap(allROIs, metricFields, gridRes, xLimits, yLimits, cmapInfo, smoothSDPts, smoothSDImg) % Combines multiple metric maps using the quadratic mean or rms over maps % Make maps gradMaps = cell(length(metricFields)); imgMasks = cell(...
a838613af0c54b5baae08e158583cd0645acf48cac2196979d058fdbb27d6d0a
MATLAB
1,238
43
% loglike() - log likehood function to estimate dependence between components % % Usage: f = loglike(W, S); % % Computation of the log-likelihood function under the model % that the ICs are 1/cosh(s) distributed (according to the tanh % nonlinearity in ICA). It does not exactly match for the logistic % nonlinearity, b...
7215d423bb9c8af92f196651dd99b28085926a0957d62ca509f6987d3c8e032d
MATLAB
1,239
43
function units = GetUnits(groups) %GetUnits - Get list of units. % % USAGE % % units = GetUnits(groups) % % group one or more optional electrode groups (default = all groups) % % EXAMPLES % % all = GetUnits; % list all units % units = GetUnits(2); % list all units on electrode group 2 ...
0e90da3898d217371b04ecae757215c9995631fb8bbbd46819c04574ac92fe22
MATLAB
1,241
37
function [a_array1, b_array1] = generate_connectome_edr(a_array,b_array, lambda, topology, isperiodic) %GENERATE_CONNECTOME_EDR Summary of this function goes here % Detailed explanation goes here if nargin < 5 || isempty(isperiodic) isperiodic = 1; end if ~all(size(a_array) == size(b_array)) ...
5ff11b8b5e34bbb86afa625cc7663833f55a86c6934a73aa922db4af9e712958
MATLAB
1,241
45
function plotFOVsCCF(dorsalMaps, allFOVs) % Plots the ROI centroids colored by areas % Figure allenMapSMc(dorsalMaps) % Creates figure by itself % Paper ready figure/axis formatting panelwidth = 2.25; panelheight = 3; leftoffset = 0.5; bottomoffset = 0.5; formatFigure(gcf, panelwidth, panelheight, leftoffset, bottomo...
eef718b1ca57a1691f7fa4942543d51e2e22b6d50974b062c1345b78a4ad6f1f
MATLAB
1,241
52
function [wincent,f,y] = ez_spectrogram(x,Fs,win,overlap) %WORK IN PROGRESS %NEED to add averaging and correct scaling for graphs %Measures and displays a spectrogram using ez_powermeasure and the %short-time FFT technique with a Hann window. x should be a time series %(row or column vector), Fs is the sample ...
2ba632b329ce4bdd8c971103fef211dbc21e254c0db58f8d242c3e61ffd31f89
MATLAB
1,242
39
% reshape() - reshape of memory mapped underlying array % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008 % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % 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 ...
83cde554b6bebb865ffc0a6bf4e9290aa1f1d9b2e1e19f7f22890f581944df18
MATLAB
1,242
45
% configure file for operations on streamline trackings results % % for BATCH EDITOR system (Volkmar Glauche) % % File created by Susanne Schnell %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function unring = dti_cfg_unring niiname = cfg_files; niiname.tag = 'niiname'; nii...
b0e52a8af9f46a59833854132db544eb1def5f9c8d0fa01f5122756dcbabb1d5
MATLAB
1,242
32
%% control_use_before_def.m % % POSITIVE CONTROL for clean/use_before_def.py. Not a runnable analysis. % % This file reproduces, in miniature, the failure that motivated the checker: % an option is READ eight lines above the guard that defines it. In MATLAB this % dies at the read - "Unrecognized function or variable '...
f8d69787c11f688eb40ed10211783e91103165b1c04f2c54fae918f92722b488
MATLAB
1,242
38
function [ cifti ] = ciftiopen(filename,wbcommand,verbose) % CIFTI = CIFTIOPEN(FILENAME,WBCOMMAND,VERBOSE) % % Open a CIFTI file by converting to GIFTI external binary first and then % using the GIFTI toolbox % % FILENAME is string containing file name to open % WBCOMMAND is string containing the Workbench command. ...
079864868c788470d7ecb8e24b18818cf11bad987f36116d6ad072b34ab4bf00
MATLAB
1,243
50
function rmAllFilFiles(basedir) % function rmAllFilFiles(basedir) % % This function starts in basedir (or the current directory, if no argument % is given) and recursively searches through every subdirectory and deletes % all of the .fil files. The .fil files can be deleted after the ndm_start % scripts are done. % % ...
89fc7fe6a5efa09429985b883e93820a530498a2ec6d83ccaeace9ddc71a6ec9
MATLAB
1,243
35
% Section 7.1.1: Counting problems with Poisson distribution % Boyd & Vandenberghe "Convex Optimization" % Joëlle Skaf - 04/24/08 % % The random variable y is nonnegative and integer valued with a Poisson % distribution with mean mu > 0. In a simple statistical model, the mean mu % is modeled as an affine function o...
8a7b18890c2f439e2687e3d5b8add68b17c77a43ecd4594b0d4bd326e6d777e4
MATLAB
1,243
35
function correlations(spikes, useassigns, show) % CORRELATIONS another temporary utility to show clusters % CORRELATIONS(SPIKES, [USEASSIGNS], [SHOW]); if (nargin < 2), if (isfield(spikes.hierarchy, 'assigns')), useassigns = spikes.hierarchy.assigns; elseif (isfield(spikes.overcluster, 'assigns')), ...
4355db91ce14c3118476f3d0c6cf2f4f97f411d478eff103df7a46c12a815da8
MATLAB
1,244
48
% Example script for estimating a regression model % % Steve Fleming 2018 clear all Ntrials = 100; Nsub = 50; c = 0; c1 = [-1.5 -1 -0.5]; c2 = [0.5 1 1.5]; group_d = 2; group_baseline_mratio = 0.8; sigma = 0.5; sigma_beta = 0.2; gen_beta = 0.5; cov = rand(Nsub,1)'; mcmc_params = fit_meta_d_params; mcmc_params.estim...
444491ccac54a8d9de80a0d26008bd9d2c74f63af16aa33a1f80e2b5b025da6e
MATLAB
1,244
39
% getFolder % % Similar to uigetdir except that it will remember the location of the % last opened folder. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Use plotAverageWaveforms % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Kian Torab % ...
c0fbc89ad12954b971e6b51c62a93b6b07777bb6dff84435737232efef29db70
MATLAB
1,244
48
% Section 5.2.5: Mixed strategies for matrix games % Boyd & Vandenberghe "Convex Optimization" % Joëlle Skaf - 08/24/05 % % Player 1 wishes to choose u to minimize his expected payoff u'Pv, while % player 2 wishes to choose v to maximize u'Pv, where P is the payoff % matrix, u and v are the probability distributions of...
d1e69e5623303dc12c7fc1a14b9fe4029f47563b5887dc57135857ce36aa64e2
MATLAB
1,244
34
function LC_pvals = myPLS_get_LC_pvals(Sp_vect,S,pls_opts) % This function computed pvalues for all latent components (LCs) using the % permuted singular values % % Inputs % - Sp_vect : L x #permutations matrix, L is #LCs, permuted singular values, % used to compute p-values to assess LCs' signific...
eaeeb3707793a3f4bb11e8094315506ea778a5d0c0b420d6792d62af28ee6a7f
MATLAB
1,244
33
function y = palm_isoctave % Test whether the function is running in OCTAVE or not. % Retuns 1 (true) if yes, 0 (false) otherwise. % % _____________________________________ % Anderson M. Winkler % FMRIB / University of Oxford % Jan/2012 % http://brainder.org % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...
c7143b6ac24a94a5b6d791d9bdf76935c392752b7ccc799de883beb5bc04d6b8
MATLAB
1,245
34
function Y4d = palm_conv2to4(Y2d,siz) % Convert a 2D array (t,x*y*z) into a 4D dataset (x,y,z,t) % % Usage: % Y4d = conv2to4(Y2d,size3d); % % _____________________________________ % Anderson M. Winkler % FMRIB / University of Oxford % Sep/2012 % http://brainder.org % - - - - - - - - - - - - - - - - - - - - - - - - -...
6b573f0f2e21dd220a818efaac69571183c03b76747e9304ae6674b3934f1095
MATLAB
1,246
38
function r = trirnd(varargin) %TRIRND Pseudorandom numbers drawn from the triangular distribution % % R = IOSR.STATISTICS.TRIRND(N) returns an N-by-N matrix containing % pseudorandom values drawn from the triangular distribution constrained % to (-1,1) and mode = 0. % % IOSR.STATISTICS.TRIRND(M,N) or IOSR.S...
86bd229ed3741a820fd0d84190be30b7b8d92242478dcc3c4f023785433fb4db
MATLAB
1,246
36
%% get data for Kragel et al. 2018 from neurovault [files_on_disk, url_on_neurovault, mycollection, myimages] = retrieve_neurovault_collection(3324); FullDataSet=fmri_data(files_on_disk); %% Extract information about study (1-18) and subject number reorder_studies_and_subjects; %% Get masks from brainnetome atlas bn_a...
0121fda208e422528b611dbcc20574f103647e55fd871db30a60435ec6755dbd
MATLAB
1,247
50
%%****************************************************************** %% blkcholfun: compute Cholesky factorization of X. %% %% [Xchol,indef] = blkcholfun(blk,X,permX); %% %% X = Xchol'*Xchol; %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%*******...
268c37b695e6af648decc71ef3d68ca193c831ef69ffee8fa6b328a2b51c338e
MATLAB
1,247
31
% eventalign - function called by pop_importevent() to find the best % sampling rate ratio to align 2 arrays of data events. % % Author: Arnaud Delorme, SCCN/INC/UCSD, Dec 2003 % Copyright (C) Arnaud Delorme, CNL / Salk Institute, 9 Feb 2002, arno@salk.edu % % This program is free software; you can redis...
6769818efaa2cd802ae216c5ad3e5fd908f09d7273018cef1f0f2ca969c29373
MATLAB
1,247
29
function [r] = sample_inverse_gaussian(mu,lambda) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome time-series datasets, and % predicts biologically relevant behaviors of the ecosystems. % Copyright (C) 2015 Vanni...
b19e457682ba23b2d263f1c6a5132365b0ea3810271081b1ab6ca97169636f16
MATLAB
1,247
39
function ea_convert_synthSeg2segmask(SynthSeg_segmask_image, segmask_output) % convert SynthSeg segmentations to GM/WM/CSF % IMPORTANT: lesions are not segmented, check for atrophies beforehand SynthSeg_segmask = ea_load_nii(SynthSeg_segmask_image); % initialize Segment_GM_WM_CSF = SynthSeg_segmask; % change the na...
f5150655623c03dbbb15ac9376553795ac83072a5470be4aa4bcf9be22c498cb
MATLAB
1,247
42
function peaks = localpeaks(x,mode) %LOCALPEAKS Find local peaks and troughs in a vector % % This function returns the indices of local peaks and/or troughs in a % vector. % % PEAKS = IOSR.DSP.LOCALPEAKS(X) locates the local peaks in vector X. % % PEAKS = IOSR.DSP.LOCALPEAKS(X,MODE) locates local features spec...
087f4b83e4df701dbf909df43bd60d3d486001dcc2090f8b984a18b0241372f9
MATLAB
1,248
50
function AUC = quickGroupedCV(X, Y, subjIdx, C, K, opts) % quickGroupedCV Subject-blocked grouped CV for the paired PLS-DA permutation null. % % AUC = quickGroupedCV(X, Y, subjIdx, C, K, opts) % % Folds are formed over SUBJECTS, so both observations of a subject always % land on the same side of the split. Pass ...
a7cc254a09cae68c0f1473701f4ae975bde382d01d87df41fa32707a6b60f1a2
MATLAB
1,248
44
function write_cifti(data, varargin) % % Usage: % write_cifti(data, varargin) % % Description: % Writes cifti file (authors: @NicoleEic, @saratheriver) % % Inputs: % data (single or double) - Data to be saved % % Name/value pairs: % dpath (string, optional) - Path to location for saving file % (e.g., '...
e0a632d42c40e524e79cd85bacafc767c1297be1845b40a1798e37a17c9e1fdd
MATLAB
1,248
40
function [accuracy, confusion_matrix] = eval_train(pred_fname) % Evaluates training accuracy. % Arguments: % pred_fname: Filename of prediction file for training. The required format % is described in the README. % Returns: % accuracy: The accuracy on the training set. % confusion_matrix: The confusion matrix...
1b2a2d68c7b9fb583f9cb616fbf95728164070a02f366972e30781223e0bbb84
MATLAB
1,249
45
function checkfits(headpath,fileexpnum,imskip,expskip) cd(headpath); filelist=dir; [Xpix,Ypix,FrameRate]=findkeyparams(); disp('select the mat file from the experiment from this computers C drive'); [matexpfile,matexppath]=uigetfile('*.*'); cd(matexppath); load(matexpfile); cd(headpath) %add some errorchecking for in...
21d6c7e581fd681e2135444eca78a59d0449827a66f8b9e7d65cb601a8f3849a
MATLAB
1,249
52
function P = setup_paths() %FNIRSPOWER.SETUP_PATHS Add fnirspower and third-party dependencies to the MATLAB path. % % P = fnirspower.setup_paths() % % Adds: % - fnirspower MATLAB root % - selected third-party dependencies % % Notes % ----- % - FieldTrip is added only at the top-level folder. Call...
55d52e7030d513f162e616a9db30e4b5540a2588a331d8d7224d0d58161bfe3c
MATLAB
1,249
53
function ea_bet(inputimage, outputmask, outputimage, fraintthreshold) % Wrapper for bet2 brain extraction % Do not output brain mask by default if nargin < 2 outputmask = 0; end % overwrite the input image if ~exist('outputimage','var') outputimage = inputimage; else if isempty(outputimage) output...
5bc394d20248d44601230beda10edf3615eb1c61568d00f421160ac20308752a
MATLAB
1,249
57
function y = hsl2hsv(x) %hsl2hsv - Convert hue-saturation-luminance colors to hue-saturation-value. % % USAGE % % y = hsl2hsv(x) % % x Nx3 RGB matrix (values in [0..1]) % Copyright (C) 2013 by Michaël Zugaro % % This program is free software; you can redistribute it and/or modify % it under the te...
6f258af260a7a37295bca7dd1f1ebf8f2a905442aaafd60ab3683d5044c9a3f3
MATLAB
1,249
32
function ClincFreq_Norm2MNI_T1_clinc(indat,inroi,outdir,outname,voxelsize,pth) try [patdat,namdat,extdat] = fileparts(indat); % [patroi,namroi,extroi] = fileparts(inroi); % load([pth,filesep,'Norm2T1_segment.mat']); load([pth,filesep,'Norm2T1_clincal.mat']); pathspm = which('spm.m'); [patspm,namspm,extspm] = fileparts...
715ec4fb20ce9fed1b3e80a1d50cc794b3eea219f826dcfa56941f145e2191dc
MATLAB
1,249
40
function p=internalpoint(v,aloop) % % p=internalpoint(v,aloop) % % imperical function to find an internal point % of a planar polygon % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2008/04/08 % % input: % v: x,y,z coordinates of each node of the mesh % aloop: input, a single vector separated by Na...
f949d5595fbc0b480e790cc751148463b92796571d0aa97b14fc3b96f32e3494
MATLAB
1,249
30
% spherror() - chancenter() sub function to compute minimum distance % of Cartesian coordinates to a sphere % % Author: Scott Makeig, CNL / Salk Institute, 2000 % Copyright (C) Scott Makeig, CNL / Salk Institute, 2000 % % This program is free software; you can redistribute it and/or modify % it under the...
c9eff667d2819f551df96fb074ce9beb766c276e723dde8feffb9da76a45aaa8
MATLAB
1,250
42
function p=speed_kalman(x,y, fs_video) defpars=[50 .02 .01 100 2 .1 10]; if ~exist('pars','var') pars=defpars; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% pos estimation % pars=[100 1 .03 1000]; % pars=[100 50 1 1000]; % pars=[108.2592 52.2000 0.9360 762.8400]; R...
6d1c0b07bd3b77b3fc6755f0586f5cd1aa46745e0344e75c5ceacea4c28e3e5e
MATLAB
1,251
48
function plotSubpopAreaProportions(allROIs, areas) % Plot stacked bars indicating the proportion of each subpopulation within % each area % Make figure fig; % Set sizes % Paper ready figure/axis formatting panelWidth = 1.16; panelHeight = 2.16; % This is the only way to get the right aspect ratio from the first submi...
97de2ec37a117da17b9aa973f7250d2ef839f6f05e470e3f8d66177043b042dd
MATLAB
1,252
41
function info = BatchInfo(batch) %BatchInfo - Get batch job information. % % USAGE % % info = BatchInfo(batch) % % batch batch parameter returned by <a href="matlab:help StartBatch">StartBatch</a> % % OUTPUT % % info.mfile batch function % info.data batch data % info.done whethe...
bffa41aaca82700ff7fc962f708a083e27e3275303a419d6e602180e2287e77d
MATLAB
1,252
39
function ea_checkleaddirs prefs=ea_prefs; if ~isfolder(prefs.lc.datadir) if ~(isdeployed && ~isfield(prefs,'firstrun')) % don't enter first time in deployed app try ea_mkdir(prefs.lc.datadir); catch ea_cprintf('CmdWinWarnings', 'Failed to create connectome directory.\nPlease...
34f771829bdf94cdbaa1fc8a81320b4f45a1cc2543bbe937eca9f07835c550be
MATLAB
1,253
28
function ea_genctmask(options) masks_path = fileparts(options.subj.recon.rawCTMask); ea_mkdir(masks_path); if ~isfolder(masks_path); mkdir(masks_path); end copyfile([ea_space,'brainmask.nii.gz'], fullfile(masks_path,'brainmask.nii.gz')); gunzip(fullfile(masks_path,'brainmask.nii.gz')); ea_delete(fullfile(masks_path,...
458527807f3fa3cd900181e4b736bad0b605084477fdfa311366e9985c2fc982
MATLAB
1,253
46
function [d pred] = dag_sp(A,u,varargin) % DAG_SP Compute the weighted single source shortest path problem. % % The DAG shortest path algorithm for the single source shortest path % problem only works on directed acyclic-graphs (DAGs). % % If the graph is not a DAG, the results are undefined. In the future, the % fu...
46b203fbe53ab04c05066932c9126e35d9f06631c4fca25f83a0248b866a0e0e
MATLAB
1,253
47
function savemedit(node,face,elem,fname) % % savemedit(node,face,elem,fname) % % save a surface or tetrahedral mesh to Medit format % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2010/10/30 % % input: % node: input, surface node list, dimension (nn,3 or 4) % face: input, surface face element list, dim...
27eb82e1b57af5edd28fc75314d5223e5292fe454fb4704c488e1571ab4fc072
MATLAB
1,254
32
function [res] = LCN_cost_intact_tracer_hill(params) % % costfunction for the calculation of the intact fraction of a tracer % using a Hill function (see LCN_calc_intact_tracer_hill.m) % We don't assume that at time t=0, the intact fraction is 1, but allow % a delay before metabolites appear % % FORMAT: res = LCN_cost...
667f0e1fe4a4d13f3083af7b9e02690fdc842c73ea457b0f216b3cba29a35add
MATLAB
1,254
49
function saveConcatMat(genotype,thedata,trllength) % example inputs: % thedata = 'nov1122_f1e4'; % trllength = 106; % genotype = 'VT062617'; % First, navigate to the folder containing the folders of data you want to % concatenate. [Xpix,Ypix,FrameRate,Zframes]=findkeyparams_newThor5D(); FrameRate=str2doub...
8cd7931e98937c244c237bd740fbf37139fe42c366269f365629f1f221bc6af6
MATLAB
1,254
26
function [n,adchans] = plx_ad_chanmap(filename) import CMBHOME.PLX2Mat.* % plx_ad_chanmap(filename) -- return map of raw continuous channel numbers for each channel % % [n,adchans] = plx_ad_chanmap(filename) % % INPUT: % filename - if empty string, will use File Open dialog % OUTPUT: % n - number of continuous cha...
9e2d94aaa5bb75415dfbd8aac0bb0a194be09f98637220258004bdacda941834
MATLAB
1,254
33
function splitData(params) % splitData(params) % % ---------------------------------------------------------------------- % Matlab tools for "Predicting human gaze beyond pixels," Journal of Vision, 2014 % Juan Xu, Ming Jiang, Shuo Wang, Mohan Kankanhalli, Qi Zhao % % Copyright (c) 2014 NUS VIP - Visual Information Pro...
b8c2bde246029a241c2ccadb491d8a2fbe3738dc76e1b27d7531d92dd37a7342
MATLAB
1,254
44
function trainedML = train_RF_matlab(database_train, params_train, n_trees, SANDIinput) % Train a Random Forest regressor for SANDI fitting % % Author: % Dr. Marco Palombo % Cardiff University Brain Research Imaging Centre (CUBRIC) % Cardiff University, UK % 8th December 2021 % Email: palombom@cardiff.ac.uk tic train...
bfaecdbfa77fea151ddc03057aa18421342e354db35645f18dab34dfbb5ebe48
MATLAB
1,254
27
function settings = ea_load_prob_parameter(options, settings, outputPaths, sideCode, sample_i) % Load probabilistic sample % IMPORTANT:this is a special case for multisource prob. PAM % By Butenko, konstantinmgtu@gmail.com arguments options % Lead-DBS options for electrode reconstruction and stimulati...
3433ef7819080907e53d8001d02b1ed8bce3b2e7d675a0b9bf3d38f80e5ace76
MATLAB
1,255
36
function [numDICOM, fileList, isCompressed] = ea_dcmquery(input, queryOption) % Check the number of DICOM file(s) in the specified folder % % queryOption can be 'y' (only show number of DICOMs found) or 'l'(show % number of DICOMs found and list of DICOMs) arguments input {mustBeFolder} queryOption {mustBeMemb...
451b4dcd8426bd953c6162d7ac92ce3df67396dcfc8910cb5388507d05863fb2
MATLAB
1,255
43
function runIntersect = mintersect(varargin) %MINTERSECT Multiple set intersection. % MINTERSECT(A,B,C,...) when A,B,C... are vectors returns the values % common to all A,B,C... The result will be sorted. A,B,C... can be cell % arrays of strings. % % MINTERSECT repeatedly evaluates INTERSECT on succes...
23fb4db420c954e04594fc806bac6cf8cefbf7cb61514e972a529e18076e1154
MATLAB
1,256
42
function z = matrix_frac( x,Y ) %MATRIX_FRAC Matrix fractional function. % MATRIX_FRAC(x,Y), where Y is a square matrix and x is a vector of the % same size, computes x'*(inv(Y)*x) if Y is Hermitian positive definite, and % +Inf otherwise. % % An error results if Y is not a square matrix, or the size...
bbea941a11c492932d1f1ed9c56bcbabe6d5cfda91e7ef3e70d1c818906e17cf
MATLAB
1,256
36
function my_system(command) %like call_fsl, but without sourcing fslconf if ismac() ldsave = getenv('DYLD_LIBRARY_PATH'); %this is just a guess at what matlab does on mac, based on using LD_PRELOAD on linux presave = getenv('DYLD_INSERT_LIBRARIES'); macflatsave = getenv('DYLD_FOR...
d18d8cdbdfa110e6e09bb27dd698203776d4f7317567c0fc8ab45c1acd31b17f
MATLAB
1,256
35
function [w,rho] = best_const(A) % Computes the constant edge weight that yields fastest averaging. % % [W,RHO] = BEST_CONST(A) gives a vector of the best constant edge weights % for a graph described by the incidence matrix A (NxM). N is the number of % nodes, and M is the number of edges. Each column of A has exactly...
1ca3e10d56bad1bdaa0d2443c85c39d10b184217b9564199867ef6110abffcc6
MATLAB
1,257
39
function params = parseVarArgs(params,varargin) % Parse variable input arguments supplied in name/value format. % % params = parseVarArgs(params,'property1',value1,'property2',value2) sets % the fields propertyX in p to valueX. % % params = parseVarArgs(params,varargin{:},'strict') only sets the field %...
b7d39d360a134bb64637a906681eb0383e55b016995d490faa606db48998cf16
MATLAB
1,257
26
function z = kl_div( x, y ) %KL_DIV Scalar relative entropy. % KL_DIV(X,Y) returns an array of the same size as X+Y with the Kullback- % Leubler divergence function applied to each element: % { X.*LOG(X./Y)-X+Y if X > 0 & Y > 0, % KL_DIV(X,Y) = { 0 if X == 0 & Y >= 0, % ...
edace5caf354220b8e445a0c266d4abf8941e758a053843b03519f7d4dc320be
MATLAB
1,258
47
function [p alpha] = circ_vmpdf(alpha, thetahat, kappa) % [p alpha] = circ_vmpdf(alpha, w, p) % Computes the circular von Mises pdf with preferred direction thetahat % and concentration kappa at each of the angles in alpha % % The vmpdf is given by f(phi) = % (1/(2pi*I0(kappa))*exp(kappa*cos(phi-thetahat) % %...
45d19feb595154adc8ef4b3de09d168cb47049f62b86f56647255f0cd2b31ac6
MATLAB
1,260
28
function [parmstype2] = convertGSASparms(parmstype1,numcells,numAS) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here % If structure, returns vector (for use in fitting algorithms). % If vector, returns structure, (needs numcells, numAS) %Note: vectr form uses logCV... for fitting bounds ...
c65b0ce73ee55ac11824e60b8508b90e17d4a7de55d7e3a4f5644bdb2c35a70e
MATLAB
1,260
54
function savevrml(node,face,elem,fname) % % savevrml(node,face,elem,fname) % % save a surface mesh to VRML 1.0 format % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2010/04/25 % % input: % node: input, surface node list, dimension (nn,3) % face: input, surface face element list, dimension (be,3) % ...
0a5f4532ea4e3aea045253cf67eb2034b1209a7327782a288758ae2c796b4496
MATLAB
1,261
40
function [ w, cvx_optval ] = fmmc(A) % Computes fastest mixing Markov chain (FMMC) edge weights % % [W,S] = FMMC(A) gives a vector of the fastest mixing Markov chain % edge weights for a graph described by the incidence matrix A (n x m). % Here n is the number of nodes and m is the number of edges in the graph; % each...
d1fb49dc3ae7e2afe783260da2e2110cc6201c18d0ae1b5a5ff38ff58c12f3b5
MATLAB
1,261
52
function h = PhasePlot(x,y,phase,sz,varargin) % Plots arrows indicating the phase on current axis. % % [h,yy,zz] = PhasePlot(x,y,phase,sz[,ArrowParameters]) % % % Requires the Arrow function by Erik A. Johnson. % % Note: Arrows will get skewed if you resize the axis. % % Aslak Grinsted 2003 % ---------...
70fc28e5288f1a510c931e89d2903af490d61edac381e8f2d6b5b79b91f012f3
MATLAB
1,262
27
function [] = intersectROIfiles(dataPath,animal,filters,tifList,tifFiles) for ROIfileN = 1:length(filters) preROI{ROIfileN} = load(fullfile(dataPath,[animal '_moCorrROI_' filters{ROIfileN} '.mat']),'moCorROI'); ROIids{ROIfileN} = string({preROI{ROIfileN}.moCorROI.ID}'); end allROI = vertcat(ROIids{:}...
c4555ce1c4f59b4c50941feda54817cdffe433b0d489fa85643da19617b88ff3
MATLAB
1,262
56
function cleanimg=deislands2d(img,sizelim) % % cleanimg=deislands2d(img,sizelim) % % remove isolated islands on a 2D image below speicified size limit % % author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu) % % input: % img: a 2D binary image % sizelim: a integer as the maximum pixel size of a isolated region % % ...