sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
41fd5fd6d8218a3a18e1e99cf8019dcb90c60302562662e9a5659a0c01625b88
MATLAB
3,487
100
function [P, beta] = d2p(D, u, tol) %D2P Identifies appropriate sigma's to get kk NNs up to some tolerance % % [P, beta] = d2p(D, kk, tol) % % Identifies the required precision (= 1 / variance^2) to obtain a Gaussian % kernel with a certain uncertainty for every datapoint. The desired % uncertainty can be specified...
e745568617b0646b7d29a30f03d3fc6bfb65f0e706c9001e9ce7af4303dded94
MATLAB
3,487
78
function [sz_str, mess, IO] = CheckGlobals(IO, act, na_str, mess) if ~exist('mess','var') , mess=[]; end sz_str = na_str; if strcmp(IO.globvar_edit,na_str), return; end nP = size(IO.PP,1); flg=false; try switch act case 'check_globvar' globvar_str = sprintf('Var: ''%s''',IO.globvar...
e15bf9df46bee9ef3bcf4143be16219c0c0507e1f29f4243ff258b7535e4652f
MATLAB
3,495
91
function sY = nk_PerfSpatFilt( Y, CURACT, Param ) if isfield(CURACT,'SPATIAL') && CURACT.SPATIAL.cubetype>1 % If data fusion has happened before the smoothing % extract the modality, smooth it and fuse it again S = CURACT.SPATIAL; dimvecx = Param.dimvecx; if iscell(Param.brainmask), nM = numel(Par...
db5e0ab70bff9a8ed51a97437ff7ab37d39a0a8cca76d638336aaed865a41f7f
MATLAB
3,501
124
function result=mloclogist(x,varargin) %MLOCLOGIST is an M-estimator of location with psi-function equal to % (exp(x)-1)/(exp(x)+1) and with an auxiliary scale estimate. % It is iteratively computed. It can resist 50% outliers. % If x is a matrix, the location estimate is computed on the columns of x. The % result is...
2f8338f3037338981271d779652b3c4dc9eaf57280527666da510403f15bdf64
MATLAB
3,502
140
function [Eres,prob_SPL] = resource_efficiency_bin(adj,lambda,SPL,M) % RESOURCE_EFFICIENCY_BIN Resource efficiency and shortest-path probability % % [Eres,prob_SPL] = resource_efficiency_bin(adj,lambda,SPL,M) % % The resource efficiency between nodes i and j is inversly proportional % to the amount of resou...
34f4039e7d02559b8b441658158b59bc1e650d2e7220f9ff802df56fff077e10
MATLAB
3,502
73
function [weights, score] = nk_SimbaMain(X_train, Y_train, extra_param, gpu) % alphas = simba(X_train, Y_train, extra_param); % % input: X_train(i,j) is the value of feature j in training instance i. % Y_train(i) is the label of training instance i. % extra_param is a struct that may cont...
96d68bdd7c557dae965353bba7031078acbd46faa2f1f4df4975f1adff278503
MATLAB
3,502
87
<<<<<<< HEAD % GIfTI Class for MATLAB % % Geometry format under the Neuroimaging Informatics Technology Initiative % (NIfTI): % http://www.nitrc.org/projects/gifti/ % http://nifti.nimh.nih.gov/ % % This MATLAB class is part of SPM: % https://www.fil.ion.ucl....
8cc2dbc82f741ffc2d811a2f3ac6be2f984a5a17f7906325d08aefa46e1d3b0a
MATLAB
3,517
100
function [k,rho,kSuggested]=chooseBestk(X,option) % Model selection. Search the best number of clusters based on dispersion Coefficients from k=1 to sqrt(#column). % X: matrix, as input of a NMF, each column is a data point % option: struct, % option.rerun: scalar, the time of reruning NMF for a k, the default is 3; % ...
ea544c9a10efca7e828aec129c1ad579e9ba58587d2a33b18673771608242f7c
MATLAB
3,520
125
function [ W, info, Thstar ] = MTFLCd_DSolver( X, y, lambda1, lambda2, opts ) % % Multi-Task Feature Learning with Calibration % diagnoal version for faster computation on small sample size. % dual projected gradient -- using solver. % % OBJECTIVE % min_W { sum_i^m ||Xi wi - yi|| + lambda1 ||W||_{1,2} + lambda2/2 |...
71293f35143c1521567b79535f80e4f345ede33891fbccce9fa4ae3eb13d0a80
MATLAB
3,527
105
function [ fY, C ]= nk_SpatFilt(Y, SPATIAL) if isfield(SPATIAL,'PX') && numel(SPATIAL.PX.opt)>1 n_opt = numel(SPATIAL.PX.opt); else n_opt=1; end fY = cell(n_opt,1); if ~isempty(SPATIAL.badcoords); tY = zeros(size(Y,1),size(SPATIAL.badcoords,2)); tY(:,~SPATIAL.badcoords) = Y; else tY = Y; end for...
75ec05b06592b69addd3b20aa62c749fd4cf34559ebfdcd7d8cadecb26292106
MATLAB
3,529
82
%% ================================================================ % Script: generate_individual_networks.m % Purpose: % Generate individualized functional networks for each subject % using the template-matching (TM) approach. % % Description: % - Applies MSC-derived group templates to each subject (MSC/...
51ea0a9ca6e5a56d44eb4fc0b4b319e44e18aa8c953e3817170a596e001a3e96
MATLAB
3,532
103
function h = bootstatFDR_clustercorr(zmap_p,mask,ff,rectime,rectype,act_chan,varargin) % BOOTSTATFDR_CLUSTERCORR Cluster-based correction of stat. result obtained % by testing significant change in time-frequency data relative to baseline. % bootstatFDR_clustercorr(zmap_p,mask,ff,rectime,rectype,act_chan,...) % ...
99a7ef47e31894bab1033177465fdf5998ee3a5c11fd665265d83b6ee6cdeae7
MATLAB
3,532
88
%========================================================================== %FORMAT OUT = MultiDichoFoldPerm(IN, OUT, F) %========================================================================== %MULTI-GROUP CLASSIFICATION PERFORMANCE EVALUATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
b7f83d939a1a8b99aa8031a06caba5e6cd96fa34b519b19eff68f8d4c87c1976
MATLAB
3,535
84
function CI = polyparci(PolyPrms,PolyS,alpha) % POLYPARCI takes PolyPrms, the 1xN vector of parameter estimates from polyfit, % PolyS, the structure returned by polyfit, and alpha, and returns the % alpha confidence intervals for the parameters in CI. The default % for alpha is 0.95. % % RETURNS: CI (2xN ma...
c1f208034dd1d8ab8951672d9473db78914b855bf55c739e434e1d27f5037735
MATLAB
3,557
108
function [meanInner,medianInner,ARI,sortedBasisNum] = evaluateReproducibility(pathDir1,pathDir2) % function that evaluates the reproducibility between the results obtained % for two different splits % The scripts assumes that experiments using the same range of components % have been performed for both splits % outpu...
6c83037fe578bbb7ad2f3a21df3cc69b37cd1360eb094addbdfe7a4c39f5a80b
MATLAB
3,559
128
% ======================================================================== classdef joystickManager < optickaCore %> @class joystickManager %> @brief Manages the Simia Joystick %> %> Copyright ©2014-2023 Ian Max Andolina — released: LGPL3, see LIv12345c12345CENCE.md % ===================================================...
8112c706eb2c0efdaf2d87b7c39bc6ad103a2f4bf8f15c9db3cf0d22036476d2
MATLAB
3,563
102
function preop_postop_RT(grnm,conditions) %PREOP_POSTOP_RT RT change relative to preop condition % PREOP_POSTOP_RT(grnm,conditions) calculates RT difference between preop % and all other task conditions for the specified patient groups. % % Required inputs: % GRNM cell array of patient group la...
2ef21609f1f52f03bc8bf53e7c7a6f609d95f4658a57dbb82a640e571e81a59c
MATLAB
3,568
96
clear load('ProcessedData\Footprints_MasterTable.mat') load("ProcessedData\OutputTable.mat") load("ProcessedData\PreProcessed.mat") load('ProcessedData\tables_compiled.mat'); % load('animal_Names_Responses.mat') %% set these things first % scaling value for cell size; bigger number makes the cells smaller ...
61d37271f96ceb8a4ed995e343c81a96573bc200065cf0da40a5cf81bb30fc5b
MATLAB
3,570
114
function y = randsample(n, k, replace, w) %RANDSAMPLE Random sample, with or without replacement. % Y = RANDSAMPLE(N,K) returns Y as a 1-by-K vector of values sampled % uniformly at random, without replacement, from the integers 1:N. % % Y = RANDSAMPLE(POPULATION,K) returns K values sampled uniformly at % rando...
f06827a3e29c217481df74c85fa57266743d06cc1518e8503dde2f505e8217ac
MATLAB
3,575
98
function [allDiffLAT_P1Go,allDiffLAT_N1Go,allDiffLAT_P1MovOn,allDiffLAT_N1MovOn,allRT1,allRT2,allBestLag_rVal]=f_CalcDifferenceLatencies_Solo_or_JaSim_Sh(LAT,contrast,fs,saveFig,t_start,t_end) % contrast=1: solo/solo (randomly paired solo trials) % contrast=4: jaSim (randomly paired ja trials) allDiffLAT_P1Go=[]...
42e41f59c07b5181bdf16cd939d924878d3c53cf7f9581941ae64f57f5723629
MATLAB
3,579
89
function PX = nk_ReturnParamChain(PO, optimonly) if ~exist('optimonly','var') || isempty(optimonly), optimonly = false; end nP = 1; if iscell(PO), nP = numel(PO); end PX = struct('Params',[],'Params_desc',[],'Typ',[],'cmd',[],'steps',[],'stepparams',[],'opt',[]); for n=1:nP Params = []; Params_desc = []; Typ...
02c1eca20c926254e62b345f7b747279cd37a8ba8e8a48a8151672f3604dcc53
MATLAB
3,590
108
function [allDiffLAT_P1Go,allDiffLAT_N1Go,allDiffLAT_P1MovOn,allDiffLAT_N1MovOn,allRT1,allRT2,allDiff_RT,allBestLag_rVal,allICD_lat]=f_CalcDifferenceLatencies_SoloObs_or_JA_perChDir_vSh(LAT,contrast,fs,saveFig,t_start,t_end) % contrast=2: solo/obs % contrast=3: ja/ja tsBeforeMtOn=round(t_start*fs); allDiffLAT...
a3c6a0ccb17aaab401857eb15be57e14a8176de14b6abad65daf5a98ba63dba3
MATLAB
3,593
131
function [AtA,Y,numIter,tElapsed,finalResidual]=superkernelseminmfnnls(X,L,k,option) % Supervised Kernel semi-NMF based on NNLS: phi(X)=A_phiY, s.t. Y>0, diag(AtA)=I. % solve the problem: % min_{A,Y,xi} 1/2|X-AY|_F^2 + 1/2|w|_2^2 + C'xi % s.t. Z'w + xi <= L % Y>=0 % xi>=0 % where Z=[1;Y]; % to be finished......
d81aff6177889274ac5d3f7e18d66ddb686dd1be4fb32f3ebe3bb68989ad7016
MATLAB
3,597
104
function [P, beta] = x2p(X, u, tol) %X2P Identifies appropriate sigma's to get kk NNs up to some tolerance % % [P, beta] = x2p(xx, kk, tol) % % Identifies the required precision (= 1 / variance^2) to obtain a Gaussian % kernel with a certain uncertainty for every datapoint. The desired % uncertainty can be specifie...
ec92adc43e53d05525ee459bc076279adaff7fd53276e1b12705dd8523956499
MATLAB
3,599
100
function T = printvis_ranked_cross_binary(analysis, fld, reorder, features, nfeat, act) % T = printvis_ranked_cross_binary(analysis, fld, reorder, features, nfeat, act) % ============================================================================== % The algorithm computes the mean of fld across available binary % cla...
52a4093aa43607b0062859d390e3f9d4b33d84a1c37f1cfad2152e4674c61ee1
MATLAB
3,600
74
function mapYi = nk_MLOptimizer_ExtractDimMat(mapY, dim_index, cPs) global PREPROC STACKING MULTILABEL RAND [m,n,o] = size(mapY.Tr); mapYi = mapY; mapYi.Tr = cell(m,n,o); mapYi.CV = cell(m,n,o); mapYi.Ts = cell(m,n,o); IMPUTE.flag = 0; if iscell(PREPROC), iPREPROC = PREPROC{1}; else, iPREPROC = PREPROC; end BINMOD...
d713bf159365cbbe51b966607d7a481248b41b599e6fa9161640ebb96b069922
MATLAB
3,602
105
function [A,Y,numIter,tElapsed,finalResidual]=convexnmfrule(X,k,option) % Convex-NMF based on multiplicative update rules: X=XAY, s.t. A,Y>0. % Definition: % [A,Y,numIter,tElapsed,finalResidual]=convexnmfrule(X,k) % [A,Y,numIter,tElapsed,finalResidual]=convexnmfrule(X,k,option) % X: matrix of mixed signs, datas...
b0535affa0b275b23a94b3ce839074b63abc70b6c6d06978e73e7b273bceac1a
MATLAB
3,603
122
function varargout = blogreg(varargin) % % BLOGREG - logistic regression with Bayesian regularisation of a Laplace prior % % ALPHA = BLOG(X, T) computes the model parameters of a sparse logistic % regression model, ALPHA. X is the matrix of input features, where each % row represents a training pattern and ...
0b5ca18714e0b20941c959fff8b542d63ae786d3779e22398e61b8f335f3cf0a
MATLAB
3,610
117
% ========================================================================= % function [P, Perf, d, crit] = nk_MultiDecideHierarchOneVsOne(H, Y, % Classes, maxfunc) % ========================================================================= % % INPUTS: % ------- % H : ...
c806630a01a133ea6b45dc12d7aa74afc555fa987af5576f17c91d8b7297b5c8
MATLAB
3,621
100
%% msRun2018 % Version 1.0 GE % Updated version of the msRun script originally proposed by Daniel B % Aharoni to analyse miniscope 1p calcium imaging data. % This version is build on top of the original package to maximize compatibility. % It includes NormCorre for image registration, CNMF-E for source extraction...
526cab86c9bb403e7a85ad5ac06f5b6b0609c97d438aa4df8bba023f8c3b9a68
MATLAB
3,625
101
function [sumNSV, meanNSV, stdNSV, rSV] = nk_ModelComplexityParams(M, S) % ------------------------------------------------------------------------- % function [sumNSV, meanNSV, stdNSV] = nk_ModelComplexityParams(M) % ------------------------------------------------------------------------- % Compute model complexity d...
c0e36b81c63f07ee0668ede68efa620b67dbf2cf4c485b566ba4656f7d20e779
MATLAB
3,631
99
classdef reduced_emgf < bt.model.reduced % This model tests fitting with the EMG frequency allowed to vary properties end methods function self = reduced_emgf() % Constructor self.name = 'model_reduced_emgf'; self.n_params = 8; self.param_names = {'X','Y','Z','Alpha','Beta','t0','EMGa','EMGf'}; ...
185c26f57aef14bdf0716c39b1f80c8728867608ad7f249feb62592fcd193bac
MATLAB
3,639
128
function result=mlochuber(x,varargin) %MLOCHUBER is an M-estimator of location with psi-function equal to % min(1.5,max(-1.5,x)) and with an auxiliary scale estimate. % It is iteratively computed. It can resist 50% outliers. % If x is a matrix, the location estimate is computed on the columns of x. The % result is th...
91a96fe22f92ff91e3a019bd3e34a1eb43aeac989ab10d73f01cb2c7a0892369
MATLAB
3,640
92
clear %% load PreProcessed file load('PreProcessed.mat'); % need the one from main Generate_TablesCompiled code to match; NaN % indicates lack of response, so this is needed instead of the prior % code to drop missing rows at the end load('trial_drop_logical.mat'); %% Re-org deltas and drop lost trials so dataset has ...
b954c4a3f22ab3da2f50abac05e5ffa7539bb4abe15b29109b75b4b87820d1b8
MATLAB
3,641
121
function D = dijk(A,s,t) %DIJK Shortest paths from nodes 's' to nodes 't' using Dijkstra algorithm. % D = dijk(A,s,t) % A = n x n node-node weighted adjacency matrix of arc lengths % (Note: A(i,j) = 0 => Arc (i,j) does not exist; % A(i,j) = NaN => Arc (i,j) exists with 0 weight) % s = F...
068b3dca6a2be75d7035cf7c56f03e0b2af897d8a3986c734b2813fee1ed3acf
MATLAB
3,644
113
function [mappedX, mapping] = laplacian_eigen(X, no_dims, k, sigma, eig_impl) %LAPLACIAN_EIGEN Performs non-linear dimensionality reduction using Laplacian Eigenmaps % % [mappedX, mapping] = laplacian_eigen(X, no_dims, k, sigma, eig_impl) % % Performs non-linear dimensionality reduction using Laplacian Eigenmaps. % T...
52566ce4a6bede193129b178a18cfed17bc7a9706e5592e10185713221e46369
MATLAB
3,647
112
function OK = WriteTfiles(self) % Write T files (MClustData) % ADR 2014-12-17 % now calls EraseTfiles to erase T files (so includes WV and CQ as well) % now asks if want to erase if save with no clusters and there are previous % .t or ._t files. MCS = MClust.GetSettings(); MCD = self; % ADR 2008 - delete .t set if ...
ae657e1f05c8ae23968497d5535f366fe0b81e88a3c25a3b7e9c3e937251ae56
MATLAB
3,649
95
function [EEGevs] = behav_events(EEG,EventTypes,SubEventTypes,currsess,tag) %BEHAV_EVENTS Saves event timestamps to EEG (eeglab) data structure % [EEGevs] = BEHAV_EVENTS(EEG,EventTypes,SubEventTypes,currsess,tag) % loads TrialEvents.mat (contains timestamps already synchronized % between EEG system ...
84ffa0272587b85b76ff964117457bc073564c7806153acff1977d882314a053
MATLAB
3,656
100
function [infos, f_val, optgap] = store_nmf_infos(V, W, H, R, options, infos, epoch, grad_calc_count, elapsed_time, metric, metric_param) % Function to store statistic information % % Inputs: % V (m x n) non-negative matrix to factorize % W (m x r) non-negative factor matrix (sol...
29b3a05c253faa39c42b3dc7ad4106c0edecbdc6ebf41f2742d711581e1cec81
MATLAB
3,657
119
function [ mappedX, mapping ] = gda(X, Y, no_dims, varargin) %GDA Perform Generalized Discriminant Analysis % % mappedX = gda(X, Y, no_dims) % mappedX = gda(X, Y, no_dims, kernel) % mappedX = gda(X, Y, no_dims, kernel, param1) % mappedX = gda(X, Y, no_dims, kernel, param1, param2) % % Perform Generalized Discriminant A...
41e90f43a496412d6f0c75c8b2fa8110c8f6981112a48db8d392cce44dbf6382
MATLAB
3,665
112
function gui_lc (action) % % This file is used by FASTICAG % This file holds the callbacks for load-dialog % @(#)$Id: gui_lc.m,v 1.4 2003/09/11 12:01:19 jarmo Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Global variables % Handle to the window global hf_FastICA_Load; % H...
d4eac7455ace55cee9e402b24687ec5922ecb46bd35df88058ec4c4d1ab247f4
MATLAB
3,667
134
function [ U, V, Ss, fv ] = pacifier_iba( X0, rank_max, reg_l1, reg_l2, reg_smooth, opts) %PERFACT PatiEnt analysis via low-Rank FACtorization. % % Input: % X0: cell of sparse matrices, . % Omega: cell % if nargin<6, opts = []; end verbose = 1; fv = []; maxIter = 10; tol = 1e-5; if isfield(opts, 'maxIter'), max...
3a446435c5b5a3f7a39073df914484671d142bb0b468189e71300a5fda557cf1
MATLAB
3,672
115
function result = robstd(x,varargin) %ROBSTD standardizes a matrix X columnwise by substracting a robust estimate % of the location and by dividing through a robust estimate of the scale. % % Required input arguments: % x: Data matrix. Rows of x represent observations, and columns represent % var...
cf6ba510c2a14be793d9a01026b4b3041eb85145dc433a306f29c213f4c04bab
MATLAB
3,672
105
% ======================================================================== classdef userFunctions < handle %#ok<*MCFIL> %> @class userFunctions %> @brief Customised user functions for a task run. %> %> The state machine's job is to run a set of functions when entering and %> exiting states. Most required functions (me...
d6c548d42d8fc52f353f7d7edd13fa07b5dd4e202faea272ee7cc96b151b45c2
MATLAB
3,672
96
function A = random_graph(N,I,P,type,varargin) % RANDOM_GRAPH create a random graph % % A = RANDOM_GRAPH(N,I,P,T) where N is the number of vertices in % the graph, I is the proportion of inhibitory vertices (useful for asymmetry or sign problems), % P is the connection probability, and T is the type of edges tha...
cc50ca80231709c6e88c450530ceda89f94a46a847fc3cac12f7a60d033f26b3
MATLAB
3,678
99
function imData=read_file(path_to_file,sframe,num2read,options,im_info) % Reads uncompressed multipage .tiff, .hdf5, .avi or .raw files % Usage: my_data=read_file('path_to_data_file, start frame, num to read); % INPUTS: % path_to_file: location of file to be read % sframe: first frame to read (optiona...
ce2a019d4c98fdc54827ae6f06f4253fd296a96261511d5d73819328b29a1d6f
MATLAB
3,690
134
function [x, infos] = onmf(V, rank, in_options) % Online non-negative matrix factorization (ONMF) algorithm. % % Inputs: % matrix V % rank rank % in_options options % Output: % w solution of w % infos information % % References: % S. S. Bucak, B. Gunsel, ...
02755fbda9a990866f9f008fdbf32d5ee9f5ea8f4b7ecb9f2a54597495dd2ee9
MATLAB
3,692
127
clear all close all setup_paths; for monkey=2 if monkey==1 monkey_name='Jupiter'; elseif monkey==2 monkey_name='Mercury'; end [num,txt,session_name]=xlsread('Session_name.xlsx',monkey_name); for session_num=1 session=session_name(session_num,1); session=char(session);...
d8b794f52fc0afd02c0cf59677eb9282b6bc76b04afcb2f8e672da31ed75a3b8
MATLAB
3,696
98
function CM = cv_graph_constructionKLS(A, method, brainmask, atlas) % KL divergence method following Kong et al. 2014 % % INPUT: nii images (already smoothed, it's another preprocessing step of % course which will always be done first) % % Steps: % 1. nk_WriteVol --> save image to disk (.nii); compute network; dele...
03481487455516afca1ab7780677b85b4e646660c2aaaa31f5de26a124deec9f
MATLAB
3,698
110
function [A,Y,numIter,tElapsed,finalResidual]=wnmfrule(X,k,option) % Weighted NMF based on multiple update rules for missing values: X=AY, s.t. A,Y>=0. % Definition: % [A,Y,numIter,tElapsed,finalResidual]=wnmfrule(X,k) % [A,Y,numIter,tElapsed,finalResidual]=wnmfrule(X,k,option) % X: non-negative matrix, dataset...
214c8e438754af895a38423a5d9fda38cbe328a6069e98a15a94db75c6bc28a3
MATLAB
3,708
102
function [imgfile, imgvol, mess] = nk_FileSelector(nimg, imgtype, titlestr, fltstr, imgfile, startdir, mess) % ========================================================================================= % [imgfile, imgvol, mess] = nk_FileSelector(nimg, imgtype, titlestr, fltstr, imgfile, mess) % =========================...
974bc58fcfe5a8ea1109f0a47993684a32f20cc3e3ecb8b12085fbcded2b93a7
MATLAB
3,714
131
% SB2_DIAGNOSTIC Helper function to output diagnostics in SPARSEBAYES % % USAGE (1): % % OPTIONS = SB2_DIAGNOSTIC(OPTIONS, ACTION) % % OUTPUT ARGUMENTS: % % OPTIONS Returned OPTIONS settings, possibly updated % (e.g. with file handle after 'open' action) % % INPUT ARGUMENTS: % % OPTIONS Options settings (SB2_US...
3682d21dda1fc0a1327d0e863c89d92ca92d99aba9e77d5d3af02bf659c2b860
MATLAB
3,715
102
% Version 1.000 % % Code provided by Ruslan Salakhutdinov and Geoff Hinton % % Permission is granted for anyone to copy, use, modify, or distribute this % program and accompanying programs and documents for any purpose, provided % this copyright notice is retained and prominently displayed, along with % a note saying t...
1e41493c4688c858a7a8e4d6040adff095cc58b39cb18a2c034d8fb5c28544bf
MATLAB
3,719
97
function Y = spe(X, no_dims, varargin) %SPE Perform the Stochastic Proximity Embedding algorithm % % Y = spe(X, no_dims, 'Global') % Y = spe(X, no_dims, 'Local', k) % % Perform the Stochastic Proximity Embedding algorithm. The SPE algorithm % can be compared to the MDS algorithm, although it is much more efficient....
38769639f2a7ceb70e4e41034b6578ac094fecfc0f6cffcecd7076f13a4a26e7
MATLAB
3,720
122
function nk_ThreshWriteImg(brainmask, P, resl) if ~exist('P','var') || ~exist(deblank(P(1,:)),'file') P = spm_select(Inf,'image','Select images for thresholding'); end if ~exist('brainmask','var') || ~exist(brainmask,'file') brainmask = spm_select(1,'image','Brainmask image'); brainmask = regexprep(brainma...
e1e5e37c914ef1a0d003a965d948c6735be723c344a5f553052c77255c7fdf1f
MATLAB
3,722
88
function [f,F]=motif4funct_bin(A) %MOTIF4FUNCT_BIN Frequency of functional class-4 motifs % % [f,F] = motif4funct_bin(A); % % *Structural motifs* are patterns of local connectivity in complex % networks. In contrast, *functional motifs* are all possible subsets of % patterns of local connectivity embedded...
0d9409d122ec342b285014c04d821287d9a43afb626113b9811266ebde807a70
MATLAB
3,729
80
function [ERR, TBL] = export_performance(handles, batchmode) warning off switch handles.modeflag case 'classification' sheetstr = 'Classifier'; case 'regression' sheetstr = 'Regressor'; end filename = sprintf('%s_A%g_PredictionMetrics', ... handles.params.TrainParam.SAV.matname, h...
10b4d36531b75bbcbc86f6ddbab25c07b3c186d92a2f4009b6c12ae0cccdfb28
MATLAB
3,731
111
function [allDiffLAT_P1Go,allDiffLAT_N1Go,allDiffLAT_P1MovOn,allDiffLAT_N1MovOn,allRT1,allRT2,allDiff_RT,allBestLag_rVal,allICD_lat]=f_CalcDifferenceLatencies_SoloObs_or_JA_vSh(LAT,contrast,fs,saveFig,t_start,t_end) % contrast=2: solo/obs % contrast=3: ja/ja allDiffLAT_P1Go=[]; allDiffLAT_N1Go=[]; allDiffLAT_P...
7d3a95a102afedcd60b91342f63c2a03f025093100e3717a7aee17b404893940
MATLAB
3,736
114
function [featmat, emptfl, skiparr, missarr] = nk_GenVISdataMaster(datid, cv, mastermat, tdir, basename, savefl) global SAV featmat = []; skiparr=[]; missarr=[]; saveflx = false; if exist('savefl','var') && savefl, saveflx = true; end if (~exist('mastermat','var') || ~exist(mastermat,'file')), masterflx = false; ...
05724381ab41c486e3c0878c6bbb6ec1936cc2062199efd2e18bdd5ca35ebad8
MATLAB
3,737
143
function mp2rage_run_interactive_synthetic(isynthetic) %MP2RAGE_RUN_INTERACTIVE_SYNTHETIC will use a T1map to synthetise an image using the provided TI. % This is done interactivly in a GUI %% Initialazation : get or set temporary file name persistent tmpvolname if isempty(tmpvolname) % First call, create a tempora...
9ba9ce3aa1b61ea9344a8c445cae985b31f21212276f46849e61b122aac08fdb
MATLAB
3,744
103
%Loading the data necessary to create this default input_struct: matpath = cd; load([matpath filesep 'brainframe_defaultHuman_datinput.mat']); %Creating the default mouse input struct %Specific fields are filled one at a time in the below script %Basic fields required for any element of brainframe to run: %Voxel or...
dd5d404aba1d98b3ab8fbbdc931e2b0f8c03764ba88cef2abb6348d439a7ab17
MATLAB
3,745
113
function [featmat, emptfl, skiparr, missarr] = nk_GenDataMaster(datid, datadesc, cv, mastermat, tdir, basename, savefl) global SAV featmat = []; skiparr=[]; missarr=[]; saveflx = false; if exist('savefl','var') && savefl, saveflx = true; end if (~exist('mastermat','var') || ~exist(mastermat,'file')), masterflx = ...
f19d5ecd91c3f3e8350d773244b604194a41face81bd5c313ddfd580fc6c40ed
MATLAB
3,750
119
<<<<<<< HEAD function s = export(this,target) % Export a GIfTI object into specific MATLAB struct % FORMAT s = export(this,target) % this - GIfTI object % target - string describing target output [default: MATLAB] % s - a structure containing public fields of the object %___________________________________...
5addf31c5ab1c60ca23061655adaf449ffd2e250f162a8a982ea915f195a75b5
MATLAB
3,754
117
%% 0. Setup % Initialization clear all; close all; clc; % Add folder with raw data to path addpath([pwd '/raw_data_mouse']) % Add library with eNDM functions to path addpath([pwd '/lib_eNDM_numeric']) addpath([pwd '/lib_eNDM_analytic']) % Load dataset of interest load Tasic_CTMaps.mat %sw...
e30c4d687e83a2aebba61bb1d044bb7ccb43c396f254508cd39ecdf9aa82f8af
MATLAB
3,754
103
function nk_smooth(Vm, P,Q,s,dtype) % 3 dimensional convolution of an image % FORMAT spm_smooth(P,Q,s,dtype) % P - image(s) to be smoothed (or 3D array) % Q - filename for smoothed image (or 3D array) % s - [sx sy sz] Gaussian filter width {FWHM} in mm (or edges) % dtype - datatype [Default: 0 == same datat...
b8712e78626ca85c3553bbaf95e44746de83a725a915a9c17a3edd291302e4d1
MATLAB
3,755
122
%% file LeastmsmtflExp.m % this file shows the usage of Least_msmtfl_capL1.m function % and study how to detect outlier tasks. % %% OBJECTIVE % min_W ||XW - Y||_F^2 + lambda*\sum_i \min{||W^i||_1,theta} % % It's a nonconvex optimization problem, which can be relaxed into a Multi-Stage Convex optimization: % min...
86e71109308e41b1b5f65717ff9d3d9577e14f4477b58f4341b3b12a6bea17b4
MATLAB
3,762
108
%% corr combined, 5 days, non PreHab, by ID clear load('ProcessedData\tables_compiled_shifterMag.mat'); %% Corr to D1 no best sorting figure, t = tiledlayout(1,5,'TileSpacing','Compact'); D_template = tables_compiled{1,1}.Deltas; D_template = D_template.'; trial_cutoff = 8; within = cell(1,5); across = cell(...
85c733626d915d154356f10da30583d8c7d2cbdb93fdabcd70c71642bd721e84
MATLAB
3,768
93
function nk_VisModels_batch(paramfile) global NM % Read parameter file % =========================== if ~exist(paramfile,'file') error([paramfile 'not found. Abort job!']); end fid = fopen(paramfile); params = textscan(fid, '%s'); fclose(fid); % Parse parameters in params % =====================================...
27a20b02c079873b3f9dd8bca825298acfbb13bc0dd4126b29e3ef621d4a2441
MATLAB
3,771
93
function param = nk_MKLRVM_config(param,setupfl,defaultsfl) % ========================================================================= % FORMAT param = nk_MKLRVM_config(param, setupfl, defaultsfl) % ========================================================================= % % Setup parameters for RVM algorithm by Psor...
73cd7f1b6e955bedac6412210b231c328c735f6229f3afc50263b076f30c5b8d
MATLAB
3,773
100
clear %% load PreProcessed file load('PreProcessed.mat'); %% Re-org deltas and drop lost trials so dataset has no missing values % intialize empties and parameters tables_compiled = cell(1,5); trial_cutoff = 8; % number trials to keep norm_toggle = 0; % 0 to not, 1 to normalize as below % pull table values, drop Na...
3e96eab27bdcfdd025773c32521d2baac3aa09d15a6abf398309cb726fcaf013
MATLAB
3,778
119
%% 0. Setup % Initialization clear all; close all; clc; % Add folder with raw data to path addpath([pwd '/raw_data_mouse']) % Add library with eNDM functions to path addpath([pwd '/lib_eNDM_numeric']) addpath([pwd '/lib_eNDM_analytic']) % Load dataset of interest load Tasic_CTMaps.mat %sw...
48c0763d77e97d77d8df55bf3ddf82e87ea48485d45be8e71c730c0dc1ec23bc
MATLAB
3,779
135
function [eigvector, eigvalue, sampleMean, ener, elapse] = PCA(data, options) %PCA Principal Component Analysis % % Usage: % [eigvector, eigvalue] = PCA(data, options) % [eigvector, eigvalue] = PCA(data) % % Input: % data - Data matrix. Each row vector of fea is a data point...
fb9f58e25139792c1b8037c04b7e4bb7d759cac968fc6b401ca28c7dee62922b
MATLAB
3,782
93
function dat = nk_PermPrep(dat, analind) global CV CLUST %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PREPARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% analysis = dat.analysis{analind}; spm5ver = nk_CheckSPMver; % ************************ LOAD PREPROCESSED DATA ************************* [preprocmat, dims] = nk_GenPreprocMaster(spm5ver...
68e0cb47c1a2dc811f6a5486ae10511f1697a8936b7a39422add6ee7516bc2aa
MATLAB
3,784
115
function imrelief = nk_IMRelief_config(imrelief, classhdr, setupfl, defaultsfl) % function param = nk_IMRelief_config(param, setupfl) % % This function sets up the parameters for the IMRelief feature % selection algorithm presented by Yijun Sun and colleagues: % % IMRelief_Sigmoid_FastImple: fast implemetation of IMRe...
f1628b196d82c005707d3e53f68cdc7db00bacfad72d56494d67ee43cb68bb98
MATLAB
3,785
103
%Loading the data necessary to create this default input_struct: matpath = cd; load([matpath filesep 'brainframe_defaultMouse_datinput.mat']); %Creating the default mouse input struct %Specific fields are filled one at a time in the below script %Basic fields required for any element of brainframe to run: %Voxel or...
80c40dfbb09414f710d9187e7020a25441f82ba97a7a4b0586d63adc1aa22c39
MATLAB
3,792
78
% Demo code for mapping cortical thickness difference taking into account covariate of sex and age, i.e., ANCOVA, using MBM. % % This demo uses 95 empirical thickness maps from T1 maps in an open dataset. % All maps are combined in inputMaps_ANCOVA_twosample.mat where each row is a map (or inputMaps_ANCOVA_twosample.mg...
b5103e00bcf8dc380edd2de9dcd845f77be157351fa94b8e3d1b7fa8124ac42b
MATLAB
3,795
101
clear %% load PreProcessed file load('PreProcessed_peakMag.mat'); %% Re-org deltas and drop lost trials so dataset has no missing values % intialize empties and parameters tables_compiled = cell(1,5); trial_cutoff = 8; % number trials to keep norm_toggle = 0; % 0 to not, 1 to normalize as below % pull table values,...
7159cd8a9f2951d9d62a21ca6a542e6422b0312b4663780346a807fcb15b1ed1
MATLAB
3,798
112
function [U, V, eigvalue_U, eigvalue_V, posIdx, Y] = TensorLPP(X, W, options) % TensorLPP: Tensor Locality Preserving Projections % % [U, V, eigvalue_U, eigvalue_V, posIdx, Y] = TensorLPP(X, W, options) % % Input: % X - 3-d data matrix. X(:,:,i) is the i-th data % ...
fc9ae869c8fc14e53f67efdabc16c8665fed026d6ffa43f4c352c192d1d9330d
MATLAB
3,800
106
function fdata = fit_cluster(model,dataset,subject_idx,npts_per_fit,suffix) % if matlabpool('size') == 0 % matlabpool_cluster(12) % end debugmode = false; %npts_per_fit = 12e5; output_dir = sprintf('%s_%i_%s',dataset,subject_idx,suffix); if exist(sprintf('%s/fit_output.mat',output_dir)) % Resume an interrupt...
08d221c1fb30d08df3e32fd0ee34ebc5b5788471535f16898e47b3ef7613d136
MATLAB
3,801
88
%% 步骤 1: 计算所有通道的功率谱密度(PSD) % ------------------------------------------------------------------------- lfp_data = LFP_NoNeedle_segment; % --- pwelch 参数定义 --- win_duration_sec = 2; % 窗口长度 (s), 2秒的窗口可以提供较好的频率分辨率 win_len_points = win_duration_sec * fs; % 窗口长度 (采样点) window = hamming(win_len_poi...
045ad60874daf96bf3ce7cc467ed7360a11e8da35b6231681d2074c8a9416613
MATLAB
3,808
102
function [ERR, TBL] = export_scores(handles, batchmode) warning off if ~exist('batchmode','var') || isempty(batchmode) batchmode = false; end switch handles.modeflag case 'classification' sheetstr = 'Cl_'; case 'regression' sheetstr = 'R_'; end % Do we print the results of the bagged ...
7a9111fa72d781b5032238093c1596bfe9e2b2ce761a4684d1aebe1b063976c9
MATLAB
3,810
115
function [ GRAPHMETRICS, PX, act ] = cv_graphMetrics_config(GRAPHMETRICS, PX, parentstr, defaultsfl) MetricsYes = 1; MetricsList = []; if ~exist('defaultsfl','var') || isempty(defaultsfl); defaultsfl = false; end if ~defaultsfl if isfield(GRAPHMETRICS,'metrics'), MetricsYes = GRAPHMETRICS.metrics; end ...
8da12a2d3d9b08236c655433cdde5db84b472524a44c770abad3666e5a51f774
MATLAB
3,813
112
function animate_fit_old % This version used the old fitting based on the states etc. load steve load pp_master db_data [time_bar,state_txt,tent_point,tent_trail,spec_axis,tent_axis,exp_plot,fit_plot] = init_plot(t,f,s); xyz_trail = zeros(length(t),3); % OK so let's first get average of the first few points i...
cc1c58c2e5925c69f0e992741450c199a8f15e2b1ff194f01f973e74b47cd905
MATLAB
3,815
97
%Biases = rand(20,2*3*2); % subjects, Hemi*Mask*Fam load('N250_left.mat') % left A = erpval; load('N250_right.mat') % right B = erpval; erpval = horzcat(A,B); [n,c2] = size(erpval); varNames = cell(2*3*2,1); for i = 1 : 2*3*2 v = strcat('V',num2str(i)); varNames{i,1} = v; end % Create a table storing th...
2943b112b8c0e9bc157dd81aea313f2785df99eccc162dc92cceb90e948ff3be
MATLAB
3,817
1
function CheckCluster(self) % % CheckCluster(@Cluster) % % INPUTS % % OUTPUTS : none % % Shows key aspects to cluster for judging quality % % ADR 1998 % version L1.0 % RELEASED as part of MClust 2.0 % See standard disclaimer in Contents.m % cowen % % Status: PROMOTED (Release version) % See documentation for copyright...
ce261383fe9281fc9fe2c9615d3d28e907aab5d2479294045a03fe794d909fe6
MATLAB
3,824
134
function [h,p,stats] = nk_CompareClassResample(Cl1, Cl2, L, scoretype, alternative, Test, alpha) modes = {'5x2t', '5x2F', 'rkCV', 'rank', 'rank_cardillo'}; if ~isequal(size(Cl1), size(Cl2)) error('Score grid of the two models must have same dimensions') end if ~exist('alternative','var') || isempty(alternative),...
27875850c2fd5f4741d069d1361165e1a97aa48df03280a22a46d88049479e26
MATLAB
3,826
128
function [PREPROC, ... RFE, ... GRD, ... SVM, ... LIBSVMTRAIN, ... LIBSVMPREDICT, ... RVM, ... MKLRVM, ... CMDSTR, ... MULTI, ... VIS, paramstr] = nk_CompatParams2(TrainParam, varind, paramstr) globa...
e5eadbe798342ee233bde493d41e2650f828d5c45d2366ed3c0098c1aef62a9e
MATLAB
3,827
101
clear %% load PreProcessed file load('PreProcessed_behaviorShifter_smoothed.mat'); %% Re-org deltas and drop lost trials so dataset has no missing values % intialize empties and parameters tables_compiled = cell(1,5); trial_cutoff = 8; % number trials to keep norm_toggle = 0; % 0 to not, 1 to normalize as below % pu...
cc733c7078aea09c89c020704a7302d958ecb05383c33c9122f3471b52c88715
MATLAB
3,837
138
clear; clc; % Load File %% load ('...\LFPdata_Fig4B.mat') %% % An example of Time-Frequency Plot: Session 9, ch 8 % frequency parameters min_freq = 1; % in Hz max_freq = 100; num_freq = 100; sRate=units.FSnb; t1CHT=200; t2CHT=900; num_cycles=6; lowPowerS=[]; lowPowerO=[]; lowPowerJA=[]; figur...
e5f82252dfa9148c7be03d8e84e8173774279b696bf5342275a6c7f9096b1eb1
MATLAB
3,841
113
function [en,tn,en25,en75,significant]=significantAcc(D,classes,numTrain,classifier,optCl,option) % determine if the accuracy is significant % D: matrix, whole data set, feature X sample. % classes: vector, the class labels: 0,1,2,... % numTrain: number of training samples to be seperated from D % classifier: string, ...
7271aeacaa2681d871d68ba064e0cae9eb77a0dbb39c33793bb40411a077bdf0
MATLAB
3,843
131
function ClusterFunc_LimitSpikesByWaveforms(self) % ClusterFunc_LimitSpikesByWaveforms (SpikelistCluster) % % Plots four subplots with waveforms, allows limits %========================================================== % PARAMETERS %=========================================================== useSelfColor = false; ...
7bbf227d3ef9cd8b41282ca4b60a6f8cde0c43030b96d11aae65e5dac889182e
MATLAB
3,844
109
function [A,Y,numIter,tElapsed,finalResidual]=sparsenmf2rule(X,k,option) % Sparse NMF, X=AY, using multiplicative update rules. Both basis matrix and coefficient matrix are constrained by % l_2 and l_1 norm. % Definition: % [A,Y,numIter,tElapsed,finalResidual]=sparsenmf2rule(X,k) % [A,Y,numIter,tElapsed,finalRe...
a27ace41d9c3b6c512754e3a89ed79494d73d9c7651626758ef18c61a8904902
MATLAB
3,856
127
function RunClustBatch(varargin) % RunClustBatch % % rebuilt completely for MClust 4.0 % % No longer uses batch files. Now is a function that takes parameters. % parameters are passed as string-set pairs. For example: % RunClustBatch('minClusters', 10, 'maxClusters', 25); % RunClustBatch(); % RunClustBatch('fcTT',...
8751949cd6f458f6bad8e76b780b754798ac8aa80b394cef793ae435cd2c9b3b
MATLAB
3,857
109
function [sY, sX, sYX, IN] = nk_PLS(Y, X, IN) % Computes PLS model from experimental predictors X and predictands Y % _________________________________________________________________________ % (c) Nikolaos Koutsouleris, 10/2023 if ~isfield(IN,'trained'),IN.trained=0;end if ~isfield(IN,'algostr'),IN.algostr='pls';end ...
d3158bde40afd72687d62166d8c78b3b5dad7e8206bf4737e1c0df35ab0c732a
MATLAB
3,857
77
% Demo code for mapping cortical thickness difference, i.e., two sample t-test, using MBM. % % This demo uses the thickness maps generated by the framework described in % the MBM paper. In particular, 25 maps were generated from each of the two % ground truths. The list of the paths of the maps stored in 'thickness' % ...
4a8c90247bca847f033952e86dcba6923cf84aec87ac9096bf19749cad3a6813
MATLAB
3,862
114
%% corr combined, 5 days, non PreHab, by ID clear load('ProcessedData\tables_compiled_shifterMag.mat'); %% figure, tiledlayout(1,5,'TileSpacing','Compact'); trial_cutoff = 8; within = cell(1,5); across = cell(1,5); for i = 1:5 day_now = tables_compiled{i,1}.Deltas; day_now = day_now.'; % do the ...
d4f1ecfa5bf8c201558dfa7a39d26d3fc9a516baf59341d5937ad76ce550f564
MATLAB
3,863
71
function ProcessedData = removeBadSignals(plxFileName,a,ProcessedData,sw) %This function allows the user to exclude specific signals from analysis if %desired. It will run through a series of prompts for the user to list the %signal(s) to remove. if sw.LabelBadSignals == 1 || ~exist([pwd '\Output Files\' plxFile...
bce425b29beacf76af37eacac11c933231a71249e4cb31e354dcd39b5d0653ef
MATLAB
3,867
130
% ======================================================================== %> @brief magstimManager - controls a MagStim Rapid TMS system using a LabJack %> %> Connects to and manages a TMS stimulator using a LabJack U3 / U6. %> %> >> mM = magstimManager() %create magstim manager object %> >> mM.open %connect via a La...
ebcde164c74b4bded592a0bc02112b479bb7a0c783417160a2361820c69a2909
MATLAB
3,867
162
function [W, funcVal] = Least_FGLasso(X, Y, rho1, rho2, opts) % Fused Group Lasso with Least Squares Loss. % By Jiayu Zhou (jiayu.zhou@asu.edu) Jan. 2011 % Objective: % argmin_W { \sum_i^t (0.5 * norm (Y{i} - X{i}' * W(:, i))^2) % + \sum_{i=1}^d rho1{i} * \|W(i, :)\|_1 % + \sum_{i=1}^d rho2{...
c88e9151f63f0e53f2a30d36a36f3f56d2e55c33f96108b2685564418c0239f6
MATLAB
3,868
104
function [mask,featNames,scores,A]=featSelNMF(D,featNames,opt) % feature selection using VSMF % Usage: % [mask,featNames,A,scores]=featureFilterNMF(D) % [mask,featNames,A,scores]=featureFilterNMF(D,featNames) % [mask,featNames,A,scores]=featureFilterNMF(D,featNames,opt) % [mask,featNames,A,scores]=featureFilterNMF(D,[]...