sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c629f79d0ea985f577585d0583cc9b2331c44c57ace15ff02d03133d07317a9d
MATLAB
1,078
36
% RSKELF_SV Solve using recursive skeletonization factorization. % % Typical complexity: same as RSKELF_MV. % % Y = RSKELF_SV(F,X) produces the matrix Y by applying the inverse of the % factored matrix F to the matrix X. % % Y = RSKELF_SV(F,X,TRANS) computes Y = F\X if TRANS = 'N' (default), % Y = F.'\X...
0abf61885f2ed4d7d5c545f605955692da19be2730bb0320f5b6badb60ddf0bc
MATLAB
1,080
33
function Y = srskelf_sv_p(F,X) % Y = SRSKELF_SV_P(F,X) The strong skeletonization factorization stored in % F is used to solve FY=X, where the "_P" suffix indicates that the % factorization in F exploits the fact that F is positive-definite. The % input X is a vector or matrix of appropriate size. % Initialize ...
1b7087742e0fd98035dde08831ed49f91d27c37af981352dfd2692513025ffc3
MATLAB
1,081
33
function [S] = wtorus(radii,scales,nosc,nu,nv,norder) npatches = double(2*nu*nv); npols = int32((norder+1)*(norder+2)/2); npts = double(npatches*npols); srcvals = zeros(12,npts); srccoefs = zeros(9,npts); wts = zeros(npts,1); iptype = zeros(npatches,1); ixyzs = zeros(npatches+1,1); n...
6eb4559fab1a377931155870ba1670357c43f450d61248f48b5d488bd2409f60
MATLAB
1,081
59
% disp("This is an example matlab driver"); disp("On output the code prints the pot+grad in example1 and, pot+pottarg in example2"); disp(" "); disp(" "); %% source to source, charges only, pot+grad example % clear srcinfo ns U eps pg; disp("Example 1: source to source, charge, pot+grad"); disp(" "); disp(" "); ns...
78056b06d3297abe39ec1f814366f78b768bcf077933a1d3cf991372b7cc1eaf
MATLAB
1,081
15
clear;clc;close all ROOTPATH = strcat(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 4), "Data\Processed Data\"); cd(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 2)) protStr = "Active duration"; temp = NoveltySU.utils.dirItem(strcat(ROOTPATH, protStr), "spkData.mat"); popRes = cell2mat(cellfun(@(x)...
bd908a6c27c0e73df0e2fc44eb4acd920d226f8701985abee1669162fbbfcbeb
MATLAB
1,081
33
function Y = srskelf_mv_p(F,X) % Y = SRSKELF_MV_P(F,X) The strong skeletonization factorization stored in % F is used to compute Y=FX, where the "_P" suffix indicates that the % factorization in F exploits the fact that F is positive-definite. The % input X is a vector or matrix of appropriate size. % Initializ...
761a8dc1e7a9d350a51fa547a479eac6ff9ed836535d2422eef3ad20cc53137f
MATLAB
1,082
47
function answer = isEndKeywordMissing(fname) % Return true if the syntactically optional end keyword is missing % from the end of the function. % This file is from pmtk3.googlecode.com if ~isfunction(fname) answer = false; return end text = removeComments(getText(fname)); text = cellfuncell(@removeStrings...
0f9553c3d70b38a624fbfe0ff50d9fb00ae1e509a0233704af908e833b9d68f6
MATLAB
1,083
20
clear;clc;close all ROOTPATH = strcat(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 4), "Data\Processed Data\"); cd(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 2)) protStr = "Active duration"; temp = NoveltySU.utils.dirItem(strcat(ROOTPATH, protStr), "spkData.mat"); popRes = cell2mat(cellfun(@(x)...
3da46f7103995cb7cc0f6ca309e5005060444a778d658c92777ddaca2ffeaa5f
MATLAB
1,083
22
function [rf_fs,gx_fs,gy_fs,gz_fs] = prepare_fat_sat(params, sat_ppm) lims = params.gen.lims; sat_freq = sat_ppm*1e-6*lims.B0*lims.gamma; if params.gen.field_strength == 7 || params.gen.field_strength == 7i rf_fs = mr.makeGaussPulse(params.gen.fs_angle*pi/180,'system',lims,'Duration',5e-3,......
b6ae2da481bfe5ff5aa85d19b04419eea5d01ad41a5509aa09b7a6fb2aae2569
MATLAB
1,083
33
function sp_site_effect_removal(fn_img,fn_sm,fn_vp,fn_gs,fn_ds,fn_mask) [filepath,name,ext] = fileparts(fn_img); % load the preprocessed image hdr = spm_vol(fn_img); img_pre = spm_read_vols(hdr); % load parametric maps hdr1 = spm_vol(fn_sm); img_sm = spm_read_vols(hdr1); hdr1 = spm_vol(fn_vp); img_vp = spm...
0d2555c403a000483f951f1e694a017e40469f19f1ff79b443a06432815860a6
MATLAB
1,084
32
% ExtractFlorescenceTimeseries.m % Sarah West % 4/5/22 % Extracts mean flourescence timeseries from source masks. function [parameters] = ExtractFluorescenceTimeseries(parameters) % Announce what extraction you're on. MessageToUser('Extracting ', parameters); % Make sure data & source dimensions agr...
1925ee57388c19e61e815eee301460aa0241d2edf6d869f603463b9893edeb3a
MATLAB
1,084
31
function Iout=affine_transform(Iin,M,mode) % Function affine_transform, is a wrapper of the (mex) functions % affine_transform_2d_double and affine_transform_3d mex functions % % Iout = affine_transform(Iin,M,mode) % % inputs, % Iin : Input image. % M : Transformation matrix % mode: If 0: linear interpo...
2333adc12c4b60996c8ab693c9d1292c0ba5987679be06a4656635208968d4da
MATLAB
1,084
55
function RasterPlot2(spk, plotRange, varargin) % spk is a cell array of spike times (each cell is one trial) % default values for optional arguments fig = []; tickColor = 'k'; tickWidth = 1; tickSpread = 1; zerolineWidth = 1; yVal = []; for i = 1:2:length(varargin) switch lower(varargin{i}) case 'fig' ...
7432a70e02367f9be84dfbe5a3c9ab02a3df43f2c4521d3edf58dea48618ec85
MATLAB
1,084
29
function x = waverec2_gpu(c,s,varargin) %WAVEREC2 Multilevel 2-D wavelet reconstruction. % WAVEREC2 performs a multilevel 2-D wavelet reconstruction % using either a specific wavelet ('wname', see WFILTERS) or % specific reconstruction filters (Lo_R and Hi_R). % % X = WAVEREC2(C,S,'wname') reconstructs the mat...
7ea64317bc2da805f3ee322f9021a3ecfceb763fadf2726f7ebef3ada6ff8a23
MATLAB
1,084
38
function x = steepestDescent(f, x0, varargin) % f is the function of the form [fx, gx] = f(x) where gx is a column vector % outputfn has the form stop = outputfn(x, optimValues, state) % This file is from pmtk3.googlecode.com [ftol, maxIter, exactLineSearch, outputFn, stepSize] = process_options(... varargin, 'f...
cdb35887e3f5618956ab4853ddd452bd2f65529c2097518402d7646645b678dd
MATLAB
1,084
40
%% if 0 b = firpm(100,[0 0.1 0.11 1],[0 1 1 1]); h = ftrans2(b); [H,w] = freqz(b,1,64,'whole'); figure; set(gcf,'Position',[ 200 500 1600 440]); colormap(jet(64)) subplot(1,3,1); imagesc(imgPair.moving.input) subplot(1,3,2);plot(w/pi-1,fftshift(abs(H))) %subplot(1,3,2); freqz2(h,[3...
0deb5dd83e12294aa540b9ef6fb94b0bb46e81ad506bb5424707fe5a70a755df
MATLAB
1,085
43
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % throws away all data in the current channel % and resets the state of this channel to 0 functio...
122684fa15196122f3d7f1e052872e708d40ae895e4562904b08126715d84cf7
MATLAB
1,085
60
%{ _ _ ___ _ __ __ _| |__ ___ ___ _ __| |_ / __| '__/ _` | '_ \/ __|/ _ \| '__| __| | (__| | | (_| | |_) \__ \ (_) | | | |_ \___|_| \__,_|_.__/|___/\___/|_| \__| # NNmake **Syntax** ``` crabsort.NNmake(input_size,n_classes...
77f422390fdf854a4b06f073ccf40e8a6abe1e5bc56b4c8172192202f59231a5
MATLAB
1,085
42
% HIFDE_SPDIAG_SV_P Dispatch for HIFDE_SPDIAG with DINV = 1 and F.SYMM = 'P'. function D = hifde_spdiag_sv_p(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find act...
1826d221538ea635798134a9bcec74c3489e88026f132753e32aec1a73461e81
MATLAB
1,086
44
%% Bayesian updating of a 2D Gaussian % %% % This file is from pmtk3.googlecode.com function gaussBayesUnequalCov() Sigmas = {0.01*eye(2), 0.01*eye(2)}; helper(Sigmas, 'Equal') Sigmas = {0.05*eye(2), 0.01*eye(2)}; helper(Sigmas, 'Two') %Sigmas = {0.01*[10 1; 1 1], 0.01*[1 1; 1 10]}; Sigmas = {0.01*[1 1; 1 10], 0.0...
2a38b981a3a8cc8992a44df2b7b5e9f074b1dabb7c5a9afa6e569f9aa87771de
MATLAB
1,086
40
function filterSteerable( theta ) % Steerable 2D Gaussian derivative filter (for visualization). % % This function is a demonstration of steerable filters. The directional % derivative of G in an arbitrary direction theta can be found by taking a % linear combination of the directional derivatives dxG and dyG. % % USA...
3e1a207bd106c3e94b29b73eb7ed811a9fd9ebc4ac65604fa0b0460e294bb619
MATLAB
1,086
47
function [returnVar,msg] = RemoveDCfromDat_AllDat(varargin) % USAGE: % RemoveDCfromDat_AllDat(fbasename) % % removes DC offset in all channels from all dat files starting with % 'fbasename'. Assumes that there is at least one xml file associated to % one the dat file (must be created before with Neuroscope and/or...
57d25116e94889348d983e0c0bd6c4b734cbf359cc8c6d10c9d319dc382acadf
MATLAB
1,086
44
function err = compute_errors(pos_pred, pos_gt) %COMPUTE_ERRORS Computes error rates given predicted and ground truth positions. % Usage: % err = compute_errors(pos_pred, pos_gt) % % Args: % pos_pred: predicted positions (J x 2 x N) % pos_gt: ground truth predictions (J x 2 x N) % % Returns: % err: struct w...
d3b19368a9e644b4fc7d58093017ed9e003a108661cafcc7b4d6bdc3ba33faf0
MATLAB
1,086
37
function [data_compressed] = append_data_compressed_v9 (data_compressed, total_ROI, Dnum, F_F0, total_volumes, sliceNum, flyback) data_compressed(Dnum+1:Dnum+total_ROI, :) = zeros; %delta F_F0 of channel 1 A = sliceNum+flyback; index = linspace(1,A,A); z_plane_index = repmat(index, 1, total_volumes); count = 1; k =...
e8467a1812eb1b3e98f1180c3ca1c6fe2bc945021b15d205bf14b6ae073b97f2
MATLAB
1,087
36
function [ stats_map ] = adjustMapsForView( structural, red_map,... blue_map, FDR_red_map, FDR_blue_map) %% set colors red_rgb = [243, 23, 23]; blue_rgb = [0, 112, 255]; ref_rgb = [0, 0, 0]; %% obtain five 4d (3d*color) maps map_cell = {structural [1,1,1] red_map, -...
436b7d7fc6cb089e24e6a379e31692d1d6e8666dd1a92356253ee6b27673e9ed
MATLAB
1,088
38
function showRegions(binaryLabelImg) % generate colors maximum = max(binaryLabelImg(:)); colorMap = zeros(maximum, 3); for i = 1:maximum val = double(i)/double(maximum); % r channel colorMap(i,1) = ceil(255*val); % g channel if val < 0.5 colorMap(i,2) = ceil(255*val*2); else col...
aacc8de18e076b098dc34077d6472a5e98eb67466f58bbc00d1e889bb090534c
MATLAB
1,088
34
function result = ReadYaml(filename, nosuchfileaction, makeords, treatasdata, dictionary) import yaml.*; if ~exist('nosuchfileaction','var') nosuchfileaction = 0; end if ~ismember(nosuchfileaction,[0,1]) error('nosuchfileexception parameter must be 0,1 or missing.'); end if ~exist('makeords','var') ...
1c79ee016fc7404622ca4530b6e3679478a7f955f3c2f4dd9659417bd29fbada
MATLAB
1,089
45
function y = detransition(y,varargin) % For fMRI timeseries that contains large 'jump' artifacts due to motion correction % or other problems. % % :Usage: % :: % % y = detransition(y,[doplot]) % % Removes these large spikes. % Updated version built into spikecorrect in trimts doplot = 1; if length(varargin) > 0, d...
1f3fbb3a187476440966071108c06d194f7825ce570761fba37cc878594bd59e
MATLAB
1,089
39
function score=fast_pacman(decoded_event) %https://blog.usejournal.com/dynamic-programming-finding-optimal-paths-2cf89f3d1437 [score1,maxsum1]=maxsum_algorithm(decoded_event); %start from top and go to bottom right [score2,maxsum2]=maxsum_algorithm(flipud(decoded_event)); %start from bottom and go to top right if s...
742eabeab19879f5c2e470f18d8b6ffc69afbc9bf4d9985d9bdce90f10435ef3
MATLAB
1,089
51
% this class stores attributes used to % detect spikes in a trace classdef spikeDetectionParameters < Hashable properties % these go directly into findpeaks MinPeakHeight (1,1) double {mustBeFinite} = 10 MinPeakProminence (1,1) double {mustBeFinite} = 1 Threshold (1,1) double {mustBeFinite} = 0 MinPeakDis...
764e864e5c716f90487ecb22d85ae02aff92db9bb2e044a2e1414055afdfa54c
MATLAB
1,089
34
function [ F,J] = gausslinefun( params, x) %DOGFUN evaluates modified gaussian with params at x % Output: % F: function value % J: Jacobian of the parameters %Written by Dimos. %========================================================================== %Unwrap inputs %====================================...
d309e36b20464d7ba84dcdf2858b36f7a67a844f383d9a61e76f10838944a9c8
MATLAB
1,089
31
%tracks the particle between two subsequent stacks and calculates the %strain. fpos = '/media/hdd2/ShearedColloids/sr15e-6/all_tracks/pos/'; savepath = '/media/hdd2/P2-Entropy/final_calculations/Dmin/allTrack_t=0-20/d6/'; coord = 'STS_ASM385_70_2-12_6_T=0-24_'; dia = 1.6; X = load([fpos coord 'PosX.dat'])/dia; Y =...
e0c5145f347726804a057d51279db0aa70b37860694a9f43b6e337446e011cbd
MATLAB
1,089
49
function out = permtest(a,b,tail,nrand) % paired or one-sample permutation test if ~exist('b', 'var'), b = zeros(size(a)); end if ~exist('nrand', 'var'), nrand = 10000; end if ~exist('tail', 'var'), tail = 0; end a = a(:); b = b(:); if numel(b) == 1, b = b*ones(size(a)); end % expand b % if there are nans, i...
138019fe21c854f9c57120a712fd23e685e867bfdb2f253ca82c76ecc32c9e02
MATLAB
1,090
34
tabNames = cell(1,19); tabNames{1} = 'Name'; tabNames{2} = 'Date'; tabNames{3} = 'Number_of_Pulses'; tabNames{4} = 'Pulse_Width'; tabNames{5} = 'ISI'; tabNames{6} = 'Electrode_Number'; tabNames{7} = 'Power'; tabNames{8} = 'Cluster'; tabNames{9} = 'Max_Z_Score'; tabNames{10} = 'Binned_PSTH'; tabNames{11} = 'a...
5b202d7e483d92c1a3d3985f06fc9db4687b458339ac6bcd9d62ccf9c0e51b70
MATLAB
1,090
51
%% Reproduce fig 1 of "Bayesian lasso regression", Chris Hans, 2009 % %% % This file is from pmtk3.googlecode.com function lassoPostPlot() bols = 1.96; xtx = 1; s2 = 1; v2 = s2/(xtx); v = sqrt(v2); taus= [2.5 2 1 0.5]; figure; hold on [styles, colors, symbols] = plotColors; for i=1:length(taus) tau = taus(i);...
7368dd133e63410e3beab46acbde2bc74adc43954556163ace034b7fec49f2d0
MATLAB
1,090
38
function link = googleCodeLink(fname, displayName, type) %% Return the html link to fname on a PMTK associated google code repository % %% % This file is from pmtk3.googlecode.com if nargin < 3 type = 'html'; end fname = which(fname); if nargin < 2 displayName = fnameOnly(fname); end if startswith(fname, p...
750a086ba467f692408d7e074a94c3e7de0d85494549a7d66fb909e6075a0be0
MATLAB
1,090
27
function downloadPretrainedWeights(varargin) % aptroot is a native path aptroot = myparse(varargin,... 'aptroot',APT.Root... ); urlsAll = DeepTracker.pretrained_weights_urls; weightfilerelpaths = DeepTracker.pretrained_weights_files_relative_path; deepnetRootPathNativeAsChar = fullfile(aptroot, 'd...
aba65b049fff42fb244e369f2a19ed78086e4dc1890bf54e1cb4925e0238b87d
MATLAB
1,090
29
%_______________________________________________________________________ % % select = selectTargets(screenInfo, xy, diamTar) %_______________________________________________________________________ % % puts the targets into correct coordinates for checking to see if a % touch is within the boundaries of the targets. Th...
dfc99404578070cf4a7dadd2817c19065c85bf41248918013ac42d3eeb0bafc7
MATLAB
1,091
49
function [muPost, SigmaPost, loglik] = binaryFAinferLatent(model, y, varargin) % Infer distribution over latent factors given observed data % % y(n,t) in {0,1} or {1,2} or NaN % Optional: % 'x' x(n,d) in real % % % Output: % mu(:,n) % Sigma(:,:,n) % loglikCases(n) [computeLoglik, computeSigma, x] = process_options(va...
90654c3e03603af1ce4d6adafe1fb15ebf0097d7a0064f461e5828f8f4bb138f
MATLAB
1,092
37
function [posR, triR] = remove_double_vertices(pos, tri) % REMOVE_DOUBLE_VERTICES removes double vertices from a triangular mesh % renumbering the vertex-indices for the triangles and removing all % triangles with one of the specified vertices. % % Use as % [pos, tri] = remove_double_vertices(pos, tri) pos1 = uniqu...
f83e64460525020fd540cbe4628e5f5187a6161674b8d61bed13a5589e73d8d4
MATLAB
1,092
43
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % attempt to automatically determine the best prominence % to detect spikes function best_prom =...
2f734a32d968446a2640b0faab4f53db7dc3302862aa596471422fc29c1168a6
MATLAB
1,093
29
% SMOOTH_HIST performs 19 point gaussian sigma 3 smoothing % smoothHist.m % % Copyright 2008 Vanderbilt University. All rights reserved. % John Haitas, Jeremiah Cohen, and Jeff Schall % % This file is part of JPSTH Toolbox. % % JPSTH Toolbox is free software: you can redistribute it and/or modify % it under the te...
7b5f052c2e84ca2d5faa6f72e86224a43d36be276fea8ae869e9f94c5f6961b4
MATLAB
1,093
38
function [RgMeans,nRg] = lme_mass_RgMean(Rgs,Data) % [RgMeans,nRg] = lme_mass_RgMean(Rgs,Data) % % Mean of the data for each region. % % Input % Rgs: 1 x nv segmentation vector containing a region number assigned % to each vertice along the surface. % Data: Any data (eg. a matrix whose colums are estimators of the co...
8c4ea422276b2ed22bd8016373c040c65f977578cc6470c08c802123de5b246f
MATLAB
1,093
38
%% EEG analysis script for: %% The transformation of sensory to perceptual braille letter representations %% in the visually deprived brain % Marleen Haupt and Monika Graumann % 22.02.2024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Preprocessed EEG data has to be downloaded to data folder %%%%%%%...
d209c9df72288b9388270dcb30088ae11d2094ec0b8ba8e98c6423d70bd37cca
MATLAB
1,093
38
function D = build_logEuclidean(datadir, kerneldir) % D = build_logEuclidean(datadir, kerneldir) % % build log Euclidean distance matrix % This is the Frobenius norm of the logarithm map of the time-averaged % covariance matrices (Jayasumana et al., arXiv 2013) % The distance matrix will be used in Gaussian kernel fo...
d4c5e604b1b6ab48d204ec67c5dbdab3a9fc5dc77981a24323b247ac8542db3c
MATLAB
1,093
46
function [ff, loglik] = hmmFwdBackMaxProduct(initDist, transmat, softev) % % We don't keep the traceback pointers. % % INPUT: % initDist(i) = p(S(1) = i) % transmat(i,j) = p(S(t) = j | S(t-1)=i) % softev(i,t) = p(y(t)| S(t)=i) % % OUTPUT % ff(t, i, j) = phat(S(t) = i, S(t+1)=j) % where phat(s(t)) = max_{-s(t)} p(s(t...
d62921d33deaf7cacc5dc833b85f1cb061662b97c7bf77a10e9ada92e76a3468
MATLAB
1,093
48
function [chm skip] = wmodkurt2(ch,kt,W,Wsum,Niter,ep,nsc) %----------------------------------------- % chm = wmodkurt2(ch,kt,W,Wsum,Niter,ep,nsc) % % modify the weighted kurtosis of an image matrix by taking % gradient steps (see wkurt2.m) % % ch: image % kt: target kurtosis % W: weighting functions % Wsum: sums of w...
d98b4a3ca73dd3a34cb040181364f38a588ad36a0431003df91af9647e224d83
MATLAB
1,093
36
function [RR, RRs, RRe, RRf, RRlg] = induced_TFC(Sig, mRT, power, freq) if nargin > 3 Ana = filter_hilbert(Sig',LAN.srate,min(freq),max(freq),0)'; Env = abs(Ana); Fase = angle(Ana); Log = abs(real(Ana)); [b,a] = butter(2,20/(LAN.srate/2)); Log = filtfilt(b,a,double(Log)); end RR=[];RRs = [];RR...
58d7fa50c2a11244a61fec5a12b3cd3d94e7e927b7489c60905ddca00f2471a4
MATLAB
1,094
37
function varargout = cfg_TA_get_defaults(defstr) % Get dafual values of TA currentPath = fileparts(which(mfilename)); persistent defaults; if isempty(defaults) defaults.space.def = 0; defaults.quantlevel.def = 8; defaults.neighborsize.def = 1; defaults.distance.def = 1; defaults.smoothing.d...
7517d6b0bb48f7dc1488457cc8851dae2c7956eb06bf0ea8cb820166db92899d
MATLAB
1,094
40
function opt=varargin2struct(varargin) % % opt=varargin2struct('param1',value1,'param2',value2,...) % or % opt=varargin2struct(...,optstruct,...) % % convert a series of input parameters into a structure % % authors:Qianqian Fang (fangq<at> nmr.mgh.harvard.edu) % date: 2012/12/22 % % input: % 'param', value: the...
e512955a5e7c42971ea4e04e10e25e8b8b8e85b4e18d535ac03b7ce4062b82b7
MATLAB
1,094
44
function y = VBA_spm_detrend(x,p) % Polynomial detrending over columns % FORMAT y = spm_detrend(x,p) % x - data matrix % p - order of polynomial [default: 0] % % y - detrended data matrix %__________________________________________________________________________ % % spm_detrend removes linear and nonlinear tren...
f40f567a7ef9d7af3ea65fe8ab4275d38f0ac3bd04eb03510d660892736ae6ab
MATLAB
1,094
37
% This script displays a mesh from a *.mat P-t file and reports the % number of triangles, minimum triangle quality, and minimum edge length % Copyright SNM 2012-2018 % The Athinoula A. Martinos Center for Biomedical Imaging, Massachusetts General % Hospital & ECE Dept., Worcester Polytechnic Inst. s = pwd;...
0d7ec1d6bc3c530790ff8d8ba1ed773cb9c821728c42a8b7efd408bc2c8a57f2
MATLAB
1,095
41
function ampl = GetMeanAmpl(data, times, timeWindow) % function ampl = GetMeanAmpl(data, times, timeWindow) % % Return mean amplitude within time windows % % Inputs: % data: matrix with time in 2nd dimension, any other shape allowed % times: [1 nTimes] vector of times % timeWindow: [min max] times of window (in...
2d398b34bb4467bb0e92f70dfb2c3b38f7cd5b55c11de72d2d722e8ec01ef0f4
MATLAB
1,095
30
function trialAll = PassiveProcess_reward(epocs) %% Information extraction trialOnsetIndex = epocs.Swep.data + 1; trialOnsetTimeAll = epocs.Swep.onset * 1000; % ms water = epocs.watr.data; % Hz n = length(trialOnsetIndex); temp = cell(n, 1); trialAll = struct('trialNum', temp, ......
39a1cddf32ff4dfa21b7dd57d2a01ae9cb63bcbdcbc4def912b1c7a4e39afe58
MATLAB
1,095
41
%% Alternating Poisson Regression for fitting CP to sparse count data %% Set up a sample problem % We follow the general procedure outlined by E. C. Chi and T. G. Kolda, % On Tensors, Sparsity, and Nonnegative Factorizations, arXiv:1112.2414 % [math.NA], December 2011 (http://arxiv.org/abs/1112.2414). % Pick the siz...
1d4b318af025a178c8610a6b7c37035f44d0036128944eeb600726bdd7843594
MATLAB
1,096
42
load(fullfile(saveLoc, 'xMediationMatrices')) % load('E:\Matalb analyses\xMediationMatrices_230522') % indY = [6 5 4 3 7]; % indX = [7 3 4 5 6]; indX = [6 4 5 7 8]; indY = [8 7 5 4 6]; indX = [7 5 6 8 9]; indY = flip(indX); figure('Position', [100 100 900 400]); hold on % ind = 3:length(uni_s)...
5cb6a5c6f9901db90af52404f27f0d8dbf205d7674456f357dffcfe8a116a27a
MATLAB
1,096
34
function order = CBIG_ASDf_hunMatch(K, Mean_ref, Mean) % order = CBIG_ASDf_hunMatch(K, Mean_ref, Mean) % % This function performs Hungarian matching between the factor-specific RSFC % patterns (i.e., E(RSFC patterns|Factor)) of two random initializations. % % Input: % - K: % An integer indicating the num...
a2dbd1b54eb7c7ec306e724370462700c85e9f062badefc397a60dbd4f59e188
MATLAB
1,096
40
%% Display four data sets each with the same correlation of 0.81. % %% % This file is from pmtk3.googlecode.com loadData('anscombe'); %stacked columnwise, source: R - builtin dataset pointSpec = {'o','MarkerSize' , 11,... 'LineWidth' , 1.2,... 'MarkerEdgeColor', 'r',... ...
15d38577bca58a5df0afb043a6b586a77d92d917c2369e5305791bcd7794e44c
MATLAB
1,097
35
function [yes_or_no] = isMTL(elec_number, elec_label_list) %createColormapFromAnnotations - Creates a colormap for Annotation of the %Surface % surface - Surface Data object % returns: % annotation_remap - remapped annotations from 1 to max % cmap - colormap associated with annotations % See also Model3DView, plot3DMo...
bddd37e2c60af3e2f7779ff748dad293ddf253db401c45086db8056c62ba43c7
MATLAB
1,097
58
% h = drawflyo(trk,varargin) % h = drawflyo(x,y,theta,quartermaj,quartermin,varargin) % draw triangle corresponding to fly position % extra arguments will be fed to plot function varargout = drawflyo(x,y,varargin) % draw an isosceles triangle with center (x,y) % with rotation theta % with height maj*4 % with base min*...
e4b9e895d2f2faee03c0cf8d055e54c73c8093ca00125c0ddf6b5962c601c765
MATLAB
1,097
33
function Y = srskelf_mv_nn(F,X) % Y = SRSKELF_MV_NN(F,X) The strong skeletonization factorization stored in % F is used to compute Y=FX, where the "_NN" suffix indicates that the % factorization in F is not symmetric and we are not taking the conjugate % transpose. The input X is a vector or matrix of appropriate s...
ea7441fcc1b3fbbd3702f53b93e55133bcfef38dc1635e19a121312b0468807a
MATLAB
1,097
35
% StrideDurationHistograms.m % Sarah West % 7/21/23 % Plots lengths of mouse paw strides in time ("durations"; calculated from paw % velocities already segmented into individual strides) as histograms function [parameters] = StrideDurationHistograms(parameters) % Inputs data = parameters.data; % column ...
ed43fab8b5dcf4a3c2d702d6f4064827f89698a1fb725432975ece753ed01fce
MATLAB
1,097
40
% stim_demo.m displayName = 'Carrasco_L1'; % 'meg_lcd','Carrasco_L2','Carrasco_L1','Carrasco_R1' d = loadDisplayParams(displayName); load stimuli/taDetectDiscrim99.mat stimulus.target.contrast = [0 .2 .8 .95]; [bg, m, t] = contrastTarget(d,stimulus.target); % a = bg{1}; % ma = m{1,1,1}(:,:,2); % % ami = a.*ma*.5 + a...
8383680a3be27bf85e50f8d98954432d35ff8aefb89e710dca6af1858f388c3c
MATLAB
1,098
36
function [avg_corr, sem_corr, z_scores, p, h] = averageCorrelation(correlation_list) % Function to compute the average of correlation coefficients using Fisher's z transformation % independently for each row % Inputs: % - correlation_lists: A list of correlation coefficients % Output: % - avg_corr: Average correlat...
dc22ee55d17c70f784c0ca0b46e182579ea99d154b7ad93a3530005988943c39
MATLAB
1,098
36
% RSKELF_MV Multiply using recursive skeletonization factorization. % % Typical complexity: O(N) in 1D and O(N^(2*(1 - 1/D))) in D dimensions. % % Y = RSKELF_MV(F,X) produces the matrix Y by applying the factored matrix F % to the matrix X. % % Y = RSKELF_MV(F,X,TRANS) computes Y = F*X if TRANS = 'N' (defa...
1d2f7ac1d3e424db20d8a8cf3d99b3e0602c09f7627fd60e67fbe8a50075cfef
MATLAB
1,099
26
function iptstandardhelp(helpmenu) %iptstandardhelp Add Toolbox, Demos, and About to help menu. % iptstandardhelp(HELPMENU) adds Image Processing Toolbox Help, % Demos, and About Image Processing Toolbox to HELPMENU, which is a % uimenu object. % Copyright 1993-2011 The MathWorks, Inc. % $Revision: 1.1.8.3 $...
4e48abddb94393ea6276af9f52b14b7dfa6d485b4d0e6b76bb71dbf19eeca20c
MATLAB
1,099
28
function [sg] = g_convSig_approx(x,P,u,in) % this function evaluates a logistic convolution of the inputs % function [gx,dgdx,dgdp] = g_convSig(x,P,u,in) % This function evaluates the following multiple convolution model: % p(y(t)=1) = sigm(cst + sum_k sum_tau w(k,tau)*u(k,t-tau)) % where u can be of any dimension (k...
6eeef1b64bff1d6958f5412e262f4c0d39c7cf1b46fa6c4f0d9f389b5159e936
MATLAB
1,099
33
function Y = srskelf_mv_nc(F,X) % Y = SRSKELF_MV_NC(F,X) The strong skeletonization factorization stored in % F is used to compute Y=FX, where the "_NC" suffix indicates that the % factorization in F is not symmetric and we are taking the conjugate % transpose. The input X is a vector or matrix of appropriate size....
798c63240f735dc8ec227ef1caae13c5fcaf6f6a2538032021adc4736594bb7d
MATLAB
1,099
54
%% Colormaps that are pretty awesome: DEMO2 % In this demo we will show how to supereasily use the new colormaps % % % this is an exampe of 4 colormaps that are being considered as the default % colormap in python's matplotlib lybrary. % % All of them look quite good and they dont have any official name, so at ...
7d761224e2779082e32cb205ae32c7f6234eecf2db0942165edadf64c68da2b8
MATLAB
1,099
56
function outIndex = deterministicR(inIndex,q); % PURPOSE : Performs the resampling stage of the SIR % in order(number of samples) steps. It uses Kitagawa's % deterministic resampling algorithm. % INPUTS : - inIndex = Input particle indices. % - q = Normalised importance ratios. % OUTPUTS ...
08fd54cfcc58a390303fc6fcba98d81b42c473be2c1b9ec7c88f868c68fa042a
MATLAB
1,100
38
function Z = mvg(MU,SIGMA,n) % % Syntax: Z = mvg(MU,SIGMA); % Z = mvg(MU,SIGMA,n); % % Inputs: MU is the desired (d x 1) mean vector % % SIGMA is the desired (d x d) covariance matrix % % [OPTIONAL] n is the desired numbe...
7a2c71aeeae6740a92c7fa0921ddd2f7556e0742edd4037be40b0672185772a9
MATLAB
1,100
44
clear all; %#ok<CLALL> %% Setup path to engine addpath(fullfile('Engine')); addpath(fullfile('Model')); addpath(fullfile('data')); %% options NC = 4000; subject='110411'; Cl = load(sprintf('%s_cluster_%d.mat', subject, NC)); Ntri = size(Cl.index_int,1); indicator_mat = sparse(1:Ntri,Cl.index_int, ones(1,Ntri)); %% ...
7b6eaa2f04703fa836a13b8536a3b388e8f8a18a4a4ee62f8adcd895e0f9a2b1
MATLAB
1,100
37
%% (pxTools) getCovArrFromJointArr; %// Resampling method to quickly convert p(X1|X0) into P(X1|X1) or P(X0|X0) % Copyright (C) 2023 Trevor S. Smith % Drexel University College of Medicine % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public...
9c57d12668a4eb7c54e8b9a5b85acacab019ce8b2034137bb03c67b92a887c2a
MATLAB
1,100
24
% This function combines data across trials for each fly function [FlyData]=Combine_Data_Across_Trials(DarkData) Flies=unique(DarkData.Fly); FlyData.FlyForward_w2p=[]; FlyData.FlyRotate_w2p=[]; FlyData.BumpPosition=[]; FlyData.BumpR=[]; FlyData.FlyPosition_w2p_aligned=[]; FlyData.TwoP_Times=[]; FlyData.Two...
9f3976b300826aae7241251acebb7d5817ed176a7b644d3e06a247010a9f2fbd
MATLAB
1,100
43
% RSKELF_SPDIAG_SV_P Dispatch for RSKELF_SPDIAG with DINV = 1 and F.SYMM = 'P'. function D = rskelf_spdiag_sv_p(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find ...
c2b0bce88c887bfaf73ce8e797df8693b5a904b63a0ea28f405e273690c17ab0
MATLAB
1,100
33
function Y = srskelf_sv_nc(F,X) % Y = SRSKELF_SV_NC(F,X) The strong skeletonization factorization stored in % F is used to solve FY=X, where the "_NN" suffix indicates that the % factorization in F is not symmetric and we are taking the conjugate % transpose. The input X is a vector or matrix of appropriate size. ...
23a12a3a98621fa441368b5815acfb8c12529486bb06e05547fc278416d90009
MATLAB
1,101
46
function [p, V, Q, iter] = policy_iteration(T, R, discount_factor, use_val_iter, oldp) % POLICY_ITERATION % [new_policy, V, Q, niters] = policy_iteration(T, R, discount_factor, use_val_iter, old_policy) % % If use_val_iter is not specified, we use value determination instead of value iteration. % If the old_policy is n...
23ada6e91aa922a6a77ef905751ddaf4ad1b70b7da8c17ca30e6cdc273adef9f
MATLAB
1,101
33
function [] = int_F_data(data, sbxframes,plane, numplanes, outfile) load(data); int_data = []; vid_start = 1; new_vid_start = 1; for j=1:size(sbxframes,2); old_length = length([plane:numplanes:sbxframes(j)]); new_length = length([2:3:sbxframes(j)]); for roi = 1: size(data.F,2) int_F(new_vid_s...
30329c64d4377cfc543e67b5be5668edd931b7efdac7b606e07f885084fa783f
MATLAB
1,101
37
function fcs = gaussMkFullCondSamplers(model, visVars, visVals) % Returns a cell array of function handles % containing the full conditionals for an MVN % for use by e.g. gibbs sampling. % % For instance, fcs{i}(xh), returns a single sample for ith hidden % variable, from the full conditional, (i.e. the distribution c...
3562af51d7e2b60075f23edd3549bcdad4fc21817b2447f8336c856ed85ccfc3
MATLAB
1,101
44
function OutputMat = CelltoMatUE (inputcell, varargin) % % This function is an extension to MATLAB original cell2mat function but it % works with cells with different dimentions. If the cell size is un-even % it generate the zero in its place. % % ===============================Inputs================================...
62409e10373da318878a9ab1eecd6c1033bd68919f01ec4ac542aa0255574dbe
MATLAB
1,101
43
% RSKELF_SPDIAG_MV_P Dispatch for RSKELF_SPDIAG with DINV = 0 and F.SYMM = 'P'. function D = rskelf_spdiag_mv_p(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find ...
942c00e3bd23bbeb9d86a8cf5b3a7fed5cfc8ae8a7ae4ce197240ef7f77c3dab
MATLAB
1,101
35
function [colors, colorMap] = pmtkColors() % http://www.mathworks.com/access/helpdesk/help/techdoc/ref/colorspec.html % This file is from pmtk3.googlecode.com lightblue = [55 155 255] / 255; orange = [255 128 0 ] / 255; green = [0 255 64 ] / 255; magenta = [255 0 128 ] / 255; ...
afd8fdd3d3de8f14408caa8f60e9960b6cf2d0abae5962583d780ba87d5d0755
MATLAB
1,101
36
function [pk1 pk1t pk2 pk2t] = PeakResponse(traj, evt, win, pol) % pk1: value measured at time of peak mean response % pk2: value measured at peak of each individual trial nEvt = length(evt); ti = traj.times(1); dt = traj.times(2) - ti; win = round(win/dt); r = zeros(nEvt, win(2)); for k = 1:nEvt p0 = round((evt(...
b783dfddfb84bcc0db9c8ff4acf23bf4c1a40f91833b7d26d3d84e927663f837
MATLAB
1,101
39
function [xtrain, ytrain, xtest, ytestNoisefree, ytestNoisy, sigma2] = polyDataMake(varargin) %% Sample Data % This file is from pmtk3.googlecode.com [sampling, deg, n] = process_options(varargin, ... 'sampling', 'sparse', 'deg', 3, 'n', 21); setSeed(0); switch sampling case 'irregular', xtrain = [-1:0.1:-0.5...
0b468680ad4a8252ea306db99607b49a9656c7dc06b41e28686adc1e6d1ba1c8
MATLAB
1,102
38
function [XData_Clean,YData_Clean,NumRemoved]=RemoveUndefinedDataPairs(XData,YData) XData_Clean=[]; YData_Clean=[]; CleanCount=0; NumRemoved=0; if any(size(XData)~=size(YData)) error('data must be the same size...') end if size(XData,2)>size(XData,1) NumEntries=size(...
91603b39cae6657c4063d251160c238fdc0cbe57bf8d61ecc5aaffe6956a0c46
MATLAB
1,102
53
function h = plotimage(mesh,val) % PLOTIMAGE Fast prewiev of data within FEM mesh in the NIRFAST format. % Plots an image of the values on the mesh. % % SYNTAX: % H = PLOTIMAGE(MESH,VAL) % % H = PLOTIMAGE(MESH,VAL) MESH is the input mesh in NIRFAST format % (workspace variable), VAL is n by 1 vector of values to pl...
a0e9f7aeb289b4980c8344a1d0ac52820f8bceef09ed3cd899b1b242b229e9c7
MATLAB
1,102
38
function v=forward_general_memory(dips,fp); % usage: v=forward_general_memory(dips,fp); % makes forward for 'arbitrary' methods for dipoles. % % same as forward_general except that it calculates dipoles % (at most) in bunches of thousand to evoid memory overflow % for very many dipoles % % input: % dips Nx6 matrix...
b853654971eabd17846007bfec8b451fcfc4f685680bc572b2ef31db31269ded
MATLAB
1,102
30
function [dip, p_value, xlow,xup]=hartigansdipsigniftest(xpdf,nboot) % function [dip,p_value,xlow,xup]=HartigansDipSignifTest(xpdf,nboot) % % calculates Hartigan's DIP statistic and its significance for the empirical p.d.f XPDF (vector of sample values) % This routine calls the matlab routine 'HartigansDipTest' t...
d47f34e8e2b6327b2e428bdb5fbd232ab103f6db59ae4cc0463840cd464d62b7
MATLAB
1,102
37
%% Illustration of how singularities can arrise in the likelihood function of GMMS % %% % This file is from pmtk3.googlecode.com f1 = @(x) gaussProb(x,0.5,0.12); %f1 = @(x) gaussProb(x,0.5,0.12); %f2 = @(x) gaussProb(x,0.88,0.003)/2; f2 = @(x) gaussProb(x,0.15,0.0003)/2; f3 = @(x) f1(x) + f2(x); domain = 0:0.001:1; ...
32495d848f1dd7088ab107241fe6bd29e213f270aa42ba1639d2c3c5f8ce5203
MATLAB
1,103
27
function [fcost,u_error,u_sol,e_sol,F_err] = Spring2D(k0,F,u_output,params,optims,condition) if isequal(condition,'1') k = Convert_k(k0,params); elseif isequal(condition,'0') k = k0; end D = params.C.'*diag(k)*params.C; F([2*params.ind_fix-1,2*params.ind_fix]) = []; D(:,[...
628e3f7724fd5f09a9f49749bc9d2d6046e002f099fe5c498a236eecde12620b
MATLAB
1,103
51
function F = angauss( I, s, r ) % ANGAUSS Anisotropic gaussian filtering. % INPUT: % Is - Input tomogram % s - Gaussian standard deviation % r - Aspect ration in Z axis, if 1 isotropic % OUTPUT: % S - Filtered output % % See also: diff3d % % AUTHOR: Antonio Martinez-Sanchez (an.ma...
55049f7a2af429aa1e9e53d1bced9da83136af8e090811f43ec7c6d012505063
MATLAB
1,104
59
setSeed(1); priorVar = 0.01; n=10; m=3; Nobs = m; D = n+1; % numnber of variables Nhid = D-Nobs; xs = linspace(0, 1, D); perm = randperm(D); obsNdx = perm(1:Nobs); hidNdx = setdiff(1:D, obsNdx); % Noisy observations of the x values at obsNdx xobs = randn(Nobs, 1); %obsNoiseVar = 1; %y = xobs + sqrt(obsNoiseVar)*ra...
5bda6748cccd8858c884a48e0913289d2d39217664b9bdcf1c779559c1d76460
MATLAB
1,104
41
%% Plot SL and RL coherence for all sessions combined dimms = [1 2 5 31 32 55 56]; rows = length(dimms); % 33 sc = 1; plotFilt = ones(1, 50)/50; xLimsSL = [0 0.5]; xLimsRL = [-0.5 0]; figure('Position', [600 100 800 900]); hold on; rows = 8; i = 0; for sess = 1 : 8 for dim = dimms ...
69e7f1413b724ca044ee355d123d33e25eba172c4145cdb2b9c013b9228cc5bd
MATLAB
1,104
35
function dyn = fcn_flow_graph(aij,r,t) %FCN_flow_graph continuous time random walk on network % % DYN = FCN_flow_graph(AIJ,R,T) instantiates a continuous time % random walk on network with adjacency matrix AIJ. Waiting time % for walkers at each node are distributed as Poisson with rate % ...
7bf509745d6c30e6558da19c454e74e883948972277e364280f3b54af203036f
MATLAB
1,104
43
% demo for Dirichlet Process (CRP) classification schemes n = 1e2; % number of samples alpha = 1; % concentration parameter of the DP p = 6; % dimension of the data mu0 = zeros(p,1); %1st-order moment of the prior for SS S0 = 1e1*eye(p); %2nd-order moment of the prior for SS % a0 = 1e2; % shape parameter % b0 = a0*1e...
8830f28bc2f2bbfea208e1cd2fef49b6cde13bb2524247cc54c9db759aae2376
MATLAB
1,104
44
function newlist = wlAux_selectEventsByTime( oldlist, timerange, timestamps ) % function newlist = wlAux_selectEventsByTime( oldlist, timerange, timestamps ) % % This selects events from an event list that overlap a specified time % range. % % "oldlist" is an array of event structures, per EVENTFORMAT.txt. % "timerang...
028b3efc8809d053b4c8efb9f220ee6b625ac4469b7a4b4fca73ad92aaac3f75
MATLAB
1,105
33
function Y = srskelf_sv_nn(F,X) % Y = SRSKELF_SV_NN(F,X) The strong skeletonization factorization stored in % F is used to solve FY=X, where the "_NN" suffix indicates that the % factorization in F is not symmetric and we are not taking the conjugate % transpose. The input X is a vector or matrix of appropriate siz...
270d890e47a0fb1f201fa29e063c512d890641021261a5354c8830fac26b7d25
MATLAB
1,105
20
% DETECTOR % See also % % Please see acfReadme for an overview of the detection code. % % Aggregate channel features object detector: % acfDemoCal - Demo for aggregate channel features object detector on Caltech dataset. % acfDemoInria - Demo for aggregate channel features object detector on Inria dataset. % ac...
58de1445a0b5b3a59d0cc4ed1f16a537944507905737b4fe505d5fe809455dbd
MATLAB
1,105
30
function Draw_Foci(foci,faces) % This function draw spheres of a specified color and radius at the % location given by the structure foci. Fields include: location, color, % radius. It is assumed that coordinate space and voxel-index space are % exactly aligned. foci.color are rows of RGB values [0,1]. if ~exist('fac...
74cb8bd0a2cac7484356477269a9832e3317a138ac21757fc24427defcd3f070
MATLAB
1,105
42
classdef WaitBarWithCancelContext < handle properties message = '' % "Base" message nobar = false % If true, no graphical fraction bar shown shownumden = false % If true, show fractional degree of completion eg (3/500) in message numerator = nan % Numerator if shownumden==true denominator = nan...