sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
387eb9228ea0ec2c0e8e4851e734f8aa25a247e4f4815bd3d56591a29c0b786f
MATLAB
2,113
56
function [network, mappedX, reconX] = train_autoencoder(X, layers, noise, max_iter) %TRAIN_AUTOENCODER Trains an simple autoencoder % % [network, mappedX, reconX] = train_encoder(X, layers, noise, max_iter) % % Trains up an autoencoder with the structure that is specified in layers. % The low-dimensional data is ret...
89c016c96e062b0f78324bdb110f31552d5bc3243042b113d3dafad311a69c1d
MATLAB
2,113
37
clear all %% %Define default parameters [opt] = ParameterOptions(); %% %Edit parameters for power spectrum plot opt.FullWaveform=1; % Option to calculate the full waveform of each signal-forming pathway rather than the condensed dictionary. Required to synthesise the Power Spectrum plot opt.nPeriods=2; ...
a0c9b8ff3d51d98a449b8689864833d1c77a19c1be379760eb750b0eec5629b1
MATLAB
2,113
49
nConds = 4; timevector = -0.05:0.001:0.2; rgb = [0.1 0.4 0.5; 0.7, 0.4, 0.7]; labels = [{'Fast trials'}; {'Slow trials'}]; clear h f = figure('NumberTitle', 'off', 'color', [1, 1, 1], 'position', [360 50 600 400]); hold on; xlimToPlot = [-0.05 .2]; for iCond = 1: nConds meanCond{iCond} = nanmean(fr{iCo...
cdcd831636d4c683ce35523ab31b8c0956c976ca8656870fe908c69f4dd8d8de
MATLAB
2,113
65
%% This is a simple demo of Matlab's memmapfile class % Here we memory map the MNIST digit data. %% % This file is from pmtk3.googlecode.com function memoryMapDemo() if isOctave() fprintf('Sorry this demo will only work in Matlab\n'); return end %% load the mnist data [Xtrain, ytrain, Xtest, ytest] = setupMni...
473d85810dbf67b7c0f43da0b60610b3120bf918ccd2ded42cd5d0d58f0b1ad0
MATLAB
2,115
87
function [vec,r,c]=getTri(mat,lu) % getTri -- extract upper triangle componet with diagonal from matrix % % [Input] % -mat: square matrix % -lu: 'lower' or 'upper', default: get lower components % % [Output] % -vec:vector % -r:row index % -c:column index % % % % [note] % each component was ex...
64ec599db102b098e9f46821b407c7f3fad000c0b5948ea22e10b92ab5fe82ee
MATLAB
2,115
73
function orig_coord = get_orig_coord2(coord, matname,PU) % Determine corresponding co-ordinate in un-normalised image. % FORMAT orig_coord = get_orig_coord2(coord, matname,PU) % coord - [x1 y1 z1 ; x2 y2 z2 ; etc] in MNI space (mm). % matname - File containing transformation information (_sn.mat). % PU ...
6757b67f0c68ee47a96a251fb96d2b8bdd8acb068e6d108efc252fe7d18eae92
MATLAB
2,115
61
function [cost, grad] = getCostGrad(problem, x, storedb, key) % Computes the cost function and the gradient at x in one call if possible. % % function [cost, grad] = getCostGrad(problem, x) % function [cost, grad] = getCostGrad(problem, x, storedb) % function [cost, grad] = getCostGrad(problem, x, storedb, key) %...
8927a153dda390b155d1ed1a4cbc1aa1772e3d2be0718f776dce87636bbd55a4
MATLAB
2,115
79
function [mask] = image_stack_adjust_median(stack, name, volume_filtering) % TODO: optimize %load parameters parameters; Nz = length(stack(1,1,:)); for ii=1:Nz images{ii} = stack(:,:,ii); end clear stack; max3 = @(x) max(max(max(x))); %% ------------------------------ 3D matrix -----...
9bd456b80d95ed035d70fdecd65e096c9eca0f0cee8abb8d07a99e91bb2c5980
MATLAB
2,115
47
function reduced = reduceids(ids, obj) % reduiceids Reduce Imaris IDs to a fundamental numerical identifier % % Syntax % ------ % reduced = reduceids(ids) % % Description % ----------- % reduced = classifyids(ids, obj) converts the Imaris object IDs in % i...
661726d77424653811941ef549f2ddc1bae92aa70cf6332d1e0f0fa257fbd9a9
MATLAB
2,116
82
function [varargout] = VBA_spm_unvec(vX,varargin) % Unvectorise a vectorised array - a compiled routine % FORMAT [varargout] = spm_unvec(vX,varargin) % varargin - numeric, cell or structure array % vX - spm_vec(X) % % i.e. X = spm_unvec(spm_vec(X),X) % [X1,X2,...] = spm_unvec(spm_vec(X1,X2,...),X...
b5d66c2beeca676df3f8ea6ccd1e6639bf5699af30d54127f3d5c760963ac15d
MATLAB
2,116
91
% Field Trip-related test scripts - Synthetic FT data - Configuration. % % % Includes. % NOTE - Assume the parent called "init" already. % % % Configuration. % % Event detection. % Select the parameter extraction algorithm we want. % "coarse" gives a poor fit, "amp" takes a while but gives a good fit, and % "...
d0a411b29d994bfe4d7e86776aa0d7513ab27c1d03eeb5816406e074a78a699a
MATLAB
2,116
47
% classdef CBIG_MFMem_rfMRI_estimation_main_ut_test < matlab.unittest.TestCase % % Written by Xiaolu Kong and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md % % % methods (Test) % % function Test_Estimation(testCase) % %% path setti...
f47d7c29ed3d8b4493e5d32499804de72ea1cfb48d4c0ff50a724d391fee1634
MATLAB
2,116
60
function ztabledat = afxConnNetwork(yRoi,lesioned,rois,outPrefix,subject) % calculation of functional connectivity fprintf(' Calculating network functional connectivity ... ') % calculate correlation coefficients and apply fisher transformation rhoFisher = atanh(corrcoef(yRoi)); % write...
8a4aa7a2ed514b4556d9da774b390da7a1d1b6348a7e92f12ec6fd96ddcd161e
MATLAB
2,117
67
function res = innerprod(X,Y) %INNERPROD Efficient inner product with a ttensor. % % R = INNERPROD(X,Y) efficiently computes the inner product between % two tensors X and Y. If Y is a tensor or sptensor, the inner % product is computed directly and the computational complexity % is... If Y is a ktensor, the i...
b426cfc03736605dd2be1be9ffd14de970fbbcebac1c8265b832755023e66a89
MATLAB
2,117
45
function unitnormals = meshnormals(P, t) % SYNTAX % unitnormals = meshnormals(P, t) % DESCRIPTION % For a manifold mesh P, t, this function returns an array of outer % normal vectors for each triangle % Inputs: % P - Vertex array of the mesh (N x 3) % t - Facets of the mesh (N x 3) % Output: % unitn...
d62f5178e0b19fa6e4b4ba84e1529590b13250d319d383bed592e597f4adffd5
MATLAB
2,117
86
% [mu,S,priors,post,nll,mix] = mygmm(X,k,...) % Input: % X: N x D matrix of N D-dimensional data points % k: number of clusters % optional: % 'Replicates' = 1 % 'CovarType' = 'full' % 'display' = -1 % 'precision' = .0001 % 'ResetCovar' = 1 % 'MaxIters' = 100 % 'Start' = 'furthestfirst' % 'distance' = 'sqEuclidean' % 'w...
6cb09986241488effff65ce6f34bca2402596c0e2246740319ba29481e84fb73
MATLAB
2,119
53
function [b,bPath1] = bHistogramOrderFull(PathwaySignal,GwaveOrder,bWeights,bWeightsPos,bLong,b,Loss,GwaveBlock,dt,gamma,bRound) %% %Estimate ratio of Longitudinal scaling Gwave=GwaveEstimate([1,-2],GwaveBlock); bPath1=sum(cumsum(gamma*Gwave*dt).^2)*dt; Gwave=GwaveEstimate([1,-3],GwaveBlock); bPath2=sum(cumsum(gamm...
2d2d17f979f93c66cdbe50208cfd8c060f6ec4481881e928233f460bdafa6e3a
MATLAB
2,120
67
function [CC_arterial] = extract_arterial_CC_PET(CC, dim_TOF_c, dynIDIF) CC_arterial = CC; numPixels = cellfun(@numel,CC_arterial.PixelIdxList); [biggest,idx] = sort(numPixels, 'descend'); CC_arterial.PixelIdxList = CC_arterial.PixelIdxList(idx); % Tolgo le componenti connesse che sono piccole to_remove = ...
e7b44783cff141eec388f07be507612a2ed0612b3d59e124d606de62ac3e664b
MATLAB
2,121
86
function D = tridiag(A, B, C, useSparse) % Make a tri-diagonal matrix from a matrix or from 3 vectors % % D = tridiag(A) sets all elements of A outside the tridiagonal to 0 % If A is sparse, D will also be sparse. % % D = tridiag(main, upper, lower) constructs a matrix with these % vectors on the diagonal and just abo...
0085677ace4592325744f2cfe4e00c995811b928d7fdff835d836812b5183cdc
MATLAB
2,122
63
%% Classify the MNIST digits using a one nearest neighbour classifier and Euclidean distance % See mnistKNNdeno for a simple minded implemenation. % This demo uses various tricks to scale the method up to large % data sets. %% % PMTKslow %% % This file is from pmtk3.googlecode.com loadData('mnistAll'); if 0 % test ...
08f82ac8c2b39db66ee2eb7b14d8726c4a885c323060875443332d8e78c209bf
MATLAB
2,122
62
% Band power Plot Fig. 1G,1H % Edited by Jerry. 10/27/2023 function [datamean,datastd] = BandPowerPlot_231027... (BPinput,Title,Yname,Yrange,figsize,SaveDir,alpha,ErrType) % fig setup hFig = SetupFigure_220724(figsize); colors = [10,139,148;130,10,40;134,179,82;242,110,48;... 177,224,123;232,21...
0d2c3973f93485494af106fea12e2eedbb92e16d8776dfe46be2da78868773b7
MATLAB
2,122
58
% time-frequency toolbox for matlab % written by F. Auger, P. Flandrin, P. Goncalves, O. Lemoine, % 1996 - 1999, GdR-PRC ISIS, CNRS, France. % % signal generation functions: % amexpo1s, amexpo2s, amgauss, amrect, amtriang % fmconst, fmhyp, fmlin, fmodany, fmpar, fmpower, fmsin, gdpower % altes, anaask, anafsk, anabp...
bd14d0815470a33d78572c933bcd53dd07f2f3df10ac2135072174f99d5b2d1a
MATLAB
2,122
68
% Script for testing the string array feature of SOFA %% Test Strings as application-specific variable % Load some arbritrary HRTFs hrtf = SOFAload(fullfile(SOFAdbPath, 'database','ari','dtf_nh2.sofa')); % Add a string array str={}; for ii=1:hrtf.API.M str{ii,1}=['String' num2str(round(rand(1,1)*10000))]; end % SOF...
e8dd2fa9bb75b44663909a2d994cd3daad6cff38ab6298d4aa78fec423459156
MATLAB
2,123
65
%% Test amplitude of stimulus on various aspects of ionic currents in % ToR-ORd+Land electro-mechanical model %% Setting parameters clear clc close all param.bcl = 800; % basic cycle length in ms param.model = @model_ToRORd_Land; % which model is to be used param.verbose = true; % printing numbers of beats simulated...
36e2e02430ab0423ac7c8662ce6e3d65bd5b9d1eb2a9b783a98fd62c0a1883d0
MATLAB
2,124
100
% cor_freq_lan.m % v1.0 % % calcula la estadistica de las correlaciones, y grafica % de cada individuo. % % 22.11.2009 % Pablo Billeke % function [ bs,mbs,p,hc] = cor_freq_lan(LAN,e) % for com = 1:length(LAN{1}.freq.cfg.corfr1) if iscell(LAN) disp('Chequeando estructura LAN') else warning('Solo para LAN con...
8a8336740a27b32506849a325be8d04d69f676da60837a5f06c19d6d23180b93
MATLAB
2,124
75
function [whtM, H] = doMMGPCA(X, comps, rec_type) M = 1:length(X); N = size(X{1},2); V = cellfun(@(x) size(x,1), X); outs = cell(size(X)); cvx = zeros(N); for mm = M cvx_ = cov(X{mm}); cvx = cvx + cvx_./(length(M)*trace(cvx_)/N); end % [V,ll] = eig(cvx); % ll = diag(ll); % ll = ll(end:-1:1); % Subject-le...
3c5e0cfc085423af6f734fa16b2271c50b29a4a6fdbcd32620f428b81944fce0
MATLAB
2,125
86
%% genvar % % Generate VAR time series data % % <matlab:open('genvar.m') code> % %% Syntax % % [X,E] = genvar(A,E,trunc) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % A VAR coefficients matrix % E residuals (single-trial) time seri...
8da56bc5cffd1557aed80b942eadf441e17c864417418e89d2e375debfeb054e
MATLAB
2,126
65
function redbluegraphs(x_var,y_var,y_var2) x=x_var y=y_var yred=y_var2 % first graph (blue) N = size(y,1); % Number of ‘Experiments’ In Data Set yMean = mean(y); % Mean Of All Experiments At Each Value Of ‘x’ ySEM = std(y)/sqrt(N); ...
bf9988a127538a64a0a63340332c7e7086fb8bf2a18de50073ccf6695a05da29
MATLAB
2,126
36
function [netMat_betas] = multregressionconnectivity(activityMatrix) %[netMat_betas] = multregressionconnectivity(activityMatrix) % %This function computes multiple regression-based functional connectivity. This is equivalent to running a general linear model (GLM) separately for each region, with all other regions' t...
a8346b16eff12a766c5decbe166141f9897c8f388d02ff407a768be76887b570
MATLAB
2,127
52
% 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 ...
3c4868768b0eddb9f46dc8979ebd89942ea84785f3c5036c3bac85a2b39a38e1
MATLAB
2,128
79
function [R2_cv,mP,VP,R2] = PRESS_GLM(X,y,verbose) % evaluates the PRESS-R2 cross-valuidation metric for a GLM % function [R2_cv,mP,VP,R2] = PRESS_GLM(X,y,verbose) % This function evaluates a prediction accuracy metric (PRESS-R2), in the % context of a leave-one-out cross-validation scheme for a GLM. Note: it is % base...
6bfc3a3c2fdc8b795c8d54870327549f97ae4417f1d8aba93d5e706b5af33809
MATLAB
2,128
53
function dispMatrixIm( M, varargin ) % Display a Matrix with non-negative entries in image form. % % USAGE % dispMatrixIm( M, [varargin] ) % % INPUTS % M - [m x n] arbitrary matrix with non-negative entries % varargin - additional params (struct or name/value pairs) % .fStr - ['%1.2f'] format for ...
70d51407a178cbc1cf2249fcac47b2efba41ce7f95fd68abef020e2741956357
MATLAB
2,128
76
%% Compare SVM, RV and kernelized logreg on synthetic 2 class data in 2d % This file is from pmtk3.googlecode.com %% Load Data % Load synthetic data generated from a mixture of 2 Gaussians. Source: % http://research.microsoft.com/~cmbishop/PRML/webdatasets/datasets.htm % % See also hastieSvmLrDemo loadData('bishop...
7ebe14b632d03e32e0035daad6e787180557306191e3acd6978d9ecc0f1903be
MATLAB
2,128
57
function [stg1net, stg2net] = get_custom_two_stage_tracker_nets_ui(mainFigure, stg1nets, stg2nets) stg1net = []; stg2net = []; stg1nets_str = cell(1, numel(stg1nets)) ; for ndx = 1:numel(stg1nets) stg1nets_str{ndx} = stg1nets(ndx).displayString; end stg2nets_str = cell(1, numel(stg2nets)) ; for ndx = ...
9ba7d3eadebc14ecb7157886d5a4b80d36aa614a53a257566e01cfb2e7eb9e96
MATLAB
2,128
64
function FigurePooler(FigDir,FigName,dc,PooledFormat,PoolingDir,SubDir) [upperPath, deepestFolder] = fileparts(FigDir); if SubDir if strcmp(PoolingDir(length(PoolingDir)),dc) PoolingDir=[PoolingDir,deepestFolder]; else PoolingDir=[PoolingDir,dc,deepestFolder]; ...
a70c2a7b1fc25c4f4a8f1ff60591f8914b02cec668e1d5596448cf07c28bc909
MATLAB
2,128
48
%% Compute the amplitude envelope correlation as defined in Hipp et al. 2012 Nature Neuroscience % % input: - virtChan_timeSeries: cell array of EEG time series, each cell % should represent a single epoch/trial % output: - connMatrix: s x s x e matrix, containing the connectivity % matrices f...
60c8e4177b74f4623a5d15c9911f4ea9363b2e45480feb2fa65f7db4f866f8b2
MATLAB
2,129
94
%% demo of spectral clustering %PMTKauthor Wei-Lwun Lu function spectralClusteringDemo() setSeed(0); datatypes = {'circle', 'spiral'}; for i=1:numel(datatypes) switch datatypes{i} case 'circle' data = sample_circle(2); case 'spiral' data = sample_spiral(); end % Kmeans [centers, mincen...
c407496b1d30255527a1d0640e45185d08fb8b2aa88c598bdc451e30209bdd4b
MATLAB
2,129
109
function [A,B,C,D,dim] = VBA_dcmMatrices(options,theta) % [A,B,C,D,dim] = VBA_dcmMatrices(out,theta) % DCM parameters are often given in a vector form (like as the output of a % model inversion usin VBA_NLStateSpaceModel) that is harder to read than % the original matrix form. % This function helps reconstructing all t...
1009ddf82b6a9edb51bd72337bd15594949f7ceffd05972898a5d4fbd2046a0c
MATLAB
2,130
70
function [mask info] = GetImageStack(filename,param) % Tries to read all the 2D image files whose file name is 'filename' plus % an incremental numbering. Also it can read an image stack from Meta % It returns a 3D matrix of 'int16' type. % If param.pad is non-zero, it will add zero padding to four sides of each % 2D i...
96d85a2c9d9ddcaa3391958433ec3e6322686e48840e81c2befe7663df48f92d
MATLAB
2,131
74
% Example of 3D non-rigid registration % using steepest gradient optimizer and grid refinement. % clean clear all; close all; clc; % Add all function paths addpaths % Get the volume data [I1,I2]=get_example_data; % Show the volume data showcs3(I1); showcs3(I2); % Start b-spline grid dimensions (in ...
ce6170bbfdce8ad8ec3120f90fcdb7656a6e0d4e7383b65959875fe303380ccf
MATLAB
2,131
71
function d = computeCohen_d(x1, x2, varargin) % % call: d = computeCohen_d(x1, x2, varargin) % % EFFECT SIZE of the difference between the two % means of two samples, x1 and x2 (that are vectors), % computed as "Cohen's d". % % If x1 and x2 can be either two independent or paired % samples, and should be treated...
b2b5629b386a366c41e8fa79f52c9991a074d95c29ae4fb07a1cd9053a2f67e1
MATLAB
2,132
67
clear all; %load ../phi/phi_0_25_1089.mat %Load the measurement matrix for measurement rate of 0.25 to sense patches of 33 by 33. load ../phi/phi_0_04_1089.mat %Load the measurement matrix for measurement rate of 0.04 to sense patches of 33 by 33. %load ../phi/phi_0_10_1089.mat %Load the measurement matrix for measurem...
6fa13b2ac68653c76ffea549a991da8d2b346334062d971b67748075f397a568
MATLAB
2,133
64
function CBIG_RL2017_Figure7_toy_ex_bi_vs_multi % CBIG_RL2017_Figure7_toy_ex_bi_vs_multi % % This code illustrates the difference between multivariate and bivariate % approaches to generate surrogate time series. The multivariate approach % consists in identifying a single multivariate AR model of the original time ...
878d12222ee5fce821f32be9233c43a5dadfd185c1989a4017a1306fb51da696
MATLAB
2,133
70
function decVec = decode_success(data,winsize,stepsize,prctokeep) %% test %close all %T=969; %sig=zscore(cumsum(randn(T,18))); %data=0.5*randn(T,18,32)+repmat(sig,1,1,32); %winsize=25; %stepsize=25; %prctokeep=1; % % data is in format time x space x subjects % winsize is a number of length of windo...
d0473714a63293eb74241995f0c2ac20af34cb2ecc2ac34ec34753256b2e5a2e
MATLAB
2,133
58
function [corr, avg_corr_sorted, I] = CBIG_ASDf_computeCorrBetweenRuns(inputDir, k) % [corr, avg_corr_sorted, I] = CBIG_ASDf_computeCorrBetweenRuns(inputDir, k) % % This function computes pair-wise correlation between each run (random % initialization). In addition, for reach run, it computes the average correlation %...
3b2fc115864db1f3b98f0495581c9f8cfc06f0fddb51ef7faf72799d081f6b62
MATLAB
2,135
88
function [nnmf_res,ss] = run_nnmf( S, niterations, summary_plot ) % function [nnmf_res,ss] = run_nnmf( S, niters, summary_plot ) % % if nargin < 3 || isempty( summary_plot ) summary_plot = false; end if nargin < 2 || isempty( niterations ) niterations = 10; end if summary_plot == true && niterations > 10 ...
a1cd632eb2525c7f07c5043d7cf249da24f109ba61c11675d2f491b52d38865d
MATLAB
2,135
57
% Adds freqbands to existing master table % Load required toolboxes addpath C:\code\spm12 addpath C:\Users\ICN_guest\Charité - Universitätsmedizin Berlin\Interventional Cognitive Neuromodulation - PROJECT ECoG Atlas Connectomics (1)\functions; addpath C:\code\wjn_toolbox spm('defaults','eeg') % Load required variable...
5ff1eeb8fd47155933667ff2352fcf8db8806f3d74486162d1d9274d39fed550
MATLAB
2,136
57
function loc_list_two_channel(data,scatter_size,scatter_num) global Int if length(data)~=2 msgbox('Number of files selected should be equal to 2') else figure() set(gcf,'name','Montage Plot','NumberTitle','off','color',[0.1,0.1,0.1],'units','normalized','position',[0.15 0.2 0.7 0.6],'menubar','non...
cd7878ef6e149243da6f8e1532e3009ebddd8349e7b6d01bdc528291f0dc9abf
MATLAB
2,136
77
%% Naive bayes classifier applied to text data (bag of words) % %% % This file is from pmtk3.googlecode.com %% Load data if 1 loadData('XwindowsDocData'); % 900x600, 2 classes Xwindows vs MSwindows Xtrain = xtrain; Xtest = xtest; else loadData('20news_w100') % 16242x100, 4 classes X = shuffleRows(doc...
18b02b6c8cacddbd06503bac7c14b22f141adec909ea5103728a80890d0eb9e7
MATLAB
2,137
79
%% Impute missing entries of the 4d Pima Indians data using an MVN %PMTKauthor Cody Severinski %% % This file is from pmtk3.googlecode.com setSeed(0); D = loadData('pimatr'); pima = D.data; pima = pima(:,3:6); pimaNan = pima; [n,p] = size(pima); probMissing = 0.3; miss = unifrndPMTK(0,1,size(pima)); miss(miss < p...
3348678334288e553e94f3d9c8c41fab3d761f924d397c11adff47e237b48f75
MATLAB
2,137
75
function [recall, precision, th, averagePrecision] = precisionRecallPMTK(confidence, testClass, col) % Plot precision-recall curve % [recall, precision, th, averagePrecision] = precisionRecall(confidence, testClass, col) % % Input % confidence: score of the classifier % testclass: 1 = inlier, 0 = outlier % ...
0ea351239f07361806d8c772ecc3407849ded1830e84c7999497b4e4698fb334
MATLAB
2,138
50
function compute_graph_measures(params,bidsID,freqBand,connMeasure) try load(fullfile(params.ConnectivityPath,[bidsID '_' connMeasure '_' freqBand '.mat']),'connMatrix'); catch error(['Connectivity matrix ' bidsID '_' connMeasure '_' freqBand ' could not be loaded']); end % Threshold the connectivity matrix d...
3be130b0e7af6f39d2bf14dd168a7d0ea290d9c8405a3da96a899cf4e672d491
MATLAB
2,138
71
function [h] = fdr(p, q) % FDR false discovery rate % % Use as % h = fdr(p, q) % % This implements % Genovese CR, Lazar NA, Nichols T. % Thresholding of statistical maps in functional neuroimaging using the false discovery rate. % Neuroimage. 2002 Apr;15(4):870-8. % % There are two types of FDR correction (Ben...
6b6f60fd200983bbe4e54089da1b76fae6e66b0d2eceaff7f1d91fad1d3c622c
MATLAB
2,138
94
% Anisotropically diffuse the calibration image % to enhance the corner detection fprintf(1,'Anisotropic diffusion of the images for corner enhancement (the images have to be loaded in memory)\n'); ker = [1/4 1/2 1/4]; ker2 = conv2(ker,ker); ker2 = conv2(ker2,ker); ker2 = conv2(ker2,ker); if ~exist(['I_' num2str...
3b03aecf082f6cc42c186256f4e07640f18bd03ec1248f380af4a84ed0212a9a
MATLAB
2,139
62
function unit = ft_estimate_units(size) % FT_ESTIMATE_UNITS tries to determine the units of a geometrical object by % looking at its size and by relating this to the approximate size of the % human head according to the following table: % from 0.050 to 0.500 -> meter % from 0.500 to 5.000 -> decimeter % fr...
61c988f4ae3d644dfe87d2a36717e7779324439a1a055cda2ef70e89e1acbb1c
MATLAB
2,140
59
function [X,keeplocs] = subsampleMatrix( X, maxMegs ) % Samples elements of X so result uses at most maxMegs megabytes of memory. % % If X is m+1 dimensional, say of size [d1 x d2 x...x dm x n], each [d1 x % d2 x...x dm] element is treated as one observation, and X is treated as % having n such observations. The subsa...
6e253b3cf0d085ab54a7959568ab46fa1e2762a17ca7610894823f368b302098
MATLAB
2,140
73
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef BlockVectorSampleType < uint16 %SampleType Encoding of the type of samples stored by a block vector % % Short: Signed 16-bit numbers (little-endian) % % Int: Signed 32-b...
84f273adcf17cb9ad89d857e3481e94c670e01bb6f046d7b2395a5fb05b03e18
MATLAB
2,140
75
function th=rotateticklabel(h,rot,demo) %ROTATETICKLABEL rotates tick labels % TH=ROTATETICKLABEL(H,ROT) is the calling form where H is a handle to % the axis that contains the XTickLabels that are to be rotated. ROT is % an optional parameter that specifies the angle of rotation. The default % angle is 90. TH ...
fe4e7caba63c963f93d87f3f0aa7e3522adf389ed3bffb078f6d8452e30d0b85
MATLAB
2,140
68
function Image_Crop=SmartCrop_withFill(Image,Crop_XCoords,Crop_YCoords,FillValue) % % Image=UltraHighRes_Contrasted_Color_Merge_ROI_Overlay; % Crop_XCoords=[-100,3000] % Crop_YCoords=[-400,2700] % FillValue=[0.5,0.5,0.5] Crop_XCoords=round(Crop_XCoords); Crop_YCoords=round(Crop_YCoords); ...
37cb08d69f3296855e947c7d60a34bb5dc8e66a2135981e6b19edd2e203f6797
MATLAB
2,141
70
function model = crf2Train(model, Xnode, Xedge, y, varargin) % Fit pairwise CRF using ML/MAP estimation with L2 prior % model = crfTrain(model, y, Xn, Xe) % y is Ncases*Nnodes (y(i,n) in 1..nStates(n)) % Xn is Ncases*NnodeFeatures*Nnodes % Xe is Ncases*NedgeFeatures*Nedges % % Optional parameters: % loss : one of % ...
b72d563116130c88fe997be8fd582820aa8bef6363c9a737785b8600acbea40f
MATLAB
2,141
58
clear;clc % dataPaths{1} = 'D:\InVivo\Shank-Only\2022-05-13_Shank-Only-UCLA\'; dataPaths{1} = 'D:\InVivo\Shank-Only\2022-05-29_Shank-Only-UCLA\'; dataPaths{2} = 'D:\InVivo\Shank-Only\2022-05-31_Shank-Only-UCLA\'; dataPaths{3} = 'D:\InVivo\S1-Opto\2023-01-27_SoCoChR2-S1_Mouse2\6-whisker_230127_150002\'; topElec...
d408d3d677075cf2fe85a2bb1f4f39754a5d26fc5b6c357f4bbcc7f69d71df32
MATLAB
2,141
72
classdef TargetSetVariable < TargetSet properties prettyString prettyCompactString % fcn with sig iTgts = fcn(labeler,mIdx). getTargetIndicesHook id % id for testing for special cases end methods function obj = TargetSetVariable(ps,pcs,fcn,id) obj.prettyString = ps; obj.pret...
d733f35c536ad4ab81c815dad8de8efbf378ab917e0b9186af77ca23d8ac80a6
MATLAB
2,141
98
%% Optimization in high dimensions using minFunc % PMTKslow %% % This file is from pmtk3.googlecode.com function demoMinfuncHighdim() %methods = {'sd', 'cg', 'bb'}; methods = {'sd', 'cg', 'bb', 'newton', 'newtoncg', 'bfgs', 'lbfgs'}; %methods = {'sd', 'cg', 'bb', 'newton', 'newtoncg', 'bfgs', 'lbfgs', 'newton0', ...
087626454e738fda3bada8bf2fb2d649f97ce7adc1bcd6a38e9d0a251264b325
MATLAB
2,142
1
% TSdisplay DISPLAYS 2-COL TSDATA WITH EVENT CODE NAMES AND LINE NUMBERS % This function takes TSdata and displays it in the command window with % additional columns containing row #'s and the event code names, which % are found using the currently loaded event code set. % % Example output: % Row #: Time: ...
03ae72308ba417c46f53b7b8d4b06f7d11e69ec0bf21f4271949d9deaf8fbbf2
MATLAB
2,143
61
%% Normalize PDF Columns to Unity % Common Macro for normalization % % Treat column vectors as discretely (and homogenously) sampled probability % distribution functions. Elementwise division of each element by the sum % of its column. % % Because p(x) cannot equal zero, handle negative values of columns either...
1ede4ab9fb01e4b267748b3f6fbe52132761c258c18fb23b8aae2b6d955cb7fb
MATLAB
2,143
99
function [ newftdata chandefs ] = wlFT_getChanSubset(oldftdata, chanlist) % function [ newftdata chandefs ] = wlFT_getChanSubset(oldftdata, chanlist) % % This function extracts a subset of channels from within a Field Trip data % structure. Channels are selected by name (matching names in the "label" % cell array). % ...
375731ebd195aff740b91f1fe568dcc34416081dff0b3868c923d44daea6f479
MATLAB
2,143
89
function CBIG_MFMem_rfMRI_run_1000_simulation_testGrp_resLow_example(save_dir_input,FCSC_file_name,parameter_file_name) %-------------------------------------------------------------------------- % CBIG_MFMem_rfMRI_run_1000_simulation_testGrp_resLow % % Input parameters: % % save_dir_input: Output file directory...
dd46cdc58322b2c286cb4e12e3f2ede1c9df3c742e83be618996e884dc803363
MATLAB
2,143
117
% crabsort.common % class that defines the common % object type % % the common object stores information % that is common to all files in a given data set % for example, the names of the channels % classdef common properties y_scales double delays data_channel_names cell show_hide_channels logical chann...
31d43543869054a42ee23f3cebc4621a3418585d37ea5bf284816adbb15e0844
MATLAB
2,144
85
% 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,...
64b071cf5ae13075ea27170ac8add8ad155663f538d9fd8a851f23828a1216a5
MATLAB
2,145
88
function [model, L, Lhist] = linregFitEbChen(X, Y, pp, varargin) % Evidence procedure (Empirical Bayes) for linear regression % PMTKauthor Tao Chen % PMTKurl http://www3.ntu.edu.sg/home/chentao/software.htm % It estimates alpha (scalar) and beta % L is log marginal likelihood % gamma is effective number of paramers % ...
65100d76e2431a8bdb041c6345a8ed150df2d9623ff34fe45d3e8db343581958
MATLAB
2,145
64
% demo for binary data classification % This script first simulates binary data (y) under a simple logistic-like % model, i.e.: p(y=1) = sigmoid(X*b), where X is a feature matrix, and b % are arbitrary weights. VBA's classifier is then applied to the simulated % data, and performance is evaluated. In particular, cross-...
8f170f61132ea652a06584817a2dca230476dc4ea2fe35bcfac19bdcf1d88835
MATLAB
2,145
49
function circular_arrow(figHandle, radius, center, arrow_angle, angle, colour, linewidth, arrowhead_angle) arrow_angle = arrow_angle*(pi/180); angle = angle*(pi/180); arrowhead_angle = arrowhead_angle*(pi/180); th = arrow_angle:angle/100:arrow_angle+angle; x = center(1); y = center(2); r = radius; xunit = r * cos(t...
bd899e8fd026d39dd45fc7f2815f984f05c66c5350ef6c262fac6bda56c83fcc
MATLAB
2,145
81
function [hEllipse,X,Y] = ellipsearcdraw(theta0,theta1,a,b,x0,y0,phi,lineStyle) %ELLIPSEDRAW can draw an arbitrary ellipse with given parameters. % The properties of that ellipse plot can be customized % by setting the ellipse handle. % % hEllipse = ellipsearcdraw(theta0,theta1,a,b,x0,y0,phi,lineStyle) % % ...
db711ceab43a4eda81ebd995f8474c816c56cc7654c1175c3c9508052162ffc9
MATLAB
2,145
61
function colorcorrection_3DWholeImage(roundnum) loadParameters; if params.DO_DOWNSAMPLE FILEROOT_NAME = sprintf('%s-downsample',params.FILE_BASENAME); else FILEROOT_NAME = sprintf('%s',params.FILE_BASENAME); end DIRECTORY = params.deconvolutionImagesDir; OUTPUTDIR = params.colorCorrectionImagesDir; if exis...
0831e83b3ffd051ff96cd4782d1909779101a56dc391e72c0d7b44a88c74171d
MATLAB
2,146
48
%-------------------------------------------------------------------------- % Title: Multi-Layer feature extraction using sparse representation % Author: [Behrang Fazli Besheli] % Email: FazliBesheli.Behrang@mayo.edu % Institution: [Mayo Clinic, Department of Neurosurgery] % Date: [09/07/2024] %------------------...
1895d86d67c8aafd153e14b7d6f489e204672584b28bdcb73ba4f9b65875e02b
MATLAB
2,146
84
function u = nvecs(X,n,r,opts) %NVECS Compute the leading mode-n vectors for a ttensor. % % U = NVECS(X,n,r) computes the r leading eigenvalues of Xn*Xn' % (where Xn is the mode-n matricization of X), which provides % information about the mode-n fibers. In two-dimensions, the r % leading mode-1 vectors are the...
531e4b94cbe6e25cbefb8759c77191b13d5a7ae3ef6c896fb6de8effc5c736d5
MATLAB
2,146
70
function a = appcoef2_gpu(c,s,varargin) %APPCOEF2 Extract 2-D approximation coefficients. % APPCOEF2 computes the approximation coefficients of a % two-dimensional signal. % % A = APPCOEF2(C,S,'wname',N) computes the approximation % coefficients at level N using the wavelet decomposition % structure [C,S] (se...
7b3be85475b1a882613154e5dcd0e37568714384e57378abef0d3dd46d3d4f7e
MATLAB
2,146
80
function contrasts = staircaseAdjustmentContrastTargetsDprime(pedestal, contrasts, trialacc, trialcatch, faweight) % % function staircaseAdjustment(contrasts, discrims) % % contrast is [low-contrast(decrement) high-contrast(increment)] % discrim is [valid-discrim-targetType1(decrement) % valid-discrim-targetType2(incre...
2212d6e70a4a08adb96c063762022410c42b5a1f3daf7c4e7fa4edab611ba664
MATLAB
2,147
50
function Rsqf = sufTrialRsq( trialCounts, prs) % sufTrialRsq computes a measure of trial-to-trial consistency (R-squared) % across different stimulus combinations. % % Inputs: % trialCounts - A matrix of spike counts, where each row corresponds to a % cell and each column corresponds to a stimulus ...
417a4ce055ae18fdfff7fee8dfd307edb954da1c0efe8d7f7f2dd96c21ccc59f
MATLAB
2,147
59
clear all clc % Define methods and their counts for machine and deep learning methods methods = {'Transfer Learning', 'CNN', 'Autoencoders', 'GANs', ... 'U-Net', 'SegNet', 'LSTM', 'Feature Fusion', 'SVM'}; counts = [12, 10, 3, 2, 2, 1, 1, 1, 1]; % Sort counts and methods [sortedCounts, sortedIdx] ...
67e3aff46e776766cfb876a05851f16981c58eb458eaf06e6f681c7428a1c200
MATLAB
2,147
48
function [dat] = ft_trialfun_example2(cfg) % FT_TRIALFUN_EXAMPLE2 is an example trial function that detects muscle % activity in an EMG channel and defines variable length trials from the % EMG onset up to the EMG offset. % % You would use this function as follows % cfg = []; % cfg.dataset = string...
a2baf5080123275eb9417e5c65576a9eea602ecd4d72f46daf85ae56e152c695
MATLAB
2,147
62
% RSKELF_PARTIAL_SV Solve using partial recursive skeletonization % factorization. % % Like RSKELF_SV but using a user-supplied function of the form % Y = SVFUN(X,TRANS) to apply the inverse of the compressed skeleton % submatrix. More specifically, denote by A the original matrix, and let ...
ddf5c90a724b40f9080fe9594428458329d65279cf4114a09fe329d57d1ce244
MATLAB
2,147
54
% From Yair Altman's findjobj utility (www.undocumentedmatlab.com) function [jRootPane,contentSize] = getRootPanel(hFig) try contentSize = [0,0]; % initialize jRootPane = hFig; figName = get(hFig,'name'); if strcmpi(get(hFig,'number'),'on') figName = regexprep(['Figure '...
e080e2a7abe1aee793f77b0459213c1f400e150aaf391e87258c9cbffa455290
MATLAB
2,147
82
function T = dirfiltersparse( I, C, Nx, Ny, Nz, F ) % DIRFILTERSPARSE Applies a directional filter over a scalar field in sparse mode % INPUT: % I - Intput tomogram (scalar field where foreground is bright) % C - Coordinates of the sparse mask % Ni - Corrdinate i of the scalar field (normalized) f...
053d233addb18ffa188d0db8b515821074b37aac6ed437c44ab1c0620a66253a
MATLAB
2,148
157
function [d_shap,f_shap,d_shap_se,f_shap_se] = get_neural_slope(rat_name) rat=rat_name(2:end); rat=str2double(rat); res=2; dur=66; load data/combined_kernels.mat %%% (generated by combine_neural_kernels.m) data=data_all_trials; data.centers=-1:res/100:2; vecx=0.01:0.02:dur/100; data.vecx=vecx; load data/r...
51e3bd8191d460da99c34876059e290c2b36c540832e15094dec9c0c997e04e2
MATLAB
2,148
76
function [stamps, f] = fmf_read_timestamps( filename, f_start, nframes, incr, show_progress ) % [stamps, f] = fmf_read_timestamps( filename, f_start, nframes, incr, show_progress ) % % reads FlyMovieFormat data from FILENAME % % starts with frame F_START (1-based) [defaults to 1], reads NFRAMES [defaults to inf] ...
5969f21f9c80b50e930b5bba537ae6fee088586512c73ec8dc9ca9ed11f78d3c
MATLAB
2,148
48
function [dat] = ft_trialfun_example2(cfg) % FT_TRIALFUN_EXAMPLE2 is an example trial function that detects muscle % activity in an EMG channel and defines variable length trials from the % EMG onset up to the EMG offset. % % You would use this function as follows % cfg = []; % cfg.dataset = string...
11d710ae2df3690a71c9fea47c54859452fe6b988a82f323b6c09333ba1a7289
MATLAB
2,149
66
function [mu, assign, errHist] = kmeansFit(X, K, varargin) % Hard cluster data using kmeans. % %% Inputs % % X ... X(i, :) the ith data case % K ... the number of clusters to fit %% Outputs % % mu ... mu(:, k) is the k'th center % assign ... assign(i) is the cluster to which data p...
17725a8c6528f999427615411f1f7fefc4355ba3ad7cf9258b117bc14678afca
MATLAB
2,149
65
function [vol] = read_ctf_hdm(filename) % READ_CTF_HDM reads the head volume conductor model from a *.hdm file % % vol = read_ctf_hdm(filename) % Copyright (C) 2003, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free...
38b45a22e3c08d2f3970536dbf7fc49d20c7ba9384240f9c45d72f56b90f22ed
MATLAB
2,149
74
%% Compute 3d tracking addpath netlab expdir = '/home/mayank/work/PoseEstimationData/Stephen/fly219/fly219_trial1/'; savefile = fullfile(expdir,'Out_3d.mat'); fvidfile = fullfile(expdir,'C002H001S0001','C002H001S0001_c.avi'); svidfile = fullfile(expdir,'C001H001S0001','C001H001S0001_c.avi'); fmat = fullfile(expdir,'C0...
8515617a5059955db9a80491a377dd96d5116766cdee352287d05573e4facce4
MATLAB
2,149
77
function [posterior, out] = demo_stochasticModel () % // VBA toolbox ////////////////////////////////////////////////////////// % % [posterior, out] = demo_stochasticModel () % Demo for stochastic system with binomial output % % This demo simulates and inverts a model of a stochastic dynamical system, % which is obser...
c6ad95326351e7b5d759d33c3b6dca1b13505399641d0c68c0a5111d2a332c1a
MATLAB
2,149
56
function h_resetZPos3(handles, syncFlag) global h_img3; if ~exist('syncFlag','var')||isempty(syncFlag) syncFlag = 1; end [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); zPos = get(handles.zPosSlider,'Value'); [xlim,ylim,zlim] = h_getLimits3(handles); zSiz = zlim(...
1894b6e064182658ccaba28e936352d0e80092e1dc4761183c2e3e0c2b73dc55
MATLAB
2,150
51
function [rf0,gz,gzReph,params] = create_rf_gz_pulseq(params,tr_tmp) % RF pulses and FA depending on sequence type (VASO,ABC) and field strength, % Values for: Duration, apodization and timeBwProduct, can be modified to % avoid SAR or other constraints lims = params.gen.lims; for i=1:params.gen.n(...
7f147e05a7ee5805dd93de218bc2f7e3d92daf00898a3209092aed13fbb2ecad
MATLAB
2,150
58
function [fx] = f_BSL(x,theta,u,in) % evolution function for a Bayesian sequence-learner (BSL) % function [fx] = f_BSL(x,theta,u,in) % BSL is simply tracking the log-odds of P(y_t=1|y_{t-1}), where y is a % binary outcome. This variable is updated according to a Laplace-Kalman % filter, yielding 2 sufficient statistics...
ffcc06f6398607196f84ee0c0144819d771b63213a2bb3502b3e030cb2792344
MATLAB
2,150
1
% TSREMOVESESSION Removes a single session from the Experiment Structure % TSremovesession ( SUBJECT, SESSION ) % Subject - A subject ID number from the Experiment.Subjects array % Session - An integer index to Experiment.Subject(subject).Session, % or a date string. % % This function wi...
1d747dc3a94dc5e15984d9b5527545b235c2cbf12e4bbb875c958e8d5b43eb77
MATLAB
2,151
93
% Illustrate a HMM with gaussian emissions in 2d % (Lillypad model) %close all clear all setSeed(0); K = 3; D = 2; %model = mkRndGaussHmm(K,D); mu = 10*[ -1,0; 1,0; 0,1 ]; Sigma = zeros(2,2,3); sf = 10; Sigma(:,:,1) = sf*[1,1/2;1/2,1]; Sigma(:,:,2) = sf*[1,-1/2;-1/2,1]; Sigma(:,:,3) = sf*[3,0;0,1/2]; A = [0.8 0.1 0...
9cf3d3d4686b496babb6f8ea4172613e4692bb74b6161c68d22b0c4b3507c685
MATLAB
2,151
78
%% Variable Selection Demo % PMTKslow %% % This file is from pmtk3.googlecode.com function varSelDemo() methods = {... @(X,y) larsSelectSubsetCV(X,y, 'nfolds', 5), ... @(X,y) fbmpCore(X,y,'maxNumSearches',5), ... @(X,y) ARDwipf(X,y,'maxIter',50)}; methodNames = {'lars', 'bmp', 'ard'}; nmethods = length(...
d1ae7e37b99a190d59bd7193a66a927ec057d2b91a69b4acc1a417fd802a80eb
MATLAB
2,151
76
%% MCMC Sampling from a 2d Gaussians % Compare MH and Gibbs % We use a N(0, sigma*eye(2)) proposal and see the effect of changing sigma %% % This file is from pmtk3.googlecode.com setSeed(0); Sigma = [1 -0.5; -0.5 1]; mu = [1; 1]; N = 500; model.mu = mu; model.Sigma = Sigma; marg1.mu = mu(1); marg1.Sigma = Sigm...
48cd27af0ac721c3f4e3fb12971a7cfe4acfbfdc230e70ad9ecb82dd8ffba61a
MATLAB
2,152
42
function q = CBIG_EM_doc_inference_wc(w, paradigm, params) % q = CBIG_EM_doc_inference_wc(w, paradigm, params) % % Update auxillary parameter q in the E-step on each experiment (document). Note that % compared to CBIG_EM_doc_inference.m, this function takes in an argument w of a different structure % FORMAT q = CBIG...
c50b1ef822744476f74208d490f7aaad3201e53523a797bc6e1dc9dcb4317d84
MATLAB
2,152
66
function [ha, pos] = tight_subplot(Nh, Nw, gap, marg_h, marg_w) % FROM FILEEXCHANGE - NEED TO BE SURE TO CREDIT WHEN CODE GOES PUBLIC % tight_subplot creates "subplot" axes with adjustable gaps and margins % % [ha, pos] = tight_subplot(Nh, Nw, gap, marg_h, marg_w) % % in: Nh number of axes in hight (verti...