sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
f5b6abe836577a22f49b9c90140eaac5c5356b4964f5aed40b51adc270aa206d
MATLAB
1,562
69
function T = tn_vector() T.expectation = @TN_vector_expectation; function [exp] = TN_vector_expectation(mus, taus) sigmas = 1.0 ./ sqrt(taus); x = - mus ./ sigmas; %lambdax = norm.pdf(x)/(0.5*erfc(x/sqrt(2))); lambdax = pdf('Normal',x,0,1) ./ (0.5 * erfc(x/sqrt(2))); ex...
a3399e4d5566a4c2eea3861bebcacddc1cdb808fe62c0c35ba456c21cc2db5de
MATLAB
1,563
58
function fdata = fit_seizure(subject_idx,model,npts_per_fit) %matlabpool_cluster(4) debugmode = false; %npts_per_fit = 1e5; padding_minutes = 5; % Start this many minutes before sleep onset d = bt.load_seizure_data(subject_idx,'Cz',30,4); st(6) = 1200; st(10) = 280; st(11) = 720; start_idx = st(subject_idx)...
6e712cddc8230f2075f594478e25df40e1e028fe63a67128855921813b166b63
MATLAB
1,564
53
function parts = strsplit(splitstr, str, option) %STRSPLIT Split string into pieces. % % STRSPLIT(SPLITSTR, STR, OPTION) splits the string STR at every occurrence % of SPLITSTR and returns the result as a cell array of strings. By default, % SPLITSTR is not included in the output. % % STRSPLIT(SPLITSTR, STR, O...
0bd456b5db18a2c88666b54e8ef336e823fa4b2c97ee4dbca8fa16b64b633ee8
MATLAB
1,569
44
function [] = BCI_DAT_to_TSV_converter(foldername) clearvars -except foldername extension = '.dat'; minsize = 9e6; newnames = {'C3'; 'C1'; 'Cz'; 'C2'; 'C4'; 'CP3'; 'CPz'; 'CP4'; 'M1L'; 'M1R'; 'M2L'; 'M2R'; 'M3L'; 'M3R'; 'M4L'; 'M4R'}; mkdir(foldername, 'output'); files = dir(fullfile(foldername, ['*' exte...
bf09036293770d5b2b59d806fdc4fe463c888c9e548006a80a7195526cf64572
MATLAB
1,569
60
function [model] = ml_binaryclass_SVM(X,y,options) % ml_binaryclass_svm(X,y,options) % % Description: % - Fits a linear classifier by maximizing the margin using SVM % % Options: % - addBias: adds a bias variable (default: 0) % - lambdaL2: strenght of L2-regularization parameter (default: 0) [nTrain,nFeatures] ...
142e722ca3425bfed085f17ee760e498655d94f7d254a4cb4d3cfdbe170e78cd
MATLAB
1,571
55
% This is an example of using NMF to find patterns in the core-MYC % signature. % 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 Lic...
ec375d7e7a32c836794d04cb82c53577f92314e7bdb0be1503a3dfb4836c9d25
MATLAB
1,571
48
function [Tdummy, idxCell, idxCellInfo] = nk_ScopeCellRetDummyFromTable(act, T, uniquelim) if ~exist("uniquelim","var") || isempty(uniquelim) uniquelim = 20; end Vars = T.Properties.VariableNames; nVars = numel(Vars); Tdummy = []; Vdummy = []; idxCell = false(1,nVars); idxCellInfo = []; switch act cas...
18859109e3ae7b16bcd9af8df1d3a07e8325a73c33d67509cb19c322f8304ddf
MATLAB
1,572
50
function [ GRAPHSPARSITY, PX, act ] = cv_graphSparsity_config(GRAPHSPARSITY, PX, parentstr, defaultsfl) SparsityPerc = []; if ~exist('defaultsfl','var') || isempty(defaultsfl); defaultsfl = false; end if ~defaultsfl if isfield(GRAPHSPARSITY,'perc') && ~isempty(GRAPHSPARSITY.perc), SparsityPerc = GRAPHSPARSI...
6663186b08f23ca62d09a41d2e096ac5dd5a48d5d0e112abecb630d6b85bbd9c
MATLAB
1,573
61
function Ypet = cv_apply_JuSpace(Yimg, brainmask, atlas, cortype, autocorcorrect, petlist) % add JuSpace path dir_tool = '/opt/matlab/JuSpace_v1.3/'; % create global variable to store atlas matrix global JSMEM % create atlas matrix if not already stored in JSMEM if ~isfield(JSMEM,'atlas_matrix') || isempty(JSMEM.at...
5d2d3260d494923eecbe1fbc6979be531719069fabaf4d34f5c1dbb8d3baa763
MATLAB
1,576
59
function [n, npw, ts, wave] = plx_waves_v(filename, channel, unit) % plx_waves_v(filename, channel, unit): read waveform data from a .plx or .pl2 file % % [n, npw, ts, wave] = plx_waves_v(filename, channel, unit) % % INPUT: % filename - if empty string, will use File Open dialog % channel - 1-based channel number o...
20764be5bc6a9b86f8c965d23b24a16fd2a7f1d9f469d880a348ac15f2706be2
MATLAB
1,579
51
function performance = nk_MultiClassAssessConfMatrix(confmatrix, label, pred, errs, crit) if ~exist('crit','var') || isempty(crit), crit='all'; end sumconf=sum(sum(confmatrix)); P=0; inan = isnan(pred); pred(inan) = []; label(inan)=[]; % Calculate sub confusion matrix for EACH GROUP vs the REST uL = unique(label);...
629ff642c4de091831d4120b582068b8713f18ed5c679afa5187c070bb83b794
MATLAB
1,579
49
% SB2_FORMATTIME Pretty output of diagnostic SPARSEBAYES time information % % STRING = SB2_FORMATTIME(ELAPSEDTIMEINSECONDS) % % % Copyright 2009, Vector Anomaly Ltd % % This file is part of the SPARSEBAYES library for Matlab (V2.0). % % SPARSEBAYES is free software; you can redistribute it and/or modify it % under th...
c8c0932fdacff52c9af69a48ba3cfbdd38edec3c0f9fc7f99ff80126760e29e4
MATLAB
1,579
66
% demonstration file for NMFLibrary. % % This file illustrates how to use this library. % % This file is part of NMFLibrary. % % Created by H.Kasai on July 24, 2017 clc; clear; close all; %% generate synthetic data of (mxn) matrix m = 500; n = 500; V = rand(m,n); %% Initialize of rank to be factorized rank ...
feb9f2a2d2f748e696ba9b5200b95536520f093e9049c787cf6ee1fc9b51ede2
MATLAB
1,579
37
function [ad] = PL2AdTimeSpan(filename, channel, startTime, endTime) % PL2AdTimeSpan(filename, channel, startTime, endTime): read a span of a/d data from a .pl2 file % returns a/d values in millivolts % % examples: % % ad = PL2AdTimeSpan(filename, channel, startTime, endTime) % ad = PL2AdTimeSpan(filenam...
0ba9c2bc8366bb4d79dda3dc80dc9008ad5d93b6f8f5bbb8fd4da816347fcb6a
MATLAB
1,580
63
function db_data = db_fit_make_pp(state,cutdown) % This function returns the db_data corresponding to a single state % db_data contains the power spectrum in the matrix pp % it also has all the corresponding parameter values required to reconstruct it % The n_d cutdown can be applied at this point if nargin < 2 ||...
9a41666676247baf036075d0cba496092d9f9e0a657c554cd5cefaa21881fc09
MATLAB
1,581
43
function palm_error(ME) % Print error messages somewhat similarly as it would % natively in Octave or Matlab, but does not necessarily % crash the calling function, such that PALM can exit % cleanly even if there are errors. % % Usage: % palm_error(ME) % % - ME : MException object (or a struct with % similar fie...
0760e30d84c8eb1e7500d16373616cf24f94b3e70329aca9aec10c9ae8d74f2c
MATLAB
1,583
47
% Pull group info from multiple grouping files. Uses unix 'find' to get all *genotype.txt files % % Jeff Eilbott, 2017, jeilbott@surveybott.com function [genotypes,G] = summarizeGenotypes(path,varargin) p = inputParser; p.addRequired('path',@isdir); p.addParameter('findStr','*genotype.txt',@ischar); p.addParameter('ta...
618b8aea1d544b49422230bf1849fe2364e82fe474c8ccf534e890713898f656
MATLAB
1,587
42
function [nCoords, nDim, nVTMode, c] = plx_vt_interpret(ts, sv); % plx_vt_interpret - interpret CinePlex video tracking data % % [nCoords, nDim, nVTMode, c] = plx_vt_interpret(ts, sv); % % INPUT: % ts - array of timestamps (in seconds) (see plx_event_ts.m) % sv - array of strobed event values (see plx_event_ts.m) %...
600115eb33dcfd4e1ccc87da28388f69bf74ac9bffe343bb88da3ef5433bf624
MATLAB
1,590
46
function [Hpos,Hneg] = diversity_coef_sign(W, Ci) %DIVERSITY_COEF_SIGN Shannon-entropy based diversity coefficient % % [Hpos Hneg] = diversity_coef_sign(W,Ci); % % The Shannon-entropy based diversity coefficient measures the diversity % of intermodular connections of individual nodes and ranges from 0 to 1. %...
c2c2c05a6ea44907c44925080f5f00b4df4661a51dc9b1d60bca139f7e5ccdd2
MATLAB
1,591
71
% demonstration file for NMFLibrary. % % This file illustrates how to use this library. % % This file is part of NMFLibrary. % % Created by H.Kasai on July 24, 2017 clc; clear; close all; %% generate synthetic data of (mxn) matrix m = 150; n = 150; V = rand(m,n); %% Initialize of rank to be factorized rank ...
f80748f93208aa30aa2936ca5f726980f06af183667c7d754af6e0da6f27249c
MATLAB
1,592
63
function testptb() Screen('preference','skipsynctests',2); Screen('Preference', 'TextRenderer', 0); backgroundColour = [0.3 0.3 0.3]; name = 'test'; %-----dots stimulus n = dotsStimulus(); n.name = name; n.size = 5; n.speed = 4; n.dotType = 2; %high quality dots n.dotSize = 0.2; n.density = 25; n.colour = [0.45 0.45...
a60cb53789d57a16706e654e39d4776e2134ab253dfbb665efbd713e7da34bf8
MATLAB
1,595
46
function paramfl = nk_PrepPreprocParams(PREPROC, paramfl, analysis, modalind, ll, curlabel) global VERBOSE MULTI paramfl.PREPROC = PREPROC; if analysis.Model.NumPreMLParams > 0 % Retrieve optimised parameters from GDdims paramfl.PXfull = nk_ReturnParamChain(PREPROC, 1); % Search for parameter ...
6826580c91ceb1fd4ba689f23d65a47eab264b51ad0c0f7cb75fbc9de6d7450f
MATLAB
1,597
56
function W = normalize_W(W, type) % function W = normalize_W(W, type) % % Normalize columns of W using: % 1 - use 1-norm [default] % 2 - use 2-norm % k - multiply the 1-norm by k % % This should work both for matrices and tensors (only for Convolutive NMF) % % 2010-01-14 Graham Grindlay (grindlay@ee.columbia.edu) %...
b577f3f6d0a44bfa086bf46189eec73d159acbaae4ee426e39b4f0121d7bc65b
MATLAB
1,598
45
function formatedClassLabels=changeClassLabels01(originalClassLabels) % Change class labels to 0,1,2,... % Usage: % formatedClassLabels=changeClassLabels01(originalClassLabels) % originalClassLabels: column vector of numbers of string cells. % formatedClassLabels: column vector including the 0,1,2,3,...class labels % ...
a5e0c26bbc126966e0a12d8d022026c0d75b0612b4f6d13e4ebd1328e736dc42
MATLAB
1,601
46
function blocks = components(A) %COMPONENTS Finds connected components in a graph defined by a adjacency matrix % % blocks = components(A) % % Finds connected components in a graph defined by the adjacency matrix A. % The function outputs an n-vector of integers 1:k in blocks, meaning that % A has k components. The v...
4157dc20b0f45484b5e4b04b9c79634c7d83b22bbec1d654f99995416c84083f
MATLAB
1,602
60
function [P,Q,R,SS,Xhat]=estimatePQRS(Y,rank) % Estimate the paramaters of the dynamical systems % This function is called by ds kernel % Y: matrix % rank: scalar, matrix rank %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the terms of the G...
8672b09376d57fe4438f20fb2fd6ab6f2cda07a0d60211678f8edf88399f604d
MATLAB
1,602
46
function UpdateCVDatamat spm5ver = nk_CheckSPMver; if spm5ver P = spm_select(Inf,'.*CVdatamat.*mat','Select CVdatamats'); else P = spm_get(Inf,'*CVdatamat.*mat','Select CVdatamats'); end for i=1:size(P,1) pth = deblank(P(i,:)); fprintf('\nLoading: %s',pth) load(pth) if ~exist('GD','var') ...
53925d19bc91e4988c4201008dfc22cc6d1ff348c6a3726e19620ac8c2a6d997
MATLAB
1,603
43
function [] = BCI_Dat_to_EDF_converter(foldername) clearvars -except foldername extension = '.dat'; minsize = 18e6; newnames = {'C3'; 'C1'; 'Cz'; 'C2'; 'C4'; 'CP3'; 'CPz'; 'CP4'; 'M1L'; 'M1R'; 'M2L'; 'M2R'; 'M3L'; 'M3R'; 'M4L'; 'M4R'}; mkdir(foldername, 'output'); %end added now files = dir(fullfile(fo...
796bff611989f2ba2bc152ee88350bf67eadb47d1861444e3ad88a637841a457
MATLAB
1,604
52
function [CURACT, act] = nk_Unitnorm_config(CURACT, parentstr, defaultsfl) CURACT.UNITNORM = 1; tMETHOD = 1; ZeroOut = 1; CALIBUSE = 2; if ~exist('defaultsfl','var') || isempty(defaultsfl); defaultsfl = false; end if ~defaultsfl if isfield(CURACT,'METHOD'), tMETHOD = CURACT.METHOD; end if isfield(CURACT...
a9a09fef7a21e5516b293bb2824ea09f6c28ee0d3e0ebd7d740d7e6e3c81d0f1
MATLAB
1,604
73
clear all close all for monkey=1 if monkey==1 monkey_name='Jupiter'; elseif monkey==2 monkey_name='Mercury' end n=0; n2=0; n3 = 0; data_name=[monkey_name,'_stepwiseGLM_result.mat']; load(data_name) [a,b]=size(mdl_result); [c,d]=size(mdl_result_TOJ) ...
06bbac1c5d88e460899d91afc2aef9796677e341e011374d0af33a94af753c4c
MATLAB
1,605
45
function [EC,ec,degij] = edge_nei_overlap_bu(CIJ) % EDGE_NEI_OVERLAP_BU Overlap amongst neighbors of two adjacent nodes % % [EC,ec,degij] = edge_nei_bu(CIJ); % % This function determines the neighbors of two nodes that are linked by % an edge, and then computes their overlap. Connection matrix must be % ...
44fa221b9c91f79153bc8dbf3d08b05fb0920d85d0dd6ba2e2c618a336f7f179
MATLAB
1,607
47
function [epoch_wavDS, epoch_wav,f] = EEGep_wav_ds(EEG_ep_choi,oc) % EEGEP_WAV_DS Wavelet decomposition and downsampling of epoched data. % EEGep_wav_ds(EEG_ep_choi,oc) Performs wavelet decomposition on a single channel of % epoched EEG/ LFP data. Epochs are concatenated and z-scored before wavelet decomp. % ...
4d2ec6998223144a7ec5a4a8658dbf9f9b217a4a0ac48332748907eb98ae0e63
MATLAB
1,609
40
function vargout = nk_GetVariateDescription(res, descrip) if exist('descrip','var') && ~isempty(descrip) vargout = descrip; end if isfield(res,'Y') && iscell(res.Y) vargout.num_variates = length(res.Y); vargout.num_variates_str = ['Number of Variates: ' num2str(length(res.Y))]; if isfield(res,'datades...
bbef0850b6aa8549614d7715fa0c981f0a802cf48640050494a1519a00b75eb2
MATLAB
1,609
37
function [cv, K, P] = nk_INDEPpartition(Groups, Labels, LGOflip, OutReps) % ========================================================================= % cv = nk_INDEPpartition(Groups, Labels, LGOflip, OutReps) % ========================================================================= % This function performs a leave-gr...
ec5dd4c9826bf3582164478b5b779993da292004594b57057ddb5ef58733af44
MATLAB
1,613
50
function MAT2DAT(D,dataPointName,dataStr) % Write a dataset in MATLAB into .dat format % Usage: % MAT2DAT(D,dataPointName,dataStr) % D: matrix, each column is a multivariate data point % dataPointName: column vector, the numeric name of each data point, for % example, dataPointName=[0;1;1;1;0;0]; % dataStr: string, the...
28b58a07add10c04d24d3b5b415271210e68c555ceb388f5c6dcadff555b4b05
MATLAB
1,614
50
function [Xdiag, samplesize, accIdx, yvect] = diagonalize(X, y) % ----------------------- Input ------------------------------ % X: cell array. samples of all tasks (each row is a sample) % y: cell array. optional. % % designed for cell arrays. % % ----------------------- Output ----------------------------- % Xdiag...
c239bd0f5654b6dd40d3fa3ecf1ffe4c0a27775ce36f88fa722e48b549e6db25
MATLAB
1,615
55
function [pplus , pminus, delta_plus, delta_minus, marginList, dists] = ... nk_SimbaHelperGpu(g_X_train, g_X_train_square, g_Y_train, Y_train, g_alphas, xs, labelsSet) g_xs = GPUsingle(xs); F = (g_alphas.^2)'; S = g_X_train(g_xs,:); SL = g_Y_train(g_xs); Pnum = size(g_X_train,1); Snum = size(S,1); % P2 =P.^2; P...
fe3058a97feb3908e5197b998997d43d2fc834b2f10ed07fa8f9909446c6fcf0
MATLAB
1,616
46
function [ENSEMBLE, act] = nk_Ensemble_config(NM) %global NM nk_PrintLogo act = nk_input('ENSEMBLE LEARNING PARAMETERS', 0,'m', ... ['Use ensemble learning|', ... 'Classifiers combination strategy|', ... 'Ensemble learning strategy|' ... ...
1c93399222d8dd8e9a3e1b930777f7c69cf6c6e187c5b646ea868bde025d7621
MATLAB
1,618
50
% ======================================================================== classdef myUserFunctions < userFunctions %> @class myUserFunctions %> @brief Customised user functions for a task run %> %> Copy and edit this file to add your own functions and variables for use %> in your task. You can rename the class and ...
d6925ab4a167af146ae2ecb6acadf261395ba5553aad777f44953e3302e2edfc
MATLAB
1,618
55
function test_nmf_online() % % demonstration file for SVRMU. % % This file illustrates how to use this library. % This demonstrates stochastic multiplicative updates (SMU) algorithm and % stochastic variance reduced multiplicative updates (SVRMU) algorithm. % % This file is part of NMFLibrary. % % Created by H.Kasai ...
074988814dd91c2345cfcce75ffbf934a9eaae5f83e61a680db1f687dc7e89f6
MATLAB
1,619
48
function [ LABELMOD, act ] = nk_LabelMod_config( LABELMOD, parentstr, defaultsfl ) LABELMODDEF_SCALE = 1; LABELMODDEF_POLY = 1; if ~exist('defaultsfl','var') || isempty(defaultsfl); defaultsfl = false; end if ~defaultsfl if isfield(LABELMOD,'TARGETSCALE'), LABELMODDEF_SCALE = LABELMOD.TARGETSCALE; end ...
72627dca8b4a3d999eb06a7ef680fa9c476d770371d2837e4baada1c52f6c234
MATLAB
1,621
68
function model = ml_binaryclass_elastic_net(X,y,options) % ml_binaryclass_logistic(X,y,options) % % Description: % - Fits a classifier using logistic regression % % Options: % - addBias: adds a bias variable (default: 1) % - lambdaL2: strenght of L2-regularization parameter (default: 0) % % Authors: % - Nikola...
b1ddc67f92820c0b53002873b3496fdc25334e3d85e996f46f629c962c390660
MATLAB
1,621
42
function nk_PrintLogo(maindlg) global NMinfo EXPERT SPMAVAIL DEV clc if ~SPMAVAIL %cl = [0.1,0.5,0]; mode = 'non-imaging mode'; else %cl = NMinfo.cllogo; mode = []; end if exist('maindlg','var') && maindlg fprintf('\n\t*******************************************') fprintf('\n\t****\\ ...
53ebeb2f5019e9a2fbc348929919a041b05f4caadf83f9b6a635260fc56ce705
MATLAB
1,623
42
function [ nexFile ] = nexAddWaveform( nexFile, WFreq, timestamps, waveforms, name ) % [nexFile] = nexAddWaveform( nexFile, WFreq, timestamps, waveforms, name ) % -- adds waveform variable to nexFile data structure % % INPUT: % nexFile - nex file data structure created in nexCreateFileData % startTime -...
58e18272d146f45e2976c4097f83cd8ed412ab67356cd3807f743b637aed9d60
MATLAB
1,624
45
function [ad] = PL2AdBySource(filename, source, channelInSource) % PL2AdBySource(filename, source, channelInSource): read all a/d data for the specified channel from a .pl2 file % returns a/d values in millivolts % % examples: % % ad = PL2AdBySource(filename, source, channelInSource) % ad = PL2AdBySource...
cb723eb86a1b72d9b2c9b74100a0c488c268c00802b5cb20a857e1137622bd70
MATLAB
1,629
61
classdef HEDTagger < handle %HEDTagger properties outputFormat = 'json' headings = {'onset','timeType','HED','tick','message','uuid','source'} timezone = 'local' end methods function me = HEDTagger() end function setupPython(me) disp('We need Python V3.12 with pip3 command, will try to instal...
35532c46865a0314c730950e37c09d3231011b54658111a5ee8232e58e3a16cc
MATLAB
1,630
61
classdef HEDTagger < handle %HEDTagger properties outputFormat = 'json' headings = {'onset','timeType','HED','tick','message','uuid','source'} timezone = 'local' end methods function me = HEDTagger() end function setupPython(me) disp('We need Python V3.12 with pip3 command, will try to instal...
7907e26b3fd68d81e28a43199abec2c51cd954c3a48dfb9b9b7376a837c86c67
MATLAB
1,630
58
function [ model ] = ml_binaryclass_extreme(X,y,options) % ml_binaryclass_extreme(X,y,options) % % Description: % - Classifies data using generalized linear model with a extreme link % - In order to fit the data, link is passed to % MATLAB's glmfit, along with the design matrix and label vector % % Options: % ...
f11bf08f3b578e1f5f0864292e5acf28d8a90530fec52d63cd3c85872a9c17eb
MATLAB
1,631
54
function [varargout] = RenyiMIToolbox(functionName, alpha, varargin) %function [varargout] = RenyiMIToolbox(functionName, alpha, varargin) % %Provides access to the functions in RenyiMIToolboxMex % %Expects column vectors, will not work with row vectors % %Function list %"Entropy" = H_{\alpha}(X) = 1 %"MI" = I_{\alpha}...
f1bf55f2d30da22fcd7c4bd9fd4720e8dc4db2a2853de2053fdd7590f65e507a
MATLAB
1,631
60
function D = agreement(ci,buffsz) %AGREEMENT Agreement matrix from clusters % % D = AGREEMENT(CI) takes as input a set of vertex partitions CI of % dimensions [vertex x partition]. Each column in CI contains the % assignments of each vertex to a class/community/module. This function % aggregates the partit...
5a6eb59affb4537712126c8a8fdd560f44b9827bd77589587c40f801382fd9f4
MATLAB
1,632
61
clear all close all for mm = 2 if mm ==1 name = 'Jupiter'; elseif mm == 2 name = 'Mercury'; elseif mm ==3 name = 'Mars'; end load([name,'_test_data_v3_align0to8.mat']) bin_size_constant=250; bins_max=(data.trial_length-500)/bin_size_constant; it=500; f_bins=bins_max; f_bin_siz...
c01536fa9b8c819091a8ff8761db2d27e93e6fbdd2ab39d6b398c7dc607a2c42
MATLAB
1,632
62
classdef SpikelistCluster < MClust.ClusterTypes.DisplayableCluster % keeps list of spikes properties(SetObservable) mySpikes = []; end methods(Static, Access=public) function bool = Modifiable() bool=true; end end methods % --------------------------- Constructor fu...
7db47299e972b0385d15735ee29ce7be62bb2d5ccf689ce971570cdcbeb31cef
MATLAB
1,633
65
<<<<<<< HEAD function map = spectral(m) % Returns MNI's black-purple-blue-green-yellow-red-white colour map. if nargin < 1 m = size(get(gcf,'colormap'),1); end values = [ 0.2000 0.2000 0.2000 0.4667 0.0000 0.5333 0.5333 0.0000 0.6000 0.0000 0.0000 0.6667 0.0000 0.0000 0.8667 0.0...
64983656b54f36e1a8391491142a6d0b35712a10e1be73d3a5ff359b26a36eac
MATLAB
1,635
67
function CutterOption_CompareAverageWaveforms(self) % plots average waveforms of only shows % % INPUTS % % OUTPUTS % % NONE % ADR 2013 % % 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 con...
fefcde2da4bbfcac70e5df6c885ea19fef5f8791aa87af1061321cbe11368762
MATLAB
1,648
41
function perf = ComputeEnsPerf(perf, O) nclass = size(O.TrHDperf,3); % Ensemble performance perf.Ens_TrDecPerf = O.TrHDperf; perf.Ens_CVDecPerf = O.CVHDperf; perf.Ens_TrTargPerf = O.TrHTperf; perf.Ens_CVTargPerf = O.CVHTperf; perf.Ens_TrTargDiv = O.TrDiv; perf.Ens_CVTargDiv = O.CVDiv; for curclass...
a809c74179e88663851f63046be50b00a34b1858964ff476f66ef2d6ef9b4295
MATLAB
1,652
50
%% FUNCTION LSSMTC % permute labels of L2 match L1 as good as possible % %% LICENSE % 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 License, or % (at your optio...
b17149f4de51ffff9e705be7d0b1f616a26eca96db7b9d5a150540c2def29d09
MATLAB
1,652
63
function [U, solver_output] = solveU_ind(U0, V0, Ss, reg_l1, solver_options) % solve U using non-negative l1 regularized regression. solver = @pnopt_sparsa; if nargin<5 solver_options = pnopt_optimset(... 'display' , 0 ,... 'maxfunEv' , 5000 ,... 'maxIter' , 500 ,... 'ftol'...
0301a5589e003ac49fa54841ba85eb878eed4ab5d5c4ae117969775d270764fd
MATLAB
1,653
35
%%% script to plot the typical tempos as a function of typical body masses % the data: (tempos in Hz, typical body masses in mg) % ref_nums correspond to the 3rd revision of the manuscript (hopefully won't change) % fireflies (5) crickets (2) crabs (2) fish (3) frogs (3) ...
63c4cd644ebae5b6e9b99ebe518d71026cffd45f229bc8d27ddbdd9011f8f3bd
MATLAB
1,655
57
function [ model ] = ml_binaryclass_Cauchit(X,y,options) % ml_binaryclass_Cauchit(X,y,options) % % Description: % - Classifies data using generalized linear model with a Cauchit link % - In order to fit the data, link is passed to % MATLAB's glmfit, along with the design matrix and label vector % % Options: % ...
58c918baad5df36dcfdc05c1a82e007ff96be102148ca0ecfe9e416931e05432
MATLAB
1,657
56
function [model] = ml_binaryclass_bagging(X,y,options) % ml_binaryclass_bagging(X,y,options) % % Description: % - Classification based on the highest prediction among models to bootstrap samples. % % Options: % - subModel: name of the underlying model (default: brokenStump) % - subOptions: options for subModel...
7707ee72ac2faf31828fb9d14a425ebe535de8bff22944d17022fef380c41110
MATLAB
1,657
41
function [upcovar,upmu] = updatecov(data,covar,mu,addrow,delrow,option) % This function updates the mean and covariance matrix of the full data % after adding or removing observations. % % Input arguments: % data : the original data % covar : the covariance matrix of the data % ...
cfdd205f2a09945ee8c039a4f441e5d1f470aaa58f8dd1604411b2b734b55089
MATLAB
1,662
58
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 ...
302d0fa3b2601153acaa24eb7984c7f97398bcb293cbb4debf93e1284956c164
MATLAB
1,673
52
function [label, n_subjects]= nk_DefineLabels(V, label, n_subjects, modeflag, addfl, CVstr, NaNflag) fprintf('\n\n*** Label definition ***\n') if exist('label','var') && ~isempty(label) fprintf('\nPrevious %s-subjects'' label vector detected.', CVstr) if addfl fprintf('\nAdding new labels.') else ...
1018fd335d17b2e20b62849dc0fdaf9dd0ea7c329bd46471e7e8bc29f9bfca6b
MATLAB
1,674
58
function result=hl(x) %HL computes the Hodges-Lehmann location estimate on the columns of x. % The Hodges-Lehmann estimator is defined as % hl(x)=med {(x_i + x_j)/2} with 1<=i<j<=n % It can resist about 29% outliers. % If x is a matrix, the location estimate is computed on the columns of x. The % result is...
dc331afb495d79ce7750b66f99745527633c6f41a651ecb71c7734e7a7e7f37e
MATLAB
1,675
48
function [K, runtime, Phi] = SPkernel(Graphs, features) % Compute the shortest path kernel for a set of graphs (by exact matching % of shortest path lengths) % Copyright 2012 Nino Shervashidze % Input: Graphs - a 1xN array of graphs represented just with adjacency matrices % Graphs(i).am is the i'th adjacency matrix ...
e0016c77f75e65bc1c3a94be5d1ebfeeb045e8dcca65c0b6f64fc6a3a97e767c
MATLAB
1,675
41
function varargout = nifti_stats(varargin) % Conversion among various statistics % FORMAT P = nifti_stats(VAL,CODE,OPT,PARAM) % CODE can be one of % 'CORREL' 'TTEST' 'FTEST' 'ZSCORE' % 'CHISQ' 'BETA' 'BINOM' 'GAMMA' % 'POISSON' 'NORMAL' 'FTEST_NONC' 'CHISQ_NON...
46d230f4430464bdbbf9e5f048a386a4b06dfe4951973a9c10fcacc1043cb46a
MATLAB
1,682
38
function [act, param] = nk_GA_config(param, defaultsfl, parentstr) GA.N = 10; % Number of chromosomes GA.max_Iter = 100; % Number of iterations GA.CR = 0.5; % Cross-over ratio GA.MR = 0.5; % Mutation ratio if ~exist('defaultsfl','var') || isempty(defaultsfl), de...
be36811a613469447418ea49b5b4f19045a2555f5abbfc9fe8d4364931f1e56b
MATLAB
1,682
49
% This is an example of how to use nmf to dicover biological process and how to draw % the heatmap afterthat. %%%% % 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 Foun...
dee70bca4cd2991bacd48e846de9cd337699893fa553f157d452de11333cd12f
MATLAB
1,684
60
function weights = RGSonce(X_train, Y_train, extra_param) m = size(X_train, 1); % Number of subjects p = size(X_train, 2); % Number of dimensions if ~isfield(extra_param, 'k'), extra_param.k = ceil(log2(size(X_train,1))); if extra_param.verbose, fprintf(' k = %g', extra_param.k); end; end k = extra_param.k; if ~...
9226040d7cf923347ec37a63a167671a1703d5c34f0496c1cbbcf919cc8323d3
MATLAB
1,687
56
function [adfreq, n, ts, fn] = plx_ad_gap_info(filename, channel) % plx_ad_gap_info(filename, channel): read a/d info from a .plx or .pl2 file % % [adfreq, n, ts, fn] = plx_ad_gap_info(filename, channel) % % INPUT: % filename - if empty string, will use File Open dialog % channel - 0-based channel number or channel...
30c0da278a2228e5cc64423c1186272fa66de77ef8168e8890e077a18afc68b1
MATLAB
1,690
61
%% FUNCTION trace_projection % solves the Trace-norm projection problem. % %% OBJECTIVE % argmin_X = 0.5 \|X - L\| + alpha/2 \|L\| % %% LICENSE % 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...
a3e8c896be49bd2a9124bd3f9596f276847f50f336c25160f12981917ad85859
MATLAB
1,690
24
% Helper function with presets. function J = customcolormap_preset(preset_name) switch(preset_name) case 'pasteljet' J = customcolormap([0 .25 .5 .75 1], {'#9d0142','#f66e45','#ffffbb','#65c0ae','#5e4f9f'}); case 'red-yellow-blue' J = customcolormap(linspace(0,1,11), ...
d10bbd4c011264543469bb9ec00aa59d39654fd9cd11ba8f0f21958008b39552
MATLAB
1,690
50
function [D,Reg_all] = mean_time_course_NM(data_mean,data_ROI,numberROIs,image_for_size) %[D,Reg_all] = mean_time_course(data_for_mean, mask_ROIs,numberROIs) global JSMEM size_data = size(data_mean); % resize atlas to image_for_size (NM.brainmask) if ~isfield(JSMEM, 'ROI_matrix') || isempty(JSMEM.ROI_matrix) [ROI...
de00805b0c26ba731ea3d969e542847d4f7e3acb07272a50cdc24a9be0798d65
MATLAB
1,695
59
% ======================================================================== %> @brief annulusStimulus TODO %> %> %> %> Copyright ©2014-2022 Ian Max Andolina — released: LGPL3, see LICENCE.md % ======================================================================== classdef annulusStimulus < baseStimulus properti...
f65074e1acb4ef7fb0ec621a229072ffa47e2a5fe3e0e5999db7f5ab8408e02d
MATLAB
1,699
90
function [vertex,face] = read_vtk(filename, verbose) % read_vtk - read data from VTK file. % % [vertex,face] = read_vtk(filename, verbose); % % 'vertex' is a 'nb.vert x 3' array specifying the position of the vertices. % 'face' is a 'nb.face x 3' array specifying the connectivity of the mesh. % % Copyright (c)...
2317749f5aa4e434051473fcf8db39a202e5e1bc25fc50ab20bb3a9eac3725a0
MATLAB
1,701
43
function [pY, mpp] = nk_PerfICA(Y, mpp, k) % Default values for 'pcamat' parameters Dim = size(Y,1); firstEig = 1; lastEig = Dim; interactivePCA = 'off'; verbose = 'on'; if ~exist('mpp','var') || isempty(mpp) % Calculate PCA options.ReducedDim = 0; [mpp.eigv...
710e88534114420d2c64e30ed9b28b0126afa1160ee8df10b836696c68761e57
MATLAB
1,703
64
function [U, solver_output] = solveU(U0, V0, Ss, reg_l1, solver_options) % solve U using non-negative l1 regularized regression. solver = @pnopt_sparsa; if nargin<5 solver_options = pnopt_optimset(... 'display' , 0 ,... 'maxfunEv' , 5000 ,... 'maxIter' , 500 ,... 'ftol' ...
0eef66117992b01cfcafe0902f3477487d1e24fd8902b96da01b8abb822c42b4
MATLAB
1,704
46
function demoCompactEditableComboBox % demoCompactEditableComboBox Demonstrate CompactEditableComboBox. % % Put this file, CompactEditableComboBox.m, % CompactEditableComboBoxEventData.m, and compactEditableComboBox.html in % the same folder, add that folder to your MATLAB path, then run: % % demoCompactEditableCombo...
6c73ce862538f97a49aecebd8f762127f7b24a68729f194df6f347004bfbc90e
MATLAB
1,704
48
function [EC,ec,degij] = edge_nei_overlap_bd(CIJ) % EDGE_NEI_OVERLAP_BD Overlap amongst neighbors of two adjacent nodes % % [EC,ec,degij] = edge_nei_bd(CIJ); % % This function determines the neighbors of two nodes that are linked by % an edge, and then computes their overlap. Connection matrix must be % b...
1aef0f4ee8a455d2ad1a38c37768d43aea149c99fa5b1eeeab0545ab1c7882a7
MATLAB
1,707
86
function [ Sf, curve ] = jGA1(r, Ps, N, max_Iter, CR, MR) fun = @jFitnessFunction1; funop = str2func(r.evaldir); dim = size(r.Y,2); X = false(N,dim); for i = 1:N for d = 1:dim if rand() > 0.5 X(i,d) = true; end end end fit = zeros(1,N); fitG = inf; for i = 1:N fit(i) = fun(r , X(i,:), Ps ); ...
1f9f88b8976cbc2f9fe6f1303fd4c8418436b645f2f2626ceb724f47b5ca3479
MATLAB
1,711
62
function [distance,branch] = breadth(CIJ,source) %BREADTH Auxiliary function for breadthdist.m % % [distance,branch] = breadth(CIJ,source); % % Implementation of breadth-first search. % % Input: CIJ, binary (directed/undirected) connection matrix % source, source vertex % % ...
6c9b20ba8af79e400633f3bc9f99b8ac020dc50df2135292e7f305607990ae9c
MATLAB
1,715
61
function [t, wv] = LoadH5(varargin) % MClust loading engine for simple h5 files with spikes data. % % Aug 2022 % Fernando Chaure if nargin == 2 % New "get" construction" if strcmp(varargin{1}, 'get') switch (varargin{2}) case 'ExpectedExtension' t = '.h5'; return; ...
3dfdae3e5bed90cbd4b3697a61e6eb1ad2db3417731816bf6887607d76e9cd23
MATLAB
1,717
77
% if there are multiple blocks, save the processed data for each block % separately in its own folder function saveROI(h) proc.files = h.files; proc.nframes = h.nframes; proc.rootfolder = h.rootfolder; proc.nX = h.nX; proc.nY = h.nY; proc.sc = h.sc; proc.useGPU = h.useGPU; proc.ROI = h.ROI; proc.eROI = h.eROI; proc.l...
8d670b0647b65a05c6c9ac5236836163206bf288751917aa4689172c44aa8d0e
MATLAB
1,717
55
function [pValueTail, rev] = mbm_estimate_p_val_tail(null, observe, pThr) % Calculates p-value (2 sides) by comparing the observed value and the distribution of the null samples. % %% Inputs: % null - matrix (nxm) of null samples, where n is the number of null % sample and m is the number of elements in...
22b3d2681d5d6c1e8f859406575dfeed7ca4cc30c7393096ba08ef7f5b1805b1
MATLAB
1,721
46
function output = load_seizure(subject_idx,electrode,window_length,fft_length) % Generate a series of spectra from the seizure data % 6, 10, 11, 13 are good examples if nargin < 3 || isempty(electrode) electrode = {'Cz'}; elseif ischar(electrode) electrode = {electrode}; end if strcmp(electrode{1},'all') ...
36be2cf46203cbf64c250731fbb454ee66d1511749c2d05efa99692da2649776
MATLAB
1,721
88
classdef ts % ts object % % Rebuilt ADR 2011/12 % contains: T - a n x 1 sorted list of timestamps % % ts objects assume that % -> T is stored in seconds % ------> ts objects do NOT assume T is sorted in ascending order % % ts objects no longer accomodate units % if you absolutely need units, create a subcl...
79ac31a5e53b24949090440ab994df3687d149d2266189c0004a3f7dadd90c66
MATLAB
1,723
41
function ms = msMeanFrame(ms, downsample) %MSMEANFRAME Summary of this function goes here % Detailed explanation goes here meanFrame = cell(size(ms.alignmentROI,2),1); minFrame = cell(size(ms.alignmentROI,2),1); maxFrame = cell(size(ms.alignmentROI,2),1); for ROINum=1:size(ms.alignmentROI,2) ...
8587ee766f50a56f2831c3ff28d0500c24a8343e9626791c9a3840c5c4f829be
MATLAB
1,725
41
function T=transitivity_bd(A) %TRANSITIVITY_BD Transitivity % % T = transitivity_bd(A); % % Transitivity is the ratio of 'triangles to triplets' in the network. % (A classical version of the clustering coefficient). % % Input: A binary directed connection matrix % % Output: T transitiv...
f65e951a8ff97848742803c3246cb3a383c1c2600154d943dc8f4a87f555edbb
MATLAB
1,726
63
function varargout = pnopt_curvtrack( x, d, t, f_old, dg_x, smoothF, nonsmoothF, ... desc_param, xtol, maxIter ) % pnopt_curvtrack : Curve search for step that satisfies the Armijo condition % % $Revision: 0.8.0 $ $Date: 2012/12/01 $ % % ------------ Initialize ------------ % Set line search parameters beta ...
322c4aa2e7180f16fcd991c8ed35fe83a2ea7c0988902d8ba574386ba996d027
MATLAB
1,729
64
function [MATreordered,MATindices,MATcost] = reorderMAT(MAT,H,cost) %REORDERMAT Reorder matrix for visualization % % [MATreordered,MATindices,MATcost] = reorderMAT(MAT,H,cost); % % This function reorders the connectivity matrix in order to place more % edges closer to the diagonal. This often helps in dis...
26e936d2e46dfb91cf922212225c661ec1a62d55594a90a68312637cf1bb5e15
MATLAB
1,733
47
function est = mripy_est_from_GCM(GCM, norm) % Extract estimates from a GCM object. % est.A, est.B, est.C, est.PA, est.PB, est.PC if nargin < 2 norm = false; end if norm % Ep./sqrt(Cp) DCM = GCM{1,1}; index = []; count = 0; for x = 'abc' idx = (1:numel(D...
26ec02ac0625b664a6c5cf1da565a2dce6ff27676f1487d398970c453b8ec83c
MATLAB
1,735
60
function plotNemenyiTest(rankCl,CD,classifiers,saveFigName) % plot the graph of the result of Nemenyi test, this function is usually % used after the FriedmanTest function % rankCl: column vector, the ranks of all classifiers % CD: scalar, the critical difference % saveFigName: string, the file name to be saved in the ...
e6ad95d70fa4b333213227f550b0ccd70fc45d20293cb0c114c594c46d106f2e
MATLAB
1,735
51
function [ord all_ord ord_skip rev rev_skip] = cuepair_trialtypes(sessdir, TEfnm) %CUEPAIR_TRIALTYPES sorts trials based on diffulty of presented cue pair. % CUEPAIR_TRIALTYPES sorts trials into following groups based on cue pair: % - ordered, i.e. numbers are in ascendent order: 12, 23 (level of conflict: lowest) ...
64da9d78ec81974f3ec44cddbc736e0687a3b2ffb9efb123f84b7fcf9b18fc29
MATLAB
1,736
47
function replaceStartleGeno(varargin) p = inputParser; p.addParameter('data_path','/gpfs/ysm/project/hoffman/ejh22/bioinfo/startle/data',@isfolder); p.addParameter('geno_path','/gpfs/ysm/project/hoffman/ejh22/bioinfo/misc/corrected_genotype_10072019/VSR',@isfolder); p.addParameter('rm',true); p.addParameter('dryrun',tr...
211f3edf9f31df370517a0a91b82e36f45d41f9e397acf59d8ea1d7c3c327422
MATLAB
1,740
90
classdef eyeOccluder < optickaCore %UNTITLED Summary of this class goes here % Detailed explanation goes here properties verbose = true address@cell = {'/dev/tty.usbmodemfa231','/dev/tty.usbmodem5d11'} end properties (SetAccess = private, GetAccess = public) serialLink isOpen = false end methods ...
9d7d49a8e42fd09cb937491eee64ad7c68c125c5403c60749af2ea627dba3b0d
MATLAB
1,741
58
function inp = nk_GetAnalModalInfo_config(NM, inp) global FUSION STACKING MODELDIR if ~isfield(NM,'analysis'), inp=[]; return; end if ~isfield(inp,'analind') || isempty(inp.analind) t_act = 1; while t_act>0, [t_act, inp.analind] = nk_SelectAnalysis(NM, 0, 'MAIN INTERFACE >> SELECT ANALYSIS', 1, [], 0, 0); end end ...
9ceab50937800b4d2803f00869141b3f0defd8f22be863f495d90ee87dcfcf3b
MATLAB
1,742
41
classdef io % a class for input and output functions methods (Static) function im_data = load_image(im_file) % im_data = load_image(im_file) % load an image from disk into Caffe-supported data format % switch channels from RGB to BGR, make width the fastest dimension % and conve...
307674d63e2c595d320f70839000fc500e487b4919a0c31a5fb4fdb5efc6be0f
MATLAB
1,745
48
function [status, paramstr] = nk_GetNMStatus(NM) status = struct( 'import_finished', false, ... 'setup_ok', false, ... 'analyses_exist', false, ... 'analyses_ready', false, ... 'analyses_completed', false, ... 'analy...
232e03f0d941f510195e2f6d43c08f7915d4ca00ce82eedb071b1170460b918a
MATLAB
1,746
30
function PREPROC = nk_SetParamChain(paramfl, curclass, PREPROC) if isfield(paramfl,'PREPROC') && isfield(paramfl,'PXfull') && ~isempty(paramfl.PXfull) PREPROC = paramfl.PREPROC; %cnt = numel(paramfl.PREPROC.ACTPARAM); curstep = 0; for y=1:size(paramfl.PXfull.cmd,1) % Set ACTPARAM if ~exist('PX'...
b18426da028b94927a54e93d7523f68a6b3169fc3bd298de1b0d70d1ca93a914
MATLAB
1,746
47
function T=transitivity_wd(W) %TRANSITIVITY_WD Transitivity % % T = transitivity_wd(W); % % Transitivity is the ratio of 'triangles to triplets' in the network. % (A classical version of the clustering coefficient). % % Input: W weighted directed connection matrix % % Output: T transit...