sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
acde529875a8450ecf9fd6d482e57c6eafbebf109eb755051d08c2d3a03d94a3
MATLAB
1,620
49
function y = amexpo1s(N,t0,T); %AMEXPO1S Generate one-sided exponential amplitude modulation. % Y = AMEXPO1S(N,T0,T) generates a one-sided exponential % amplitude modulation centered on a time T0, and with a % spread proportional to T. % This modulation is scaled such that Y(T0)=1. % % N : number of points. % T0 : a...
cd55443fd919e128436c3f97fe3d128452c869a971aead4326dcb19d89be507d
MATLAB
1,620
1
% TSSETOVERWRITEMODE Turns overwriting on or off for all TS routines. % TSSETOVERWRITEMODE(mode) turns overwriting on or off for all TS % routines. This controls whether sessions that have already been loaded % are reloaded and whether statistics that have already been computed are % recomputed. When overwrite...
f9f7f95c52e2504f7924feef5ebdb072d635c81ed1c8ba1c893a1aaacc216493
MATLAB
1,620
51
function [model, loglikHist] = emAlgoAdaptiveOverRelaxed(model, data, init, estep, mstep, mstepOR, varargin) % Adaptive over-related EM algorithm % Reference: "Adaptive Overrelaxed Bound Optimization Methods", % Ruslan Salakhutdinov and Sam Roweis, ICML 2003 % % mstepOR shoud be a funciton of the form % [model, valid]...
13aa5f3413bb6d3440496f845b7fa97a75c0695e903c6ea2458e0197db440e4d
MATLAB
1,621
37
% Pooled [corr_pyr_all,corr_pyr_int_all] = extract_variables ('pair_corr','tot',resultsPath, 'pyr_all', 'pyr_int_all',conditionType,conditionValue); for recCounter = 1:size(corr_pyr_all,2) for pyrCounter = 1:length(corr_pyr_all{recCounter}) corr_pyr{recCounter}(pyrCounter) = mean(corr_pyr_all{recCounter}{p...
007ea1b99b709b322da04aba6ef9ff82b955f34a751393798806264223363db5
MATLAB
1,622
38
function offset = time2offset(time, fsample) % TIME2OFFSET converts a time-axis of a trial into the offset in samples % according to the definition from DEFINETRIAL % % Use as % [offset] = time2offset(time, fsample) % % The trialdefinition "trl" is an Nx3 matrix. The first column contains % the sample-indices of the...
50d5df98afee4ee486997056c8ec4afd2612de5025769b781966fab1ceb42ddd
MATLAB
1,622
49
%% initialize if ispc pn.root = ['D:',filesep,'Dokumente und Einstellungen',filesep,'guest',filesep,'Desktop',filesep,'StateSwitchMR',filesep,'C_Paradigm',filesep]; else disp('Setup no supported.'); pn.root = ['/Users/kosciessa/Desktop/StateSwitchMR/C_Paradigm/']; end pn.CB = [pn.root, 'checker',fil...
61e005338c3b9fdc4dca2e894d1f3f9926311410c47f73356f99c932b22c6073
MATLAB
1,622
100
clear clc close all %script that plots behavior regression weights across all animals load data/numsessions_all_rats %%% (generated by number_sessions_per_rat.m) rat_list=rats(find(numhits>=120000 & early_rat==0)); plot_type='difference'; for iii=1:length(rat_list) ratto=rat_list{iii}; [d_shap...
624513bd8b187b31a04605529713a4a5fa161d0e96ded9b3582167c803c732f3
MATLAB
1,622
67
% % Name: demo_PCA1.m % % Description: Generates multivariate Gaussian samples and applies PCA to % extract the dimensions of maximum variance and projects the % samples onto them % % Author: Brian Moore % brimoor@umich.edu % ...
a1e29742b2e3e073d8ee7c5e8bab83c83c3a5a5aff4d14317f2de1bb3ad8c078
MATLAB
1,622
65
%% % Extracted from 'testSig' to better segregate the predictions; May be % redundant %_______________________________________ % Copyright (C) 2024 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 ...
b4afb9bb20f157e4c9bfef77b6a2d832be5ba6109ab93291e5f20cba8ee25a2e
MATLAB
1,623
70
% 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 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
57de4a5663080be7a6ef203402a18e21b5a7c050e932ce14da596406a4dfa3d3
MATLAB
1,624
35
function [rfunc_file, rp_file] = realignment_byrun_4d(func_file,out_path) % Expand func filenames. A single 4D Nifti file is expected per run. An % SPM-style list of volumes is returned. [func_p,func_n,func_e] = fileparts(func_file); func_vols = cellstr(spm_select('ExtFPList',func_p,['^' func_n func_e '$'],inf)); % S...
87c14f5b9cf6e9c70db5f371867076152dfe6133bfdeccc238cf7fbf08e38ec9
MATLAB
1,624
51
function labels = CBIG_RemoveIsolatedSurfaceComponents(avg_mesh, labels, abs_threshold) % Remove isolated surface components. % % labels = CBIG_RemoveIsolatedSurfaceComponents(avg_mesh, labels, abs_threshold) % Input: % avg_mesh : average mesh read from CBIG_ReadNCAvgMesh.m % labels : ...
c07553fb5b3824387fcaa3218e0ff0591136322c2edf40a79d3a9be6f3458ceb
MATLAB
1,625
65
%% trfun2var % % Calculate coefficients from VAR transfer function % % <matlab:open('trfun2var.m') code> % %% Syntax % % [A,p] = trfun2var(H,p) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % H VAR transfer function matrix % p VAR mo...
866afbfe146ce8a5ecc1e272970e63a5d8e1b583f52e552f3bac5770939a6d66
MATLAB
1,626
62
% this function finds spikes in view % called when sliders are moved in the find spikes popup function findSpikesInView(self,Parameters,~) arguments self (1,1) crabsort Parameters ~ end if self.verbosity > 9 disp(mfilename) end if isempty(self.channel_to_work_with) return else channel = self.channel_to...
4541e84dcf72f210fce3f9a30272dbdc1425969fde5b7bbbe77989aeb236ceda
MATLAB
1,627
62
% Demo of factor analysis applied to some synthetic 2d binary data % This file is from pmtk3.googlecode.com setSeed(0); D = 16; K = 3; proto = rand(D,K) < 0.5; M = 50; source = [1*ones(1,M) 2*ones(1,M) 3*ones(1,M)]; N = numel(source); dataClean = zeros(N, D); for n=1:N src = source(n); dataClean(n, :) = proto(:,...
7425481d3c5cd77cd93a32fe1658cb3ad3dfdf7ff283c608020ace543d9a8172
MATLAB
1,627
58
function [gx] = g_conv_approx(~,P,u,in) gx = P(end); % constant as starting point nt = round(size(u,1)./in.dim.nu); % dgdx = []; % persistent K; % if size(K,1) ~= nt % K = zeros(nt,nt); % end % dgdp = zeros(size(P,1),nt); for i=1:in.dim.nu Pi = P((i-1)*3+1:3*i); kernel = kernel_sinexp(Pi(1),Pi(2),Pi...
b275ca195964d59a18743af826c0b42d22e5da85e414e36b22b81b564744ee66
MATLAB
1,627
60
% Slice sampling in 2d % From http://www.mathworks.com/products/statistics/demos.html?file=/products/demos/shipping/stats/bayesdemo.html %PMTKslow requireStatsToolbox(); setSeed(0); %% Setup % Likelihood: binomial regression % poor(i) ~ Binom(total(i), logit(theta1 + theta2*weight(i)) % A set of car weights weight ...
be8748d7c38a493abf5eeccce1b21b5f036a691651a52ed30f0c207aafc4c08a
MATLAB
1,627
46
function [imdsTrain, imdsTest, pxdsTrain, pxdsTest] = partitionCamVidData(imds,pxds) % Partition data by randomly selecting 80% of the data for training. The % rest is used for testing. % Set initial random state for example reproducibility. rng(0); numFiles = numel(imds.Files); shuffledIndices = randperm(numFiles); ...
df300fd072e2e32f3d4c8e0323dc548e3b4d1c47e44ac67b14d5c2089ff7ca91
MATLAB
1,627
53
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef Spike_v1 < VoltageWaveform %SPIKE_V1: An extension of Waveform that represents a spike recorded by % spike detector in Axis. % % TriggerSampleOffset: Offset (in sampl...
09d8f50d6683cf881edd08c22db52fd07f8ff437572e217f520a5c1f9b9e8b5e
MATLAB
1,628
44
function [fcost,u_sol,e_sol,F_err] = Spring2D_CE(k0,F,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(:,[2*params...
525af1277d68ff1ce846bc463d320c965188b23c9406b2746bf754bbb512b8f0
MATLAB
1,628
50
function y = amexpo2s(N,t0,T); %AMEXPO2S Generate bilateral exponential amplitude modulation. % Y = AMEXPO2S(N,T0,T) generates a bilateral exponential % amplitude modulation centered on a time T0, and with a % spread proportional to T. % This modulation is scaled such that Y(T0)=1. % % N : number of points. % T0 : t...
797aef71c0ed3ff2ce39dcd95598c95d626463fa644e1694f2d258f1e82f2964
MATLAB
1,628
47
function info = GetGitMatlabStatus(source_repo_folder_path) % Extract a bunch of git version info for the given source folder. % Also get the Matlab version. % This function reads the filesystem, but does not write to it. % Get the matlab version matlab_ver_string = version() ; % Figur...
2d3d2f6ff1b34cdbf289a35d4ff5ba7e9830f5708c9bcfe0b1d2385a1f79241d
MATLAB
1,629
50
function spkDat = ReclassifyWaves(spkDat, reclassDat, varargin) origClust = arrayfun(@(x) x.id(1), reclassDat); destClust = setdiff(unique(spkDat.id), 0); errorCriterion = Inf; for i = 1:2:length(varargin) switch lower(varargin{i}) case 'origclust' origClust = varargin{i+1}; case 'dest...
39475407f696f01749ddc302cec267a8a6ff2e96900bf99db060dde0b4708955
MATLAB
1,629
73
%% Sequential Updating of Sigma in 1d given fixed mean % %% % This file is from pmtk3.googlecode.com setSeed(1); %% Prior nu = 0.001; S = 0.001; prior.Sigma = S; prior.dof = nu; %% True model % mutrue = 5; Ctrue = 10; mtrue.mu = mutrue; mtrue.Sigma = Ctrue; %% Generate data n = 500; X = gaussSample(mtrue, n)...
403fc1524e86a6881bcad5be4a0b3ffa566527f6b31f1ab14cd58578cde8981a
MATLAB
1,629
61
function J0 = computeJI(J1Vec,A,C0,psiSamp,N,numSamps) if nargin < 6 numSamps = 100; end J0 = zeros(length(J1Vec),1); for j1 = 1:length(J1Vec) J1 = J1Vec(j1); if length(psiSamp) <= 2*N % find thetac corresponding to psiFP with JE = J1 thcinit = pi/2; thc = zeros(size(psi...
53c98073db9451aa01c7dacba61affe81be1197491e360b3807f63c58a6b2256
MATLAB
1,629
53
% Name: Phone Kyaw % Date: 09/19/2024 % Description: Return the XT header after stripping the XT data until % the cut parameter and finding the header in the stripped % data % Parameters: xt_data - Cell data that is read from file % cut - The number of first...
b4d8486fde2a182bd34a48a1c91418a816ff4cf3bc0ff02f94eb53f9c4af348e
MATLAB
1,629
53
function [yhat, f] = svmPredict(model, Xtest) % Return svm predictions. % model is a struct as returned by svmFit() % Xtest(i, :) is the ith case. % f is the signed distance to separating hyperplane % This file is from pmtk3.googlecode.com if isfield(model, 'standardizeX') && model.standardizeX Xtest = mkUnitV...
4a12a0fe1733946e219252103ebc4a36fd59b6cb9e953a00aed08cff9d7d6e9e
MATLAB
1,630
58
function Aout = h_calcROIDistToFiducial3(handles) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); siz = currentStruct.image.data.size; fiducialObj = findobj(handles.imageAxes, 'Tag', 'fiducialPoint3'); ROIObj = findobj(handles.imageAxes, 'Tag', 'annotationROI3'); fiduci...
ab3a127f7901742e334c79bf9781f6add3443147452eb7a3b99c8679a5fdd0a3
MATLAB
1,630
65
%% Denoising an Image Using Gibbs Sampling % Here we use an Ising Prior and a Gaussian likelihood. % %% % This file is from pmtk3.googlecode.com setSeed(4); sigma = 1; % noise level A = loadData('letterA'); y = A.AwithoutHole; %load('imageWithBlackHole.mat') % defines y %load('imageWithWhiteHole.mat') % defines y ...
12dd4632e4691f2408ae1b475bca27debc5619f4ba6b291d33bffbaa898632cb
MATLAB
1,631
44
function s = ps2pdf(filename) % PS2PDF Converts a PostScript file into Adobe PDF format. % PS2PDF(FILENAME), where FILENAME is a PostScript file, will convert a % .ps file to an Adobe .pdf file. Although Matlab supports directly % printing to a PDF driver, the PS driver has added flexibility (e...
45f741f8da0fa397d6d01187b1effa524408fb644bd9946850efc99352c6e56a
MATLAB
1,632
41
function C = conv2fft(varargin) % C = conv2fft(A, B) % C = conv2fft(H1, H2, A) % % C = CONV2FFT(A, B) performs the 2-D convolution of matrices A and B. % If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then % mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]). % % C = CONV2FFT(H1, H...
76997c3877c57def64503b80dfe33cde7e54bb823f124869caa0f11712c6c13d
MATLAB
1,632
50
function initPmtk3Octave() more off %% Initialize PMTK3 for Octave w = which(mfilename()); if w(1) == '.' % for octave compatability w = fullfile(pwd, w(3:end)); end thisDir = fileparts(w); cd(thisDir); restoredefaultpath(); addpath(genpath(pwd)); % if ~exist('matlabToolsRoot', 'file') % url = 'http://matlabto...
cbfa00c72240d59a7999d0ce4bcf44c3c131cf1bf940829425ee883d08b25fdf
MATLAB
1,632
42
function [index_num, index_link, index_num_mask] = detectors_active_index(mesh) % DETECTORS_ACTIVE_INDEX Calculates permutation vectors for mesh detectors. % % [INDEX_NUM, INDEX_LINK, INDEX_NUM_MASK] = DETECTORS_ACTIVE_INDEX(MESH) MESH % is NIRFAST mesh structure. % INDEX_NUM - n by 1 vector where n is the numbe...
eef2edb74d7dd6102064e2acfd9dc73e5789453d14d1d9de0192a80a57a3b33c
MATLAB
1,632
65
function [B, lims] = rescale(A, lims, out_lims) %RESCALE Linearly rescale values in an array % % Examples: % B = rescale(A) % B = rescale(A, lims) % B = rescale(A, lims, out_lims) % [B lims] = rescale(A) % % Linearly rescales values in an array, saturating values outside limits. % % IN: % A - Input array of ...
f5687fba4240fac1abeed9df694f1d0e1ab083ea253ed95c8ced243e7e05d792
MATLAB
1,632
68
function [ey,ex]=energyop(sig,gr) %% %calculates the energy operator of a signal %% %input %1. Raw signal (Vector) %2. gr (Plot or not plot) %% %Output %Energy operator signal (ey) %Teager operator (ex) %% %Method %The Teager Energy Operator is determined as %(x(t)) = (dx/dt)^2+ x(t)(d^2x/dt^2) (1.1) %in the cont...
835145de6a2339070747f738dba890cb709129481aadbcf2849e14484dfa7fac
MATLAB
1,633
32
psthPara.binsize = 10; psthPara.binstep = 10; % ms cwStr = ["push", "nopush" ]; if contains(protStr, "duration") devStr = "devDur"; end for cwIdx = 1 : length(cwStr) switch cwStr(cwIdx) case "push" tIndex = [trialAll.(devStr)] == devType(2) & (([trialAll.stdNum] == stdType(sIndex) ...
9afc25b86225e6a07c85b2a052d09d9bcb5daf7a734a8714329db60a8d94cc8a
MATLAB
1,633
53
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% cuixuFindStructure %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [onelinestructure, cellarraystructure] = cuixuFindStructure(mni, DB) % function [onelinestructure, cellarraystru...
a4f7866969b211a9036ca4bbbeff9cc3192618f54c8fa70410e246b3ddeb5fba
MATLAB
1,633
70
function [ w, loglik ] = linregSparseScadFitLLA( X, y, lambda, varargin ) % Fits a linear model with a SCAD penalty % We assume lambda is a scalar %PMTKauthor Hannes Bretschneider % This file is from pmtk3.googlecode.com [maxIter, convTol, alpha] = process_options(varargin, ... 'maxIter', 100, 'convTol', 1e-3, 'a...
be890c7ae91a0073105c7691ee7e86091c8449cca8147d11b7b299f1f91ac722
MATLAB
1,633
102
function [az1d2f,az2d2f,az1f2d,az2f2d] = compute_taskswitch(sessions,trials) minperf=.65; mintri=100; minbe=0.65; [hits,task,choice,gfreq,gdir,side,nta] = get_trials_stim(sessions,trials,minperf,mintri,minbe); prevstart=5; prevend=30; lenprev=prevend-prevstart+1; newend=30; bz1=nan(1,lenprev+newend); bz2=nan(1,len...
f17e36d32118f7b0ca0c424e046c007e58fbf7bc6f7e8020effc6219798e39eb
MATLAB
1,633
90
%% Pareto Taxicab Example % %% %pareto-pdf-1-2 %pareto-evidence % This file is from pmtk3.googlecode.com function paretoDemoTaxicab() as = 0.1:0.01:5; bs = [1, 1, 1, 0.001]; Ks = [2, 1, 0.1, 0.001]; %% figure(); b=1; K=2; model.m = b; model.K = K; ps = exp(paretoLogprob(model, as)); plot(as, ps, 'linewidth', 3) set(g...
f18e3e5793c0eddf60119676204bffe60c109a129715e339cfe63f6129a5343e
MATLAB
1,633
61
%% Plot Some Wishart Distributions % PMTKneedsStatsToolbox ksdensity %% % This file is from pmtk3.googlecode.com requireStatsToolbox setSeed(2); S = [3.1653, -0.0262; -0.0262, 0.6477]; dofs = [20 3]; wiModel.Sigma = S; nr = 3; nc = 3; nsamples = 9; for i=1:length(dofs) wiModel.dof = dofs(i); M = wiModel.dof*w...
281d66ffc58beff11123f484c17354b39ce866b2f8479d9a3e76d87019ecc350
MATLAB
1,634
59
function IDXpred = clfKnnDist( D, IDX, k ) % k-nearest neighbor classifier based on a distance matrix D. % % k==1 is much faster than k>1. For k>1, ties are broken randomly. % % USAGE % IDXpred = clfKnnDist( D, IDX, k ) % % INPUTS % D - MxN array of distances from M-TEST points to N-TRAIN points. % IDX - ...
a66543d29a32d801eba56ded80f48f2e93a5d5deb5c59f2046eb3bc734d1120b
MATLAB
1,634
54
function [im,header,timestamp,bb,mu] = mmf_read_frame(header,framei) fp = header.fid; % read from the current location if no frame input if nargin < 2, loc = ftell(fp); framei = find(header.frame2file==loc,1); if isempty(framei), error('Could not find file location %d in frame index',loc); end else fsee...
ad3d57198118d5c1efd93dfce857a40b856df2fe374d5d4172c9b52bc325321e
MATLAB
1,634
50
function y = amtriang(N,t0,T); %AMTRIANG Generate triangular amplitude modulation. % Y = AMTRIANG(N,T0,T) generates a triangular amplitude modulation % centered on a time T0, and with a spread proportional to T. % This modulation is scaled such that Y(T0)=1. % % N : number of points. % T0 : time center (default : N...
dea6fdf2ada006444919d1553e636ffe12c831ce98f96419df0e5b1445e3115f
MATLAB
1,634
52
function b = copyfields(a, b, fields) % COPYFIELDS copies a selection of the fields from one structure to another % % Use as % b = copyfields(a, b, fields); % which copies the specified fields over from structure a to structure b. Fields that % are specified but not present will be silently ignored. % % See also KEE...
0c52e8d9c4eacb288593eac5962accc1bb9de9bfd21e0bf559134156100942fb
MATLAB
1,635
46
Qmv = load('/localhome/kabram/Dropbox (HHMI)/MultiViewFlyLegTracking/multiview labeling/romainJun22NewLabels.lbl','-mat'); Qs1 = load('/localhome/kabram/Dropbox (HHMI)/MultiViewFlyLegTracking/older stuff/trackingApril28-14-53/track_date_2016_04_28_time_14_53_16.lbl','-mat'); Qs2 = load('/localhome/kabram/Dropbox (HHMI)...
6bd1b6fdf3736eff784e53197c24f40dd39074b4bfb8aade8342006ac21ab4e9
MATLAB
1,635
59
function [model, logev, postSummary] = logregFitBayes(X, y, varargin) % Fit logistic regression using Bayesian inference % X is n*d, y is d*1, can be 0/1 or -1/+1 or 1..C % Do not add a column of 1s % % By default we use a N(0,(1/lambda) I) prior % % INPUTS: % method: one of these % - 'laplace' use Laplace approximatio...
74fd8cff09b311ed3ae60003ac593cafa3fa44666c6d85d2c99a7022fd0a7955
MATLAB
1,635
52
function [q, n_gradq_1, n_Gq_n] = find_one_fp(net, n_x_1, const_input, do_topo_map, tolq) % Return the function q(x) = 1/2 |F(x)|^2 at n_x_1, where dx/dt = F(x) % describes the (continuous) dynamics of RNN (note that time constant tau % is absorbed in F). Also return its gradient and the Gauss Newton % approximation to...
b621bf6a625ca2b1fd742bb56b86bc926e3fa0e50d23b525bd17724fdc8a6bd3
MATLAB
1,635
57
function [Aout,info,err] = h_genericOpenTif(filename, frame_numbers) % [Aout,info] = h_genericOpenTif(filename, frame_numbers) % h_genericOpenTif - Opens an Image file with TIF extension. It can retrieve % only the frames specified by frame_numbers. Aout=uint16([]); header=[]; if ~(exist('frame_numbers')==...
b982bffbf784520db6ff7273a929924b400f3e679d83ed2332f5c403355cab6c
MATLAB
1,635
41
function headmodel = ft_headmodel_asa(filename) % FT_HEADMODEL_ASA reads a volume conduction model from an ASA *.vol % file % % ASA is commercial software (http://www.ant-neuro.com) that supports % among others the boundary element method (BEM) for EEG. This function % allows you to read an EEG BEM volume conduction m...
c2efc8325ca544fb1425022d905e80319ce86d6b9507c081ec9421cb9f82fe9d
MATLAB
1,635
55
function [header_size, version, f_height, f_width, bytes_per_chunk, ... max_n_frames, data_format] = fmf_read_header( filename ) % [header_size,version,nr,nc,bytes_per_chunk,nframes,data_format] = fmf_read_header(filename) % % reads FlyMovieFormat header data from FILENAME % % HEADER_SIZE is in bytes for the ...
09a56e27fc398e80855a5c06dee78edb065d87954c2c428fce62e67513780c8e
MATLAB
1,636
60
function y = kronmult(Amats,x,ii) % Multiply matrix (.... A{3} kron A{2} kron A{1})(:,ii) by x % % y = kronmult(Amats,x,ii); % % INPUT % Amats - cell array with matrices {A1, ..., An} % x - matrix to multiply with kronecker matrix formed from Amats % ii - binary vector indicating sparse locations of x ...
0bf9d37fa6f9a08dbc6b225f5ecb7369dcaeadd6d08023edf754d41c021b70aa
MATLAB
1,636
67
% 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 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
a4b53818b7b25adcf61c985560b81d05ad888ac3811bb9f003bce683f3835b59
MATLAB
1,636
50
%% Load and trim ABF cmPerPeak = 0.0039; imagingCh = 1; %imaging channel in abf file mvmCh = 3; %locomotion channel in abf file (old:4, current:2) [imagingTrimmed, mvmTrimmed, fs_abf, si_abf] = loadMvm(Tracecellsdf,imagingCh,mvmCh,'traces'); if exist('fileName') == 0; fileName = input('Type filename:','s');...
018485ed38f892db6b1d217d799819a88887cb8a9e67a38fef00e05e5e29978c
MATLAB
1,637
66
% Redundancy reduction principle % This demo performs BMC on two nested models, one of which is fully % redundant. The data is then varied on a pre-defined grid, to assess the % impact of the complexity penalty term as a function of the data. clear variables close all dim1.n_phi = 1; dim1.n_theta = 0; dim1.n=0; dim2...
354fb5b17840a04cb4cef65396962b5826f384a1d14b214c57b967eb546358a3
MATLAB
1,637
70
function mask=vessels_binary_sum(PET_sum, voxs_thresh,pixdim) %extract vessels binary mask by processing Jerman filter output %INPUT: % PET_sum: sum of first PET frames % lastframe: index of the latest volume to sum % pixdim (optional): image voxel size %OUTPUT: % vessels mask %Written by MDF, adapted from ES and A...
b5ba341ae4a2940ab7c84a3b1b0fdebfb30109a9e3a68cadc55eb0013cb2c7f9
MATLAB
1,637
1
% TSloadMEDPC Load a Gallistel lab MEDPC file onto the Experiment structure % TSloadMEDPC(FILENAME) loads in the data from FILENAME into TSData. This % code gets rid of the recurring headers and long strings of 0's that % appear in the raw data files when the data grabber function reads the % files that appea...
0b753ee00e840efd418e82e9e913b49acf83fd930214fd4fc0936fc932f824f9
MATLAB
1,638
66
function [H0,tfuse] = typicalImHist(I,varargin) % Compute typical imhist of set of images % % I: [N] cell array of identically-sized images % % H0: [nbin] 'typical' imhist for I. % tfuse: [N] logical indicating whether each image in I was used in % computing H [nbin,wbObj,incPrctile] = myparse(varargin,... 'nbin'...
1069e2f064e57b4416210fc812da94676b2465c4bf44602452aefcbcd6deb4e1
MATLAB
1,639
70
function [q_radius_ratio,q_area_ratio,area,zeroflag,... edges,edgeflag]=checkmesh3d_surface(e,p,nodemap) % Checks the integrity of a surface mesh by running following diagnosis: % 'type' = % 0- all % 1- area of each patch % 2- face connectivity % 3- edge connectivity % 4- quality of each surface patch e=e(:,1:3); ...
85559bc1e52163e6a77cfbe728fa2477d85378a41cff2ae55943b7afafc230d5
MATLAB
1,639
50
%% Simulate tissue damage function [z, x] = SimulateTissueDamage(u, A, B, params) % Simulate 1-dimensional value of tissue damage for time points i = 1,...,n % as a linear dynamical system x(i) = A*x(i-1) + B*u(i)', where u is % m-dimensional control input. % Simulate sensory feedback as z(i) ~ N(x(i), R) % ==== In...
9ba6ac0dc60fe3baf020f279562d1b81323c5e4173da4c5a8bd7f26d0ebec474
MATLAB
1,639
46
function out = xpathText(node, path) % XPATHTEXT Shorthand for loading text from node in xml file % % xpathText(node, path) % % if path doesn't exist, return empty string %--------------------------------------------------------------------- % license %-----------------------------...
9d09ca1a730e1d9e619b5480fa2ac934444e0d9e521c2240dbcae89ab328ef18
MATLAB
1,639
63
function [numt0marker] = plotTriggers( dataset, t0marker , varargin ) %PLOTTRIGGERS Plot all the triggers in the file over time p = inputParser; addParameter(p, 'showFigure', true); addParameter(p, 'savePath', []); addParameter(p, 'xUnits', 'samples', @(x) any(strcmp(x, {'samples', 'sec', 'msec'}))); parse(p, varargin...
d86578783f5189309326243ebdf93bfac662fcea74e71e98760c5955b1bf099d
MATLAB
1,639
46
function [aROC, falseAlarmRate, detectionRate] = rocLabelMe(confidence, testClass, col) % You pass the scores and the classes, and the function returns the false % alarm rate and the detection rate for different points across the ROC. % % [faR, dR] = plotROC(score, class) % % it generates 150 points. % faR (false ala...
eeebef75bd7a0fbc59da476db11ef7722f9d866590c78918250a136d1fd043e3
MATLAB
1,639
65
% This is small script that demonstrate the computation of extrinsic % parameters using 3D structures. % This test was build from data provided by Daniel Small (thank you Daniel!) %-- Image points (in pixels): x = [479.5200 236.0800 608.4100 415.3700 461.0000 40.0000 451.4800 308.7000 373.9900 314.890...
a51997bc3971cafbc6afedebd2c90df5de2e4a1e96fa73ea581932e73fcf474c
MATLAB
1,640
67
%% initialize % Create a set of stacked position traces. % if true, will not offset positions based on a fly's starting point preserveOrigin = false; % size of the arena bounds = 8; %% open files % This file opens a set of position traces and stacks and plots them on the % same set of coordinates. inputFiles = uip...
40a2b802c0c39834addc27373902c22f2379aa0c81355f40c37862d4205f9e7b
MATLAB
1,641
45
function F=backwards2forwards(B) % This function will turn a backward transformation field in to a % forward transformation field, using gaussian kernel splatting. % % Thus when you have transformed image1 into image2 with the Rueckert % Registration, this function can reverse the vectorField allowing the % tran...
25007e5b4ba2e1d957d8cfab6945376aa39e55318f6d551d5e0ee16439d8e273
MATLAB
1,642
63
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % saves data in a .crabsort file function saveData(self) % early escape if isempty(self.time) ...
27e6e22f97d4d0d0abfc5eb968d9366e47ec67d7d667b3f9833fbf09c91f8596
MATLAB
1,642
44
function TSFC_BGFC(stat_path,exp_folder,N) % ======================================================================== % Ruslan Masharipov, October, 2023 % email: ruslan.s.masharipov@gmail.com % ======================================================================== tic for subji = 1:N load([stat_path filesep exp...
3dbcf9d126ba7a6bfe5fa6e91f6230896880a594cdcd1baa8f0856fd712b4426
MATLAB
1,642
53
function Psth = calPsth(data,binpara,scaleFactor,varargin) EDGEMISMATCH = false; NTRIAL = 1; for i = 1:2:length(varargin) eval([ upper(varargin{i}) '=varargin{i+1};']); end binsize = binpara.binsize; binstep = binpara.binstep; if ~isempty(data) & max(data)>binsize if ~(exist('EDGE') == 1) %if WIN is a va...
7548ea06687890e977b8a34bb75990c68e83396da930b792023cc585483f472a
MATLAB
1,642
57
load('E:\2022-09-22_Grids-Imaging\FOV1-225um\imaging\CaimanPipeline.mat') %load this tiff if you want to check cell location % maxtiff = imread('E:\2022-09-22_Grids-Imaging\FOV1-225um\imaging\MAX_2022-09-22_FOV1-225um.tif'); %load this to overlay with grid location maxtiff = imread('E:\2022-09-22_Grids-Imaging\FOV1...
a3506644a1a159fa05720fda70150f2e3ffb562d2484d3ea49b46a887874dd88
MATLAB
1,643
60
function FbVisualize( FB, show ) % Used to visualize a series of 1D/2D/3D filters. % % For 1D and 2D filterabnks also shows the Fourier spectra of the filters. % % USAGE % FbVisualize( FB, [show] ) % % INPUTS % FB - filter bank to visualize (either 2D, 3D, or 4D array) % show - [1] figure to use for display...
a776aaabf25c7ef0fc01c90e0109b2d37479162ecd1745aa8dc930bf1a6fe758
MATLAB
1,643
42
function batch_split_dat(metadata_path) % pulls path and port info from metata csv and runs split_dat.m % % input: % metadata_csv_path: excel file with column variables: % data_path: path to intan data to split % save_path_A: project folder where data should be saved for port A % save_path_B: proje...
c420793e35745fd172b9630eef41fa586be1340de58a0c9d555b1d18f6110a7b
MATLAB
1,643
35
function formatted_act = CBIG_AuthorTopicEM_ConvertActToEMFormat(act) % formatted_act = CBIG_AuthorTopicEM_ConvertActToEMFormat(act) % % Convert activation data to input format required for the % Expectation-Maximization (EM) algorithm % % Input: % - act = activation foci across experiments % Output: % - formatted_...
f1c9bcad8eeb53d6c50a35bfb825267cb3bafe8b13b64d2d226c99db7b87b6cc
MATLAB
1,643
39
AgeSource = round(40 + betarnd(3,2,[400,1]) * 40); AgeTarget = round(40 + betarnd(2,3,[300,1]) * 40); SexSource = binornd(1,0.2,400,1); SexTarget = binornd(1,0.8,300,1); mu1 = [100, 400, 500, 600]; Sigma1 = 0.8 * eye(4) + 0.2 * ones(4); mu2 = [30, 40, 50, 60]; Sigma2 = 0.6 * eye(4) + 0.4 * ones(4); Xsource = AgeSour...
90296f0e432f586cedc974f612d94b53041fa233dd832d2d6ea1d54e8f67423d
MATLAB
1,644
54
%% Script for processing all tomograms in a directory with membflt % Author: Antonio Martinez-Sanchez %% Clear workspace close all clear all %% Input/Output directories din = '~/Desktop/test/in'; dout = '~/Desktop/test/out_s7_t2'; %% Input parameters s = 7; % Scale factor t = 2; % Membrane thickness factor v = 1; ...
10e95f00ec0e55b8d1d7b1ff439404bc0408e804f741c67c63261d705fddbe42
MATLAB
1,645
34
% SOFA API - demo script % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not use this work except in compliance with the ...
cc7d621ccc44b531cac65375dc2380600fdce19a8ed133999f07862a5886f827
MATLAB
1,645
64
function C = global_analysis( M, tv, c, v ) % GLOBAL_ANALYSIS Perform a simple global analysis for tomogram segmentation, firstly binarizes % and secondly labels tomogram structures according to their size % % INPUT: % M - Input tomogram % tv - Binarization threshold % c - Voxel c...
da8ea4ce21d6e51f9ab989c90755211c6a8fc90af81563315aeb0c55969133fb
MATLAB
1,645
55
%% Posterior over 5-node DAGs on Sewell-Shah college data % Iterate through all 5 node DAG and calculate the marginal likelihood to % determine the most likely strucutre to explain the college data. %% % This file is from pmtk3.googlecode.com loadData('sewellShah'); X = X(:,2:end) + 1; [N, D] = size(X); ns = [2 4 2 ...
0c93da5e879bbb3a4741bdf4735b7e361e362ceafe3678432838778f400c3831
MATLAB
1,646
40
function [vol] = yokogawa2vol(hdr) % YOKOGAWA2VOL converts a spherical volume conductor model that can % be present in the header of a datafile into a structure that can % be used by FieldTrip. % Copyright (C) 2005, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the do...
a27c365c73194a95bc01cf105cfdd7d40abc94fa32417f1f68e7c99110b14e2c
MATLAB
1,646
52
function [xsR,ysR] = tpsInterpolate( warp, xs, ys, show ) % Apply warp (obtained by tpsGetWarp) to a set of new points. % % USAGE % [xsR,ysR] = tpsInterpolate( warp, xs, ys, [show] ) % % INPUTS % warp - [see tpsGetWarp] bookstein warping parameters % xs, ys - points to apply warp to % show - [1] will disp...
b4297912da8fced92be376957475c58c74d178004e9885034a4f3d26950cdae7
MATLAB
1,646
57
function [sloc] = genLocsSA(slbl,tblsplit,varargin) % Locs for Single animal. Use images in the lbl cache for now. % mov is empty for now. Seemed too convoluted to include it for now. % MK 07022022 imgpat = myparse(varargin,... 'imgpat','im/%s.png' ... ); nrows=size(slbl.preProcData_I,1); sloc = []; ro...
d6d20493339d1735df5dfbf69d8aca76b5802fe5452f314d3c2976cfaecceb44
MATLAB
1,646
68
%% Normal Gamma Distribution Plot % %% % This file is from pmtk3.googlecode.com function normalGammaPlotDemo() xs = -1:0.01:1; %deltas = [1 1 0.1, 0.1]; %cs = [1 0.1 1 0.1]; deltas = [0.01 0.75 1, 2]; cs = ones(1,4); [styles, colors, symbols, str] = plotColors; str = {}; if 1 f1=figure; hold on for i=1:leng...
44850d7581a22ae6c838f847bfc0e55a7bb8eef1a8481c95dc1333d4c399647d
MATLAB
1,647
40
function b = multitransp(a, dim) % Transposing arrays of matrices. % % B = MULTITRANSP(A) is equivalent to B = MULTITRANSP(A, DIM), where % DIM = 1. % % B = MULTITRANSP(A, DIM) is equivalent to % B = PERMUTE(A, [1:DIM-1, DIM+1, DIM, DIM+2:NDIMS(A)]), where A is an % array containing N P-by-Q mat...
9842a1c3419fe42a64c1f55a6f84c13f3eaab2d102ea46e3cbd2ff9237b534fc
MATLAB
1,647
66
function [ks,oks,okstype,hfig] = ComputeOKS(data,kappa,varargin) hfig = []; [distname,pttypes,doplot] = myparse(varargin,'distname','gamma2','pttypes',{},'doplot',false); [n,npts,~] = size(data.labels); if isempty(pttypes), pttypes = cell(npts,2); for i = 1:npts, pttypes{i,1} = num2str(i); pttypes{i,2} = ...
b072260585a16ad0601c02fb525331897f3c503b6d164911dd0057bf6c989c74
MATLAB
1,647
32
psthPara.binsize = 10; psthPara.binstep = 10; % ms if contains(protStr, "Sound reward") devStr = "Type"; end tIndex = matches({trialAll.(devStr)}, devType(dIndex)); trials = trialAll(tIndex); trialsSPK = trialsSpike(tIndex); % spike spkReward(dIndex).devType = devType(dIndex); spkReward(dIndex).trials ...
ce16812df8c4068f20c79e60a16b8a4b4909714736c2c3eb7220e0802f0dea31
MATLAB
1,647
78
%% help web('https://bitbucket.org/marcelostockle/lan-toolbox/wiki/edit/Creating%20a%20LAN%20variable', '-browser') %% make LAN manually LAN = []; LAN.srate = 1000; % Sampling rate. LAN.data{1} = data1; % data1 is a matrix of sampled data in rows. LAN = lan_check(LAN); lan_fill_gui(LAN); %% make LAN from a .csv file...
e291890513fb68f6aac4ee3437cb47b4e95f002439d58d08bebcb89fce006f8a
MATLAB
1,647
42
%% This file creates the trace weighted nii file for all data. %% transfer nii to trace nii data PATH = pwd; subjects = {'sub_001'};%, 'sub_003', 'sub_004', 'sub_005', 'sub_006', 'sub_007', 'sub_001_rescan', 'sub_003_rescan', 'sub_004_rescan', 'sub_005_rescan', 'sub_006_rescan', 'sub_007_rescan'}; for ii = 1:...
408617403a39dba97fb63df8c16d95012666daea301fb30ee910fb9d529c6e4b
MATLAB
1,648
49
function [modelParam, simParam, resultsStruct, PFresultsStruct, varargout] = loadResults(decodeName) % [modelParam, simParam, resultsStruct, PFresultsStruct, preplayGridSpikes, pfGridspikes] = grid.loadResults(decodeName) % % Returns preplay spikes as optional 5th output % Returns place field spikes as optional 6th out...
6098ca84cb1b38be5eb2c56b87149b76f7bc2637b5da3225cd92e2639b1d0baf
MATLAB
1,648
50
% CreateStrings.m % Sarah West % 2/25/22 % Takes an input cell array of character strings, and inputs any variable % to any keyword. Outputs a string. % Input: % string_format_cell--cell array. Establish the format of the file names of compressed data. Each piece % needs to be a separate entry in a cell array. % ke...
7d53b8a55c531579049b0e2789be3cfdc1eb19a9be2687c79ecc2c47f7f2551e
MATLAB
1,648
40
function [suffStat] = VBA_getSuffStat(options,suffStat,flag) % fills in default sufficient statistics structure % function [suffStat] = VBA_getSuffStat(options,suffStat,flag) % IN: % - options: the options structure (only the substructure .dim is used here) % - suffStat: {[]} % - flag: {0}, 1 if online version i...
8a8984663922478e3f7a2c05591b787a993a5e26343298dbd7532adcc78a7312
MATLAB
1,648
53
function lme_lowessPlot(time,y,bw,group) % lme_lowessPlot(time,y,bw,group) % % Time plot of the lowess regression curve estimating the trend in the % mean response over time (Depends on the curve fitting toolbox). % % Input % time: Time covariate (ordered according to time for each subject) . % y: Ordered data vector (...
f3d45428c590b256e38dfe88a804cbb481c21b603fc7752b322ab1ff6c0a3a80
MATLAB
1,648
64
function C = global_analysis( M, tv, c, v ) % GLOBAL_ANALYSIS Perform a simple global analysis for tomogram segmentation, firstly binarizes % and secondly labels tomogram structures according to their size % % INPUT: % M - Input tomogram % tv - Binarization threshold % c - Voxel c...
f8fa70bc0b3e5c8009acd1a3e7c81dc33fa3f4fce620d9689285a283ef2213b1
MATLAB
1,648
66
function wlPlot_plotExtractedParams(cfg, times, wave, env, freq, phase, ... figtitle, filelabel) % function wlPlot_plotExtractedParams(cfg, times, wave, env, freq, phase, ... % figtitle, filelabel) % % This function plots a time-series waveform, its envelope, its instantaneous % frequency, and its instantaneous ph...
10a522878b1d6bd26f3b1aee4fa9e30386806fea8011b9cdaaf18ac63bf73744
MATLAB
1,649
63
function res = grs2rgb2(img, map) %Zach edited version of grs2rgb to fix color size issues with large images %grs2rgb2 ONLY MAKES SINGLE PRECISION COLOR MAP %%Convert grayscale images to RGB using specified colormap. % IMG is the grayscale image. Must be specified as a name of the image % including the directory, or ...
8d4af7309fe74e72a5f57f5222bfb0cd9b8fe54a7edf822c804199109a6772a3
MATLAB
1,649
62
function [returnVar,msg] = RemoveDCfromDat(fname,nbChan) % USAGE: % RemoveDCfromDat(fbasename,nbChan) % This function removes DC from dat files by computing the average of % the first 1e6 samples (or less if file is smaller) % INPUTS: % fname: dat file name % nbChan: total number of channels in dat...
b819897c21e8c6bb0d697c640ad5b0218bf3150c00d51b0333f28ecb9c97d94f
MATLAB
1,649
79
function Y = symmetrize(X) %SYMMETRIZE Symmetrize a ktensor X in all modes. % % Y = symmetrize(X) will symmetrize a ktensor X with respect to all % modes so that Y is symmetric with respect to any permutation of % indices. % % See also ISSYMMETRIC, SYMKTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia C...
bdb9cfce4ff1a606b82dd56952164c87242a18d9caa05386c75ce47b1d99de12
MATLAB
1,649
43
%% SAT - app_input:: %% helper.returnFilesFromDirectory % Name: Phone Kyaw % Date: 09/19/2024 % Description: Extract all the files inside a directory % Parameters: None % Return Value: files - Nx1 cell containing all the files' path inside the % directory user selected %_____...
92facc7b64c1f5639eec0e7d3a7950f90a266eac2def0a09ad81daf316e05531
MATLAB
1,651
75
function [eps] = Dmin_2D_opt_qst(a0,a1) %calculates local strain in an amorphous system. % INPUT : % a0 - (x,y) coordinates at time t0. a1 - at later time. N = size(a0,1); % number of particles %disp(N) NNacceptance = 1.2; %5.0 % first minimum of g(r) NNsq = NNacceptance*NNacceptance; min = 0...
f316eab0b87ba7fbd6ecff7d7d7ad21e343c9c80173aac9297407935c382267a
MATLAB
1,651
55
function [msg, prevNodes] = treeMsgOrder(adj, root) %treeMsgOrder Find message scheduling for inference on a tree. % Determines a sequence of message updates by which BP produces optimal % smoothed estimates on a tree-structured undirected graph. % % msg = treeMsgOrder(adj, root) % % PARAMETERS: % adj = a...
4748b15dc18654befc960bde41fcb6538a864d115debe52ae0ad84a89db9c820
MATLAB
1,652
48
function [a,b] = find_ab_params(spread, min_dist) %FIND_AB_PARAMS Fit a and b parameters for the differentiable curve used in % lower dimensional fuzzy simplicial complex construction. We want the % smooth curve (from a pre-defined family with simple gradient) that best % matches an offset exponential decay. % % [a,b] ...