sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4d5cab3f3ec67f44b29ae51eb551e998dab511841922011f73535da0dd6f14b6
MATLAB
2,369
66
function essential_svd % Sample solution of an optimization problem on the essential manifold. % % Solves the problem \sum_{i=1}^N ||E_i-A_i||^2, where E_i are essential % matrices. Essential matrices are used in computer vision to represent the % epipolar constraint between projected points in two perspective vie...
b5c3f4a3c72a1a2f2a2a2722f52e77e2e90b32619cd5ef15293b7f201a4253d9
MATLAB
2,369
62
function bfUpgradeCheck(varargin) % Check for new version of Bio-Formats and update it if applicable % % SYNOPSIS: bfUpgradeCheck(autoDownload, 'STABLE') % % Input % autoDownload - Optional. A boolean specifying of the latest version % should be downloaded % % versions - Optional: a string sepecifying the v...
b5e99a4bc7aaaa278cc74fa3abac8e526c0f128ec7ee722fb5fbc1b9bd8a83c7
MATLAB
2,370
90
function [coef] = lan_thetavsdelta(LAN, cfg, sample) % cfg : % chan : channel % th_freq : theta frequency range % de_freq : delta frequency range % win_len : sliding window length (seconds) % twin : time windowing function : hann|hamming % step : sliding window step (points) if ~isfield(cfg, 'chan') disp('Default ...
1b2670e86c59a5f04e263457864cfbc816bf519e3976ad2facb16739fc5822e5
MATLAB
2,371
75
function A=mkfilt_eloreta_v2(L,regu); % makes spatial filter according to eLoreta % usage A=mkfilt_eloreta_v2(L); or A=mkfilt_eloreta_v2(L,regu); % % input L: NxMxP leadfield tensor for N channels, M voxels, and % P dipole directions. Typically P=3. (If you do MEG for % a spherical volume cond...
0f78c32f6e35ae7d994a82da42f4b03ce161594470edf14be6cce1fb7c29d9a9
MATLAB
2,372
66
clear close all % Load neuronal PSY regressor and PPI regressor calculated by SPM PEB load(fullfile(pwd,'examples','01_Simulated_Block_Design_[TR_2s]_[NT_16].mat')) % Setup variables TR = 2; % Time repetition, [s] NT = 16; % Microtime resolution (number of time bins pe...
202ed9eccacaa767d8c50fc28ccd81e9e2acbaa001a24e300dd0cc6cb971714b
MATLAB
2,372
94
%GETDSV reads a Siemens IDEA file in DSV format % tmax = getDSV(f) % f filename % tmax maximum time in seconds % % [t, y, Fs] = getDSV(f, tmax) % t time of samples in microseconds % y sample values % Fs sampling rate in Hz % % Author: Christian Labadie, 2008-2012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
469295e56832adfbddd6335821396d5016797e59aeedd02e23a9dcaf69bd3dba
MATLAB
2,372
88
function waves = LoadUnitWaves(unit, baseDir, varargin) unit = unit(1); unitInfo = strsplit(unit.name, ' '); trode = unitInfo{3}; [wL nChan] = size(unit.meanWaveform); pk = unit.peakLoc; uFs = unit.Fs; tStart = unit.taskStart; tEnd = unit.taskEnd; % hard-code custom waveform stats here wL = 72; task = ''; batchSize...
4cf17e2a65657baea2797f71f4fd76ffd7d38686260700702cad1406ce5fea02
MATLAB
2,372
101
% 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,...
94477cfe073db97c43832376c79832fffa985a5c4f22a6855436b0457b8c6ef3
MATLAB
2,372
88
function z = eq(x,y) %EQ Equal (==) for sptensors. % % A == B compares the elements of A and B for equality. The arguments can % be a pair of sptensors, an sptensor and a tensor, or an sptensor and a % scalar. Regardless, the result is always returned as a sparse tensor. % % See also SPTENSOR. % %MATLAB Tensor...
1f13e278f4c5d2369938d54bffbd589fa32e07be04014ffda519a930c1a428ad
MATLAB
2,373
95
function [issame,fns] = structcompare(s1,s2,varargin) [prefix,verbose] = myparse(varargin,'prefix','','verbose',false); fns1 = fieldnames(s1); fns2 = fieldnames(s2); fns = union(fns1,fns2); issame = ismember(fns,fns1) & ismember(fns,fns2); for i = 1:numel(fns), fn = fns{i}; if isempty(prefix), fp = fn; ...
731be1312ccf3eee50351eacdb9a1b7195b3dfb0d9eeb978d323e178bd33c065
MATLAB
2,373
65
function [xyzshift,I_shifted] = get_xyzshift(A1, B1, toshift, pixel, rmax, xyzshift, distance) % Gets and applies xyzshift for two images that we desire to register % Based on "get_enrichment_3dMatrix_final.m" (author info below) % Updated 01.26.10 by Sarah Veatch. % Modified 02.18.14 by Aihui Tang. % Last updated 10...
a2f6680f014554ca5e93f869420098f200189be283ac46e616f3636fdb9184c5
MATLAB
2,373
89
function [max_mem] = ttm_me_mem(X, U, edims, sdims, tflag) %TTM_ME_MEM Estimates intermediate memory comsumption for ttm_me. % % MAX_MEM = TTM_ME_MEM(X, U, EDIMS, SDIMS, TFLAG) estimates the memory % comsumption used in the TTM_ME function. Here, X is a sparse tensor % (sptensor), U is a cell array of matrices of ...
ecd2f5b9994d598c6f42d7761cd3df18760790ba3eaa369ee12b85e3fbb9c6af
MATLAB
2,373
86
function y = d2b(x, nBits) % Convert decimal numbers into a logical array, least significant digits % first. The function is meant to work on integers and the fractional % part is truncated. Adds a trailing dimension for binary digits. % Optional argument nBits pads or truncates most significant bits so that...
b95b1e92fd51b1b1fbd9282a448c368cc63dd48ee019c36eb97426d423471582
MATLAB
2,374
75
function tilefigs(tile,border) % <cpp> tile figure windows usage: tilefigs ([nrows ncols],border_in pixels) % Restriction: maximum of 100 figure windows % Without arguments, tilefigs will determine the closest N x N grid %Charles Plum Nichols Research Corp. %<cplum@nichols.com> 7...
5d364f1e0059029c6a0ae03b5e46d08d7b5b08f9a40f559ad5ba8a91612fc5d7
MATLAB
2,375
93
function x = stdrinvZN(p, v, r) %STDRINV Compute inverse c.d.f. for Studentized Range statistic % STDRINV(P,V,R) is the inverse cumulative distribution function for % the Studentized range statistic for R samples and V degrees of % freedom, evaluated at P % Copyright 1993-2004 The MathWorks, Inc. % Based on ...
04d6a1015905c0dc23b3ed2f398f2579386e514b816cf28f08f64f8bb28bb3cc
MATLAB
2,377
77
function generateSynopses(wikiFile) %% Generate the synopses listing files and one line desriptions % PMTKneedsMatlab % This file is from pmtk3.googlecode.com if nargin < 1 wikiFile = fullfile(getConfigValue('PMTKlocalWikiPath'), 'synopsisPages.wiki'); end dest = fullfile(pmtk3Root(), 'docs', 'synopsis'); googleR...
b1b70a0e745cb7f8f96ce52b3ece3805e79692e2ec4581f2d97b9eb0f3a799cb
MATLAB
2,377
83
function [gx,out,dgdp] = VBA_odeLim(Xt,P,ut,in) % collapses evolution and observation functions for ODE limit inversion % function [gx,out,dgdp] = VBA_odeLim(Xt,P,ut,in) % This function evaluates the evolution/observation functions that are % embedded in the observation function of a deterministic (ODE) state-space % m...
e2ffdebf6d0634e0efa33664fda1e05616fdbdd314ae35f1e69d8da4899617b1
MATLAB
2,377
73
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% bem_1_visualize_dipoles.m %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% load BEM-FMM engine and utils restoredefaultpath; addpath(fullfile('../engines/bem_fmm_e...
e88ef83f8d127f183e3a0c2de7bb498a549c5e232e74acd4e46297e03d83caf8
MATLAB
2,377
103
function ConfString = bitseqquattro(fsamp, nchannel, highpass, lowpass) switch fsamp case 512 Fsamp = 0; case 2048 Fsamp = 8; case 5120 Fsamp = 16; case 10240 Fsamp = 24; end switch nchannel case 120 nchan ...
733b90e300d00a537b9f025b15d372ecc2030571124c1e03011cccb750b688a9
MATLAB
2,378
79
function compare3dMovie(outf,fmov,smov,matfilef,matfiles,outfile) %% [readframe_front,~] = get_readframe_fcn(fmov); [readframe_side,~] = get_readframe_fcn(smov); rdf = load(matfilef); rds = load(matfiles); FRONTOUTPUTTYPE = 1; % output of MRF SIDEOUTPUTTYPE = 1; % output of raw detector rdf.locs = permut...
7807c6ca7e6ac40ed074f2171a065219bed0090ed60c4f1b9199af70dfad2c93
MATLAB
2,378
60
function opts=Config_FormatCorrDynamic(GlobalOpts,varargin); %% Arguements for wrapping function % opts.Dates={'20150413' '20150415','20150424'}; Note that 20150415 has % only 7 NoGo trials opts=GlobalOpts; opts.PlotShuffle=0; [varargin,opts.Dates] = Utilities.ProcVarargin(varargin,'Dates',{opts.Dates}); [...
f0b76569c808f521cb53187e8411bfecf3e96313b596fe3e92aeb848370b4e8b
MATLAB
2,378
77
classdef DataSummaryGraph < handle % % % %<PRE> % This file is part of dspace-core. % % Copyright (C) 2020 University Zurich, Sepp Kollmorgen % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU Affero General Public License ...
fba0bed54ad1f37fe4d127f6367947386d19a48c609341c9acdd485fe584ba5e
MATLAB
2,378
105
function writeras(filename, image, map); %WRITERAS Write an image file in sun raster format. % WRITERAS('imagefile.ras', image_matrix, map) writes a % "sun.raster" image file. % Written by Thomas K. Leung 3/30/93. % @ California Institute of Technology. % PC and UNIX version of writeras - Jean-Yves Bouguet...
1af992b44601ad108f9f7831765cee45105fd55a6d58fdfc141b009dc1afe2df
MATLAB
2,380
67
function [Kernel, features, D] = build_kernels_noPiP(datadir, hmmdir, kerneldir, HMM_name, Fn, Kn) % [Kernel, features, D] = build_kernels_noPiP(datadir, hmmdir, kerneldir, HMM_name, Fn, Kn) % % build kernels from HMMs using only state parameters (no transition % probabilities and initial state probabilities) % (wrapp...
a2195109e49edb3fca9f9f3841a680cd6d03e95e34fc22ce54a18288db401271
MATLAB
2,380
56
classdef CBIG_gwMRF_unit_test < matlab.unittest.TestCase % % Target project: % Schaefer2018_LocalGlobal % % Case design: % Schaefer2018_LocalGlobal already has unit test script, here % we call its unit test script and automatically % make judgement on whe...
bd46f148fad34e9e3d2833f7b30527a0dc1580874aa5ffa7b4a17f204e09984d
MATLAB
2,381
80
%% Set metadata resultsPath = 'D:\GAD67 results\Test\'; fileName = 'mb062_deep1_201014'; mouse = 'mb062'; belt = 'uncued'; layer = 'deep'; fov_code = 'deep1'; sr_img = 8; %sampling rate si_img = 1/sr_img*1000; %sampling interval date = datetime(2020,10,14); % fov size d1 = 200; % x axis in pixel d2 = 200; % y axis in...
830b01be9d817ba68e4e385f48fc341b95c41faf8a9d06a5d194c6d74a2692cd
MATLAB
2,382
69
% Main script for the state switching MR practice (October 2017) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% enter subject ID & task variant %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% prompt = {'Enter subject ID:','Enter paradigm (dynamic/words/visual):'}; dlg_title = 'StateSwitch Input'; num_lines = 1; defaultans = {'00...
3ef7dc13b2d551bdb5d711508be587d43abcc62df0765f8e40fc4d08360429bf
MATLAB
2,384
80
function M=movsc2wv(N,Np); %MOVSC2WV Movie illustrating the passage from the scalogram to the WVD. % M=MOVSC2WV(N,Np) generates the movie frames illustrating the passage % from the scalogram to the WVD using different smoothing gaussian % windows in the affine smoothed pseudo-WVD. % % N : number of points for the sign...
8c866c0d2529ecd75f70a0192fca1565efe7edbc76632b619831bf21b6f99939
MATLAB
2,385
66
function[slope,intercept] = fitMMD(datasource,datatarget,calpvalue) %% function[slope,intercept,pvalue] = fitMMD(datasource,datatarget,calpvalue) %% Inputs: datasource and datatarget are related to the one dimension measurement of interest; if calpvalue=1, return pvalue, else, return 2. %% Outputs: slope, intercept for...
246c70377495858ba4e0f7cace5988ce1ba17108c2ca6e4a1baba199193bbe4c
MATLAB
2,386
70
function gradfd = getGradientFD(problem, x, storedb, key) % Computes an approx. of the gradient w/ finite differences of the cost. % % function gradfd = getGradientFD(problem, x) % function gradfd = getGradientFD(problem, x, storedb) % function gradfd = getGradientFD(problem, x, storedb, key) % % Returns a finit...
299eba83911f9c05d7aa08732c0982732645071831c74d2b6e739f9a82d3c88a
MATLAB
2,386
80
function P = ggmFitMinfunc(G, X, C) % MLE for a GGM using gradient method % Usage: % precMat = ggmFitMinfunc(G, X) % X is N*D % or precMat = ggmFitMinfunc(G, [], C) % C is cov(X) D*D % This file is from pmtk3.googlecode.com %PMTKauthor Mark Schmidt % % Basically the same code as GWishartFit, except we use the % unr...
92720f73e58aecef4fd02935f703c9694e47758aa3fbdde8f6664d93acdde966
MATLAB
2,386
1
% TSEDIT Flexibly edit tsdata information. % TSEDIT(TSDATA,MATCHCODES,EDITCODES) edits TSDATA based on MATCHCODES % and EDITCODES. MATCHCODES denotes a cell array of match definitions, % and EDITCODES denotes a cell array of edit information vectors. % % The format of each vector is [MATCHNUM MATCHPOS NEW...
d6d094621424e8f95e545d8c0ce79152e46a3dbe2e82cf3677613a6b9f2dc7f4
MATLAB
2,387
63
function [fx] = f_Hampton(x,P,u,in) % Hampton's "influence learning" model: evolution function (Hide and Seek) % function [fx] = f_Hampton(x,P,u,in) % Hereafter, the learner is referred to as the "agent", whereas her % opponent is referred to as the "other". % Let p=P(o=1) be the agent's prediction of the other's next ...
e7e969569af443c89f6dacdc45da7b6735fef1cd8cba5f939ed7188431328969
MATLAB
2,387
46
% CLASSIFY % See also % % Clustering: % demoCluster - Clustering demo. % demoGenData - Generate data drawn form a mixture of Gaussians. % kmeans2 - Fast version of kmeans clustering. % meanShift - meanShift clustering algorithm. % meanShiftIm - Applies the meanShift al...
933576366bb9d88ed201c1d75bc22e0a5925b25103fb0e96770d21e7537453df
MATLAB
2,389
57
function success_code = registerWithCorrespondencesInParallel() loadParameters; run_num_list = 1:params.NUM_ROUNDS; run_num_list(params.REFERENCE_ROUND_WARP) = []; arg_list_1 = {}; arg_list_2 = {}; arg_list_3 = {}; postfix_list = {}; for run_num = run_num_list arg_list_1{end+1...
df01ae785544ea2f14268743dd1c48c1fedf991c9f33882666262010b5f1a120
MATLAB
2,389
87
classdef AxesHighlightManager < handle % Handle highlighting of axes for 'special' frames, used by eg GT mode properties hAxs % vector of axes to which hiliting is applied tfHilite % scalar logical, current hilite state tfHilitePnl % scalar logical. If true, hilite panel; otherwise hilite axes ...
0499ff762747da8d29a1b0cf97f2f1bdfb88cb9b7d438d44b87b27b0b18813bf
MATLAB
2,390
80
function traj = CalculateMotion(aChip1, aChip2, param) % unpack inital conditions x = param.x; % position vector (of board center relative to box) Oz = param.Oz; % vector specifying orientation of board top Oy = param.Oy; % vector specifying orientation of board front v = param.v; % linear velocity vector w = par...
24e232142e1a956e406d976a999d79f019977ce1246a4d983279f2ee4d15ba56
MATLAB
2,390
69
classdef TrackingVisualizerBase < handle % Tracking Visualizer base class; mostly for doc % % TrackingVisualizerBase provides an interface for TVs, currently related % to frame updates and cosmetics. Clients like LabelerController have % common needs regardless of visualization type. % % *Frame updates, direct* % Some ...
51ca0df6b55a95831312879322344ff7a925308b0fcdfeca581987c15ae6eb41
MATLAB
2,390
91
%% An illustration of least squares projection % %% % This file is from pmtk3.googlecode.com function leastSquaresProjection() setSeed(2); n = 3; d = 2; W = 0.05*[1; 1]; %X = 0.1*randn(n,d); X = [1 1 1; 2 -2 2]' y = X*W + 1*randn(n,1) wHat = X \ y; yHat = X*wHat; % check that residual is orthogonal X'*(y-yHat) % ...
f45c707b0da899dd18f9dab35dd880032a01a9392c4884500dc5bed5e65a4930
MATLAB
2,390
73
function [XL,XR] = stereo_triangulation_extrinsic(xt,xtt,om,T) % [XL,XR] = stereo_triangulation(xL,xR,om,T,fc_left,cc_left,kc_left,alpha_c_left,fc_right,cc_right,kc_right,alpha_c_right), % % Function that computes the position of a set on N points given the left and right image projections. % The cameras are assumed t...
f8e0aba4a72597635f98a78c9216468fb2ad78dc62be335c411b243cd6c289b5
MATLAB
2,390
70
% LSEDC Equality-constrained linear least squares using deferred correction. % % X = LSEDC(LSFUN,A,B,C,D,TAU) produces the solution X to the equality- % constrained least squares problem % % MIN. NORM(A*X - B) S.T. C*X = D % % by solving the unconstrained weighted least squares problem % % MIN. NO...
087b5c65bc84fc62bf5c7be70ce8839b08d605c69ce79a5375104abb38c8c333
MATLAB
2,391
67
%% SAT - app_input:: %% getPpDataFromDirectory % Name: Phone Kyaw % Date: 09/19/2024 % Description: Get PP data from multiple PP files % Parameter: pp_files - A cell array containing files' path % Return Value: pp_cell - Nx1 cell array where each row contains Mx2 cell for % ...
1d5241b708bb38a2d1daa5350d52d0f5834eacd19948d08baf216d1bbbde0fe9
MATLAB
2,391
74
classdef SBFMFRecording < VideoRecording properties highlightForeground = false % TODO: expose a UI to set this end properties (Transient) sbfmfFile haveImageToolbox end methods (Static) function canLoad = canLoadFromPath(filePath) ...
80c4a10f71ddef6d5d3937ce2626f18a0aa73f5ae17397915be09abb93db9594
MATLAB
2,391
66
function [y1,y2] = toolboxHeader( x1, x2, x3, prm ) % One line description of function (will appear in file summary). % % General commments explaining purpose of function [width is 75 % characters]. There may be multiple paragraphs. In special cases some or % all of these guidelines may need to be broken. % % Next come...
ad6726eeb1179c5cb1bf70861ccf2465740800f38c793de2b37b22f5d0cb7ab8
MATLAB
2,391
67
classdef NoldusImporter < FeaturesImporter properties end methods(Static) function n = typeName() n = 'Noldus'; end function c = canImportFromPath(featuresFilePath) c = false; if exist(featuresFilePath,...
4e6dca14c61fe070c1aec3414b74604956e31979475ef6622d65248069c23583
MATLAB
2,392
79
% Define cells LIP_MIP_HandEye %% ------------------------------------------------------------------------ % 20211004 unitIdxLIP_Tin = [26 29 32 44 46 49 61 69 71 93 103 141 157 163 188,... 205 212 220 221 249 253 256]; % Map maybe: 2 3 34 44 46 49 53 57 60 89 93 103 105 121 129 133 134 141 152 157 163 %...
ff7e8154c86ff22ffde107bc29649d05e0eae19ec913f020bfc6682c367008a7
MATLAB
2,392
85
function decVec = decode_success_par_new(data,winsize,stepsize,prctokeep,seed) %% test %close all %T=969; %sig=zscore(cumsum(randn(T,18))); %data=0.5*randn(T,18,32)+repmat(sig,1,1,32); %winsize=25; %stepsize=25; %prctokeep=1; % % data is in format time x space x subjects % winsize is a number of le...
29faf23c60e2eef0bf24f481800704349079d5d2ec8a132836f81e91bd636353
MATLAB
2,393
85
function [x,y] = ldsSample(F, H, Q, R, init_state, T, models, G, u) % Simulate a run of a (switching) stochastic linear dynamical system. % [x,y] = switching_lds_draw(F, H, Q, R, init_state, models, G, u) % % x(t+1) = F*x(t) + G*u(t) + w(t), w ~ N(0, Q), x(0) = init_state % y(t) = H*x(t) + v(t), v ~ N(0, R) %...
c4fbe96e87094e601a2f90cccd97d39e413fb309c0e9590b4542ea335f1d42e2
MATLAB
2,393
70
function mix = mygmminit(x,centres,idx,covartype) %GMMINIT Initialises Gaussian mixture model from data % [ndata, xdim] = size(x); k = rows(centres); mix = gmm(xdim,k,covartype); I = eye(k); post = I(idx,:); mix.centres = centres; % Arbitrary width used if variance collapses to zero: make it 'large' so % that centre i...
c7a407ce11232537045b4728b01bc7b7a7e3a335e7f063626387fe4fb0d41326
MATLAB
2,393
61
function mono_res = bz_GetMonoSynapticallyConnected(basepath,varargin) %% Method for estimating likelihood of monosynaptic connectivity based off of relative spike timing % Based off of Stark and Abeles 2009 and verified for PYR -INT in English et al., 2017 % Assumes network synchrony is low frequency and that synapse...
020d0112b6d649738dd1804209403ca6808e8b1f71cf9a6542fa79204c45f35c
MATLAB
2,394
106
% 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,...
657ed5201bcf8bd332395541e9a49814cf7e9b565d627cb2c7c2fe126593f2bf
MATLAB
2,394
54
% Copyright Christopher Fricke, University Leipzig Medical Center, % Neurology 2024 close all; clear; datafolder = 'Resting State Connectivity Analysis\results\HCP\datscan_learning'; d1 = dir(fullfile(datafolder,'firstlevel','avg','grouproi')); for i = 3:length(d1) matlabbatch = []; matlabbatch{...
d112825a2f14399fa4a397c49c1a1ae6eaa962d5440eec4e71ba836dedcd667d
MATLAB
2,394
74
%resnet50for feature extraction 26/3/2020 %acuracy 91.88 data set of 10 printer % accuracy rearranged dataset of 10 printer clc close all clear % images=testreaddata(); images=imageDatastore('D:\Doaa_PHD\PHD2020\2nd paper\code\custom cnn48\KDEF','IncludeSubfolders',true,'LabelSource', 'folderna...
fefea2248cf2efb3542e59d051dfe6c12c1a9f09702a69025283923c713a9666
MATLAB
2,394
68
function [fx,dfdx,dfdp] = f_Qlearning(x,P,u,in) % // VBA toolbox ////////////////////////////////////////////////////////// % % [fx,dfdx,dfdP] = f_Qlearning(x,P,u,in) % Reinforcement-learning evolution function for a n-armed bandit task % % An RL agent learns by trial and error. A bandit task is such that, after % eac...
13ffac016f50f46f5f5fced656c03ef3eb3e7b3466683c55652eded88437a842
MATLAB
2,395
84
function newdata = ... wlSynth_traceAddNoise(olddata, samprate, colortype, ... noisef1, noisef2, noisepower, powerf1, powerf2) % function newdata = ... % wlSynth_traceAddNoise(olddata, samprate, colortype, ... % noisef1, noisef2, noisepower, powerf1, powerf2) % % This function adds noise to a signal. % % "...
e0de8cd47dd9dee882d628587388fd88afe2a330bf6fa59f55cc7337076f760e
MATLAB
2,395
73
function blockstimulus = returnFixMovie(screensize, imEnsemble, listfixations) % returnFixMovie - Generates a movie of fixations using an image ensemble % % Syntax: blockstimulus = returnFixMovie(screensize, imageEnsemble, listfixations) % % Inputs: % screensize - [Ny, Nx] size of the monitor, always [600, 800] for...
390fec0854674d1e2be7458fe8d8232f1899fe800fa5edcfbf2afb70402073dc
MATLAB
2,396
66
% Fig 1L, scatter plot with error bar of the data % Edited by Jerry. 10/27/2023 function [datamean,datastd] = ScatterPlotWheel_231027... (data,Title,Yaxe,figsize,alpha,SaveDir,ErrType,Yrange) % fig setup hFig = SetupFigure_220724(figsize); colors = [10,139,148;130,10,40;134,179,82;242,110,48;... ...
61699e767abd2516c3c54143d175bf327b2037ae5a8d868fbfad75b448e00620
MATLAB
2,396
47
function [oldimg, climit] = h_getOldImg3(handles) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); try imageModes = get(handles.imageMode,'String'); currentImageMode = imageModes{get(handles.imageMode,'Value')}; switch currentImageMode case {'Green','G S...
ec3acff57621466edfbf1ae81aa5f925ceed9f00715760f3269409bc4b2a01a2
MATLAB
2,396
61
function [ss,p,pwmd] = dabest3(data,identifiers,p,pwmd,varargin) %-------------------------------------------------------------------------- % Data inputs have two valid options: % Option 1: % data: nx1 vector of values (double, int, etc) % identifiers: nx1 cell array of labels % Option 2: % data: ...
1757e86bf34f31da74cb89a618825012399b3d39b3253b05c33196d3e4536718
MATLAB
2,397
95
% copied from NLA toolbox 2022.03.22 because I wanted to make some % modifications function f =View_ROI_Modules(IM,Anat,ROIxyz,Params) % % This function generates a plot of ROI Sortings for % various kden, scanning through the kden chosen. if isfield(IM,'ROI') ROI = IM.ROI; end %% Set up paramters Modules=IM.key(:...
0dc5ddbd414e1d5bf942d55032c7ea4feb95868fe3cc7fac62519b28abe6ad03
MATLAB
2,398
77
%% NVR_EventsAro % This script adds the arousal events to the NeVRo EEG data. % Requires behavioral arousal rating data in seperate folder (ratings/...). % % 2017 (edited 2018) by Felix Klotzsche % 2024 update by Antonin Fourcade function NVR_03_eventsARO(cropstyle, mov_cond, path_data) %% 1.Set Variables %clc %cle...
69e74615b1b071990cb1f4eb19d1eda01a0fbd80cd87f04a98a87bc319dd737b
MATLAB
2,398
67
% makeBarcodeMultiPlots function makeBarcodeMultiPlots(registrationDir,transcriptsDir,numRounds,channelsList,barcode,saveDir) loadParameters; base0 = load(fullfile(transcriptsDir,sprintf('%s_transcriptsv9.mat',params.FILE_BASENAME))); base1 = load(fullfile(transcriptsDir,sprintf('%s_transcripts_probfilte...
7fce110f03a73bbad0206fbe8b888965264975f6dc1ba321f1398c92aee1b9e4
MATLAB
2,398
63
function e_global = error_cam_proj(param); global n_ima x_1 X_1 xproj_1 x_proj_1 x_2 X_2 xproj_2 x_proj_2 x_3 X_3 xproj_3 x_proj_3 x_4 X_4 xproj_4 x_proj_4 x_5 X_5 xproj_5 x_proj_5 x_6 X_6 xproj_6 x_proj_6 x_7 X_7 xproj_7 x_proj_7 x_8 X_8 xproj_8 x_proj_8 x_9 X_9 xproj_9 x_proj_9 x_10 X_10 xproj_10 x_proj_10 x_11 X_11...
a4b04112f458c37edc96f79b645f0442cf3d54a9d43d7489d444c5a8482c043d
MATLAB
2,399
61
function e_global = error_cam_proj(param); global n_ima x_1 X_1 xproj_1 x_proj_1 x_2 X_2 xproj_2 x_proj_2 x_3 X_3 xproj_3 x_proj_3 x_4 X_4 xproj_4 x_proj_4 x_5 X_5 xproj_5 x_proj_5 x_6 X_6 xproj_6 x_proj_6 x_7 X_7 xproj_7 x_proj_7 x_8 X_8 xproj_8 x_proj_8 x_9 X_9 xproj_9 x_proj_9 x_10 X_10 xproj_10 x_proj_10 x_11 X_11...
91f463fd34698dbb9e56185c5d643d372aeb20921899404bf30da24c9c8e6285
MATLAB
2,400
63
Cfg.WorkingDir Cfg.SubjectID Cfg.ParallelWorkersNumber=1; Cfg.Isqsiprep=1; Cfg.OutputResolution=2; Cfg.IsLowMem=1; Cfg.IsCalTensorMetrics=1; Cfg.IsTBSS=1; Cfg.Isqsirecon=1; Cfg.FreesurferInput %Choose the freesurfer folder. Default: [Cfg.WorkingDir,filesep,'freesurfer'] Cfg.ReconSpec='mrtrix_singleshell_ss3t_A...
ea129202f0008f0b2c5ea3560a0e3f13490ffe33d3d96eb04cc6d8c148e8d174
MATLAB
2,400
81
function foci=AdjustFoci(foci,meshL,meshR,side,ctx) % % This function adjusts Foci locations to match the surface of the mesh % in case it is inflated or rotated or otherwise adjusted. % % New algorithm 8/16/17, to be fixed.... % 1. deal with std vs inf or vinf first % 2. determine home hemisphere for ROIs % 3....
6ddd2a4aab035152de4647b307ffb27bd40a655921a07a835404e2a6c58719ca
MATLAB
2,401
84
function p = genpathPMTK(d, isMatlab) % Like built-in genpath, but omits directories unwanted directories: % e.g. .svn, cvs, private, deprecated, +package % For best performance, optionally specify whether this is Matlab, (as % opposed to Octave). %% % This file is from pmtk3.googlecode.com if nargin==0, p = gen...
e45effe76a1227568a55ab73bd81e55d5f82b24834bba3747c0de431ac9f41f1
MATLAB
2,401
84
function draw_figure2DE(p,decRes) % % This code is for drawing figure 2DE % In the paper, we used Pycortex (Gat et al., 2015) for drawing map. % Here, similar visualization is mimicked without pycortex % %% settings % prepare surface map load([p.rootPath,'code/util/hcp360colMap.mat'],'hcp360colMap'); % ROI info. hcpI...
e5872a55685e82b56c7a4a26ee067eaaa90bfd844ae430224e86fa461c84f2ff
MATLAB
2,401
82
function z = ne(x,y) %NE Not equal (~=) for sptensors. % % A ~= B compares the elements of A and B for equality. The arguments can % be a pair of sptensors, an sptensor and a tensor, or an sptensor and a % scalar. Regardless, the result is always returned as a sparse tensor. % % See also SPTENSOR. % %MATLAB Te...
ff0ee8c316718c6343b0fb68c60e69259a3faaf712ebc9f76c138c894c6a15ae
MATLAB
2,401
77
function [model, loglikHist] = mixStudentFit(data, nmix, varargin) %% Fit a mixture of multivariate Student Ts via MLE/MAP (using EM) % % data - data(i, :) is the ith case, i.e. data is of size n-by-d % nmix - the number of mixture components to use % This file is from pmtk3.googlecode.com [mixPrior, initP...
259fd87bf62a52f3c1d634b06a2fca298a8e1c60863795c3883b5bad3c4b0035
MATLAB
2,405
74
function out = imoverlay_single(in, mask, color) %IMOVERLAY Create a mask-based image overlay. % OUT = IMOVERLAY(IN, MASK, COLOR) takes an input image, IN, and a binary % image, MASK, and produces an output image whose pixels in the MASK % locations have the specified COLOR. % % IN should be a grayscale or an R...
601fa1c68f25d22ced2e87a361a48fadcb425f16ee71dfe095ed6a96db0c2c90
MATLAB
2,405
87
%% Power vs sample size for excluding a null value from binary trials function powerCurvesDemo() Ns=1:5:100; nullValue = []; maxWidth = 0.2; priorMeans = [0.6 0.7 0.8]; priorNs = [5 10 100]; [styles, colors, symbols, str] = plotColors(); for i=1:numel(priorMeans) figure; hold on for j=1:numel(priorNs) priorM...
1c2d63d5df345b2fe9685ef2d615122912087e6ae7203f720fe4dbe0606ae8da
MATLAB
2,407
73
function memused = memtoc(counter) % MEMTOC return the memory that was used % % MEMTIC and MEMTOC functions work together to measure memory usage. % MEMTIC, by itself, saves the current memory footprint that MEMTOC % uses later to measure the memory that was used between the two. % % Use as % MEMTIC % MEMTOC...
e9bbbb908c8038f0cd87cdf2fbdb2c39a9468bf2da6ca3a477e34913afa1d09a
MATLAB
2,407
70
function [errcode, times, wave, mag, freq, phase] = ... wlSynth_makeOneBurst_Gabor(samprate, f1, a1, pmid, periods) % function [errcode, times, wave, mag, freq, phase] = ... % wlSynth_makeOneBurst_Gabor(samprate, f1, a1, pmid, periods) % % This function generates approximations of Gabor wavelets using % wlSynth_ma...
035a2531058cadc6c94436575c3b058673ad3ed92134d9752360bb973114ae89
MATLAB
2,408
80
function M=movsp2wv(N,Np); %MOVSP2WV Movie illustrating the passage from the spectrogram to the WVD. % M=MOVSP2WV(N,Np) generates the movie frames illustrating the passage % from the spectrogram to the WVD using different smoothing gaussian % windows in the smoothed pseudo-WVD. % % N : number of points for the signal;...
fcc8743e4e60062145508696b7e4bb7afca1b038d3c2900356a1a5fba7224674
MATLAB
2,408
68
% Pyr in SCEs [data] = extract_variables ('SCE','cellsInSCE',resultsPath, 'pyr'); [n_cells] = extract_variables ('nCells',[],resultsPath, 'pyr'); for recCounter = 1:size(data,2) data_mdn(recCounter) = length(data{recCounter})/length(n_cells{recCounter}); end data1 = data_mdn(contains(layer,'deep')); data2 = data_m...
246db77b459b7727350b80a27aeca8f803d446ec87b5fc4e9fb4b276508e1430
MATLAB
2,409
67
function x=altes(N,fmin,fmax,alpha) ; %ALTES Altes signal in time domain. % X=ALTES(N,FMIN,FMAX,ALPHA) generates the Altes signal in % the time domain. % % N : number of points in time % FMIN : lower frequency bound (value of the hyperbolic % instantaneous frequency law at the sample N), % in n...
5e562bef4fc5a596cba00668ae1b85d92184043961a7ef2e62828eea204c69ca
MATLAB
2,409
69
function meanShiftImExplore( I, X, sigSpt, sigRng, show ) % Visualization to help choose sigmas for meanShiftIm. % % Displays the original image I, and prompts user to select a point on the % image. For given point, calculates the distance (both spatial and range) % to every other point in the image. It shows the re...
93e2c701c7161437c07576334c323ed6a1d16bddf726418d1e6cc7516cf5de51
MATLAB
2,409
48
clear all %% %Define Parameters [opt] = ParameterOptions(); %% %Define Parameters for Oscillating gradients opt.nOscillations=3; % Number of oscillations per TR opt.Waveform='Sine'; % Type of Oscillating Gradient. Choose from Rect (conventional rectangular gradient), Rect_Sym (symmetric rectangular gradie...
a7a0dffd3037515bd864ce7da16e2dc7ee0cc2396d8afdf09622745141b2736d
MATLAB
2,409
62
% SOFA API demo script % load HRTF in BT-DEI format and save in SOFA format. % 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") % Yo...
34cfd2c0ce87ec1de03ccbb94f4e4678fb4aa069bd2f3d9ffc71342af4f14351
MATLAB
2,410
67
function [ ] = computeCorrelations( ws ) %the function takes as input a ws object and computes the correlations %between the red and blue references, and the seed. %create three empty correlation vectors [ ws.TCA.correlations.seed_red, ... ws.TCA.correlations.seed_blue, ... ws.TCA.correlations.red_blue] = ...
4c050bab5e2f750af1b9288f3ad96c86d6759c9b09303c62847436fdbdc859ca
MATLAB
2,410
88
function [tf,all_diffs,all_perms] = issymmetric(X,grps) %ISSYMMETRIC Verify that a tensor X is symmetric in specified modes. % % TF = ISSYMMETRIC(X) returns true if X is exactly symmetric for every % permutation. % % [TF,DIFFS,PERMS] = ISSYMMETRIC(X) also returns that maximum difference % in DIFFS for each perm...
9429a6141e2d09dcc1e35e4477d6551365b36a2004e78f0fba0fbb05bdec30ed
MATLAB
2,412
72
% SNORM Spectral norm estimation using randomized power method. % % S = SNORM(N,MV,MVA) produces a spectral norm estimate S of a matrix with % column dimension N and functions MV and MVA to apply the matrix and its % adjoint, respectively, to a vector using the randomized power method. If A % is the matrix...
5163cb545a269670831129b0607d56029a166fe6ddd042e73bfa983933d53fde
MATLAB
2,413
84
function [k,p] = laplace_pca(data, e, d, n) % Estimate latent dimensionality by Laplace approximation. % % k = LAPLACE_PCA([],e,d,n) returns an estimate of the latent dimensionality % of a dataset with eigenvalues e, original dimensionality d, and size n. % LAPLACE_PCA(data) computes (e,d,n) from the matrix data % (da...
b951123e38ff2240ca82c4a73afb4b478bba1a685b0f6b9d2d9a7f1a3f2361ad
MATLAB
2,413
98
%% booststrap shuffled novel aligned activity to generate baseline activity %Chad Heer %INPUTS %novel_data = novel aligned data %ids = ids of each roi %n_reps = number of times to repeat bootstrap %x_units = time from novel exposure for each frame %OUTPUTS %out = binary for if individual roi was above baseline or no...
d41505b5fa25535fef7ba23faacc60aa4bacc32573f900e613e48d551a2b0988
MATLAB
2,413
82
function mergeDat = MergeTest(spkDat, refClust, varargin) spkDat.waves = double(spkDat.waves); [wL, nChan, ~] = size(spkDat.waves); pk = spkDat.peakLoc; wP = spkDat.wavePad; wL = wL - 2*wP; clustList = setdiff(unique(spkDat.id), 0); refIdx = find(clustList == refClust); nClust = length(clustList); win = 1000 * [1 - pk...
0a7b1a2a941694de038305657b420c8bad88264ddbdf62d925d9bfe422c32302
MATLAB
2,414
73
function varargout = convert_triangle_geometry_format( varargin ) % Modified by William Warriner 22 Aug 2019 % from CONVERT_meshformat by Adam H. Aitkenhead. % Inputs: % - @mesh, a real, finite, 3D double array with dimensions (:,3,3) % representing face-vertex data with only triangular faces. The first % dimension re...
f45b44dd3691448e058323d3bbda1941b3b7ba504626c14602f969ba227e66b7
MATLAB
2,414
82
function everythingFileFromOldStyleProjectAndClassifierFiles(... everythingFileName, ... projectFileName, ... classifierFileName, ... gtExpDirNames, ... scoreFeatureMatFileNames, ... scoreFeatureJabFileNames) % process args if ~exist('scoreFeatureMatFileNames','var') || ~exist('scoreFeatureJa...
e548b85ee64f2add5a4439250e8dcbd2a6f724632e48e691fe07ae6101d95afd
MATLAB
2,415
84
loadParameters; load(fullfile(params.rajlabDirectory,'transcriptsv9_punctameannormed.mat')); load(fullfile(params.rajlabDirectory,'groundtruth_codes.mat')); load(fullfile(params.rajlabDirectory,'transcripts_probfiltered.mat')); %% Load ground truth codes %Turn the Nx3 array into a set of strings gtlabels = {}; for i ...
0ee4e4e5c8913a90d8eb81204f6671f53dffb7f3d68352ac8f102d18203e1917
MATLAB
2,416
91
function [ a,b,c ] = min_encl_ellipsoid( X,Y ) %Finds the minimum enclosing ellipsoid of points along a rat's trajectory %in the Morris Water Maze % X=all x-ccordinates of the trajectory % Y=all y-coordinates of the trajectory % Coordinates must be in columns, not rows % a=major radius of the ellipse % b=mino...
456eff20dd74605f89bd6e983a8e29ba53c325a6ae2393c18cab4a6711556f94
MATLAB
2,416
70
function mesh = ExtractSurfaceRelations(fnprefix, no_regions) % Reads disjoint surface meshes from each file (total of 'no_region' files) % and establishes their relational hierarchy. % The output is a structure compatible with nirfast format. The relation % ship information is stored in .region field, which provides t...
8c1d6789653722520b7fd6b89535d20a7b9d273ff6a8992d5bbe30d7166e1e37
MATLAB
2,416
64
function I=imgaussian(I,sigma,siz) % IMGAUSSIAN filters an 1D, 2D color/greyscale or 3D image with an % Gaussian filter. This function uses for filtering IMFILTER or if % compiled the fast mex code imgaussian.c . Instead of using a % multidimensional gaussian kernel, it uses the fact that a Gaussian % filter ...
d2ecacaab2e0840e57cc1652e7e0f4921e0676a055664c63c611cc3506cb7638
MATLAB
2,416
77
%% Bayesian model selection demo for polynomial regression % This illustartes that if we have more data, Bayes picks a more complex model. % We use empirical Bayes (EB) and variational Bayes (VB) % to tune the hyper-parameter and approximate the marginal likelihood % This file is from pmtk3.googlecode.com % Based on...
111cfc3fada5d32a720ab895186039ec17f5e29a34cd64fff0b6d0b3143bb74d
MATLAB
2,417
59
function num_events = calculate_number_replay_events cd('X:\BendorLab\Drobo\Neural and Behavioural Data\Rate remapping\Data') load('folders_to_process_remapping.mat') for f = 1 : length(folders) cd(folders{f}) load('sorted_replay_wcorr.mat') num_events.T1(f) = length(sorted_replay(1).index.trac...
8acca59dc488334d958021fe0708a3adabcc376a22ebc089763076bbbb8e6968
MATLAB
2,417
83
function [dat, state] = ft_preproc_standardize(dat, begsample, endsample, state) % FT_PREPROC_STANDARDIZE performs a z-transformation or standardization % of the data. The standardized data will have a zero-mean and a unit % standard deviation. % % Use as % [dat] = ft_preproc_standardize(dat, begsample, endsample) %...
e9106def8f4af5df632681c7363b28a2be3e667e6d4207d9cc410286e88e899a
MATLAB
2,417
59
% SOFA API - demo script % Copyright (C) 2012-2014 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 ...
1fac44f5f247f1940d4b035dc2e35635d069ac23ebbf9ee691566822214618e4
MATLAB
2,418
80
function [hdr] = ft_fetch_header(data) % FT_FETCH_HEADER mimics the behaviour of FT_READ_HEADER, but for a FieldTrip % raw data structure instead of a file on disk. % % Use as % hdr = ft_fetch_header(data) % % See also FT_READ_HEADER, FT_FETCH_DATA, FT_FETCH_EVENT % Copyright (C) 2008, Esther Meeuwissen % % This fi...
165e907164b3ef36fc85e660f626c6bd5dbc4b0614f0eda41704dc78a91fa0eb
MATLAB
2,419
91
function [yhat, p, pCI] = logregPredictBayes(model, X, method) % Approximate p(i) = p(y=1|X(i,i), model) and yhat(i) = ind{p(i) > 0.5} % Method should be one of % - 'plugin': uses p(y=1 | X(i,:), E[w]) % - 'moderated': uses the Mackay trick to approximate int_w Gauss(w)*sigmoid(y|w) % - 'vb': uses variational bayes to ...
5d0edf369cd882217b457dfc20553c9feb60c0cb952299ea53025f71855e1f82
MATLAB
2,419
89
function table = struct2table(s) % STRUCT2TABLE converts a struct-array to a cell-array of strings that represents a table % % Example % s(1).a = 1 % s(1).b = 2 % s(2).a = 3 % s(2).b = 4 % disp(struct2table(s)) % % See also PRINTSTRUCT, APPENDSTRUCT % Copyright (C) 2017, Robert Oostenveld % % This file is p...
0abb5da5f3fa0081e64886933753328e37b3b386902f8f0f567463bcce267aac
MATLAB
2,420
82
function imputationMixedAdultDemo() %% Comparison of methods for imputing missing values in UCI adult census data % PMTKslow % PMTKauthor Kevin Murphy % PMTKneedsStatsToolbox boxplot %% % This file is from pmtk3.googlecode.com requireStatsToolbox setSeed(0); adult = loadData('adultCensus'); X = adult.X; types = adu...