sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
f0fa8fc99d4e8888b8f200ffe245c31047940cf9135e6331a5a19645d198c7e6 | MATLAB | 813 | 21 | % =========================================================================
% FORMAT [Y, beta] = nk_PartialCorrelations(G, Y, beta, revertflag)
% =========================================================================
% Remove nuisance effects G from Y (optionally, using a predefined beta)
% %%%%%%%%%%%%%%%%%%%%%%%%%... |
54aa4668d4aecbb16fdf97b2e7bbde05a50680d05bdfb7f8fc309730b4228589 | MATLAB | 814 | 28 | function h_out = plot_track(self,idx,smoothed)
if nargin < 3 || isempty(smoothed)
smoothed = 1; % With a moving average of 1, smoothing does nothing
end
if nargin < 2 || isempty(idx)
idx = 1:self.latest;
end
% First, do the smoothing
f = self.subrange(idx);
xyz = f.xyz;
for j = 1:size(xyz,2)
xyz(:,j) = ... |
c02dce9991af605614ab9ae438d0bcc89755ec5c5d4d45bfe4d0e344e7dfdc95 | MATLAB | 815 | 25 | function imagingMLI(casenum, MLIcont, APPstMLI, brainmask, badcoords, datadescriptor)
global stMLI
y = MLIcont.Y_mapped(casenum,:)';
stMLI = APPstMLI;
nk_WriteVol(y,'tempMLI', 2, brainmask, badcoords, datadescriptor.threshval, char(datadescriptor.threshop),[],[],false);
mli_orthviews('Image','tempMLI.nii');
% alphama... |
ce01a2b3980382b75cbaa4711f46a216d06423a171e3feda292c9a27122c3ae4 | MATLAB | 815 | 16 | % =========================================================================
% FORMAT param = SCC(expected, predicted)
% =========================================================================
% Compute Squared Correlation Coefficient, also called Coefficient of
% Determination or alternatively % Explained Variance
% ... |
740926815c97a8fc2bdfb698c1c67e3874288f5305d0d749d7acdc6fe8a6b13e | MATLAB | 816 | 35 | function ShowNMFBasis(W, w, h, scale, dotranspose)
[m, r] = size(W);
rsq = sqrt(r);
if ~exist('scale', 'var') || isempty(scale)
scale = 2;
end
if ~exist('dotranspose', 'var') || isempty(dotranspose)
dotranspose = false;
end
w1 = w * scale;
h1 = h * scale;
padding = 3;
titleheight = 0;
allwidth = w1 * rsq + ... |
d8bef039dfe34d08d42f1e2c4b138cd271878a306386fc3e77630f59bd046783 | MATLAB | 817 | 24 | function [sY, IN] = cv_perfJuSpace(Y, IN)
% =========================================================================
% =========================== WRAPPER FUNCTION ============================
if ~exist('IN','var'), IN = []; end
if iscell(Y)
sY = cell(1,numel(Y));
for i=1:numel(Y), [sY{i}, ... |
cd3eb845dafaf0a3538c6be55c02bbdd9dd17168f9d051dbd85816f7227c421a | MATLAB | 818 | 27 | function [sY, IN] = cv_perfCustomPreproc(Y, IN)
% =========================================================================
% =========================== WRAPPER FUNCTION ============================
if ~exist('IN','var'), IN = []; end
if iscell(Y)
sY = cell(1,numel(Y));
for i=1:numel(Y), [s... |
f54d4455875afd324fc0a3978b4077cfacfef2766944bde6a1d4de05b0ea61ff | MATLAB | 818 | 18 | function mripy_align_asc(fname, transform, output)
%MRIPY_ALIGN_ASC Apply surface-to-experiment alignment transform to
% vertices coordinates.
% 2017-08-14: Created by qcc
% 2017-08-16: Get coordinates mapping done right
if nargin < 3
[pth, name, ext] = fileparts(fname);
output = fullfile(pth,... |
389e9e731bf185ebc3f724b23649ba2047c0d7ad20e44bfa2f1a07a817043586 | MATLAB | 820 | 21 | % =========================================================================
% FORMAT param = FSCORE(expected, predicted)
% =========================================================================
% Compute F-Score of classification
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Nikol... |
22564483eae7bb09a91ecc4d3040078a187b5bdfe01b1b436c81778fd75de143 | MATLAB | 821 | 32 | function [PeakData, PeakNames,PeakPars] = feature_PEAK6to11(V, ttChannelValidity, Params)
% MClust
% [PeakData, PeakNames] = feature_PEAK6to11(V, ttChannelValidity)
% Calculate peak feature max value for each channel
%
% INPUTS
% V = TT tsd
% ttChannelValidity = nCh x 1 of booleans
%
% OUTPUTS
% Da... |
d6c05f7b0b9bd00f924c02ee2e81de54a0b289645d2e78739de5e77560283b99 | MATLAB | 821 | 29 | % NDM with Source
%
% Evaluate NDM predictions [y] at desired time stamps.
%
% Input:
% x0 = Initial Condition
% time_stamps = provided in units given by experiment
% C = connectivity matrix
% beta = diffusivity parameter
% alpha1 = basal (constant) growth... |
e03854f1c86e7feab37aac6f348d028f97917f9b2de40730a7c701342c6ba4b9 | MATLAB | 825 | 36 | % NDM
%
% Evaluate NDM predictions [y] at desired time stamps.
%
% Input:
% x0 = Initial Condition
% time_stamps = provided in units given by experiment
% C = connectivity matrix
% beta = diffusivity parameter
%
% Output:
% y = NDM predicted vectors (columns) at ... |
0fc485d6a7a3b06335c4090e8f8ad28155f5d4dbb336044170ad07cedcdcdc5b | MATLAB | 826 | 30 | % authors: Ioannis Psorakis psorakis@gmail.com, Theodoros Damoulas theo@dcs.gla.ac.uk
% Copyright NCR, 2009
%
% Use of this code is subject to the Terms and Conditions of the Research License Agreement,
% agreed to when this code was downloaded, and a copy of which is available at
% http://www.dcs.gla.ac.... |
d91f4bc7301e390ec47dc3cbb5c2f66ee0696528afb63f7bdd89e73827ad12b4 | MATLAB | 826 | 24 | function m = nk_SVEN(SVM, X, Y, Params)
global TRAINFUNC
[~,p] = size(X);
m.t = Params(1); m.lambda = Params(2);
Xnew = [bsxfun(@minus,X,Y./m.t) bsxfun(@plus,X,Y./m.t)]';
Ynew = [ones(p,1);-ones(p,1)];
m.C = 1/(2*m.lambda); cParams = m.C;
if ~isempty(TRAINFUNC)
model = TRAINFUNC( Ynew, Xnew, ModelOnly, cParams);
m.w... |
b23492b1fc8a9fd6dc53b48a706464b02dd731b14e99aec7edf156d191a2d264 | MATLAB | 827 | 32 | function voted_label=wvote(classk,scorek)
% vote by the majority rule
% classk: matrix, rows are samples, columns are committee members
% voted_label, column vector
% Contact Information:
% Yifeng Li
% University of Windsor
% li11112c@uwindsor.ca; yifeng.li.cn@gmail.com
% May 26, 2011
% % example:
% classk=[0,0,0,1,2;2... |
2f200805682b3ca9c70a52b01d2f3de2757281833f1abeb3e0c7ac7576a4fdd9 | MATLAB | 829 | 22 | function [ID, NUM, TBL] = nk_CountUniqueOccurences(Y,PTH)
% =========================================================================
% function [ID, NUM, TBL] = nk_CountUniqueOccurences(Y,PTH)
% -------------------------------------------------------------------------
% Count unique occurences in Y and return labels a... |
6bb3f366fee85f693b86a162e402a8928f1cbddf9d72160fd6cce831921d9f43 | MATLAB | 830 | 28 | % Objective function for NDM with Source (NDMwS)
%
% param(1) = beta
% param(2) = x0_value
% param(3) = alpha1 = basal (constant) growth/clearance
% param(4) = alpha2 = linear growth/clearance term in x
function [f] = objfun_NDMwS(param,seed_location,pathology,time_stamps,C)
% Define Laplacian matrix L
rowdegree... |
779137b27b33202708891c6479d8802179c5510932729d90c39a3c6bcbf33225 | MATLAB | 831 | 34 | function runDeployed(scriptname)
% Works around a problem with app deployment and using `run`, this is a
% simplified version of the official MATLAB function. Basically `run` will
% fail if there is a shadowed script in the app bundle, which is not an
% issue for opticka.
if isstring(scriptname)
scriptname = char(scr... |
5224f7b94afac09b2e7fc683431c733881f60cecfbafff5d82d0fc5308b892e7 | MATLAB | 834 | 25 | function H_x = pnopt_Lbfgs_prod( s_old, y_old, de )
% pnopt_Lbfgs_prod : Product with L-BFGS Hessian approximation
%
% $Revision: 0.8.0 $ $Date: 2012/12/01 $
%
l = size( s_old, 2 );
L = zeros( l );
for k = 1:l;
L(k+1:l,k) = s_old(:,k+1:l)' * y_old(:,k);
end
d1 = sum( s_old .* y_old );
d2 = sqrt( d... |
a6e563d1e77ba62d0eeb1ed05d5389045dec1a3e96c640d114def48f6a63758a | MATLAB | 835 | 34 | function [n,names] = plx_adchan_names(filename)
% plx_adchan_names(filename): gets the names of a/d channels in a .plx or .pl2 file
%
% [n,names] = plx_adchan_names(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
%
% OUTPUT:
% names - array of a/d channel name strings
% n - number of ... |
5e4eb03653f7f6a25d04211be7a38f54b41a5850a7dc7d6ea4970bd9829c2d4b | MATLAB | 836 | 25 | function [PX, PreML] = nk_GenPreML(PREPROC)
PX = nk_ReturnParamChain(PREPROC, 1); PreML = [];
if ~isempty(PX)
nP = numel(PX);
if nP>1
Params = []; Params_desc=[]; ModalityVec = [];
for n=1:nP
Params = [Params PX(n).Params];
for m=1:numel(PX(n).Params_desc)
... |
85cc4f2c2f5253ebc2c5a372074632a054bed2c349ca037f4afe0eb253f3a3a0 | MATLAB | 840 | 29 | function M = Q2M(Q)
% Generate a rotation matrix from a quaternion xi+yj+zk+w,
% where Q = [x y z], and w = 1-x^2-y^2-z^2.
% See: http://skal.planet-d.net/demo/matrixfaq.htm
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging
%
% ... |
366257b299b08a2154c336fbf8a2b10e83f005decf274f4115982763f210c1d6 | MATLAB | 841 | 38 | function RedrawClusters(self)
% Redraw clusters within panel
% don't need this anymore because you're doing the tree
%{
nClustersInPanel = 30;
uicHeight = 1/nClustersInPanel;
panel = self.clusterPanel;
% clear old display
if ~isempty(get(panel, 'children'))
delete(get(panel, 'children'));
end
% clusters to sho... |
bdd49a4e974f0e940560421ccf60d142b5c4d59b5519914d117f7e25ee77fd20 | MATLAB | 841 | 32 | classdef Layer < handle
% Wrapper class of caffe::Layer in matlab
properties (Access = private)
hLayer_self
attributes
% attributes fields:
% hBlob_blobs
end
properties (SetAccess = private)
params
end
methods
function self = Layer(hLayer_layer)
CHECK(is_valid_handle(... |
7a8cf855920b01ed8107389eecdc5df6a694b69e3906107ee8d660cc2dffb5e7 | MATLAB | 842 | 41 | function writetoPAJ(CIJ, fname, arcs)
%WRITETOPAJ Write to Pajek
%
% writetoPAJ(CIJ, fname, arcs);
%
% This function writes a Pajek .net file from a MATLAB matrix
%
% Inputs: CIJ, adjacency matrix
% fname, filename minus .net extension
% arcs, 1 for direct... |
d2943432601119fc5a34d5bccdc72c4537e6982cb60d5533c33f5d3db216e2e9 | MATLAB | 843 | 41 | function ClusterFunc_Remove_Doubles( self )
% RemoveDoubleCounts
% remove all points which precede another point in the cluster by <1 ms
% and put them in a new cluster
%================================================
% PARAMETERS
%================================================
minThreshold = 0.001; % less than 1 ... |
b36d2576bed955d6791010bf8afda6ea355649511073ad0af5d2ee1b9703034d | MATLAB | 844 | 22 | function load_selVisMeas2(handles)
popuplist2 = [];
popuplist = handles.selVisMeas.String;
pop = {'CV-ratio of feature weights [Overall Mean]', ...
'CV-ratio of feature weights [Grand Mean]', ...
'Feature selection probability [Overall Mean]', ...
'Probability of feature reliability (95%-CI) [Gran... |
8db00a636ac28de26d541b29a9ab0e1a97d83d138d93fa3b09b7a04d2727eb76 | MATLAB | 845 | 41 | function H = ReadHeader(fp)
% H = ReadHeader(fp)
%
% Reads NSMA header, leaves file-read-location at end of header
%
% INPUT:
% fid -- file-pointer (i.e. not filename)
% OUTPUT:
% H -- cell array. Each entry is one line from the NSMA header
%
% Now works for files with no header.
% ADR 1997
% version ... |
0d356707bf1ecf05e6839959d3e091a4cc5aefe7ab1cb69460dcbf4269fc5e53 | MATLAB | 846 | 41 | function [r]=clustering_adjustedRand_fast(u,v)
% clustering quality measures assumptions :
% 0 corresponds to background
% we do not care about the background
% cluster labels are assumed to be enumerated from 1 to max number of
% clusters
%
% this function should not be used when comparing binary segmentations
m=ma... |
3353585949378db98edf80c1a98d387489685e6ac740626bf01ae58e720a1de0 | MATLAB | 846 | 31 | % Plot prediction vs data
function plot_pred_vs_data_corr_unscaled(predicted,data,time_stamps)
num_plots = size(data,2);
% % Set min and max points for plot axis
% notnaninds = ~isnan(data(:,1));
% data = data(notnaninds,:);
% predicted = predicted(notnaninds,:);
% D = [predicted,data];
% plot_m... |
594bfcbd27c0dd370de2a1581c8397a902cdf5fea56ffaa7331ea6a0519fcca5 | MATLAB | 847 | 30 | % resizes ROIs based on the spatial downsampling set in the GUI
function h = resizeROIs(h, spatscale)
rsc = h.sc / spatscale;
for k = 1:size(h.ROI,1)
nxS = floor(h.nX{k} / spatscale);
nyS = floor(h.nY{k} / spatscale);
for j = 1:numel(h.ROI{k})
if ~isempty(h.ROI{k}{j})
h.ROI{k}{j} = h.... |
6beb2d19f7a72a805328f9aeae97e9e47ae961389b204ac38628507ada29fdec | MATLAB | 848 | 34 | function [CatArray, ClassArray] = nk_CatNodes(arr, curclass)
NodeNum = numel(arr);
[PermNum, FoldNum, nclass] = size(arr{1});
CatArray = cell(PermNum, FoldNum);
ClassArray = cell(PermNum, FoldNum);
for Perm = 1:PermNum
for Fold = 1:FoldNum
CatArray{Perm, Fold} = [];
ClassArray{Perm, F... |
42405e37f3328e96089ec2d6fdb986fb002b8c0dffb38bec69988e89e74c20ea | MATLAB | 849 | 28 | function set_my_boxplot(ax)
%SET_MY_BOXPLOT Sets the properties of boxplot figures
lines = findobj(ax, 'type', 'line', 'Tag', 'Median');
set(lines, 'Color', [0 0 0]);
lins = findobj(ax,'LineStyle','--');
set(lins,'LineStyle','-');
outL = findobj(ax, 'type', 'line', 'Tag', 'Outliers');
set(outL,'Marker','o'... |
c99942517f671e8104c698ccb982b5e139fb1ad8cab4889eaa569ea1dfb80c40 | MATLAB | 849 | 32 | function [ C, params ] = nk_PerfCompConnectivity( Y, params )
% Step 1: Get Seed point for connectivity analysis if not specified
if ~isfield(params,'seeds')
if isfield(params,'seedparams')
fprintf(' ... computing seeds')
D = params.seedparams.weights;
prc = params.seedparams.threshprc;
... |
3e85e4ecd9f5c7fdb4d6acc39391abcfc088173654000167f2ea75eea0af9af7 | MATLAB | 851 | 24 | % =========================================================================
% FORMAT param = MCC(expected, predicted)
% =========================================================================
% Compute Matthew' correlation coefficient of classification:
% MCC = (TP * TN - FP * FN) / sqrt( (TP+FP) * (TP+FN) * (TN+FP) ... |
a84d19bcbd2fd5790b345122c617ccc858a5cc2a71b654c24cb7e9a15f763b9e | MATLAB | 851 | 22 | function param = nk_GLMNET_config(prog, param, defaultsfl, framework)
if ~exist('defaultsfl','var') || isempty(defaultsfl), defaultsfl = true; end
param.options = nk_matLearn_getopts_config([], 'get_learner_params', prog, param, framework);
ind = 1;
if ~defaultsfl
while ~isempty(ind)
[mn_str, mn_act] = nk_... |
ab07518074d3ec951c6a992b56a6aa1fb5f8a7e82a4a9d5427cd447e5c9b04c5 | MATLAB | 852 | 43 | % SETENVIRONMENT Set value of "global" variable
%
%
% Copyright 2009 :: Michael E. Tipping
%
% This file is part of the SPARSEBAYES baseline implementation (V1.10)
%
% Contact the author: m a i l [at] m i k e t i p p i n g . c o m
%
function setEnvironment(varargin)
switch nargin
%
case 0,
% Initialise
VA.Versi... |
66da6d066e26473ffe4e2c796bf63137fce8fe0fde5717301d3337c76c45d6fd | MATLAB | 855 | 36 | function [n,names] = plx_chan_names(filename)
% plx_chan_names(filename): read name for each spike channel from a .plx or .pl2 file
%
% [n,names] = plx_chan_names(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
%
% OUTPUT:
% names - array of channel name strings
% n - number of channe... |
688b22409dd89aa271865ceb721d21e23df197df4cb13ad4bf2dda63e462d930 | MATLAB | 855 | 28 | %% plotting sample traces for figs
% load deconvolved trace
trace_ex = load('109_REC289083_D1awake_BoxHab_DeconTrace.csv');
% z-score for scaling consistency
Decon_Z = zscore(trace_ex, 0, 2);
% gap between traces; adjust as needed for fig aesthetics
gap = 10;
% create fig, plot one trace at a time from... |
5530c491b41982c81fd42923a87cbe2a3ab97426e4f40f149ccdc6b6dac421ee | MATLAB | 856 | 23 | function boxplot_astx(bpax,compbox,sign)
%BOXPLOT_ASTX adds asterisks above boxplots
% BOXPLOT_ASTX(bpax,compbox,sign) draws asterisks above bar/boxplots where
% results are statistically significant.
% Input arguments:
% BPAX - bar/boxplot axis
% COMPBOX - index of compared groups (each boxplot co... |
f968279648d4aa7670e88871d61f012a8899c880fd04612a0801927863886c1d | MATLAB | 863 | 32 | function normqqplot(y,class)
%NORMQQPLOT produces a Quantile-Quantile plot in which the vector y is plotted against
% the quantiles of a standard normal distribution.
%
% Required input arguments:
% y : row or column vector
%
% Optional input arguments:
% class : a string used for the y-label and the title(d... |
2ae472319539175862fb90c6e3ba1da4e9c77849b6368c11e3dcc0616b62db06 | MATLAB | 864 | 30 | function op = prox_null( )
%PROX_NNL1 null projection
% OP = PROX_L1( q ) implements the nonsmooth function
% OP(X) = norm(q.*X,1), OP(X)>=0
% Q is optional; if omitted, Q=1 is assumed. But if Q is supplied,
% then it must be a positive real scalar (or must be same size as X).
%
% Update Feb 2011,... |
fba7abf61ec11a1bfe3eccd97cc6dd3cb14a2c87df526baf0409c9882ae457ad | MATLAB | 865 | 36 | function ApplyConvexHullsFromFile(self)
% ApplyConvexHullsFromFile
% Loads a set of convex hulls and appends new convex hull clusters if the
% feature names match
% Get settings
MCS = MClust.GetSettings();
% Get file name and load clusters
[fn,fd] = uigetfile(['*' MCS.defaultCLUSText], ...
'Clusters File', ['*' ... |
1e1b9ab6f909daf97686dc5c277bf73ff614bb3d2c6e67a6de555100ed67b288 | MATLAB | 866 | 33 | classdef MCCluster < MClust.ClusterTypes.CvxHullCluster & MClust.ClusterTypes.SpikelistCluster
% Basic MCCluster
%
% the type we had in MClust 3.5
methods(Static, Access=public)
function bool = Modifiable()
bool=true;
end
end
methods
function S = GetSpikes(self)
... |
77752a7e08f98108be9c4654914202f501773f83da7fbe6c8fea2606ec7c5f16 | MATLAB | 866 | 30 | function [energyData, energyNames, energyPars] = feature_EnergyD1(V, ttChannelValidity, ~)
% MClust
% [Data, Names, Params] = feature_EnergyD1(V, ttChannelValidity, Params)
% Calculate energy feature for the first derivative of each channel.
% Normalizes for number of samples in waveform.
%
% INPUTS
% V = TT tsd
% ... |
a83e785f6c51903788d5cde3acfde14d3072947eebfedbb0ddf1869fb86c3bef | MATLAB | 867 | 33 | function [energyData, energyNames, energyParms] = feature_Energy(V, ttChannelValidity, ~)
% MClust
% [Data, Names, Params] = feature_Energy(V, ttChannelValidity, Params)
% Calculate energy feature max value for each channel. Normalizes for #
% samples in waveform.
%
% INPUTS
% V = TT tsd
% ttChannelValidity = nC... |
0c473102a357605a2dd4ddf52b5a4e0fde09e7befc4698880f54cd8443885df4 | MATLAB | 870 | 33 | function disp(obj)
% Display a file_array object
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging
%
% $Id: disp.m 7147 2017-08-03 14:07:01Z spm $
if numel(struct(obj))>1
fprintf(' %s object: ', class(obj));
sz =... |
87e68902eb560d4b7a676c18ee6da20b632f07332b635b7488d008f3a6d2ea5b | MATLAB | 873 | 32 | classdef WaveformLimit < handle
% WaveformLimit class
properties
channel = [];
sample = [];
min = [];
max = [];
end
methods
function self = WaveformLimit(channel, sample, min, max)
self.channel = channel;
self.sample = sample;
... |
c6d17258a8a30e2e0cbc83543564c8226effbadf8bff0eb511bdff2f161df350 | MATLAB | 873 | 30 | function msPlayAlignment(vidObj, downSamp)
%MSPLAYALIGNMENT Summary of this function goes here
% Detailed explanation goes here
% count = 0;
cc = {'b' 'g' 'm' 'y'};
% h = vidObj.alignedHeight(1)/2;
% w=vidObj.alignedWidth(1)/2;
figure;
frame = msReadFrame(vidObj,1,true,false,false);
imshow(uint8(frame));
[w, h... |
0521fde17bf06d8c872361b6af564e19c48556e0fc1a4234782fc3eeb21457f2 | MATLAB | 875 | 25 | function [ts] = PL2Ts( filename, channel, unit )
% PL2Ts( filename, channel, unit ): read spike timestamps from a .pl2 file
%
% ts = PL2Ts( filename, channel, unit );
% ts = PL2Ts( filename, 'SPK01', 1 );
% ts = PL2Ts( filename, 2, 3 );
%
% INPUT:
% filename - if empty string, will use File Open dialog
% channel - ... |
8c5cb8959d37502a39fab1e1e261d73bd2e213d69e2cf31c3c4280b8cfbcd5fc | MATLAB | 879 | 36 | function fig = jh_bar(data, error)
% contact: cautious@kaist.ac.kr
% last modified: 2019.04.04.
% description
% draw bar graph with label, data and error terms
% inputs
% data : data to be drawn (vector or array)
% error: error to be drawn (vector or array)
% outputs
% bar graph with er... |
cb2fb7c34a89adb6055dda0c4d3ca6c00b1778fcce6287243127e538c52e0288 | MATLAB | 879 | 40 | function R = selectalongfirstdimension(IN, f)
% R = selectalongfirstdimension(IN,f)
%
% equivalent of IN(f) for 1D, IN(f,:) for 2D, IN(f,:,:) for 3D, etc...
%
% INPUTS:
% IN = any matrix input
% f = selection indices (such as returned by find)
%
% OUTPUTS:
% R = same type matrix as IN
%
%
% ADR 1998
% versio... |
848ae7734c21bf4af2483f190b87bfd5395afe66cd129ff4755d84f45b828588 | MATLAB | 881 | 28 | function Ymean = cv_compute_ROImeans(Yimg, brainmask, atlas)%, PREPROC, prevP)
S.Vm = spm_vol(brainmask);
[S.dims, S.indvol, ~, S.vox] = nk_ReadMaskIndVol(S.Vm, []);
image_for_size = char(brainmask);
atlas = [];
if ~exist('atlas','var') || isempty(atlas)
maskVec = nk_Vol2Vec(brainmask);
el... |
23f8f2138e9ab70950e123e99d4700617b4d56d532a5767444b1a145a7acaf9a | MATLAB | 883 | 33 | function [ wY, wYnew, wYoocv ] = nk_PreprocDataForEval(param, wY, wYnew, wYoocv)
if isfield(param,'DR') && isfield(param.DR,'RedMode')
fprintf('%s',param.DR.RedMode)
[wY, mpp, indNonZero] = nk_PerfRed2(wY, param.DR);
if exist('wYnew','var') && ~isempty(wYnew)
wYnew = nk_PerfRed2(wYnew, param.DR, mp... |
e9f71631c348b07294828205ea1bbece8d4d4760a98e30088b6e011205b6de40 | MATLAB | 886 | 33 | function [output, m] = L_Ratio(FD, ClusterSpikes, NoiseSpikes)
% output = L_Ratio(FD, ClusterSpikes)
%
% L-ratio
% Measure of cluster quality
%
% Inputs: FD: N by D array of feature vectors (N spikes, D dimensional feature space)
% ClusterSpikes: Index into FD which lists spikes from the cell who... |
f1dbfd3a860325d4f76368a900670f82dcbe40e7285648b1774809a7c3556701 | MATLAB | 887 | 27 | % authors: Ioannis Psorakis psorakis@gmail.com, Theodoros Damoulas theo@dcs.gla.ac.uk
% Copyright NCR, 2009
%
% Use of this code is subject to the Terms and Conditions of the Research License Agreement,
% agreed to when this code was downloaded, and a copy of which is available at
% http://www.dcs.gla.ac.... |
c645e85b43f1ba0b20893dcb6d97ca3b26172cbfc720f0cf49bb64a49dfff652 | MATLAB | 888 | 27 | function n=matrixNorm(A)
% Calculate the Frobenius norm of matrix A
%%%%
% 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 License, o... |
3a7050258e5437793e69365f6a266b104f086ffaa817e77a187505dd465a049f | MATLAB | 890 | 27 | function [coreness,kn] = kcoreness_centrality_bd(CIJ)
%KCORENESS_CENTRALITY_BD K-coreness centrality
%
% [coreness,kn] = kcoreness_centrality_bd(CIJ)
%
% The k-core is the largest subgraph comprising nodes of degree at least
% k. The coreness of a node is k if the node belongs to the k-core but
% not to ... |
80415df362c75f7786ba5016cdb354cce64c7dd4679231c5fdabeea97efcbb4d | MATLAB | 894 | 32 | clear
load('ProcessedData\tables_compiled_behaviorShifter_best.mat');
%% behavior for best odor trials cross days
behBest_meanDay = cell(1,5);
for i = 1:5
day_now = tables_compiled{i,1};
day_now = day_now(day_now.Odor == 1,:);
behBest_meanDay{1,i} = mean(day_now.Beh_Index,2,'omitnan');
end
%%... |
df32c5c39e95acc14e90f38f512095be5eeb01538fa22af764f14ce0277fb420 | MATLAB | 897 | 35 | function ClusterFunc_ShowWaveformWaterfall(self)
% ClusterFunc_ShowWaveformWaterfall(self)
% ADR 2003
%
% 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 b... |
a405e1a17061b8defd915e9e08c0a39ff0d0e90fd2c2a13601e053985ab5fc3b | MATLAB | 900 | 33 | function check_dependencies()
%CHECK_DEPENDENCIES Basic dependency checks for the core oracle benchmark.
%
% This function checks for the MATLAB functions and toolboxes needed by the
% core repository code. CEEMDAN is optional and is checked separately.
fprintf('Checking core dependencies...\n');
required_funcs = { ... |
ada1b85259fc23e5235c6cf35572d0c1d7245e9a201d87b271180db0a3f103de | MATLAB | 902 | 42 | function d = size(a,varargin)
% Method 'size' for file_array objects
%__________________________________________________________________________
% Copyright (C) 2005-2017-2012 Wellcome Trust Centre for Neuroimaging
%
% $Id: size.m 7440 2018-10-10 17:28:26Z john $
sa = struct(a);
nd = 0;
for i=1:numel(sa)
nd = ... |
191a866c4906ddaac21337550ebae37e60b81a3d13532d36e641d8063924513b | MATLAB | 905 | 24 | function [event] = PL2EventTs(filename, channel)
% PL2EventTs(filename, channel): read event timestamps from a .pl2 file
%
% [event] = PL2EventTs(filename, channel)
% [event] = PL2EventTs(filename, 1)
% [event] = PL2EventTs(filename, 'KBD2')
%
% INPUT:
% filename - if empty string, will use Fil... |
fd3b46de445b4830d871ef78f40cf93ec985a18bb051ff5f48e4d0ac44193730 | MATLAB | 906 | 37 | function output = cmi(X,Y,Z)
%function output = cmi(X,Y,Z)
%X, Y & Z can be matrices which are converted into a joint variable
%before computation
%
%expects variables to be column-wise
%
%returns the mutual information between X and Y conditioned on Z, I(X;Y|Z)
if nargin == 3
if (~isa(X,'double') || ~isa(Y,'double'... |
cf2e0b5b475f3d329a02d98b1e1bcaed15d09d6894258ab9be2b4acdb77ceea6 | MATLAB | 908 | 30 | function param = nk_RegAmbig(sE, tE, ambigtype)
% =========================================================================
% FORMAT function param = nk_RegAmbig(E)
% =========================================================================
%
% this function measures the average divergence of single ensemble component ... |
07b3a6685105a4b7bd24c1a09f81879ef38085ab86fb0825d184d39a6d5b7fb3 | MATLAB | 909 | 32 | % NDM with Source
%
% Evaluate NDM predictions [y] at desired time stamps.
%
% Input:
% x0 = Initial Condition
% time_stamps = provided in units given by experiment
% C = connectivity matrix
% beta = diffusivity parameter
% alpha1 = linear growth/clearance... |
0c1cd1bfc20e21cad78b22c64230edcb2248198df6489ad4c7510874af04038c | MATLAB | 909 | 31 | function [cov_mat, reorder] = nk_ReorderComponents(T, S, method)
% T: the matrix to be reordered
% S: the source matrix which serves as template for the reordering
if ~exist('method','var') || isempty(method), method = 'mi'; end
switch method
case 'mi'
S = discretize(S);
T = discretize(T);
end
swit... |
8e6e7fe260780e31d2fc0957772719e32bf275be62bdf7cb6712e7ac980b507b | MATLAB | 909 | 35 | function mbm_check_input(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.
if isfield(MBM, 'maps')==0 | isf... |
5c058baf25711bcc96c258b56aa7f37dd7ddfa1c3de5f7f36d474ca895ac0fed | MATLAB | 910 | 40 | function [K,runtime] = allkernel(Graphs,k)
% Compute all 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
% Output: K - nxn kernel m... |
84b14ddb429b490eaf89e49c31acf544ac6e12ec67cb973a3bf679243d90b428 | MATLAB | 910 | 28 |
function [z y] = YTruncate(F,comp,Nsamps)
% Calculate the normalising constant and the expected value of a gaussian
% with mean f and largest component comp
% SUPER-FAST Vectorised version
% Written by Dr. Simon Rogers: www.dcs.gla.ac.uk/inference/~srogers
%-----------------------------------------
% Copyright August... |
75c4070f8e23056685d0dbe1e79baa2abb95383979c3e58c4fdf79b38b3f8f3c | MATLAB | 911 | 29 | function T=transitivity_wu(W)
%TRANSITIVITY_WU Transitivity
%
% T = transitivity_wu(W);
%
% Transitivity is the ratio of 'triangles to triplets' in the network.
% (A classical version of the clustering coefficient).
%
% Input: W weighted undirected connection matrix
%
% Output: T trans... |
9939f9a39f323236205f376f5f9b61dac4fc8aea254eef3ed2811efe12ae88b9 | MATLAB | 911 | 34 | function [ dY, IN ] = PerfDiscretizeObj(Y, IN)
% Defaults
if isempty(IN),eIN=true; else eIN=false; end
% Default params for binning
if eIN|| ~isfield(IN,'DISCRET') || isempty(IN.DISCRET),
IN.DISCRET.binstart = 0;
IN.DISCRET.binsteps = 0.5;
IN.DISCRET.binstop = 5;
end
% Compute mean if not in IN.mY
if e... |
ca95e06c79eab64f42dc93beea5779dc414477406c9ffd2b381887ac64d3b65f | MATLAB | 911 | 30 | function cellnr_pie(X,colors, labels)
%CELLNR_PIE
% CELLNR_PIE(X,colors, labels) creates pie chart with unit nrs stored in X.
% Johanna Petra Szabó, 10.2024
% Lendulet Laboratory of Systems Neuroscience
% Institute of Experimental Medicine, Budapest, Hungary
% szabo.johanna@koki.hun-ren.hu
P = pie(X);
pat... |
7d6be96ea24d6ec85d8d965902e765c0129997e0134af794e5d5fcc13e981ca2 | MATLAB | 912 | 35 | function runSeparateSessions(parentFolder)
%%% Function to run CNMFe on sessions separatelly
%%% Requirements: Step 1 of Concatenation Pipeline.
% Input:
% parentFolder: Folder with data of one single subject. Should contain
% child folders from single sessions each.
% Developed by Daniel Almeida Filho (Apr, 2021)... |
b81c85d17b4665b6050dfcbf8056fe7578fc494b38ddca372bef919b3c91c88c | MATLAB | 917 | 36 | function [PeakData, PeakNames, PeakPars] = feature_PeakValleyDiff(V, ttChannelValidity,Params)
% MClust
% [PvData, PvNames] = feature_PeakValleyDiff(V, ttChannelValidity)
% Calculate pv feature max value for each channel
%
% INPUTS
% V = TT tsd
% ttChannelValidity = nCh x 1 of booleans
%
% OUTPUTS
% Data - nS... |
5f750b5a68863fe578f9983dd9f1fc326dcfc998e0263153a57b25ec3c17b6e0 | MATLAB | 918 | 30 | function [Spos,Sneg,vpos,vneg] = strengths_und_sign(W)
%STRENGTHS_UND_SIGN Strength and weight
%
% [Spos Sneg] = strengths_und_sign(W);
% [Spos Sneg vpos vneg] = strengths_und_sign(W);
%
% Node strength is the sum of weights of links connected to the node.
%
% Inputs: W, undirected conne... |
a51f129ba31ec8f4363ce8aeb1d13aeb00fbb11a4eb84f6089842d367c44cdf4 | MATLAB | 918 | 34 | function [d,ix] = data(tsa, tlist, varargin)
%
% d = data(tsa)
% returns tsa.D
%
% d = data(tsa, tlist)
% returns the nearest elements to tlist in tsa
%
% d = data(tsa, tlist, parms)
% allows control of parameters through process_varargin(varargin);
%
% extrapolate = nan; %% if 0 then only include tlist values such ... |
a6c4ea80da498377c7ae9f3b1776626b501ee7349a340fcd2501b03b64cdaeee | MATLAB | 918 | 42 | function V = solveV_eig_ind(U, Us, Vs, Ss, reg_smooth, reg_l2)
% solve S analytically using eigen-decomposition
%
% TODO: check with optimization form.
n = length(Ss);
V = cell(n, 1);
for ii = 1:n
UtU = U{ii}' * U{ii};
[Q1, Lu] = eig(UtU);
V{ii} = solveVi(U{ii}, Us{ii}, Q1, diag(Lu) + reg_l2, Vs{ii}, ... |
b4a630a580500a58ca3d238ea0c581b435dea40488ed11edd0a847cc9be9c2d4 | MATLAB | 919 | 22 | function D = mripy_diagnose_DCM(GCM)
% Diagnose the goodness-of-fit of DCMs.
%
% Return a table, in which each row is a DCM (for one subject) and the
% columns are:
% - explained: percent variance explained
% - LAPE: largest absolute posterior expectation (extrinsic connections)
% - complexity: complexity and effectiv... |
3895050fa08b01700596ee9078311b160348bff0f0d3fff1142a937a86efab10 | MATLAB | 924 | 32 | function [b, f, b0] = fit_svd_model(Y, nb, A, C, b_old, f_old, thresh_outlier, sn, ind_patch)
% fit a patched data with SVD
Ymean = mean(Y,2);
if ~exist('A', 'var') || isempty(A)
[d, T] = size(Y);
A = ones(d,1);
C = zeros(1, T);
elseif issparse(A)
A = full(A);
end
Cmean = mean(C, 2);
Y = bsxfun(@m... |
9919860cdc1c518d31d90543197791541bcd8e8df6100d2b18790ed6e0b374bf | MATLAB | 924 | 45 | function h = jointentropy(vec1,vec2)
%=========================================================
%
%This is a prog in the MutualInfo 0.9 package written by
% Hanchuan Peng.
%
%Disclaimer: The author of program is Hanchuan Peng
% at <penghanchuan@yahoo.com> and <phc@cbmv.jhu.edu>.
%
%The CopyRight is reserved by th... |
4c61a4ce6add045667586ecdd09cfd0ce1f368ffa299aa86d28fb2019eed36d4 | MATLAB | 925 | 33 | function h_out = plot_statecolored(varargin)
% Plot a single quantity using state_str for the colours
f = varargin{1};
varargin = varargin(2:end);
if ishandle(varargin{1})
parent_axis = varargin{1};
varargin = varargin(2:end);
else
parent_axis = gca;
end
if length(varargin) == 3
z = varargin{3};
end
y ... |
9fb3942e0857b6447069b36434bc444377cdac4a44f29a320767fdc4005d5eaf | MATLAB | 925 | 36 | function sV = nk_VisSmooth(V, fwhm, varind, brainmask, badcoords, dimvecx)
sV = zeros(size(V));
for i=1:numel(varind)
if numel(varind)>1
fprintf('\n\nSmoothing weight vector data for Variate #%g',i)
end
% Get pointer2variate vector
if exist('dimsizes','var')
varsuff = sprintf('_v... |
daefe4684c30646d13ba77a013ccccd10817da493cadc38752cc16a2bda8013d | MATLAB | 925 | 25 | function load_selYAxis(handles)
switch handles.modeflag
case 'classification'
str = 'classifier scores';
case 'regression'
str = 'target predictions';
end
if strcmp(handles.popupmenu1.String{handles.popupmenu1.Value},'Multi-group classifier')
popuplist = {'Multi-group probabilities derive... |
fef09e801709bc66bfdbaae13f1c9e539dca8fedf92d7ee25253729ca8ece6a4 | MATLAB | 925 | 25 | function tittaCalCallback(titta_instance,currentPoint,posNorm,posPix,stage,calState)
global rM aM %our reward manager and audio manager object
if strcmpi(stage,'cal')
% this demo function is no-op for validation mode
if calState.status==0
status = 'ok';
if isa(rM,'arduinoManager') && rM.isOpen
giveReward(rM);
... |
7776ced434771c27d3fdb4828a2f373510bb5a5c0e38c98a841e74f09839fc3f | MATLAB | 927 | 33 | function [count] = countconnected3graphlets(A, L)
% Count all 3-node connected 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: A - nxn adjacency matrix
% L - 1xn cell array ... |
f835f73cb9f9d46ddbb6bc5e482c852ec1615738d1714b0a557e01dfbd3fb244 | MATLAB | 927 | 27 | function [ sY, IN ] = PerfSymbolizeObj(Y, IN)
if isempty(IN),eIN=true; else, eIN=false; end
% Default params for binning
if eIN|| ~isfield(IN,'SYMBOL') || isempty(IN.SYMBOL),
IN.SYMBOL.symMinBin = 3;
IN.SYMBOL.symMaxBin = 25;
IN.SYMBOL.symSeqLength = 4;
IN.SYMBOL.symStdNum = 3;
end
if eIN || ~isf... |
d04c079124eea12b82266eeee97d1a22494490f23ce8c825810f08813974d441 | MATLAB | 932 | 32 | function [dY, mY, sY] = discretize(Y, astart, astep, aend, mY, sY)
% =========================================================================
% FORMAT [dY, IN] = nk_PerfDiscretizeObj(Y, IN)
% =========================================================================
%
% Discretizes Y columnwise to mean +/- alpha*std, w... |
eafde6cd385a4a68db49a54e51ff9b10da59a0cd89fccc8f63f01c7c3f7096df | MATLAB | 935 | 27 | function valid = is_valid_handle(hObj)
% valid = is_valid_handle(hObj) or is_valid_handle('get_new_init_key')
% Check if a handle is valid (has the right data type and init_key matches)
% Use is_valid_handle('get_new_init_key') to get new init_key from C++;
% a handle is a struct array with the following fields
% ... |
0e917b3a0dce4982043c5abc101682a69b921b1ea1b80f6de9772268ce0aca61 | MATLAB | 936 | 35 | function opts = mergeOptions(opts1, opts2)
% Merges two options structures with one having precedence over the other.
%
% function opts = mergeOptions(opts1, opts2)
%
% input: opts1 and opts2 are two structures.
% output: opts is a structure containing all fields of opts1 and opts2.
% Whenever a field is present in bot... |
b776874ece097dda9711e77f075c971e202a6cfbea03eec953292a290db03d67 | MATLAB | 936 | 30 | function SetParms(self, varargin)
%
% SetParms for convex hull cluster
self.SetParms@MClust.ClusterTypes.DisplayableCluster(varargin{:});
if isa(varargin{1}, 'MClust.ClusterTypes.CvxHullCluster')
self.CopyHulls(varargin{1});
elseif isa(varargin{1}, 'MClust.ClusterTypes.Cluster')
S = varargin{1}.GetSpikes();
MCC ... |
1a887357326c3456f18e603bff9f74029a512efd215b79e139405c863c1bd4cf | MATLAB | 938 | 37 | % NDMwS
%
% Evaluate NDMwS predictions [y] at desired time stamps.
%
% Input:
% x0 = Initial Condition
% time_stamps = provided in units given by experiment
% C = connectivity matrix
% beta = diffusivity parameter
% alpha0 = cte growth/decay term independe... |
f7d451bde289f2174b107b159ab94e719762aefb9f705a83d9a4684182fe35e2 | MATLAB | 944 | 29 | function s=sparsity(Y)
% Calculate the sparsity of a matrix
% Y: matrix
% s: scalar, the sparsity of Y
%%%%
% 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,... |
927074a74649ba385809e607550618f0784e10d4a29736066cf0595f455c25c1 | MATLAB | 945 | 63 | function res = zpad(x,sx,sy,sz,st)
% res = zpad(x,sx,sy)
% Zero pads a 2D matrix around its center.
%
%
% res = zpad(x,sx,sy,sz,st)
% Zero pads a 4D matrix around its center
%
%
% res = zpad(x,[sx,sy,sz,st])
% same as the previous example
%
%
% (c) Michael Lustig 2007
if nargin < 2
error('must have a target s... |
8fac682814f234e9c4f3471047e2a5ab63adf105264e7071240228146248e73a | MATLAB | 946 | 40 | function [D] = floydwarshall(A, sym, w)
% % Copyright 2012 Nino Shervashidze
% Input: A - nxn adjacency matrix,
% sym - boolean, 1 if A and w symmetric
% w - nxn weight matrix
% Output: D - nxn distance matrix
n = size(A,1); % number of nodes
D=zeros(n,n);
if nargin<2 % if the graph is not weighted and ... |
23ba4290b2748ccf988a26da2b46c923650bfb3f524b5ae3a0364fbf29972874 | MATLAB | 947 | 25 | function [Y] = diagonalize(X,samplesize)
% ----------------------- Input ------------------------------
% X: samples of all tasks (each row is a sample)
% samplesize: the i-th entry is the sample size of the i-th task
% ----------------------- Output -----------------------------
% Y: sparse data matrix which is diagon... |
6fd73065c8fc91de430b62d62d9fe88c17bafc49767dad1bf017da81c66a6966 | MATLAB | 949 | 27 | function [TE_index,evinx] = StimOn_stoppart_evinx(Evinxx,event,evty)
%STIMON_STOPPART_EVINX Epoch indeces of subevent
% [TE_index,evinx] = STIMON_STOPPART_EVINX(Evinxx,event,evty)
% -Finds epoch indeces in EVINXX struct of EVENT related epochs, corresponsing to EVTY
% subevent (Failed or Succesful Stop).
%
%... |
d15c135c632f72f91864a61a4a6253e2075d383d04a5cb00d4987b18659d2a37 | MATLAB | 949 | 41 | function [n, ts] = plx_ts(filename, channel, unit)
% plx_ts(filename, channel, unit): read spike timestamps from a .plx file
%
% [n, ts] = plx_ts(filename, channel, unit)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% channel - 1-based channel number or channel name
% unit - unit number (0-... |
e5c2465d695108e0a5dd1e55cd68eeba81e34735a50b4ec6d114168ccf87f721 | MATLAB | 949 | 31 | function [wmean,wcov]=weightmecov(data,weights)
%WEIGHTMECOV computes the reweighted mean and covariance matrix of multivariate data.
%
% Required input arguments:
% data : data matrix
% weights : weights of the observations
%
% This function is part of LIBRA: the Matlab Library for Robust Analysis,
% availabl... |
f166eedb5bb2609fadd4d8939ce3593f6f41df2f9ddd9662b1d8e0f9ce601df4 | MATLAB | 951 | 37 | function ClusterFunc_ShowHistAtPeak(self)
% ClusterFunc_ShowHistAtPeak(self)
% ADR 2003
%
% 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 accom... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.