sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
6e48d79edcc19bfc127ad457ccc0ef518cceca52bb9214caca62ab11b97e04fa
MATLAB
1,055
33
%GRAY Black-white colormap % % Examples: % map = gray; % map = gray(len); % B = gray(A); % B = gray(A, lims); % % Similar to MATLAB's gray function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor array ...
a2eab93b76b14c07c0eaaa04a79d78be812d4cdbd8a9d0b17e58968efcc6908b
MATLAB
1,055
33
%GRAY Black-white colormap % % Examples: % map = gray; % map = gray(len); % B = gray(A); % B = gray(A, lims); % % Similar to MATLAB's gray function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor array ...
46ea171ff265daaff43952c988f26c49166bdddfd8c609a8eb7452aeef1c52e3
MATLAB
1,056
29
classdef ConnectomeFeatureAnalyzer methods (Static) function [reciprocalFeatureMasks] = makeReciprocalUnidirectionalMasks(connMat,crossInfo) arguments(Input) connMat ConnectionMatrix crossInfo CrossRegionInformation end arguments(Output)...
c8937e5f53ed780fc3cdf44e46e53087a10585d14d88aa29dbe0df53d7125570
MATLAB
1,056
28
function listen(port, handler, varargin) % LISTEN Wait for a connection from Gadgetron (or other client). % % LISTEN(PORT, HANDLER, ...) % % LISTEN will listen for incoming connections on the specified port. % When a connection is ready, HANDLER is called with a Connection % object as ...
e33b4edcb6f8998a4a8ef0f58bdb2b6e1a78134f5e1befc9c6f767b8ce699860
MATLAB
1,057
33
%GRAY Black-white colormap % % Examples: % map = gray; % map = gray(len); % B = gray(A); % B = gray(A, lims); % % Similar to MATLAB's gray function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor array ...
2be39d32d7ffc745aaa8dcbcdf24408329b7240d45b4d5bae42ef14f29e8c50c
MATLAB
1,058
41
%% % Returns either black or white, depending on whether color is most % different from the two choices. % function [color] = blackOrWhite(color, clrBlack, clrWhite, cmpBlack, cmpWhite, invert) persistent toLab; if isempty(toLab) toLab = makecform('srgb2lab'); end if nargin < 2 || ise...
94982fe05b49942c51e8892ef6a32ed38f8f3c8f88f61293f1800fd6e6088c13
MATLAB
1,058
32
clc;clear all;close all;restoredefaultpath; %addpath(genpath('/big_disk/ajoshi/coding_ground/bfp/supp_data')) addpath(genpath('/home/ajoshi/Projects/bfp/src')); % 1050345 rest 2 % Set the input arguments configfile='/home/ajoshi/Projects/bfp/supp_data/config_bfp_preproc_minimal.ini'; sublist = dir('/deneb_disk/pa...
5f9945bcffe8d6b80aa6eb60b60c4d4bd9fd8d139ea778d96bc7b949126e741d
MATLAB
1,061
22
clc;clear all;close all;restoredefaultpath; %addpath(genpath('/big_disk/ajoshi/coding_ground/bfp/supp_data')) addpath(genpath('/home/ajoshi/Projects/bfp/src')); % 1050345 rest 2 % Set the input arguments configfile='/home/ajoshi/Projects/BrainSuiteBIDSAppSampleData/config_mysoftware.ini'; t1='/home/ajoshi/Projects...
f15fe152fab375498931a62f6b610ff5882306e4c133ae38bfcd676290f9668c
MATLAB
1,061
33
%GRAY Black-white colormap % % Examples: % map = gray; % map = gray(len); % B = gray(A); % B = gray(A, lims); % % Similar to MATLAB's gray function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor array ...
125cad57a10d7257e5ff1731e278a91a1d00152d82434d3588b71cda57e0ca24
MATLAB
1,063
31
%% Mean and binomial uncertainty variance of a random variable that is a fraction of a given count. function [mean, variance] = fracstat(numerator, denominator, numeratorVariance, denominatorVariance) % Default to Poisson statistics if nargin < 3 numeratorVariance = numerator; end if nargin < 4 ...
821dc9248933a06b2c36e0fb4bb28aa10d2510a36f0b8caa712b806b761c1004
MATLAB
1,064
36
function[resultname] = identification_batmotiv(taskName, subid, runname) %% identification_batmotiv % % INPUTS % taskName: name of task % subid: subject number as a string % runname: run/session name as a string % % OUTPUTS % resultname: name of the main results folder % % script initially made by Nicolas Borderies, ch...
bf8fa23696a7c0d2ef191d00b0f9db4aabd53f13d1548f4e1774c27f0ecf512c
MATLAB
1,064
40
%putRawTT.m %Demo file on how to write SE and TT files %This function can write either. % %modeOut: 1 is SE, 2 is TT % % %urut/MPI/Dec11 function putRawTT( modeOut, filenameOut, timestamps, dataPointsOut, headerLine ) AppendFile=0; ExtractMode=1; ModeArray=1; NumRecs=length(timestamps); %all % Field List % 1. Tim...
860d18e6ebba0709bd865a5a2051da354b4716862b34c39dffb372f6f0fefba7
MATLAB
1,065
39
function data = readcfl(filenameBase) %READCFL Read complex data from file. % Read in reconstruction data stored in filenameBase.cfl (complex float) % based on dimensions stored in filenameBase.hdr. % % Written to edit data with the Berkeley Advanced Reconstruction Toolbox (BART). % % Copyright 2016. CBClab, Maas...
0596dc1e9a634cfcdb5c3168a6a918e5f59d07e8b2338680336420861f98a132
MATLAB
1,066
23
function coef_vals = group_rwLCA_wrapper(dictionary_n, x_im, opts) % coef_vals = group_rwLCA_wrapper(dictionary_n, x_im, opts) % % Wrapper for the l1ls minimization function % Required parameters: % opts.eta: 2-D vecotr of Delta/T for LCA (1 for coefficients, one % for weights. Typically eta(2) < et...
0e65114b7ad4c916073139e935da4b136686a75646ba212d3e258c813237adaa
MATLAB
1,066
23
function bias_bits = bias_cmi_ggg_bits(Nvarx, Nvary, Nvarz, Ntrl) %BIAS_CMI_GGG_BITS Analytic bias correction for Gaussian conditional MI. % bias_bits = bias_cmi_ggg_bits(Nvarx, Nvary, Nvarz, Ntrl) returns % the scalar bias correction in bits for CMI(X;Y|Z) where X, Y, and Z are % Gaussian variables with dimensio...
c66a40380abe6da0d032558a99faf7d466701d842b419e73fb593b9c162349bd
MATLAB
1,067
36
function outpict = ghlstool(inpict,hls) % OUTPICT = GHLSTOOL(INPICT,HLS) % Adjust hue, lightness, saturation as in the GIMP Hue-Saturation tool. % This just exists strictly for replicating the GIMP tool behavior. % % INPICT is an RGB/RGBA image of any standard image class % HLS is a 3-element vector of the form [...
edb24897b256c535ad224d7451e0b80430cc0729c68cad9e49955dd6807119c4
MATLAB
1,067
32
clc;clear all;close all;restoredefaultpath; %addpath(genpath('/big_disk/ajoshi/coding_ground/bfp/supp_data')) addpath(genpath('/project/ajoshi_27/code_farm/bfp/src')); % 1050345 rest 2 % Set the input arguments configfile='/project/ajoshi_27/code_farm/bfp/supp_data/config_bfp_preproc_minimal_carc.ini'; sublist = ...
eafad9af71ac63704f8d73a7e0a23115a2142c5be18ebccd19de449d916d1dd6
MATLAB
1,071
47
function [keys, is_empty, exitKey] = record_keys(start_time, dur, device_num) % Collects all keypresses for a given duration (in secs). % Written by KGS Lab % Edited by AS 8/2014 exitKey = 0; % wait until keys are released keys = []; while KbCheck(device_num) if (GetSecs - start_time) > dur break end e...
9cef4a82b41255838305288f28bc7da3075ab29e0bfd644d61be50435793e08b
MATLAB
1,072
37
function r = CBIG_ICCW_ICC_1_1(data_vectors) % function CBIG_ICCW_ICC_1_1(data_vectors) % % This code is adapted from the '1-1' formulation for ICC(c) from % Arash Salarian, 2008 % % Reference: McGraw, K. O., Wong, S. P., "Forming Inferences About % Some Intraclass Correlation Coefficients", Psychological Methods, % ...
aa0b49af2c5fa4b1612b791118e9068c8a41f0391504d12d4b41813f19f67dc6
MATLAB
1,072
39
%% % Parses unit specifications in the format {unitInfo, xUnit, yUnit, ...}. % Either individual output can be requested, or a combined cell array of % axes units: % [unitInfo, xUnit, yUnit, ...] = getunits(...) % [unitInfo, units] = getunits(...) % function [unitInfo, varargout] = getu...
d2da697adbe2d7226b186acb50733fe480c815073c76822339770af1714316ed
MATLAB
1,075
44
function [D R] = DT1(f) % One-dimensional generalized distance transform % % Input: f - the sampled function % % Output: D - distance transform % R - power diagram % % Based on the paper: % P. Felzenszwalb, D. Huttenlocher % Distance Transforms of Sampled Functions % Cornell Computing and Information Science Te...
0f4d672c5207723212ddd3cb51ffb7f926c08dcfbab1f808081eb32b0b05672f
MATLAB
1,077
48
function [toGood,fromGood]=interpolate_bad_channels(x,iBad,coordinates,n) %y=interpolate_bad_channels(x,iBad,coordinates,n) - interpolate bad channels from good % % y: interpolated data % % x: data to interpolate % iBad: indices of bad channels % coordinates: coordinate map (see nt_proximity) % n: number of neigh...
e3edbc771fa633fc15e4611502dfc3960c1fa46a72601279eddff50444669cac
MATLAB
1,078
41
%% % Advances the given subscripts by one step. % advance(subscripts, lasts, [firsts], [steps]) % function [subscripts] = advance(subscripts, lasts, varargin) % Default start and increment if nargin > 2 firsts = varargin{1}; else firsts = ones(1, length(subscripts)); ...
7747c8b2bd0b3baae917b838fffc16a66f8b8b5163b10b749a09f361d699f44b
MATLAB
1,080
48
function [y,w]=nt_trial2mat(x,max_nsamples) %[y,w]=nt_trial2mat(x,max_nsamples) - convert trial cell array to 3D matrix % % y: matrix (samples * channels * trials) % w: weights (samples * 1 * trials) % % x: trial array (each trial is channels * samples) % max_nsamples: max number of samples per trial % % In the ca...
93b2382c0b75a22ab6d6bbabba25d0e8895a5d43e778dc6c131f4da550277b3d
MATLAB
1,084
39
function outnum = roundeven(innum,varargin) % ROUNDEVEN(INNUM,{TYPE}) % Round numbers toward even integers, in the direction specified. % % INNUM is a real-valued numeric scalar or array % TYPE specifies the type of rounding (default 'round') % 'round' is similar to the inbuilt function round() in that values...
5b653719b7759e71bf7a24e14ab3254a518d94ca2bdeb60af1b263d8367dbc6a
MATLAB
1,085
51
% % P = sampleCorrelationDistribution(r, rho, N, isPlot) % % Description: % calcualte the sample correlation distribution (Fisher 1915) % % Input: % r - sample correlation % rho - population correlation % N - length of the time series % isPlot - flag to plot % % Output: % P - the distribution...
ab7e0f87d1b1170c6cb62ba41231e706f7f480e2334b9067d715ad81fab8b0ce
MATLAB
1,085
44
function nt_linestyles(h,property,values) %nt_stylelines(h,property,values) - apply different styles to lines of plot % % h: handle to plot (default:gca) % property: property to set (default:linewidth) % values: cell array of values, one for each line % % Values may be a numerical matrix, in which case each row is u...
d9cd34a110bb68a5be1968074f0431a63c93caf88de58e77714f023b841a928d
MATLAB
1,085
44
set(groot,'defaultAxesTickLabelInterpreter','latex'); set(groot,'defaulttextinterpreter','latex'); set(groot,'defaultLegendInterpreter','latex'); subplot(2,1,1); fnn = load("fnn_FNNcompare_Log_L_4_Nmax_6_phi3_moderate_phi4_moderate_alpha_1.txt"); mbf = load("mbf_FNNcompare_Log_L_4_Nmax_6_phi3_moderate_phi4_moderat...
f09e2a1041955cccc58debc55b51bf3367a9ed56e8d7b84439049d99bf545e77
MATLAB
1,085
33
%GRAY Black-white colormap % % Examples: % map = gray; % map = gray(len); % B = gray(A); % B = gray(A, lims); % % Similar to MATLAB's gray function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor array ...
13673b50eb1c7d211fc1382e8d2cb6e957227cafb1deb047c415161375653239
MATLAB
1,086
33
%HOT Black-red-yellow-white colormap % % Examples: % map = hot; % map = hot(len); % B = hot(A); % B = hot(A, lims); % % Similar to MATLAB's hot function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor a...
14c4462a4b15074e82f7028653e7c18095f631d92985ccc1467b59f724975666
MATLAB
1,087
41
% % Demo of how to load and use the dataset % % Parameters nletter_per_alpha = 20; % number of letters of each alphabet to show % Load the dataset if ~exist('D','var') load('data_background','drawings','images','names','timing'); D = Dataset(drawings,images,names,timing); end nrow = ceil(sqrt(nletter_per_alp...
76067c8b6e88a402db62587ccc7205a6c95bc6db7efb23ab8b07b02d5287a53e
MATLAB
1,088
43
%% RECTANGLECORNERS Returns patch x and y coordinates for a rectangle with corner at (x,y) and with the given width/height function [cornerX, cornerY] = rectangleCorners(x, y, width, height, doClose) if nargin < 5 doClose = false; end if isempty(width) width = 0; end if isempty(height) ...
803c2d79585cbc0713252d94304f7fa3422b5e0cc364c1dbe6f9ebf86b81d4d2
MATLAB
1,094
39
%% % Tacks on or replaces a trailing ' / b x' where b is a (histogram) bin % size and x is a unit. % function [formatted] = formatBinning(handle, bins, binUnit, precision) persistent findUnit; if isempty(findUnit) findUnit = '(?<=\s/\s)([-+0-9.e]+)\s([a-zA-Z]+)\s*$'; end if nargin < 4 ...
5b5ddd3052fa6190fc6a2d83527b2f1f4583f8c8f169ccb7e3c744f3e7f2c2a9
MATLAB
1,097
44
%% % function [handle] = moreticks(axis, handle, numSplits, extendRange, dontSplit, precision) %----- Default settings narginchk(1, inf); if nargin < 2 handle = gca; end if nargin < 3 numSplits = 2; end if nargin < 4 extendRange = 1; end if nargin < 5 ...
63545b3c3e3cbdc7db4c25b37fbf78cbdfeddfa8ce17fd683752b92e0e074634
MATLAB
1,097
48
% % [dataOut, unitOut] = convertByteUnit(dataIn, from, to) % % Description: % convert unit of Byte from one to another % % Input: % dataIn - the number of Bytes in "from" unit % from - unit for current number % to - unit to convert to % % Output: % dataOut - converted data % unitOut - unit co...
93ace0000ffdad976fed6c31327826310c38aaedde4c2796969ffd22cb67669f
MATLAB
1,097
28
function next = ESPIRiT_unfold(input, header) disp("ESPIRiT unfolding setup...") global N_order matrix_size = header.encoding.reconSpace.matrixSize; % [x,y,z] nEchoes = header.encoding.encodingLimits.contrast.maximum+1; nSets = header.encoding.encodingLimits.set.maximum+1; function data = ESPIRiT_unf...
801640e86a0472fddc19548866da2ff6d62260d34e3c1d7dd6b5b91756ae7335
MATLAB
1,100
40
function [y,mn,mask]=nt_rereference2(x,mask,thresh,factor) %[y,mn]=nt_rereference2(x,mask,thresh,factor) - robust rereferencing % % y: rereferenced data % mn: subtracted reference % mask: channel mask % % x: data to rereference (time X channels) % mask: channel mask % thresh: std threshold to discard channe...
957a38af8bfc9ead90851f957699761755b205293240445f2e55dd51e0e41d62
MATLAB
1,100
34
function CBIG_UpsampleSagittalPlane(input, output, scale, interp_type) % Upsample a volume along sagittal plane. % % CBIG_UpsampleSagittalPlane(input, output, scale, interp_type) % Input: % input : input nifti file % output : output nifti file % scale : a single parameter % ...
74cfc9174794eb2d467a3693f2d6e7cd840455a5c27998c3bd259da6e43a9fd7
MATLAB
1,101
57
cm2hartree = 4.556e-6; A = load('AnCorr_L4_Nmax3.txt'); A = log10(A); B = load("AnCorr_L4_Nmax6.txt"); B = log10(B); C = load("AnCorr_L4_Nmax9.txt"); C = log10(C); set(groot,'defaultAxesTickLabelInterpreter','latex'); set(groot,'defaulttextinterpreter','latex'); set(groot,'defaultLegendInterpreter','latex'); data ...
17cd7625d108959e8e8a7b37b87a44a32111d7e1bc52d8416c1b8a5e997f49bf
MATLAB
1,102
26
%% settings sliceInterval = 3; scaleIntensity = 1; %% read file [stack, rowCal, columnCal, sliceCal, fileName, pathName] = readCZI2channels(); %% user draws the mask disp(fileName); disp('Outline the mushroom body in each slice'); disp(strcat('It is only displaying one slice out of every ', num2str(sliceInterval),' ...
9432142598cad0666e01f7c7ab116739e19c5f0e28ede71bc71301358c81814d
MATLAB
1,102
33
%HOT Black-red-yellow-white colormap % % Examples: % map = hot; % map = hot(len); % B = hot(A); % B = hot(A, lims); % % Similar to MATLAB's hot function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor a...
c1a39383ed5f74f7bef5c527a3fa748c613ad5cd3a045da752b8b620c7754f21
MATLAB
1,103
47
% % Copyright (c) 2015, Yarpiz (www.yarpiz.com) % All rights reserved. Please read the "license.txt" for license terms. % % Project Code: YPML110 % Project Title: Implementation of DBSCAN Clustering in MATLAB % Publisher: Yarpiz (www.yarpiz.com) % % Developer: S. Mostapha Kalami Heris (Member of Yarpiz Team) % % Cont...
d063bc2576eaa7d1cbdd6a1a4925a7cf078969e45e83e2d382080a386241c744
MATLAB
1,104
26
%% function get tuning strength of orthogonal cells function TuningStrength = GetTuningStrength(HD_table, HD_list) TuningStrength = []; counter = 1; for i = 1:length(HD_list) idx = find(HD_table.cellID == HD_list(i)); if HD_table.IsPC_HDC(idx,2) == 1 && HD_table.IsPC_HDC(idx,3) == 0 % if cell is tu...
43f5028ff29fe6494e18c7e0dd54a5e160ec6fbf9c843172a1b9813a8fbc7916
MATLAB
1,105
33
%HOT Black-red-yellow-white colormap % % Examples: % map = hot; % map = hot(len); % B = hot(A); % B = hot(A, lims); % % Similar to MATLAB's hot function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor a...
a8d660aea582cdaf5bcd214af2cd7d86aed067d968901e755c83a8ca3a72b5af
MATLAB
1,105
36
%-------------------------------------------------------------------------- %% function [x] = findOvershoot(initX, xScale, xShift, fOfX, comparator, targetY, maxIterations) if nargin < 7 maxIterations = 1000; end lastY = nan; x = initX; for iter = 1:maxIterations y = fOf...
dc5148d852a884259731db5f6b04bcedae12498626cc9ebdece2f728c15dcc77
MATLAB
1,105
33
%HOT Black-red-yellow-white colormap % % Examples: % map = hot; % map = hot(len); % B = hot(A); % B = hot(A, lims); % % Similar to MATLAB's hot function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor a...
8b534dd8f79a90799c81c88692e2ed358daa4f5d54de2098f4f2ad1281cd5b1d
MATLAB
1,106
50
numDigits = 10; mean_samples = zeros(numDigits, 1); std_samples = zeros(numDigits, 1); mean_time = zeros(numDigits,1); std_time = zeros(numDigits,1); for digit = 0:9 path = ['D:\Datasets\MNIST_DVS\' int2str(digit) '\']; listing = dir(path); [a,b] = size(listing); eventos = zeros...
a1fbd4c8563a817440f9215065c420cf3a9f2357f40c5a0c09083dc46242f8aa
MATLAB
1,106
41
function writecfl(filenameBase,data) %WRITECFL Write complex data to file. % Writes reconstruction data to filenameBase.cfl (complex float) and its % dimensions to filenameBase.hdr. % % Written to edit data with the Berkeley Advanced Reconstruction Toolbox (BART). % % Copyright 2013. Joseph Y Cheng. % Copyright ...
ae210ffd70fe8e2c11da680734f8ca7fec6abbdb0489d641c47d5a796bdec463
MATLAB
1,106
31
function [simple,differences_bs] = decision_peak_prominance(epoched_model_predictions) %% Participant selection based on the difference between the aligned largest peak and second largest peak % % **Usage:** [simple, differences_bs] = decision_peak_prominance(epoched_model_predictions) % % % Input(s): % - epoched_mod...
01bd06a1ac172b1f8b28bda76cb5f57ba6b297392b4ed4e8f81dc6102dc82c6d
MATLAB
1,107
27
function muse2SC %% Place artefact file for Spyking-Circus in each data directory for idir = 1 : size(MuseStruct,2) Starttime = []; Endtime = []; try if size(MuseStruct{idir}.markers.BAD__START__.events,2) > 0 for ievent = 1 : size(MuseStruct{idir}.markers.BAD__START__.events,2) ...
5e8483b3d74e60647ccb583dfb92b89a7d47c454439792e38c11a7b2e5725218
MATLAB
1,108
40
%% % Returns standardized spherical coordinate angles, where theta ranges % from 0 to pi and phi ranges from -pi to +pi. Either of the two % following forms can be used: % [stdTheta stdPhi] = stdSphericalAng([theta phi (...)]) % [stdTheta stdPhi] = stdSphericalAng(theta, phi) function [theta phi...
98f6135df56e5c938044c4ca1e73a8763d50c742619be8b5ce37c1710b350cdd
MATLAB
1,108
61
function [p,n]=numSubplots(n) % function [p,n]=numSubplots(n) % % Purpose % Calculate how many rows and columns of sub-plots are needed to % neatly display n subplots. % % Inputs % n - the desired number of subplots. % % Outputs % p - a vector length 2 defining the number of rows and number of % columns req...
7bb844a01aad1531690f579ff65c80fd98146e265aa344b27739bf3df6a55566
MATLAB
1,113
33
function [ output_args ] = ciftisave(cifti,filename,wbcommand,verbose) % CIFTISAVE(CIFTI,FILENAME,WBCOMMAND,VERBOSE) % % Save a CIFTI file as a GIFTI external binary and then convert it to CIFTI % % CIFTI is the cifti-formatted file in the Matlab workspace % FILENAME is the string containing the file name to save as %...
e243529f5697d75bfe87bd8148a1c1d236cd18a0677fc5ef7e23f9d0b9c51336
MATLAB
1,114
42
function y = maxstar(x, w) % MAXSTAR Stable log-sum-exp helper. % For vectors, maxstar(x) is equivalent to log(sum(exp(x))). % For matrices and N-D arrays, maxstar operates along the first % non-singleton dimension. % % maxstar(x,w) is the log of a weighted sum of exponentials, % equivalent to log(sum(w.*exp(...
f41826f995303129c5f1561b4dc9cb74d0e0e60a111b53040551136ec37f7623
MATLAB
1,114
33
%HOT Black-red-yellow-white colormap % % Examples: % map = hot; % map = hot(len); % B = hot(A); % B = hot(A, lims); % % Similar to MATLAB's hot function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor a...
c506a8b704c8e3a567e5a3b4294dc5538261b52fa12c46d968e37493d4299cae
MATLAB
1,116
33
%COLD Black-blue-cyan-white colormap % % Examples: % map = cold; % map = cold(len); % B = cold(A); % B = cold(A, lims); % % A black to white colormap through cold shades. % % The function can additionally be used to convert a real-valued array into % a truecolor array using the colormap. % % IN: ...
757fe92f61522cc0def023d10a13a8514d29f966d3ccccf5b410f25efdaa48e1
MATLAB
1,118
42
dim = 128; dim_kernel = 5; pad = (dim_kernel-1)/2; num_ev = 500; inicio = 1; num_sc = 10; frame = zeros(dim,dim); Ch = zeros(num_sc,dim,dim); Cv = zeros(num_sc,dim,dim); path = 'D:\Datasets\Test\sample10_128\'; fname = 'mnist_0_scale16_0001.aedat'; [allAddr,allTs,ISI,monTime] = loadaerdat(fname, path);...
9fec78154d21f26e72453de1228a8bbbe1198c451ace73d953235aa067d2faf5
MATLAB
1,118
50
function f = dimidatedGaussian(x, mu, sigmaLeft, sigmaRight) %{ persistent SQRT2PI; if isempty(SQRT2PI) SQRT2PI = sqrt(2/pi); end %} persistent SQRT12; if isempty(SQRT12) SQRT12 = 1 / sqrt(2); end % Special cases if isempty(x) f = x; return; en...
84e3aca1e2be5d03a22b8f708cd59fb5ac7b182c8e4a97285a490625eab9c44e
MATLAB
1,119
31
function [spectrum, freq] = pWelchSpectrum(signal, windowSize, overlap, nfft, fs, maxFreq) %% Calculate powerSpectrum using pWelch's method % By Joachim, updated by Mattia % INPUTS: % signal: ´ signal in row vector % windowSize: windowSize in sec (2) % overlap: overla...
3177bf6448a7eb61c4932dc4950636c67f34c2eb5e679fe0cd66f822a105c069
MATLAB
1,120
37
function tiny_recon(connection) tic; try % Once the connection is consumed, calling next will throw an % exception. We wrap the loop in a try here to avoid printing an % error. while true recon_data = connection.next(); data = permute( ......
372b5bdd406e3aaa8c2519a1c485c591f51544fdf978ddd534ff5c0d57399578
MATLAB
1,120
39
%% % Bi-normal cumulative distribution function. function [c] = bigausscdf(x, mu, sigmaL, sigmaR, tolerance) if nargin < 3 && iscell(mu) if numel(mu) < 3 c = normcdf(x, mu{:}); else c = bigausscdf(x, mu{:}); end return; end if nargin < 5 tolerance ...
684ba87be8109654bcaf7ff7b20fa3fa9e23b85cd52909ee2b6290db3728ccf6
MATLAB
1,120
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
091c5c4e77fa151aad42c3b7f20f577a55485e54b241346fe4f0627ad887a781
MATLAB
1,121
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
196fe0cb86ee37ef01b1a01a969a50074a0b1a0dc9b957acfb1ec2d16b55e002
MATLAB
1,121
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
1db81341781691983a2a6c2713d1e4d013ceb88f36c82ad7e4b6dccbfaf17125
MATLAB
1,121
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
383bd258fb2cc5781721bc3f0bce96c37cd48b658a73a0e2652f834608f7fc8a
MATLAB
1,121
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
4959f4451fe5a7b5c7223d81518af588c4b7f7556951f53a0fbd94a4b2dfee97
MATLAB
1,121
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
4b70ef61f1e62854fbe2174edeb8170262459e0315e547189d9578fb8c0f0e95
MATLAB
1,121
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
809e06c917f597a76b0737c3c7e7bffd7a5b2a32ba83df7ef718e97291c9659e
MATLAB
1,121
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
8a3c956d85e56601d97dcd67b1b4ec5b9622f4eb02452eac4f043f6f50d7bf42
MATLAB
1,121
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
9d9a5748c56b2483d0def6115f331a09f9609adf338bc6ecf5dca3d2a56bfd8a
MATLAB
1,121
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
e54b2d2b7a87a2f43362478dc6061c26a9da4e00e095c1e8e3c7ab6b09005437
MATLAB
1,121
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
18da2e04a598d987cd0eeff382f9447286e8ea47a9ec273ea6d5dccd5994ae73
MATLAB
1,122
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
63487a5e72ece7e0608c43f09d4bc7d66ba0ce54f87a10a86f2451a7f5166e69
MATLAB
1,122
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
a9887ade6547ea0931af20e864e452071ec7827ca9ca224ee8653db144de84ac
MATLAB
1,122
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
badab50c2a8fee217e028a87bc281844a36bb230b614fc3a35098618ba62b7f1
MATLAB
1,122
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
e4af9bffd9b24e4d94545b2f00281f1d65f225e57e8ed4655f6792fc52c36be7
MATLAB
1,122
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
c177822cd8f1f8d5a73e2c9a382a385bcbce7b00fb01e74762ab516d8c255680
MATLAB
1,123
37
clc;clear all;close all; load /deneb_disk/SCD_BOLDdata/atlas.mat full_graph=atlas_data'; sample_rate=.1; para_sigma=1; nSurf=32492; % This is sample code that finds reduced set of vertices based on method by Minqi Chong for the % grayordinates. Handling full grayordinates at once takes a lot of memory % a...
793c402a21aa837aec135018f559a3ee22c1ca2b49583d6ae9097e833c642097
MATLAB
1,125
33
%COLD Black-blue-cyan-white colormap % % Examples: % map = cold; % map = cold(len); % B = cold(A); % B = cold(A, lims); % % A black to white colormap through cold shades. % % The function can additionally be used to convert a real-valued array into % a truecolor array using the colormap. % % IN: ...
7db22907d9431b52ade623d9429b2fcac0ec9e32ec666868279e2e36fd07756f
MATLAB
1,125
45
function y=nt_dft_filter(x,transfer,N) %y=nt_dft_filter(x,transfer,N) - apply filter using DFT % % y: result % % x: data (time*channels) % transfer: transfer function (size=N/2) % N: number of samples to use in DFT (default: next power of 2) % % Data are zero-padded to N. if nargin<3||isempty(N); N=2.^nextpow2(s...
ac9c8d773185854bbc832f396db5bb15f09694eee2022d46eb3d49f97900e78f
MATLAB
1,127
26
%% Demo 4 - One-way repeated-measures ANOVA (random intercept) % A within-subject factor handled by a random intercept reproduces the one-way % repeated-measures ANOVA. Shown on the ergoStool dataset (nlme; Wretenberg et al. % 1993): 9 subjects each rate the perceived effort (Borg scale) of rising from % four stool typ...
f31ee615e4baf09e5924354462f9c327475f39308bd511ea982b00e2f0bd100f
MATLAB
1,127
57
close all; clear all; clc addpath(genpath('/data/code/matlab')); prepOutput; %%%% PARAMETERS %%%% % Database database{1} = '/data/coord/tyr/tyrunits'; database{2} = '/data/coord/zen/zenunits'; % Data files dataDir = 'data/pow'; % Display linProp.col = {'k','g','r','b','m'}; linProp.width = 2; % Save params sav...
530699c9f70561c872eaa3872f5e097be74919d561ebf1f07638abe8b157b7f6
MATLAB
1,128
46
function [rep] = array2str(x, bracketize, colSep, rowSep, precision) if ~ismatrix(x) error('array2str:input', 'Only possible for dimension 1-2 arrays, received %d instead.', ndims(x)); end if nargin < 2 bracketize = inf; end if nargin < 3 colSep = ', '; end if nargin ...
ca5a47a2afbed095c8ead3e226983cf624b2ab7840c9099d7b161ba1f1d51327
MATLAB
1,128
39
function [stack, rowCal, columnCal, sliceCal, fileName, pathName] = readCZI2channels(varargin) % Assumes that there are 2 channels if nargin==2 fileName = varargin{1}; pathName = varargin{2}; else [fileName, pathName] = uigetfile('*', 'Pick a file'); end % Get the extension [~,~,extension] = fileparts(fi...
116f881ec0f98a9f3ededccea8584740e484ff6ce09f4fc82277b593a748725c
MATLAB
1,130
45
function plan = buildfile plan = buildplan(localfunctions); plan.DefaultTasks = "test"; plan("test").Dependencies = "compile"; plan("bench").Dependencies = "compile"; plan("package").Dependencies = "compile"; end function compileTask(~) add_tooling_path(); gcmi_cpp_mex_compile(); end function testTask(~) add_tooling_...
90f55a85dbbcbd887c430f886d0f73751f47034a3bb5e5d31722133e008369b0
MATLAB
1,131
22
clc;clear all;close all;restoredefaultpath; %addpath(genpath('/big_disk/ajoshi/coding_ground/bfp/supp_data')) addpath(genpath('/home/ajoshi/Projects/bfp/src')); % 1050345 rest 2 % Set the input arguments configfile='/home/ajoshi/Projects/bfp/supp_data/config_bfp_preproc_minimal.ini'; t1='/home/ajoshi/Downloads/for...
39c6615f8d34bfe50aa7d86e9b2408325eb1cc065e0f56660be0a8aee865a489
MATLAB
1,132
52
function out = circmean(x,varargin) % CIRCMEAN(X,{DIM},{MODE}) % Calculate mean of angles. Useful for calculating mean color properties in % polar color models. % % X is an array of angles in either degrees or radians. % DIM optionally specifies the dimension along which to operate (default 1) % MODE optionally ...
5e99423ee79858077062d2fe6b2e8e536498a8ae0c966ba3e47cb9954c8233ce
MATLAB
1,133
45
function [rms,sd,all]=nt_bsrms(x,N,w) %[rms,sd,all]=nt_bsrms(x,N,w) - calculate rms, estimate sd using bootstrap % % rms: rms over second dimension of x % sd: standard deviation of rms calculated by bootstrap % all: matrix of all trials % % x: matrix of observations (time X repetitions) % N: number of bootstrap ...
abd47e749ed42389c9feb405a66518c4253d1c89e65c6771e78ac1e6b9f241f9
MATLAB
1,134
46
function [mn,sd,all]=nt_bsmean(x,N,w) %[mn,sd,all]=nt_bsmean(x,N,w) - calculate mean, estimate sd using bootstrap % % mn: mean of x over second dimension % sd: standard deviation from mn of bootstrap trials % all: matrix of all bootstrap trials % % x: matrix of observations (time X repetitions) % N: number of bo...
73c370f132be8a9007580ce2a04a3c0108e0ea999258ab642e1d5acc20f2e274
MATLAB
1,135
44
function S02_create_GLM_empty_onsets(subject, game) root_path = 'YOUR_DATA_PATH'; main_dir = strcat(subject, '/', game) ; sess_no = 5; GLM_name = 'GLM_empty'; mkdir(strcat(root_path, main_dir, '/GLMs/', GLM_name, '/')); for run_no = 1:sess_no clear no_of_volumes_to_remove clear first_volum...
b3b76cebba39e63406b05e4088ba5bc0a928f1f4f4202c05d2ff8c63062e079c
MATLAB
1,135
38
%% % Piecewise assignment of values, with lazy execution % piecewise(x, range1, value1, range2, value2, ..., rangeN, valueN, valueOut) % If x is outside of all ranges then the return value is valueOut. % Ranges are to be provided as upper bounds (not inclusive) and expected % to be in ascending order...
d1aac7bad222a3cc4281da78b7553e97556363367c78f81e453518e2af642a34
MATLAB
1,135
33
function kbsaveFigure(fig, filePath, fileTypes, figWidth, figHeight) [fdir, fname, ~] = fileparts(filePath); filePath = fullfile(fdir, fname); fileTypes = cellstr(fileTypes); % ensure cell array figPos = get(fig, 'Position'); if nargin < 4 figWidth = figPos(3); figHeight = figPos(4); end fig.Position(3:4) = [...
f21a6f7b60c734a60aa327957c5dc7aca6251c32ea98a5688306928d5472d56b
MATLAB
1,135
48
function CBIG_PartitionSubjectsVarargin(num_subjects, varargin_txt, out_path) % Split subject's list into several lists and each list contains num_subjects. % % CBIG_PartitionSubjectsVarargin(num_subjects, varargin_txt, out_path) % Input: % num_subjects: number of subjects included in each text file % ...
74022e00292c9ac86b03d86357fb7d6a44ea7396fb37e3d2a4658b0021cc8dc8
MATLAB
1,137
38
function [out,cc]=cntrdW4(im,mx,ra) %cntrd: calculates the centroid of bright spots to sub-pixel accuracy % based on indice vector operation instead of looping; % % created by Pei-Hsun Wu 10/04/2019 at JHU % added radius estimators 11/08/2019 PW. % added radius estimation based on std 05/21/2020 PW msk=mskci...
ba5d28c0434cd9b9369f01fc907bdccd13a2e9cf842816d5caec25b2b2fe8dfd
MATLAB
1,137
36
function weight=getWeights(X1D) % creates the weights for quadrature / numerical integration %function weight=getWeights(X1D) % this function calculates the weights for integration/the volume of the % cuboids given by the 1 dimensional borders in X1D d=length(X1D); % puts the X values in their respective dimensions t...
31ce86487a5645adf0aa942ebb95f7ae64c3102266a77dc39e6ed31f3d75a5e7
MATLAB
1,140
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
33e1b9491ba32939904b52099948630744ff0e09c3863d799599576555af7488
MATLAB
1,140
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
51f4a80d0affd0c9ef443bed394bc81f28905d8ef5f8da30501e631ee41b8fa8
MATLAB
1,140
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
598eb4479fe653678dae1a9a2ba429b83ef1098cba41f7d024f9a4f5d14f71c7
MATLAB
1,140
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...
cc98cee9829d5e48c714f3d95d37d75be5566db9745150a2df3ffb9fde919749
MATLAB
1,140
38
% loop trough files in folder to make undistortion for all .nii files in % folder % Attention: the mask needs to be made first! (see % Use_mc_undist_wouter_dante.m) % This is STEP 2. clear % addpaths addpath('/fmri/apps/spm5') addpath('/fmri/spm5_scripts/') addpath('/fmri/spm5_templates/') addpath('/fmri/spm5_utils/'...