sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
faae3b11272d38b80c92ccb302f23d49be4a6a790af2164c633d1f372646265d
MATLAB
1,246
57
% outputs the dx, dy offsets between frames by registering frame N to frame % N-1. If the movement is larger than half the frame size, outputs NaN. % ops.yrange, xrange are ranges to use for rectangular section of movie function [DS,corrv] = processRunning(h, frames) [ly, lx, nt] = size(frames); lCorrX = ceil(lx/4); ...
04bded4d029cbdd8c48196c1d1fef951ebb142e395eea8986533dde478513989
MATLAB
1,248
45
function T = LoadNeuralTimes(self, records_to_get, key) % MClust_LoadNeuralWaveforms % returns a TS of times % % calls appropriately constructed loading engines % % fn = file name string % records_to_get = an array that is either a range of values % key = 1: timestamp list.(a vector of timestamps to load % ...
908af31a4751afc56b7d0f851041e182fb9e9d82e7a2d13d348abca18f1d172a
MATLAB
1,248
34
function IN = nk_PerfANOVAObj(Y, IN) global VERBOSE [~,n] = size(Y); IN.p = zeros(n,1); IN.F = zeros(n,1); IN.R2 = zeros(n,1); if VERBOSE, fprintf('\t running ANOVA on %g variables ',n); end for i=1:n if VERBOSE;fprintf('.'); end IN.beta = pinv(IN.X)*Y(:,i); % here we use a pseudoinverse: % X is ...
e3e41e8ebff6435915256b8776d116e726b6c15410cd94dafd5dfc36f25c53bb
MATLAB
1,249
46
function [K,runtime] = connectedkernel(Graphs, k) % Compute connected k-node graphlet kernel for a set of graphs % Author: Nino Shervashidze - nino.shervashidze@tuebingen.mpg.de % Copyright 2012 Nino Shervashidze % Input: Graphs - a 1xn array of graphs % k - the size of considered graphlets - 3, 4, or 5 % Output...
2e5d51f19f07674b5a9cfa37678e4c219a622c9fed71a3277a92b72156f8c1fe
MATLAB
1,251
46
function varargout = permission(varargin) % file_array's permission property % For getting the value % dat = permission(obj) % % For setting the value % obj = permission(obj,dat) %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging ...
17307d78a2bc55542b4269fd0a3a1ea9609b1ca0b540334cb53558d818c331a8
MATLAB
1,259
48
function [optk, t] = nk_EstimKforMI(Y,Labels,kstart,kend,K) optk = []; [kX, ix] = size(Y); kvec = kstart:kend; kvecX = length(kvec); t = zeros(ix,length(kvec)); mi = zeros(K,1); miperm = zeros(K,1); % Generate K-fold subsamples of original data ordering cv = nk_CVpartition(1,K,Labels); TrainInd = zeros(length(cv.Trai...
31316b1982b84f40f9f222e4502180a1eb131540fa90fb3db71575313280a200
MATLAB
1,259
31
function result=qn(x) %QN is a scale estimator which does not require an auxiliary location estimate. % Essentially it is the first quartile of all pairwise distances between % two data points. Its definition is given by % qn(x)= c_n 2.2219{|x_i - x_j|; i<j}_(k) % with c_n a small sample correction factor to mak...
43a484b5fbc7c19bbe25586e6a36e218c163565dd3c0aad087f0e411439459b9
MATLAB
1,260
41
function [count] = countall3graphlets(L) % Count all 3-node subgraphs in an undirected graph % without node labels and with unweighted edges % Author: Nino Shervashidze - nino.shervashidze@tuebingen.mpg.de % Copyright 2012 Nino Shervashidze % Input: L - 1xn cell array - adjacency list % Output: count - 1x4 vector of i...
8974d01fe06cfe4597ab672cf53ce1ce177403fd0c50cad74b52b34d8991c38a
MATLAB
1,260
61
function [ W, info ] = MTFLC_CVX( X, y, lambda1, lambda2, opts ) %#ok %MTFLC_CVX Summary of this function goes here % Detailed explanation goes here if(nargin<5), opts = []; end opts = setOptsDefault( opts, 'verbose', 1); verbose = opts.verbose; info.algName = 'Primal CVX'; m = length(X); %#ok d = size(X{1},...
8b1ccfe69d91f6cc056418a9ed0a547493ead259799af47b208fbb5e4926b73e
MATLAB
1,260
47
function writeGeneList(geneList,fileName,writeDir) % write the gene list into a .txt file % geneList: column vector of string. % fileName: string % writeDir: string % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Publi...
e5b5af6993950fa8087c06286dce1df61a3b5c6e7e5f0c6a0ab2ad2e2d00528c
MATLAB
1,260
33
function [img3d] = resize_img_useTemp_imcalc(file,temp,opt_save) % function [img3d] = resize_img_useTemp_imcalc(file,temp,opt_save) %----------------------------------------------------------------------- % Job saved on 15-Jul-2015 09:33:17 by cfg_util (rev $Rev: 6134 $) % spm SPM - SPM12 (6225) % cfg_basicio BasicIO -...
46c8ce352fd1c5fb13dccba7cdb618988af521f6ef2fbc818dfb9526506c4579
MATLAB
1,261
40
function o = cat(dr,varargin) % Concatenate file_array objects. The result is a non-simple object % that can no longer be reshaped. %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging % % $Id: cat.m 7147 2017-08-03 14:07:01Z spm ...
ba7b7e1ba0e3abf477b1753a970513bd7ee6271a1e9d44733bbe3de48fa62622
MATLAB
1,263
45
function WV = LoadNeuralWaveforms(self, records_to_get, key) % MClust_LoadNeuralWaveforms % returns a TSD % % calls appropriately constructed loading engines % % fn = file name string % records_to_get = an array that is either a range of values % key = 1: timestamp list.(a vector of timestamps to load % ...
38e3e8b8f4144a61497d18dad4811e69672c5039f6f194e80852a13211d5c044
MATLAB
1,264
38
function P = nk_TestPerfCompConnectivity( Y, L ) [m,n] = size(Y); params.seedparams.threshprc = 95; P=zeros(m,1); % Perform LOO for i = 1:m trainind = 1:m; trainind(i)=[]; testind = i; fprintf('\nWorking on subject %g',i); %[Ytrain, meanY, stdY, meanY2] = nk_PerfStandardize2(Y(trainind,:),[],...
c1ad69a99b57c58109a3bda188e076da95042059be8110aebeea2511f0e58a24
MATLAB
1,268
38
function exportCurrentFigAsPDF(filespec,userOptions) % exports the current figures to the file [filespec,'.pdf'] in pdf % format. % filespec is the full path (including the file name) of the file to be % saved. % userOptions can be used to modify the dots per inch (dpi) or the % tightness of the figure in the pr...
ca7ca34de57bbdeb085cd5e5540232fc83106d50f10f80e0b557e8c8acf04270
MATLAB
1,270
52
function [] = PL2Print(cellArrayOfStructures) % PL2Print(cellArrayOfStructures): prints cell array of structures % % PL2Print(cellArrayOfStructures) % % INPUT: % cellArrayOfStructures - cell array of identical structures % % OUTPUT: % prints specified cell array if nargin ~= 1 error 'expected 1 input argument'...
430dd8a67510908ea29f3ab0dd8917a2ab866b2d65a3aedc16db31c63c86bc9e
MATLAB
1,271
52
function X = mask(tsa, t0, t1, masking) % % mTSD = ctsd/Mask(tsd, t0, t1, masking) % % INPUTS: % X = tsd object % t0 = sets of start times % t1 = sets of end times % masking = 1=NaN times inside trial pairs, 0=NaN times outside trial % pairs (default = 1) % NOTE: must be SAME units as tsd! % % O...
9c484908769b5791cfc71d4824210fe4793945fe9e7addc3e8354547c044d0f7
MATLAB
1,272
45
function demo_face_online() % Demonstation file for online NMF for face images % % Created by H.Kasai on Apr. 18, 2018 clc; clear; close all; %% set parameters max_epoch = 1000; batch_size = 100; N = 1000; K = 49; %% load data V = importdata('.....
abc1156ba54f2ceb623693130625f9f2244ecccba1a8f50375c351ae62bdcbe5
MATLAB
1,272
35
function GridAct = nk_GenGridAct_script(cv, x1, x2, y1, y2, xx1, xx2, yy1, yy2) % %%%%%% DEFINE CV ACTION GRID %%%%%%%% if nargin < 8 % Outer CV mode [ix, jx] = size(cv.TrainInd); ixP = x2-(x1-1); jxP = y2-(y1-1); numCV2parts = ixP * jxP; numCV2partsCPU = ceil(numCV2parts / numCPU); GridActP...
d86db3d26aba76e21865eac91afdfedc79392d38ffd7ffdb0aa28ab12195367c
MATLAB
1,273
41
function [CURACT, act] = nk_GroupNorm_config(NM, varind, CURACT, parentstr, defaultsfl) if ~exist('defaultsfl','var') || isempty(defaultsfl); defaultsfl = false; end IND = []; ZeroOut = 1; if ~defaultsfl if isfield(CURACT,'IND') && ~isempty(CURACT.IND), IND = CURACT.IND; end if isfield(CURACT,'zerooutflag...
8117713024e224d8417129b92f7dd0537715e67201d2c7a93e0ba2d5064a51d5
MATLAB
1,276
35
%erpval = zeros(20,3*2); % 3 familiarity, 2 mask load('N250_both.mat') [n,c2] = size(erpval); varNames = cell(3*2,1); for i = 1 : 3*2 v = strcat('V',num2str(i)); varNames{i,1} = v; end % Create a table storing the respones tbiases = array2table(erpval, 'VariableNames',varNames); % Create a table reflect...
83da662eddefb8afe6363b5a36e572c72cfab6490a29b15e3ca540a3ba2e32cb
MATLAB
1,277
52
function [res] = build_and_verify_mexPlex() % this script will build and verify mexPlex % % OUTPUT: % returns 1 if all verification tests passed % returns 0 if some of the verification tests failed % % if ReadingPLXandDDTfilesinMatlab-mexw.zip was inzipped to % % C:\PlexonMatlab % % this script should be run when ...
a944722bd979bda8191942f8b1cfcc9caf6fc3bb59fd64ba00fa068824d6ad65
MATLAB
1,280
41
function D = nk_FScoreFeatRank(Y, L, N) % Y : Data % L : Target Labels % N : Nuisance Labels (optional) ix = unique(L); if numel(ix) == 2 indP = L==ix(1); indM = L==ix(2); YP = Y(indP,:); YM = Y(indM,:); % Mean of Positive / Negative Labels mP = nm_nanmean(YP); mM =...
d8fd60cc85abf544d84c075f00e46a1aaa3447a0d93a3abbb38bb7907b63e0de
MATLAB
1,280
53
function [AC,xrange] = CrossCorr(T1, T2, varargin) % MClust.CrossCorr(T1, T2) % % % INPUTS % T1 -- times of data (in seconds) % T2 -- times of data (in seconds) % % OUTPUTS % AC --- tsd of autocorrelation of self % % ADR 2012 % % Status: PROMOTED (Release version) % See documentation for copyright (owned by o...
f631d1074929fd23bc18480b38cd7de66fff43ad7378290e7397e884e99a90be
MATLAB
1,281
31
% Matlab Toolbox for Dimensionality Reduction % Version 0.8 18-APR-2012 % % %Main functions %---------------------- % compute_mapping Performs dimension reduction using the specified technique % out_of_sample Performs out-of-sample extension using trained DR technique % out_of_sample_est Performs out-of-sample...
50e2a2960a214eb565e4540341ec721414948dc49f7eca851b184081fb7db59c
MATLAB
1,282
28
function NM = nk_AdjBrainMask(NM) i = nk_input('Define modality index',0,'i'); if i>numel(NM.Y), error('Index exceeds no. of data modalities'); end [file_brainmask,path_brainmask] = uigetfile({'*.nii';'*.img';'*.*'},... 'Brainmask Image Selector'); [~,n,e] = fileparts(NM.datadescriptor{i}.inp...
6844ceaf63d585090a575885eb50e2ed298cc5e341950dd4b870f921810ed474
MATLAB
1,284
46
function [c,b,c1] = cvx_foopsi(y,b,c1,sn,b_lb,g,w,keep) % implementation of constrained foopsi in CVX % Written by Eftychios Pnevmatikakis if isempty(b) bas_est = 1; else bas_est = 0; end if isempty(c1) c1_est = 1; else c1_est = 0; end gd = max(roots([1,-g(:...
a3bfb29cf41125dbe706c974056526bcfe38904f040f3f6b446e8c7b3b6e49df
MATLAB
1,287
36
% two-way anova with hemisphere as a factor: Sept 14 2022 load('N250_both.mat') [n,c2] = size(erpval); varNames = cell(3*2,1); for i = 1 : 3*2 v = strcat('V',num2str(i)); varNames{i,1} = v; end % Create a table storing the respones tbiases = array2table(erpval, 'VariableNames',varNames); % Create a ta...
d264b6e50802f48cb1f6e3b9b4ebf08fde50694f4ee323591878771309b2e77e
MATLAB
1,290
36
function IO = DefineLabels(IO, modeflag) switch modeflag case 'classification' if isfield(IO,'L') && ~isempty(IO) IO.label = zeros(size(IO.L)); IO.n_label = size(IO.L,2); uL = unique(IO.L,'stable'); nLall = numel(uL); for j=1:IO.n_label ...
a2b1358b7099c7eadfa29b89c60e46dfb95fdfba61a00c684a47529a6a118c8d
MATLAB
1,291
43
function nk_ModelExport_config(dat, analind) global SAV MODEFL CV OOCV FUSION MULTILABEL if isempty(analind), return, end; % Initialize analysis with current training parameters complvec = []; for z=1:numel(dat.analysis) if dat.analysis{z}.status, complvec = [ complvec z ]; end; end analysis = dat.analysis{complv...
6c7760679a5d698ea6f9468d10295151c474f8e2be6a65da21b1baf46591c00f
MATLAB
1,293
39
function calculate_trialnrs % CALCULATED_TRIALNRS Trial nr.s for each patient allpats = {'pd01','pd02','pd03','pd04','pd05','pd07','pd08','pd10','pd12','pd13','pd14','pd15','pd16'}; gotbl = nan(length(allpats),3); stoptbl = nan(length(allpats),3); for rT = 1:3 switch rT case 1; recty...
11c6aac9fec3b01d8002750f3e149b7ed3dbd2c3b79cac8f390618c7ce56a1d4
MATLAB
1,294
39
<<<<<<< HEAD function s = struct(this) % Struct method for GIfTI objects % FORMAT s = struct(this) % this - GIfTI object % s - a structure containing public fields of the object %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neur...
6c4da1f9463057dcba2f00e2e167400bbf6c855a16a5c2266f392c32ae15d0ac
MATLAB
1,298
37
% 20180313 CRM %% load nii data, using one of three options % (1) Matlab 2017b+ has this built-in as 'niftiread' % V = niftiread('example_Sbunny.nii.gz'); % (2) FreeSurfer has a function 'load_nifti' % nii = load_nifti('example_Sbunny.nii.gz'); % V = nii.vol; % (3) Use the NIfTI toolbox and use 'load_n...
5078b075472feac3b52b4246d77ddd122d78d621fb329e18237ac5e790d1ee7e
MATLAB
1,299
39
function [sY, IN] = cv_graph_PerfGraphConstruction(Y, IN) % ========================================================================= % =========================== WRAPPER FUNCTION ============================ if ~exist('IN','var'), IN = []; end if iscell(Y) sY = cell(1,numel(Y)); for i=1:nu...
2b83c45b5cd3386022984f9e56ed7b778b523dd7dd231497e11d3c65a32c1949
MATLAB
1,301
64
function [Vo, Ro, No, V] = generate_syntheticdata(F, N, K, noise_level, rho) % % % Vo % W = randn(F,K); % W = max(W, 0); % W = min(W, 1); % % H = randn(K,N); % H = max(H, 0); % H = min(H, 1); % % Vo = W * H; % % % noise No = noise_level*randn(F,N); % % ...
e17207a913cf9a27ad00b19ed94d0da7d8fdfa7309c8a5c1c5846af3f7b0aa38
MATLAB
1,301
45
function [evinx TEevinx] = find_evinx(EEG_ep, evty,evlevel) % FIND_EVINX Gets epoch index corresponding to EVTY event and EVLEVEL level % of subevents in EEG_EP data (eeglab struct). % % % Johanna Petra Szabó, 10.2025 % Clinic for Neurosurgery and Neurointervention % Semmelweis University, Budapest, Hungary % ...
2a09d82e9e86789db287a7e735361828c67adfd795efe6539fcbb2d5cb82392c
MATLAB
1,303
40
clear; clc; % Load the dataset load('combinedData.mat'); % Make sure this file contains the 'Year' and 'Type' columns % Group the data by Year and Type to count research items groupedData = groupsummary(combinedData, {'Year', 'Type'}, 'IncludeEmptyGroups', true); % Create a list of all unique types types =...
1207db9b7bc8d84f4165bc6ad6df918cc6a1b6b01f83fd91df615508b9fb65be
MATLAB
1,311
40
% FastICA for Matlab 7.x and 6.x % Version 2.5, October 19 2005 % Copyright (c) Hugo Gävert, Jarmo Hurri, Jaakko Särelä, and Aapo Hyvärinen. % % Type fasticag to launch the graphical user interface % % Please refer to your Matlab documentation on how to add FastICA to your % Matlab search path. (One place to start is t...
7b66bc82926b4eb28572ed9698f27eb8175c5c1f2aae313a1f79e1728937fafc
MATLAB
1,312
53
function [errReturn] = mbm_check_input_app(MBM) % Check if required inputs are provided for the app. If not, display error % message. % %% Inputs: % MBM - structure % % fig - figure where error message is displayed. % Trang Cao, Neural Systems and Behaviour Lab, Monash University, 2024. errReturn = false; ...
68e34d0c2b2769e7b7c1fa203d7e7b3b773440621b3758a073fa4d9c58b9a668
MATLAB
1,314
53
% mdodified t-statistic with median absolute deviation as an estimate of SD % permutation testing to get distribution load 'N250_both.mat' y = erpvalues(:,[2 5]); % cols to be tested X1 = y(:,1); X2 = y(:,2); [n1,~] = size(X1); [n2,~] = size(X2); mu1 = mean(X1); mu2 = mean(X2); mad1 = mad(X1); mad2 = mad...
e5781df2b985e1c24c1fe85930e9ea5726532af05cfd5adb6626832b9871d952
MATLAB
1,314
59
classdef Feature % Feature - % % this version keeps the feature on disk and only loads as necessary properties(Access=public) normalizedYN = false; fdFile = ''; fdColumn = nan; name = ''; inMemory = false; FD; end methods % call as Feature(name, FD) or as Feature(name, fdFile, fdColumn...
6b180572f8c934469699ad3c135a0eb753151392895d43a0b7a5e4f0c9552d56
MATLAB
1,315
35
function GridAct = nk_GenGridAct_batch(cv, curCPU, numCPU, x1, x2, y1, y2, xx1, xx2, yy1, yy2) % %%%%%% DEFINE CV ACTION GRID ACCORDING TO "numCPU" and "curCPU" %%%%%%%% if nargin < 8 % Outer CV mode [ix, jx] = size(cv.TrainInd); ixP = x2-(x1-1); jxP = y2-(y1-1); numCV2parts = ixP * jxP; numCV2pa...
de5608ca4079d80093754780b81c44c6420e239a9bdc432a745c760cd0c9e18f
MATLAB
1,315
37
function [sortedDist,index] = getBestScores(dist,k) % get the nearest K values from a distance vector % dist; column vector % k: scalar % sortedDist: column vector, the k best distances % index: the numeric index of these k best distances %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you ...
3ee381338a39b465a19a5c740fca6022094d9f9ce616b6ef03c91d70040748f8
MATLAB
1,316
39
classdef CompactEditableComboBoxEventData < event.EventData %CompactEditableComboBoxEventData Event data for CompactEditableComboBox. properties Value char = '' Items cell = {} SelectedIndex double = 0 Action char = '' Data = struct() end methods functio...
5fa75b8de53cce03e2480ee3575aa268926fdf36240f0bcef12998e4cc25072c
MATLAB
1,316
56
function putlabel(x,y,names,z,znames) %PUTLABEL plots user-specified labels to the observations in a two- or % a three-dimensional figure. % If no labels are given, the indices are plotted. % % Required input arguments: % x : x-coordinates of the data % y : y-coordinates of the data % % Optional input argume...
80492ff469dafead7581894a50cc776ef4b3c0cf4427c991e35d1405c2fdcc80
MATLAB
1,316
52
function ghat = isotonic_regression(y,w) % ghat = IsoMeans(y) % fits a vector ghat with nondecreasing components to the % data vector y such that sum((y - ghat).^2) is minimal. % (Pool-adjacent-violators algorithm). % In case of a second input vector w with positive entries % (and the same size as y), % ghat = IsoMe...
90cdf27143c2f3c6d64c85332e266ffbd585b6c0204753fe693995c19a702e7d
MATLAB
1,317
36
function inv = stdnormal_inv (x) % STDNORMAL_INV Quantile function of the standard normal distribution % INV = stdnormal_inv(X) % For each component of X, compute the quantile (the inverse of the % CDF) at X of the standard normal distribution. % Adapted for Matlab (R) from GNU Octave 3.0.1 % Original file: statis...
5755425c727fa0305380a916cf5b275b6c9dfd931897b1f3ed1c53c5ad5f36d9
MATLAB
1,321
35
function GridAct = nk_GenGridAct_batch(cv, curCPU, numCPU, x1, x2, y1, y2, xx1, xx2, yy1, yy2) % %%%%%% DEFINE CV ACTION GRID ACCORDING TO "numCPU" and "curCPU" %%%%%%%% if nargin < 8 % Outer CV mode [ix, jx] = size(cv.TrainInd); ixP = x2-(x1-1); jxP = y2-(y1-1); numCV2parts = ixP * jxP; numCV2pa...
fc7c0034198c6e768e42d4ab0ce8f0cb5888fce5bfdec5190dcf75f25ec2de2b
MATLAB
1,322
51
function W = pnmfkl_sparse(X, r, max_iter, tol) % % compute PNMF based on I-divergence (non-nomarlized KL-divergence) % input: % X nonnegative data input (m times n, sparse) % r number of PNMF components % max_iter maximum number of iterations (defaut 5000) % tol convergence tolerance...
13a94d86ff7cfcedac0a43cf4b90db0ca8a42bdc33f08c7346e8d1c399a71a70
MATLAB
1,323
57
function [ w_sol, infos_sol, costs ] = nk_NMFbase( V, rank, algo, options) [F, N] = size(V); Vo = V; dim = N * F; %% set initial data x_init.W = rand(F, rank); x_init.H = rand(rank, N); x_init.R = rand(F, N); %% set options if ~exist('options', 'var') || isempty(options) max_epoch = 100; options.max_epoch = m...
4c6919d7f50d6868627184e2318c8951d28826a7d2a894f4341dc4a2734a7274
MATLAB
1,323
32
function [ nexFile ] = nexAddInterval( nexFile, intervalStarts, intervalEnds, name ) % [nexFile] = nexAddInterval( nexFile, intervalStarts, intervalEnds, name ) % -- adds an interval variable (series of intervals) to nexFile data structure % % INPUT: % nexFile - nex file data structure created in nexCre...
ee0e1bda570cf4e5fca5073c94958373a54134fd330ea6b6a78659dea31fbadd
MATLAB
1,324
48
function Hinv=pseudoinverse(H,lambda) % compute pseudoinverse of matrix H % Usage: % Hinv=pseudoinverse(H); % Hinv=pseudoinverse(H,lambda); % H: matrix % lambda: scalar, the parameter to reach stable result and avoid % singularity, its value should be very large, i.e. 2^32. % Hinv, the pseudoinverse of H %%%% % Copyrig...
a9685c3dae1ab4edb970d96a37a24f93fb878ade0147deec72cfe7644e102b0d
MATLAB
1,325
56
function [cmb association] = IAMB( data, targetindex, THRESHOLD) %function [cmb association] = IAMB( data, targetindex, THRESHOLD) % %Performs the IAMB algorithm of Tsmardinos et al. (2003) %from "Towards principled feature selection: Relevancy, filters and wrappers" if (nargin == 2) THRESHOLD = 0.02; end numf = si...
488cc6e23f9a664baf280cb85a6851e53837f6c72678f63151910ee299ffba2d
MATLAB
1,328
41
function Y = gplvm(X, no_dims, sigma) %GPLVM Gaussian Process Latent Variable Model % % Y = gplvm(X, no_dims, sigma) % % Simple implementation of the Gaussian Process Latent Variable Model using % a Gaussian kernel with bandwidth alpha. The function reduces the % dimenisonality of the dataset X to no_dims dimensions...
6ed74e03b0959f1b631832d3f1a88cbd985b2832fba3ca45fa1ae75cf993044c
MATLAB
1,329
51
classdef (Sealed) MClust0 < handle % Internal class for MClust % % There can only be one element of this class properties Settings = []; Data = []; MainWindow = []; end methods function self = MClust0() end function de...
15824f48122e2d7fa14be91b9988df6ab31f812cb66a1db1ab67046f50eecf77
MATLAB
1,330
45
function [dims, indvol, Y, vox] = nk_ReadMaskIndVol(Vm, Vp, label, labelop) % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ % function [dims,indvol] = nk_ReadMaskIndVol(Vm) % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ indvol=[]; if ~exist('Vm','var') || isempty(Vm) Pm = spm_select(1,'image','Space-defining im...
f2392cde245d3fbde4f5929b23e4727938bbb525ebc30df2ed01da3433d6f7b5
MATLAB
1,334
37
function [trainSetTrainSubset,trainClassTrainSubset,trainSetTestSubset,trainClassTestSubset]=splitTrain2TrainTestSubset(trainSet,trainClass,option) % as the function name %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU Ge...
df023dce1a56ea7877c236f48fc06beb27fc948f1925010c77d0f18073ce8733
MATLAB
1,337
68
function [ypred,tabkppv,distance]=kNNm(xapp,yapp,valY,X,k) % % knn implementation % % USE : [ypred,tabkppv,distance]=knn(xapp,yapp,valY,X,k) % % xapp, yapp : learning data % valY : all the Y value possible % X : data to be classified % k : number of nearest neighbours % % ypred : class of X % tabkppv : [nbpts x nbpts]...
aa4de558c88732492251d677822aabdc99f6471bfd59043e879683baa3cc36ba
MATLAB
1,340
41
%% script for selecting random animal from given group: % We can choose to set a random seed if we want a repeatable sequence of % choices rseed = 2; rng(rseed); % xenocanto's web interface returns this many items per page: MAXPERPAGE = 30; % Select the animal type here: % (as of dec 2025, xenocanto has "...
ca2296d2541e55fc61eca572a083bb9708a838864f741fd5c712237ccb55504e
MATLAB
1,341
52
function S1 = my_conv2(S1, sig, varargin) % takes an extra argument which specifies which dimension to filter on % extra argument can be a vector with all dimensions that need to be % smoothed, in which case sig can also be a vector of different smoothing % constants idims = 2; if ~isempty(varargin) idims = vararg...
fd322cbb181a312154a495ffcf836be91614bff1d0eff9d534d283daecd15800
MATLAB
1,342
36
function [S,lambda,gamma] = SanalyticER(n,k,C,L,FLAG) % SANALYTICER computes small-world-ness for analytic E-R graph values % [S,lambda,gamma] = SANALYTICER(N,K,C,L,FLAG) computes small-world-ness S, for networks of % size N, mean degree K, clustering coefficient C, and path length L, % where each is an array of...
1c6cfe0a3b87ed088333f7919a6e09477735ae3a27fb8c3099f941916a16b04e
MATLAB
1,343
38
function [wave] = PL2WavesBySource(filename, source, channelInSource, unit) % PL2WavesBySource( filename, source, channelInSource, unit ): read spike timestamps and waveforms from a .pl2 file % returns waveform values in millivolts % % wave = PL2WavesBySource( filename, source, channelInSource, unit ) % ...
4eb60fd94a88d3613fc585087d54a4f665d4cc9435f16a877afdd27ab351efd5
MATLAB
1,344
50
function param = nk_SVM_config(res, param, progtype, kerntype, parentstr) if ~exist('progtype','var'), progtype = []; end if ~exist('kerntype','var'), kerntype = []; end %% Define SVM optimization options depending on the SVM implementation if isempty(progtype) sftmenu = ['SVM --------------> LIBSVM|' ... ...
756f3930aaa227873517270a8987583ecf35dc87efd4bcbe067fc61147d5b0e5
MATLAB
1,344
42
function b=SB(K, trainClass) % compte the averaged distance between all class centroids % K: kernel matrix % trainClass: column vector, the class labels of the samples %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU Gener...
a923ff4a536665cef42bd16bd05161796ae42dc080a69a9eccc30dd5b7e55ec2
MATLAB
1,344
39
function [neighborIds neighborDistances] = kNearestNeighbors(dataMatrix, queryMatrix, k) %-------------------------------------------------------------------------- % Program to find the k - nearest neighbors (kNN) within a set of points. % Distance metric used: Euclidean distance % % Usage: % [neighbors distances] =...
4b68a8deb47326493c71c69e95ee88845aaaa5c52e48b2b50809c3100e254cb1
MATLAB
1,345
54
function [ out] = msMaxFrames( ms, frames, filtering) %MSMAXFRAMES Summary of this function goes here % Detailed explanation goes here %Parameters filtering_factor = 2; meanFrame = ms.meanFrame{ms.selectedAlignment}; max_mean_frame = median(median(meanFrame)); [rows, columns] = size(meanFrame); max_projection = ...
9b46cfe6d138b801208047721d5d0beac57b0f19869bc6706fc05a3ff7163411
MATLAB
1,347
48
function [maps, weights] = ecalib_3d( ksp, ncalib, ksize) eigThresh_k = 0.02; % threshold of eigenvectors in k-space eigThresh_im = 0.9; % threshold of eigenvectors in image space % Generate ESPIRiT Maps (Takes 30 secs to 1 minute) %[sx,sy,Nc] = size(ksp); sz_ksp = size(ksp); Nc=sz_ksp(4); sz_calib=[ncalib,ncalib,nca...
0954abe9aeb1248a13cf25d2dd32afb1e8c5ba184fbf6d8a8954d746a1ed921b
MATLAB
1,348
28
%% Pipeline for the proper concatenation of miniscope data across sessions % Developed by Daniel Almeida Filho Mar/2020 (SilvaLab - UCLA) % If you have any questions, please send an email to % almeidafilhodg@ucla.edu %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Step 2: Alignment across...
3378ce65ca27a1e71fd4cadc113a97b1fc1bfad80d8ad481ae8c7eaa8bd02306
MATLAB
1,348
42
% Objective function for extended NDM (eNDM) % % param(1) = x0_value % param(2) = beta1 = diffusivity parameter % param(3) = alpha1 = linear growth/clearance term in x % param(4) = alpha2 = cell-type reweighting for alpha1 % param(5) = beta2 = cell-type reweighting for beta1 function [f] = objfun_eNDM(param,seed_lo...
5cd96adf837c6ca89278f5730373043fcc6233cef16d99e2ac7918879f99d7ba
MATLAB
1,348
38
function ClusterFunc_ShowCrosscorr(self) % ClusterFunc_ShowCrosscorr(self) % ADR 2012 % % Status: PROMOTED (Release version) % See documentation for copyright (owned by original authors) and warranties (none!). % This code released as part of MClust 3.0. % Version control M4.0. % Extensively modified by ADR to accomod...
1f7ad0d79d757aee17b3f3c490b84bf928811c5b60218145fefaf6f4c5e0113c
MATLAB
1,349
38
function [ D, datatype, brainmask, badcoords, threshval, threshop] = getD(FUSEFLAG, inp, n) if isfield(inp,'stacking') && inp.stacking datatype = 0; brainmask = []; badcoords = false(1,inp.nD); threshval = []; threshop = []; D = inp.nD; else switch FUSEFLAG ca...
1f66870bc82b3b8135927d2641a0b15d1bfa40101c964511aef74e49b5266d49
MATLAB
1,352
64
function [fea] = mrmr_miq_d(d, f, K) % function [fea] = mrmr_miq_d(d, f, K) % % MIQ scheme according to MRMR % % By Hanchuan Peng % April 16, 2003 % bdisp=0; nd = size(d,2); nc = size(d,1); t1=cputime; for i=1:nd, t(i) = mutualinfo(d(:,i), f); end; %fprintf('calculate the marginal dmi costs %5.1fs.\n', cputime...
2990c7cf6c8b415f5a141dfeca25df3c1fcffb07d92518642e6a8536b087d57b
MATLAB
1,354
64
function [tY, Fx] = nk_ExtractFeatures(Y, F, Ytest, indF) if iscell(Y) nvar = size(Y,2); tY = cell(1,nvar); for v=1:nvar if isempty(Ytest) if isempty(F) tY{v} = Y{v}; else D = size(Y{v},2); try Fx = ...
9521633df35596967ef71c9aa8ea77802098297167735628f990561b0bfaf0d6
MATLAB
1,355
40
clear load('ProcessedData\tables_compiled.mat'); %% Indivial corr figs for day 1 ID_unique = unique(animal_ID); D1_deltas = tables_compiled{1,1}.Deltas; figure, t = tiledlayout(3,5,'TileSpacing','Compact'); trial_cutoff = 8; for i = 1:length(used_ID) animal_now = ID_unique(i); delta_now = D1_deltas(:...
f73708fc4189ca4e1aec74e116e22e7d3f941aa38388669aee2ac347f8377dfb
MATLAB
1,357
52
function PP = nk_AddParam(p, desc, t, PP, actstr) if ~exist('actstr','var'), actstr = []; end if strcmp(actstr,'reset') Px = struct('Params',[],'Params_desc',[],'Typ',[]); PP.Px = Px; PP.opt = []; return elseif ~exist('PP','var') || isempty(PP) || strcmp(actstr,'replace') Px = struct('Params',[],'Params_desc',...
ea4f69fe5124eaedf19ab45e8c41ce7335e241a01de7bff3fba6f0f1c41a3997
MATLAB
1,359
46
function [Y_mapped, Y_mapped_ciu, Y_mapped_cil, Y_mapped_std] = nk_MapModelPredictions(n, O, R, I, MapIdx, Method, NormRange, ZnormData) m = size(R,1); if ~exist('ZnormData','var') || isempty('ZnormData') ZnormData = false; end tY_mapped = zeros(m,n); Y_mapped = zeros(1,n); Y_mapped_ciu = zeros(1,n...
a1805efd85a6f6b1bbb63813a98a49ba71c3a2d6e9b302153ba7b8dbdc23c5b3
MATLAB
1,360
42
% Objective function for NDM (using numeric integration for ode) % % param(1) = beta % param(2) = x0_value function [f] = objfun_NDM_numeric_costopts(param,seed_location,pathology,time_stamps,C,costfun) beta = param(1); x0 = param(2)*seed_location; % Calculate predictions y with NDM % Solve NDM; [...
a82f794de826e569e9fbda24e02406e54d96ace837452a6cd5650b7c52cb3c93
MATLAB
1,360
39
function [ad] = PL2AdSpanBySource(filename, source, channelInSource, startCount, endCount) % PL2AdSpanBySource(filename, source, channelInSource, startCount, endCount): read a span of a/d data from a .pl2 file % returns a/d values in millivolts % % examples: % % ad = PL2AdSpanBySource(filename, source, c...
f58ec22c33fa402b6d46a8e0d48f35d86e4c6c2a86945d88efca5a83534143b5
MATLAB
1,362
28
function SUBGROUP = nk_SubgroupOperation_config( NM, SUBGROUP ) if ~isfield(SUBGROUP,'indperc') || isempty(SUBGROUP.indperc) SUBGROUP.indperc = 50; end if isfield(NM,'C') menustr = ['Entire training set|' ... 'User-defined subset of training partition|' ... 'Random subset of the ...
3790361cbb3f3f72c3446310c605ae47a3a7562e0d6791d6d65dd01ddafe0806
MATLAB
1,363
45
%% FUNCTION mtSplitPerc % Solve the l1 projection problem % %% OBJECTIVE % output = argmin_Z beta/2gamma ||Z - S||_F^2 + |Z|_1 % %% INPUT % Sp: S the point to be projected % beta,gamma: projection parameter % %% OUTPUT % Tp: projected point % %% LICENSE % This program is free software: you can redis...
7b40d0ae266e5c6acf7efe664e29b7370436a7f7cd29a2b87a4d8b7e7d3fe286
MATLAB
1,365
35
function [ nexFile ] = nexAddContinuous( nexFile, startTime, adFreq, values, name ) % [nexFile] = nexAddContinuous( nexFile, startTime, adFreq, values, name ) % -- adds continuous variable to nexFile data structure % % INPUT: % nexFile - nex file data structure created in nexCreateFileData % startTime - ti...
f826d6f9999c10c39e4dfa29faaf418cfa420499bb759768699beb009d648860
MATLAB
1,366
49
function [C, dA] = mcml_grad(x, X, P) %MCML_GRAD Computes MCML cost function and gradient % % [C, dA] = mcml_grad(x, X, P) % % Computes MCML cost function and gradient. % % % This file is part of the Matlab Toolbox for Dimensionality Reduction. % The toolbox can be obtained from http://homepage.tudelft.nl/19j49 % Y...
55e7116c1b9bb8760b5342cecef2d6bae6cad4d7bb7e71aab1d8f1abc5119e75
MATLAB
1,370
52
function residualplot(x,residuals,attrib,labx,laby,nid) %RESIDUALPLOT plots the residuals from a regression analysis versus x % % Required input arguments: % x : the vector to be plotted on de x-axis % residuals : the residuals % attrib : string identifying the used method = 'LS', 'MLR', 'LTS', 'MCDREG'...
431be3c41e121e7a47a1815aaf41fc3cd3138385fa6585b9cca6cd0e10e74f75
MATLAB
1,372
49
function selectedFeatures = CMIM(k, featureMatrix, classColumn) %function selectedFeatures = CMIM(k, featureMatrix, classColumn) %Computes conditional mutual information maximisation algorithm from %"Fast Binary Feature Selection with Conditional Mutual Information" %by F. Fleuret (2004) %Computes the top k features f...
d46a5d37b9f9484069d6ba8146e5c2434b40624923432c351578106c5c83abc8
MATLAB
1,373
31
function FR = CalcFoopsiThresh(Data,DownSampleFactor) % Function to calculate the Foopsi Thresholded deconvolution of a dataset % comprising recordings of calcium imaging data. % Reference paper: Friedrich, J., Zhou, P. and Paninski, L., 2017. Fast % online deconvolution of calcium imaging data. PLoS computational bio...
b079d2611e67d65d7bf53083092491002f6660e1ac2a3c35ee500d4fda0a9159
MATLAB
1,374
53
function indLog=leaveMOut(m,C) % leave one out % C can be scalar or vector % C: if C is scalar, it is the number of samples; if C is a vector, it is the class labels % Yifeng Li % Oct 29, 2012 % example: % m=10; % C=[0;0;0;0;1;1;1;1;1;1;2;2;2;2;2;2;2;2;2;2]; % indLog=leaveMOut(m,C) numS=numel(C); if numS==1 % C is t...
3559d1235b4ab3301fd4a7ddef41d58ae486b904588007594fbe1ea477d91757
MATLAB
1,376
45
function range=searchkernelRange(trainSet,trainClass,option) % search the feasible range of gamma of rbf kernel %%%% % Copyright (C) <2012> <Yifeng Li> % % 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 Fo...
7e3c80c93f7070f6b4cac2189bbae2278f20a5e5559eeead6cee3847c1e49ce2
MATLAB
1,376
45
function [C, dC] = mvu_x_grad(Y, N, no_dims, ni, K, DX, lambda) %MVU_X_GRAD This file is not currently used by the toolbox % This file is part of the Matlab Toolbox for Dimensionality Reduction. % The toolbox can be obtained from http://homepage.tudelft.nl/19j49 % You are free to use, change, or redistribute this code...
8ee70c23172005c069f99d12e45b2a1edc8539d9017349848605c3eb819f9435
MATLAB
1,376
59
function screeplot(vec,attrib,lev) %SCREEPLOT draws the eigenvalues of the covariance matrix of the data in decreasing order. % It can be used to decide how many latent variables to retain in a PCA analysis % by looking at the kink in the curve. % % Reference: J.A. Jackson (1991), "A User's Guide to Principal Compon...
941acc5565388dc69f56f4a733033d4c0ed4611efc9a8fbf8a72687469501e8d
MATLAB
1,378
34
function [ad] = PL2Ad(filename, channel) % PL2Ad(filename, channel): read all a/d data for the specified channel from a .pl2 file % returns a/d values in millivolts % % examples: % % ad = PL2Ad(filename, channel) % ad = PL2Ad(filename, 2) % ad = PL2Ad(filename, 'FP02') % % INPUT: % filename - if empty ...
84bab9c65f16f12b36fade5602bac966acad2d7db41f85e77a42b7db41f7d52e
MATLAB
1,379
37
function param = nk_Simba_config(param, setupfl) % function param = nk_Simba_config(param, setupfl) % % Setup parameters for the Simba algorithm % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (c) N. Koutsouleris 03/2010 max_iter = 5; block_size = 1; utilfunc = 1; iter_abort_crit=100; if ~setupfl if isfield(...
08602a62d1a086f9c161ca1ff1f617efeac21c19a5fc2c96830d9f0d07958f4e
MATLAB
1,381
70
classdef CvxHullCluster < MClust.ClusterTypes.DisplayableCluster % Convex Hull Cluster % % the type we had in MClust 2.0 properties(SetObservable) % featuresX = {}; featuresY = {}; xg = {}; % limits yg = {}; end methods(Static, Access=public) function bool = Modifiable() bool=true; end end ...
a8f323f47385f041b03828eeeffc7e5574ba0e8c30502cba5881297172d987b6
MATLAB
1,381
40
function compare_partitions_resppred(EventTypes,partition,parttags,patgr_nm) %COMPARE_PARTITIONS_RESPPRED Compare partitioned trials in responsive/ predictive units % COMPARE_PARTITIONS_RESPPRED(EventTypes,partition,parttags) % -Compares partitioned sets of trials in responsive/ predictive units % using pe...
50a035bb9b271b04c2b574d7a81dee0893a2e1d8b428b4b228c30efaab9e82c8
MATLAB
1,382
58
function Projection2(self) % Recalculate Projection (self) % Projection plan 2 % % Modified from Jadin Jackson's original code. MCD = MClust.GetData(); nFeatures = length(self.Features); % -------------------------- % Find points in n-dimensions C1 = self.PrimaryCluster; C2 = self.SecondaryCluster; FD = nan(MCD.n...
0692cce85f92cab92ed60821610194118988ab7427795a45263e51e5240a824f
MATLAB
1,383
31
function FR = CalcFoopsiThresh(Data,DownSampleFactor) % Function to calculate the Foopsi Thresholded deconvolution of a dataset % comprising recordings of calcium imaging data. % Reference paper: Friedrich, J., Zhou, P. and Paninski, L., 2017. Fast % online deconvolution of calcium imaging data. PLoS computational bio...
832c6c83c2610f062b693fd2407aabcb5d7e61447ee9b0b93ba13b13e0f048f2
MATLAB
1,383
53
function lsscatter(x,y,fitted,attrib) %LSSCATTER makes a scatter plot with regression (LTS/LS) line % % Required input arguments: % x : predictor variabele (without missing values) % y : response variabele % fitted : fitted values corresponding with the regression % attrib : string identifying the used metho...
7094b81375a8ed0972f12d9f2edb7c16b10b22179bf794fbe8fa257fe34f1ec6
MATLAB
1,393
46
% This is an example of how to use weighted NMF on data with missing values. %%%% % Copyright (C) <2012> <Yifeng Li> % % 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 3 of the L...
b86144c8429bf23fe9d0a86c57478924e43953c920438eed81b22ba1368e432d
MATLAB
1,394
61
function [mWV, sWV, xrange] = AverageWaveform(WV,varargin) % AverageWaveform(wv) % % % INPUTS % wv -- tsd of tt or waveform data % % OUTPUTS % mWV - mean waveform 4 x 32 % sWV - stddev waveform 4 x 32 % % % ADR 1998 % % Status: PROMOTED (Release version) % See documentation for copyright (owned by original au...
ae30a6b9d6e1239446e9fda6586082d213e7aab09a4220d35c3107b58f799c28
MATLAB
1,395
46
%% Visualize Data Types with Pie Chart (Modern Colors) % Clear workspace and command window clear; clc; % Display message about cleaning the workspace disp('Workspace and command window cleared.'); % Delete txt files delete('*.txt'); disp('Old text files deleted.'); % Load the cleaned dataset load('combi...
ff4d012d5f7195943d23797cff42795ba696c40f8ac3c936acddfc058ca6cd66
MATLAB
1,397
43
function [pY, mapping] = cv_PerfICA(Y, opt, mode) % function to extract independent components from data % Input: Y - input data (N*D) % Output: pY - output data (N*IC) % in training mode, the ICs are computed; during testing the ICs are % projected onto the unseen data (after unseen data is whitened) global MODELDI...