sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
cb8a3013029e0d55d5be73ebb311f41e5ab74189642ee403b6bf3e61a40f2340
MATLAB
1,479
70
function LAN = erplab2lan(file,setfile) % <°LAN)<] toolbox % v.0.1 % load .erp file (ERPLAB) with the corresponding .set file (EEGLAB) % file = name (and path) of .erp file [ 'file.erp' ] % setfile = name (and path) of .set file [ 'file.set' ] % % Pablo Billeke % 29.08.2013 load(file,'-mat'); if nargin==1 ...
33f1667e894448d9a91357806420379509b40a5fcd0ebf1cdcc6144e0dbc864c
MATLAB
1,480
60
%% var2trfun % % Calculate VAR transfer function from VAR coefficients % % <matlab:open('var2trfun.m') code> % %% Syntax % % H = var2trfun(A,fres) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % A VAR coefficients matrix % fres frequenc...
42a6aac9a04ae47de4a3abba66deb0312666095477e060fe7e6c6e405c01f239
MATLAB
1,480
35
% FMM3D: MATLAB/Octave wrappers to 3D fast multipole methods. % Center for Computational Mathematics, Flatiron Institute. % % Functions: % lfmm3d - FMM in 3D for Laplace (electrostatic) kernels. % l3ddir - Direct (slow) 3D Laplace kernel sums (reference for LFMM3D). % hfmm3d - FMM in 3D for Helmholtz...
70a9a1862699e40094b107d5a8e798d640970a8cd5dae9c47eb23bec9b628492
MATLAB
1,480
1
% TSSET Set a field in the Experiment structure % TSSETTRIAL(TRIALNAME) sets TRIALNAME as the active trial that will be % used for computing statistics. % % When a trial is defined, it becomes the active trial. % % See also TSsetdata, TSsetoverwritemode, TStrialstat %%% FIX ABOVE function TSset(arg1,arg2,arg...
f31f361b9d449a20d56ca428c0cc0e312b5e045ded5404d4cec30c7bdd26aaf5
MATLAB
1,480
37
function y_ChangeImgPrefix(InputDir,CurrentPrefix,WantedPrefix) % y_ChangeImgPrefix(InputDir,CurrentPrefix,WantedPrefix) % Change the prefix of images in the sub-directories. % InputDir - where the data stores % CurrentPrefix - the current prefix of the images. % WantedPrefix - The wanted prefix. % Exampl...
f71e68f0533ebd4f34ebec2a6ab6f823b524bcb980a944fdc542065d23211021
MATLAB
1,480
56
function lan_master_gui_spks_clu(spikes, clu) figure choice = 1; dimx = 1; dimy = 2; ccfg = struct('feature', 'wav', 'scales', 4, 'inputs', 10); inspk = wave_features(spikes, ccfg); uicontrol('style', 'text', 'string', 'dim x',... 'units', 'norm', 'position', [.1 .0 .1 .07]); uicontrol('style', 'edit', 'string'...
77d48bde6bf15f77801fe6e757156394cc8fa17c976dfb827d28b1e947f3eeb9
MATLAB
1,481
50
%% 4-PANEL TEXTURE DEMO (will take <1min per iteration) % % This version of the model computes parameters within nine windows that % tile the image. It is NOT the same as the model used in the paper, % but runs substantially faster, so is a good way to make sure % that the code is working. The resulting synthetic imag...
0ee68528352fbfa3e7e097790413066f76c8470369ef28689dc83db5669be80b
MATLAB
1,482
60
function c = SubjectColors(subjectID, cb) if nargin == 1 cb = false; % Colorblind alternatives end % Get multiple from ordered cell array if length(subjectID) > 1 && isa(subjectID , 'cell') c = zeros(length(subjectID),3); for i = 1:length(subjectID) c(i,:) = Sub...
11cd57f90042555604b83508a8fc1e93c14be2f597ff33cacbb36b9f2d682839
MATLAB
1,482
50
function [pZ, pX] = noisyMixModelInferNodes(model, Y, softev) % Y is Ndims * Nnodes % so Y(:,j) are the observations for node j % % Model is Z -> Xj -> Yj % % pZ(k) responsibility of cluster k % pX(c, j) = p(Xj = c) Nmix = model.mixmodel.nmix; Nstates = model.Nstates; Nnodes = model.Nnodes; logMix = log(rowve...
fbe7ea440ccb165532a88dadd0ce088236a649427aac86f88899f709344c4dab
MATLAB
1,482
54
% changeaxisunits(factorx,factory) % changeaxisunits(factorx,factory,hax) % Changes the units of the x and y axes. % Suppose the original units of the x axis is frames and the original unit % of the y-axis is pixels, and we want to change to seconds and % centimeters, respectively. If a frame is .05 seconds and a pixe...
7cb385d8c16dee7ea8cea9ed92fa8d95c27d047e74a6e5cfb122e59f0f21d489
MATLAB
1,483
74
function LAN = cnt2lan(cfg) % v.0.2 % Pablo Billeke % from EEGLAB % % 12.04.2016 improve RT extraction if nargin == 0 [filename, filepath] = uigetfile('*.CNT;*.cnt', 'Choose a CNT file -- cnt2lan()'); else if isstruct(cfg) filename = getcfg(cfg,'filename'); filepath = getcfg(cfg,'filepath','...
f2cae1fda014c4b113ebe074b1e5a2e9f14f74f96959e448cfb564e58fffe58b
MATLAB
1,483
57
function [FitCC,CC,coef]=FitTemporalPattern(Data,Labels,NumTests) % How well is the neural response to an "action" that combines two % movements explained by the neural response to those movements alone? %% X1=Data{1}; X2=Data{2}; Y=Data{3}; if nargin<2 || isempty(Labels); Labels=1:size(X1,2); end if nargin<3; NumTes...
413b5757efff92785ea0ae020d72deb4f9356826b1f02f9ff479314cddae411b
MATLAB
1,484
68
%% Find the mode of a mixture of 2, 1D Gaussians using Simulated Annealing % %% % This file is from pmtk3.googlecode.com function saDemoMOG() sigma_prop = 10; % Standard deviation of the Gaussian proposal. seed = 1; randn('state', seed); rand('state', seed); xinit = 20*rand(1,1); % initial state Ns...
fa764269c8b8b9479f051bc2ba5d5b5e05084bf2a8d3b42b9771d3beb016dc9f
MATLAB
1,484
52
function [CC]=ComputeTemporalConsistency(Data,Labels,NumTests) % Test to see if one condition (column) is reliably the larger then all % other columns across random 50/5-0 NumTests in the data % Data : Number of samples X number of conditions. % labels Optional condition names % NumTests Number of NumTests % % Reli...
a75ad629c97aea8abfee7c2da3779444d24caeac4d9cceeee3c0b7e330ff441a
MATLAB
1,485
26
disp('############################################'); disp('#### Design a cone trajectory ####'); disp('#### ####'); disp('############################################'); disp(' '); r = linspace(0,5, 500)'; th = linspace(0,2*pi, 500)'; C = r.*exp(2*pi*1i*th); C = [real(C) i...
69b4fd0638fe1e3b01d384ab63ee52e81ac0d49a486c0aeb96393d212e5eeeb7
MATLAB
1,486
56
function [binnedx, binnedy, binnedz, stdx, stdy, stdz] = divideintobins3(x, y, z, nbins) % take two vectors and divide x them into nbins, then compute the mean % response of y for each x if ~exist('corrtype', 'var'); corrtype = 'Spearman'; end %assert(~any(isnan(x)), 'x contains nans'); %assert(~any(isnan(y)), 'y cont...
7227bbb39ef90e5e3aabd714ab015ea78a75d755b2b4561bcdbd06a72f0c1df3
MATLAB
1,486
31
function plot_sectors_2(this_center, circle_rad, sector_endpoints, random_color_red_colony, theta) num_sectors = length(sector_endpoints)/2; sector_points = zeros(length(theta) + 2,2); sector_points(1,:) = this_center; sector_points(end,:) = this_center; % If the colony should be cured if num_sectors == 1/2 %se...
b0f5ba5d5200c771a47b8a634f68bd3c809f3671835f02ac1be10b5bf173d12d
MATLAB
1,486
51
clear all; close all; % SYNTAX % example_global_smoothing_lumped_laplace % DESCRIPTION % This script performs global (or local) iterative Laplacian mesh % smoothing using the lumped-smoothing algorithm. The smoothing improves % triangle quality and increases min edge length but deforms the mesh % % Low-...
ffc54f01c8ab365aafcd8923acfdf9e39a41e870da7834a87f09768f70aef1a9
MATLAB
1,486
47
function a = extract(t,srchsubs) %EXTRACT Extract value for a sptensor. % % EXTRACT(X,SUBS) returns a list of values. % % See also SPTENSOR/SUBSREF. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkold...
219389f16a36f4cd75bc72f905cade97cff225db4bfd0d222347c46d3e245832
MATLAB
1,487
55
function Is = anisdiff(I,sigI,NIter); if nargin < 3, NIter = 4; if nargin < 2, sigI = 10; end; end; % Function that diffuse an image anisotropially. Is = I; [ny,nx] = size(I); c_n = zeros(ny-2,nx-2); c_s = zeros(ny-2,nx-2); c_w = zeros(ny-2,nx-2); c_e = zeros(ny-2,nx-2); c_nw = zeros(ny-2,nx-2); c_ne = ze...
876eebd087d20fadf85bf97d28a6c84c2d61c5d056f83669e14dfc03fe6d7fb3
MATLAB
1,487
53
function R = randrot(n, N) % Generates uniformly random rotation matrices. % % function R = randrot(n, N) % % R is a n-by-n-by-N matrix such that each slice R(:, :, i) is an % orthogonal matrix of size n of determinant +1 (i.e., a matrix in SO(n)). % By default, N = 1. % Complexity: N times O(n^3). % Theory in...
95b25341f8e7774850a82328093accde8aa4344e085712938f796119a0df6a39
MATLAB
1,487
67
function [Kp stdKp] = Patlak(tissue,time_tissue,Cp,Cpint,weights,nrpoints) % NOTA IMPORTANTE %Cp e Cpint devono essere interpolati sulla griglia dei tempi definita da %time_tissue % Cp = interp1(tnew,Cpnew,time); % Cplint = cumtrapz(tnew,Cpnew); % Cpint = interp1(tnew,Cplint,time); % nrpoints = 10; %Check s...
b9b46ac9a46d1c835cd8d2e7bacd6f671322ebb9893654f377bc955cfaae247d
MATLAB
1,487
38
function [azi,ele]=hor2sph(lat,pol) %HOR2SPH transform horizontal-polar to spherical coordinates. % [azi,ele]=hor2sph(lat,pol) % % Input: % lat ... lateral angle (-90 <= lat <= 90) % pol ... polar angle (-90 <= pol < 270) % % Output: % azi ... azimuth (0 <= azi < 360) % ele ... elevatio...
dde7b28fe9db029dd9890f9dc709f8745592646793199a7ced1e4f467e3ecb39
MATLAB
1,487
37
function ret = make_links_in_registration() ret = true; loadParameters; src_dir = relpath(params.registeredImagesDir,params.normalizedImagesDir); old_dir = pwd; cd(params.registeredImagesDir); for c_i = 1:length(regparams.CHANNELS) normalized_filename = fullfile(src_dir,sprintf('%s_r...
fdcb5d2ae64ee20b71c551a11906f9ec5eb37776d4af40a465ba635694db7764
MATLAB
1,487
52
function outpoints = y_tal2icbm_spm(inpoints) % % This function converts coordinates from Talairach space to MNI % space (normalized using the SPM software package) using the % tal2icbm transform developed and validated by Jack Lancaster % at the Research Imaging Center in San Antonio, Texas. % % http://www3.intersci...
6f9f3e30f97acc85b968255d63d6d5ddd42e7208575e5e31131c74fe5ad7d974
MATLAB
1,488
49
function b = myregress(y,X,varargin) %MYREGRESS Multiple linear regression using least squares. % B = MYREGRESS(Y,X) returns the matrix B of regression coefficients in the % linear model Y = X*B. X is an n-by-dx design matrix, with rows % corresponding to observations and columns to predictor variables. Y is % ...
a94df201de70a58dcfe35165f73e74aa39c44f46e31ff07cff292be9aaeb7d43
MATLAB
1,488
64
function logp = gaussInvWishartLogprob(arg1, arg2, arg3, arg4, arg5, arg6) % logp(i) = p(m(:, i), S(:, :, i) | model) % logp = gaussInvWishartLogprob(model, m, S) OR % logp = gaussInvWishartLogprob(mu, Sigma, dof, k, m, S) % % logp(i) = p(m(:, i), S(:, :, i) | model) % = N(m(:, i) | model.mu, (1/model.k) * S(...
d30d9ed5fdfa312389b85540629484201c0e480ad39372953e4e11fd5b73f4ec
MATLAB
1,488
40
function datToNPY(inFilename, outFilename, dataType, shape, varargin) % function datToNPY(inFilename, outFilename, shape, dataType, [fortranOrder, littleEndian]) % % make a NPY file from a flat binary file, given that you know the shape, % dataType, ordering, and endianness of the flat binary file. % % The point here...
e5ef47b2dae1e29ea01e7add83bbbce6643c65025a2be7648e3c0112bb853c7b
MATLAB
1,488
37
function [pts] = generateHexSubunitGrid(NsubMax) %GENERATEHEXSUBUNITGRID Generates a hexagonal grid of subunit locations. % % This function creates a hexagonal grid of points with unit spacing, % centered at (0,0). The grid is designed to accommodate up to NsubMax % subunits, ensuring that the points are arrang...
badd92e3923057e548d90aa5d17d4b136acd8f66ea33024fd8bfa3f2162f64cf
MATLAB
1,489
72
function sdata = stack(data, options) stack_id = 0; fn = fieldnames(data); sdata = struct; for j = 1:length(fn) sdata.(fn{j}) = []; end for i = 1:length(data) if data(i).time_offset == 0 stack_id = stack_id + 1; for j = 1:length(fn) sdata(stack_id).(fn{j}) = []; end end % add to the current ...
267696f866886e6bc614f39a8bbdb69564081b2e6fa112f241d11c3ed60b57d5
MATLAB
1,490
45
function [trl, event] = ft_trialfun_example1(cfg) % FT_TRIALFUN_EXAMPLE1 is an example trial function. It searches for events % of type "trigger" and specifically for a trigger with value 7, followed % by a trigger with value 64. % % You would use this function as follows % cfg = []; % cfg.dataset ...
0d0ccedeb768c2351c61dd7c3e59da83f44eab38791103630eb20d562fd37d47
MATLAB
1,491
38
data = dir('/DATAPOOL/ERRORMONITORING/SEM_mri_data/P*'); %% sub = 1; for i = 1:size(data,1) data_anat = [data(i).folder, '/', data(i).name, '/mri/SEM_', data(i).name, '/nifti/anat']; anat_files = dir(fullfile(data_anat, "*.nii")); def_field = anat_files(startsWith(string(char(anat_files.name)),...
1c1404010f0aaeddc9d552970f354e535642b152b8bdcfa39e832c49c405bdc8
MATLAB
1,491
43
function [keypoint reRun precomp_grads] = Create_Descriptor(pix, xyScale, tScale, x, y, z, sift_params, precomp_grads) % Main function of 3DSIFT Program from http://www.cs.ucf.edu/~pscovann/ % % Inputs: % pix - a 3 dimensional matrix of uint8 % xyScale and tScale - affects both the scale and the resolution, these...
2439809f4db8cbc2f763454d8afef709fa5eb60296a956bb3bbd84e0f686c559
MATLAB
1,491
66
addpath(genpath('/groups/branson/home/bransonk/tracking/code/piotr_toolbox_V3.02')); addpath /groups/branson/home/bransonk/behavioranalysis/code/Jdetect/Jdetect/misc; addpath /groups/branson/home/bransonk/behavioranalysis/code/Jdetect/Jdetect/filehandling; folder = '../headTracking'; file = 'FlyHeadStephenCuratedData_...
4efa6b6a36db33df13625f53ec216382d60fa350b47ae74db3c35c077a1ea7a6
MATLAB
1,491
51
%% ------------------------------ Initialize ------------------------------ % include all functions addpath(genpath('src')); parameters; % summary variable summary = {}; % TODO: Somos centro detekcija imant sankirtą su branduoliais % TODO: Ląstelės branduolio detekcija: branduolys turintis didžiausią sankirtos tūrį ...
1379008f607ccfb521d8665bb67129b1257a165131c0de90e47ba4c640fbaca4
MATLAB
1,492
55
function [normal,normalf] = compute_normal(vertex,face) % compute_normal - compute the normal of a triangulation % % [normal,normalf] = compute_normal(vertex,face); % % normal(i,:) is the normal at vertex i. % normalf(j,:) is the normal at face j. % % Copyright (c) 2004 Gabriel Peyré [vertex,face] ...
38f66d951d92504d42d499aed31906857bb78187f61c05042cb1366eb17f2693
MATLAB
1,492
41
function [gx,dgdx,dgdp] = g_2AFC_basis(x,P,u,in) % 2AFC observation function: projection onto basis function set % function [gx,dgdx,dgdp] = g_2AFC_basis(x,P,u,in) % This function evaluates the probability of choosing the first alternative % options in a 2 alternative forced choice paradigm, where each option is % decr...
43c5e5856edaf1d1624a3abb2876be8135091d2184ef98755f67328360e5ec39
MATLAB
1,492
44
%% pairedResample % % Used when we have paired data which we are 'resampling'; ensures that the % shuffle points which are randomly drawn from one group matches the other % groups EXACTLY. % % Returns a tensor of the observations for later manipulation; % % Assume data is a [nObservations x nGroups], with eac...
609c33bfe1f0131acc9755e03a0367f39dc706abe6fd0606dca66198190e0d2f
MATLAB
1,492
45
function out = spm_run_fmri_data(job) % Set up the design matrix and run a design % SPM job execution function % takes a harvested job data structure and call SPM functions to perform % computations on the data. % Input: % job - harvested job data structure (see matlabbatch help) % Output: % out - computation res...
aa792151df2ff7120b765d20b6fe2dfb98f606457d63544e46d58c1a99f9be33
MATLAB
1,492
76
function out = wwhich(s1,s2) % Like built-in which but supports wild cards % Locate m-files using wildcards % Works exactly as WHICH, but you can % use wild cards. % % out is a cell whenever 2 or more % matches are found or if the flag % -all was used % % Note: a function may be shawdowed, % ...
aae583f8286c38fd1688fcc3f7ff0d681b21bc1436aacecd0b6f0624fd259da6
MATLAB
1,492
20
% SOURCE % % Files % angauss - Anisotropic gaussian filtering. % cropt - Crop a tomogram, set to zero voxels in the border of the tomogram % diff2d - Differentiation in 2D images % diff3d - Calculates partial derivative along any dimension in a tomogram. % dtvot...
ee67771af66be4d7121e7d1dd804cd3b879ecce76648414b354ccd514c2918f7
MATLAB
1,492
47
function mergedTbl = tableAppend(tbl1, tbl2) % mergedTbl = tableAppend(tbl1, tbl2) % tbl1 - Main table to which tbl2 will be appended. This table will be % unmodified. % tbl2 - Table that is being appended. Only the variables that are present % in tbl1 will be conserved. % % mergedTbl ...
eff597d44af3620a388d4ec8b98869f36d0bd8a730e92c3901523047871b3ce7
MATLAB
1,492
61
function [ stat_mean stat_dev stat_sem ] = ... wlStats_getBootstrappedStats( datavals, bootcount ) % function [ stat_mean stat_dev stat_sem ] = ... % wlStats_getBootstrappedStats( datavals, bootcount ) % % This computes the mean, standard deviation, and standard error of the % mean for a set of samples. SEM is est...
7d0a4404c6c08eb4ae419d8fcee48ff01bc57aa540d27d278186068e26343ba7
MATLAB
1,493
50
function [Q] = VBA_spm_Q(a,n,q) % returns an (n x n) (inverse) autocorrelation matrix for an AR(p) process % FORMAT [Q] = spm_Q(a,n,q) % % a - vector of (p) AR coefficients % n - size of Q % q - switch to return inverse autocorrelation or precision [default q = 0] %___________________________________________________...
855af7e3c1840c81a5ab0e7eb105ee875514d010b0bc964ecbed517ca272544d
MATLAB
1,493
36
function [gx] = g_wrap_perseveration(x,P,u,in) % wraps observation function to include (anti-)perseverative bias % function g_wrapInGame(x,P,u,in) % A perseveration bias occurs when an agent tends to repeat his past % action, irrespective of his beliefs and/or preferences. It can be % modelled as a bonus for repeating ...
89aac44760a744bec985ff8bb0db1450c59bab003348647430b8d4ceb37c32bb
MATLAB
1,493
46
function clf = clfEcoc(p,clfInit,clfparams,nclasses,use01targets) % Wrapper for ecoc that makes ecoc compatible with nfoldxval. % % Requires the SVM toolbox by Anton Schwaighofer. % % USAGE % clf = clfEcoc(p,clfInit,clfparams,nclasses,use01targets) % % INPUTS % p - data dimension % clfInit - bi...
0afab900b14c7fae29e62e40c390769d69bcbc3afb407be1103d89bf2434e53e
MATLAB
1,494
44
function [ rawmag, rawfreq, rawphase ] = ... wlProc_calcAnalytic(data, samprate) % function [ rawmag, rawfreq, rawphase ] = ... % wlProc_calcAnalytic(data, samprate) % % This function uses the Hilbert transform to generate an analytic signal % for the specified input signal, and from that extracts magnitude and ph...
12f11db54ef08e1e6bf95a27e724374d378ff0137c1bc6657f6b9f068f11184f
MATLAB
1,494
49
function y=odd(x); %ODD Round towards nearest odd value. % Y=ODD(X) rounds each element of X towards the nearest odd % integer value. If an element of X is even, ODD adds +1 to % this value. X can be a scalar, a vector or a matrix. % % X : scalar, vector or matrix to be rounded % Y : output scalar, vector or matrix c...
21b42c4d1d9d8ec470dd3c4127d2606783159b1140e13d6c2a3ad0fdf0e52d85
MATLAB
1,494
38
function [fx] = evolution0bisND(x,theta,u,in) % 0-ToM's evolution function (without doubled hidden states) % function [fx] = evolution0bisND(x,theta,u,in) % 0-ToM is simply tracking the log-odds of P(o=1), where o is the % opponent's action. This variable is updated according to a Laplace-Kalman % filter, yielding 2 su...
8e3cc30705720cbaac62a16ad25f22ce1257cec98ef8ed309dc6cc5171de6947
MATLAB
1,494
52
% Compute unigrams and bigrams of Darwin's "On the origin of % species". Written by Matthew Dunham close all; verbose = 1; fid = fopen('darwin.txt'); if(verbose),display('reading file...'),end; data = fread(fid); if(verbose),display('done'),end; fclose(fid); lcase = abs('a'):abs('z'); ucase = abs('A...
d3ad4168545ea9006d4d827e8007facefe3f93e631d4c43068fcbc4e1023a0d0
MATLAB
1,494
60
function [k,g,s,time,Ck] = vdSpiralDesign(Nitlv, rv, res, fov,radius , Gmax, Smax, T,ds, interpType) % [k,g,s,time] = vdSpiralDesign(Nitlv, res, fov,radius , Gmax, Smax, T, interpType) % % This function designs a variable density spiral % % Input: % Nitlv - Number of interleves % rv/riv - Indicates type of s...
ddda7a0584fb83e8fdd41ce222fae300af650bb5a01c8b9e6d9fe322022e6c44
MATLAB
1,494
39
%% Perform a random walk on the integers 0:20 % Visualize the probability of the the states for various time steps, % and different initial conditions. %% % This file is from pmtk3.googlecode.com function randomWalk0to20Demo T = diag(repmat(0.5, 1, 20), -1) + diag(repmat(0.5, 1, 20), 1); T(1, 1) = 0.5; T(21, 21) = 0....
fcb36fc491f22b3c0c9b28244f84329ddd8daddf32a940870850637714b7a818
MATLAB
1,494
73
function [center,radius]=sphfit(vc) % fits a sphere to a set of surface points % % input: % vc nx3 matrix, where each row represents the location % of one surface point. vc can have more than 3 columns % (e.g. orientations) - then only the first 3 columns are used % % center 1x3 vector denoting the cente...
077f7a541303236ea9cc3ab42bcf427dd11c7467580f28424cd4f81bbfc5e716
MATLAB
1,495
52
function FD_jenk = CBIG_ABCD_proc_compute_FD_Jenkinson(motion) % FD_jenk = CBIG_ABCD_proc_compute_FD_Jenkinson(motion) % % This function compute the FDRMS (Jenkinson) from the 6 motion parameters % % Inputs: % - motion: % #frame*6 matrix. The 6 motion parameters. The first 3 should be rotation in radians, the ...
282c989a34574940b02b283a560361976008a0ed4e50088b5ad42b1268fee969
MATLAB
1,495
40
function prec_apply_deform(input_fn,ref_img,y_fn) for i = 1:numel(input_fn) [filepath,name,ext] = fileparts(input_fn{i}); mask_icv = ['mask_icv_',name,ext]; mask_bg = ['mask_bg_',name,ext]; matlabbatch = {}; matlabbatch{1}.spm.util.defs.comp{1}.def = {y_fn{i}}; matlabbatch{1}.spm.util.d...
cb3a90cd3b413d37517a8bbad1083cdc02f31a6d6483f4c8133b5acbcbd88615
MATLAB
1,495
91
function loc_phys=mk_coordinates_highlevel(mnt,pars); inds=1:length(mnt.x); inds=inds(isnan(mnt.x)==0); sensors=[mnt.x(inds),mnt.y(inds)]; [ns_ori,ndim]=size(sensors); if nargin>1 if isfield(pars,'rot'); rot=pars.rot; else rot=0; end if isfield(pars,'nin'); nin=pars.nin; else nin=n...
eb54ff8f33ee79beeb0f076c35daa96f6b224fd7c09705ddd2f6028cc3470f15
MATLAB
1,495
63
clear;close all;clc; foldername='Lin24'; secv=[50,100,200,400,600]; sigma=linspace(1,100,200); y2=-100:99; x2=-100:99; [X,Y]=meshgrid(x2,y2); mainfolder=cd(foldername); for j=1:length(secv); No{j}=num2str(secv(j),'%05.f'); filename=['t=',No{j},'.png']; a=imread(filename); b1=double(a(:,:,1...
44127058b9c33c9873d914c62c51f1982a2b55bd31145c41d19ac379f55a9d3e
MATLAB
1,496
41
function B = assignToBins( A, edges ) % Quantizes A according to values in edges. % % assignToBins replaces each value in A with a value between [0,nBins] where % nBins=length(edges)-1. edges must be a vector of monotonically % increasing values. Each element v in A gets converted to a discrete % value q such that ed...
7d865dcc01329b41f5407357299de40541c99269dd77dd90ded324f80cc5a955
MATLAB
1,496
37
function [u,options,dim] = addConfounds2dcm(X0,u,options,dim) % this function modifies the i/o of DCM inversion to cope with confounds % function [u,options,dim] = addConfounds2dcm(X0,u,options,dim) % This function adds in a dummy input that indexes time, which is used in % the observation function of DCM to extract th...
f48ceeade9f5f3b8d0840cbb3542739414985d098c37465b09fd103935fd76b9
MATLAB
1,497
57
function [gotTrigger, timeStamp]=waitForTrigger(syncBoxHandle,triggerN,timeOut) % % waits for timeOut seconds for the Nth MR trigger on port % % Example usage: % waitForTrigger (syncBoxHandle, 1, 300) % % Inputs: % syncBoxHandle (handle) - handle to I/O port % triggerN % timeOut (int) % Out...
fc73edf989080c6801ae5ad77b2c9f05b6318fdb7a50442cb7d69e191075d402
MATLAB
1,497
62
% Plot stimulus-locked mean traces for all coherences - considering nans in % each trial % meanTracesSL_bigSbigT if exist('sigSL') == 0 && exist('normS') >= 1 sigSL.sig_coh = normS.sigSL.sig_coh; sigSL.t = normS.sigSL.t; elseif exist('sigSL') == 0 && exist('normS') == 0 error('No signal struc...
fde0ec2d55c11f7fae4d8547856af0564db768b589dc74d1a5341b79f21fa6fd
MATLAB
1,497
64
function TF = exists(path, dir_only) %EXISTS Returns true if the specified path exists in the filesystem. % Usage: % TF = exists(path) % TF = exists(paths) % TF = exists(_, dir_only) % % Args: % path: string path % paths: cell array of paths or scalar structure where fields are paths % dir_only: if true, re...
05b70fe500cd16cc9e94f8ea644d4c51880e7f514188bede219ccb9fb5e7b244
MATLAB
1,498
58
% 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,...
4345f381d3c56badae389c0068b1039a8c167fb9f1f7edc426fa54022a8c88e8
MATLAB
1,498
58
% 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,...
888a6117095c6b0fa51faa4ede4ae17867cb0eda875db6059d9aca0080b75de1
MATLAB
1,498
50
classdef SortedStringMap < handle % AUTHORSHIP % Primary Developer: Stephen Meehan <swmeehan@stanford.edu> % Math Lead & Secondary Developer: Connor Meehan <connor.gw.meehan@gmail.com> % Bioinformatics Lead: Wayne Moore <wmoore@stanford.edu> % Provided by the Herzenberg Lab at Stanford University % Lice...
629c3a659a40225dbb1e57722202cf5b603c815720b889d67ba9c5c9b8b67e0e
MATLAB
1,499
54
function plot_fourierp(LAN,nch,t) % <*LAN)<] % PLOT_FOURIERP do a plot of FT of the channel 'nch' and the trials 't' % plot_fourierp(LAN,'Cz') Do the mean od the electrode Cz % plot_fourierp(LAN,[ 10 11],5) Do plots of the 5th trial for the % electrodes number 10 and 11 % % v...
70230a2167c14d6bdf41c4cdd93f4b5c211e16ecc5e36d9ec9b6611ee3856690
MATLAB
1,499
44
%function converts python outputs of suite2p into mat files for any number %of planes function [] = suite2p2mat(mousefolder, nplanes) % mousefolder = the directory where the suite2p folder is found % nplanes = the number of planes in the suite2p folder for i=1:nplanes; d = [mousefolder '\suite2p\plane' num2s...
976839c591bde9a24757defa0db5a3be14403dcc01c12855b23b6ee55dced020
MATLAB
1,499
92
if ~exist('I_1'), active_images_save = active_images; ima_read_calib; active_images = active_images_save; check_active_images; end; check_active_images; if isempty(ind_read), return; end; n_col = floor(sqrt(n_ima*nx/ny)); n_row = ceil(n_ima / n_col); ker2 = 1; for ii = 1:n_col, ker2 = conv(ke...
adb4de4554e95eaaced2f50f33d680f1b2d49a0b0fd98c2da87f87953895a746
MATLAB
1,499
44
function[mean_aligned_activity, aligned_activity, cell_id] = grab_lap_activity(analysis_out, samples, measure, grab_lap, range) session_names = fieldnames(samples); initiation_id = {}; region_lap = {}; norm_region_lap = {}; idx = 1; id = []; roi = 1; frame_count = -1000:100; for session = 1: length(sessio...
b65109afbcefb993a496a1b0c72e142af3e9952ec0d292e1782be2341680a214
MATLAB
1,499
31
function [multi_event_percent multi_event_number] = calculate_multitrack_event_percentage(session_index,event_index,track_1_index,track_2_index) % for session = 1:length(session_index) multitrack_event(session) = sum(ismember(event_index(track_1_index(ismember(track_1_index,session_index{session}))),... e...
e8b96b2ee9ea5ff76147a7d2b41055f5584dd7727add94efdcbb98b3c395299e
MATLAB
1,499
58
function write_nodelm_poly2d(fn,e,p,nodemap,holes) % Writes the 2D boundary defined in e and p to .poly file format. % Note that it will create a .poly and a .node file. % holes is a cell of n by 2: % holes(:,1) : coordinaets of a point inside the region % holes(:,2) : material/attribute ID for the hole. if ~((size(e,...
f648c5ae3cf105c5cc08c89af6f4b62db1b895034577e2b7e48dc0800f5e528a
MATLAB
1,499
40
function [DM, xd] = ft_preproc_online_downsample_apply(DM, x) % function [DM, xd] = ft_preproc_online_downsample_apply(DM, x) % % Passes signal x (channels times samples) through the downsampler. % Returns updated downsample model (numSkip!) and downsampled signal. % Copyright (C) 2010, Stefan Klanke % % This file is...
84355481b16662242ebae500a5f0fc42026176f6832059e16e522ccea63c76a5
MATLAB
1,500
55
function is_same = compare_tif_images(srcDir, dstDir, avgErrTol, postfix) srcFiles = dir(fullfile(srcDir,['*', postfix, '.tif'])); dstFiles = dir(fullfile(dstDir,['*', postfix, '.tif'])); if length(srcFiles) == 0 disp('no tif file.'); is_same = false; return; end if length...
8d39653011252f6ee06c9f86de13e2f3707fe9c41f45dfea95cbdec7eaa78460
MATLAB
1,500
49
function [model, logev] = linregFitEbNetlab(X, y, pp) % Empirical Bayes linear regression using Netlab's evidence procedure % X is n*d, y is d*1 % Do not add a column of 1s % This file is from pmtk3.googlecode.com pp.addOnes = false; % netlab already does this [model.preproc, x] = preprocessorApplyToTrain(pp, X); ta...
b22a9bde2fa9849594025b51172ca31a5dfdd12fe7e26d461f555a6cd5137414
MATLAB
1,500
35
function candoit = canGetGradient(problem) % Checks whether the gradient can be computed for a problem structure. % % function candoit = canGetGradient(problem) % % Returns true if the gradient of the cost function can be computed given % the problem description, false otherwise. % % See also: canGetCost canGe...
fea56be1258c482529adbbaaa1e2c403cc2cb4d2b762eff9d93f8f89d2ce4e99
MATLAB
1,501
57
function h_zStackQuality3(handles) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); maxProjection = get(handles.maxProjectionOpt,'Value'); maxProjectionEnable = get(handles.maxProjectionOpt,'Enable'); if strcmp(maxProjectionEnable,'off') maxProjection = 2; end [xlim,yl...
13a488e2755b3f63c75f265754b335c53c8d594adf4ad3cf7efe91b278852309
MATLAB
1,502
56
function [color, eraseMode, lineWidth] = h_getColor3(synapseAnalysis) if ~(synapseAnalysis.isLast>0)%unassigned is -1 ROIType = synapseAnalysis.synapseStatus; else % if isLast has been assigned and is larger than 1. switch(synapseAnalysis.synapseStatus) case {'new'} ROIType = 'transi...
2c32deb03ab766d33855c6a09f8476baa404d4c5093acf25d6b9c24998051c8f
MATLAB
1,502
45
function [gx] = g_metaToM(x,P,u,inG) % observation function for meta-learner (k-ToM vs sequence) % function [gx] = g_metaToM(x,P,u,inF) % The meta-learner bases her decision (a=1 or a=0) upon her prediction of % her opponent's next move, given the game payoff table. The specific % difficulty of the meta-learner is that...
3719a665d07bb6e22d8e6a0e5ff2f566f98d692e46f979f62d9f072cff7751d9
MATLAB
1,502
52
function rz = getrunningpulses2(rotf,thresh,k,n,fig) % rz = getrunningpulses(rotf,thresh,k,n,fig) % This function generates pulses corresponding to running blocks. % Inputs: rotf = rotary function; thresh = the threshold for generating % pulses; k = the length of sliding window for movstd, moving standard % deviation; ...
681b8faf67e8462c0fefebd7aea79dfe2416987a234100cc657075eb32245c7e
MATLAB
1,502
41
function generateSynopsisTable(directory, outputFile, rootDir) %% Create an html table of files and one line descriptions for a directory % PMTKneedsMatlab %% % This file is from pmtk3.googlecode.com if nargin < 2, outputFile = ''; end files = filelist(directory, '*.m', true); files = files(sortidx(low...
732917f317bbf45c07c5d9cf3a979516c54a12e23e573be548fd84b41c9c5ee8
MATLAB
1,502
55
function G = filterDog2d( r, var, order, show ) % Difference of Gaussian (Dog) Filter. % % Adapted from code by Serge Belongie. Takes a "Difference of Gaussian" - % all centered on the same point but with different values for sigma. Also % serves as an approximation to an Laplacian of Gaussian (LoG) filter (if % order...
8868afb164abc7cdef9f4346670d999ea68b796fb7d17642ee68c44b78f6e3f6
MATLAB
1,502
41
function r = get_random_sites(sample_size,arena_L,arena_shape,return_as_xy_coords) % returns r with size(r) == sample_size % where each entry is a lattice site in the arena grid of shape arena_shape % each entry in r can be translated to an arena x,y-coordinate by using func.myind2sub([L,L],r,true) % if return_as_xy_co...
5444330a9043c994180ce0a42aad6d7a76f97b16afe73897685aec0e8d5f1b7d
MATLAB
1,503
39
function [rm, names] = fs_get_rm(subpath, annot_name) % Combine rh and lh .annot file % Input subpath:subject path % annot_name:annotation file name [~, label1, colortable1] = freesurfer_read_annotation([subpath '\lh.' annot_name '.annot']); [~, label2, colortable2] = freesurfer_read_annotation([subpath '\rh...
76c2d04e8c3fc47293eea8d5bd4f5eb646e13307803524819dac0f32c8160593
MATLAB
1,503
36
clear all %% %Define Parameters [opt] = ParameterOptions(); %% %Generate Pathway Amplitude & Gradient Waveform basis set %First Dictionary [PathwaySignalFirstOrder,GwaveFirstOrder,TransFirstOrder] = PathwayOperatorOrder(opt,'First'); %Second Dictionary [PathwaySignalHigherOrder,GwaveHigherOrder,TransHigherOrder] = Path...
c43a4dcc2181339098d0bab7256f6d6bdcfed618b77019b40b0909f4bc3ac6db
MATLAB
1,503
42
% normalization function success_code = normalization() loadParameters; % Removed the formal requirement for four channels. -DG 2020-09-09 %if length(params.SHIFT_CHAN_STRS) ~= 4 % disp('# of channels is not 4.') % return %end arg_list = {}; postfix_list = {}; run_num_list ...
f123b41c61e64fbd83518cd5aba88122fd84e09732476a746bf04705dec8cd9b
MATLAB
1,503
53
function [Xtrain,ytrain,Xtest,ytest] = setupMnist(varargin)%binary, Ntrain, Ntest,full) % Load mnist handwritten digit data % Optional arguments [default in brackets] % binary - if true, binarize around overall mean [false] % ntrain - [60000] % ntest - [10000] % keepSparse - if true, do not cast to double [true] % clas...
a3d3f4aa5f1b7a6b34c6641e0ef06db06560e5d6fd6a851a9be1bd043148f12f
MATLAB
1,504
72
function data = ReadChoreDatFile(filename) nparams = 7; data = []; fid = fopen(filename,'r'); if fid < 1, error('Could not open file %s for reading',filename); end ids = []; expname = ''; while true, l = fgetl(fid); if ~ischar(l), break; end if isempty(l), continue; end % first word is the ...
ed4b274e2557aff00257f1a06a6892e4a8cae82c999a1c4831b3e7751f71f2b2
MATLAB
1,504
54
function h = SuperimposeKS(data, ksArgs, yMinMax, colour, alpha) % function SuperimposeKS(data, ksArgs, yMinMax, colour, alpha) % % Superimpose a KSDensity of a distribution (e.g. RT) onto a figure. % % Inputs: % data = data to run ksdensity() on. Will convert to column first % ksArgs = cell array of arguments pa...
efe728cb08e57e888be13ff8db81f4cfd1c58bb7aa78f70f9446b001f2771104
MATLAB
1,504
32
% SOFA API - demo script % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not use this work except in compliance with the ...
20b650683823435e4d12f03b84d969634aa33c616e5c3c0b9c0d531e2375a353
MATLAB
1,505
50
%% Visualize the Projection of 3D Gaussian Ellipsoids onto the 2D Plain % %% % This file is from pmtk3.googlecode.com C = {[2 4 10] [12 0 10] [20 0 10]}; R = {[6 3 3] [3 6 3] [3 3 6]}; npoints = 25; nellipsoids = length(C); D = repmat(createStruct({'X', 'Y', 'Z'}), 1, nellipsoids); f1 = figure; hold on; colors = pmtk...
7f7c08dee9c243d407a534b59c5484d3333e7de92915b48aa7f8c91a45b0a978
MATLAB
1,505
46
function vert = forceVert(im,im_ecc,im_pol,ecc,pol,varea,area_val) %{ Occasionally, no vertices will be found when you want them to be when binary is true. This function will find the single vertex nearest the centroid of the object in the image. As of now, this assumes there is only up to a single object per hemifield...
7e2231139253d63fd1372fa55c4203b6802bfc1b62f0d326eb5f0c86566e3bcb
MATLAB
1,506
46
%% general options elec_path = fullfile(patient_path,'dipoles',strcat(patno,'_',model_name,'_', ... dipole_name,'_electrodes.mat')); %% load BEM-FMM Engine addpath(fullfile('../engines/bem_fmm_engine')); %% load skin shell skin_id = find(strcmp(tissue,'Skin')); ...
9dfef6d7344bdbc2f2a494623e8234d02aa1e440210c7d8091a860dfe259c4a0
MATLAB
1,506
47
disp("Perf and math test matlab driver for FMM3D/Stokes") disp("Source to target, stokeslet+stresslet (1-vec), vel pot only..."); % Barnett 8/4/23 clear ns = 100000; nt = 100000; eps = 1e-3; ifstrs = 1; % include stresslets? ifppreg = 0; % no eval at sources ifppregtarg = 1; % just vel out rng(0) srcinfo....
ef2eca5dc02b891802165bc536b8b91c1f954175947993db4d81f8039069e5f1
MATLAB
1,506
43
data = dir('/DATAPOOL/ERRORMONITORING/SEM_mri_data/P*'); %% sub = 1; for i = 1:size(data,1) fprintf(data(i).name); data_func = dir([data(i).folder, '/', data(i).name, '/mri/SEM_', data(i).name, '/nifti/func/run*']); data_anat = [data(i).folder, '/', data(i).name, '/mri/SEM_', data(i).name, '/n...
f266e1dfb8f6314fdd7b8478c12c134b5bac12a5895d2ad63780f20b101d0dad
MATLAB
1,506
50
function [matdif, ParElec] = difphaser3(matphase, step) % [matdif, ParElec] = difphaser3(matphase, step) % Computes the phase diferences between all the electrode pairs, provided % in a matrix of phase info. (Output of sinwave6) % % INPUT % matphase : 3D Matrix of phase information. 1D electrodes, 2D timepoin...
87b4efd618cb6dff166daa674e7f28ecd968ea19627277413c03fe6c54faa561
MATLAB
1,507
66
%% Kmeans Model Selection in 2D % %% % This file is from pmtk3.googlecode.com setSeed(0); d = 2; ncentres = 3; mix = gmm(d, ncentres, 'spherical'); mix.centres = [1 1; -1 -1; 0 0]; % mu(k,:) mix.covars = [0.1 0.1 0.1]; n = 1000; ndx = 1:n; Xtrain = gmmsamp(mix, n); n = 1000; Xtest = gmmsamp(mix, n); figure; %Ks = [...
81cc3ac4960aece54df42391747a579146f2b270fcef2e7af3271ac7243b70f4
MATLAB
1,508
41
function [tc,nodes,status]=FixPatchOrientation(p,sfaces,meshnodemap,silentflag) % [tc,nodes,status]=FixPatchOrientation(p,sfaces,meshnodemap) % Assuming the 3D shell defined by p and sfaces is a closed one, this % routine will make sure that all the facets are pointing outward. status=0; if nargin<=3 || silentflag==0 ...
a5f560111909578c3225c7ed6aec404bb7dcab8368ce09fd574ca72f02c51d39
MATLAB
1,508
43
function Output_Image_RGB=ColorMasking(Input_Image_RGB,Mask,OverlayColor) if size(Input_Image_RGB,1)~=size(Mask,1)||size(Input_Image_RGB,2)~=size(Mask,2) warning(['Input Height = ',num2str(size(Input_Image_RGB,1))]) warning(['Mask Height = ',num2str(size(Mask,1))]) warning(['Input ...
e0829ac70dd2ca39b8d135518db32ec82485671d33a19bb719e7892f43e614a3
MATLAB
1,508
48
%%Used to divide behavior into different planes for each imaging plane % Chad Heer; Sheffield lab function [] = splitplanes(behavior_file, sbxframes, nplanes, outfilename) %behavior = unsplit behavior data (output of loadbehshef) %sbxframes = vector with the number of frames for each sbx file %nplanes = number of ...
e52d5e2fd7d3712434adec61c48499999ffc68b68f6ddf992282e2b65292b10e
MATLAB
1,508
58
function [SWI, C, L] = calcSWI(W) % CALCSWI calculates the Small-World Index of a connection matrix. % % Inputs: % - W: Connection matrix (weighted or binary) % % Output: % - SWI: Small-World Index of the matrix % % References: % Neal et al., 2017 % https://www.cambridge.org/core/services/aop-cambridge-core/content...