sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c0ca08268cbaf6c96722985e423bf5d3ae289eff5364fae02cdd3545e0a127c5
MATLAB
2,631
74
% This is an example script that segments audio data and % can be used to transcribe verbal responses. % There are two options here: % (1) a continuous recording that first has to be segmented % into potential words (with some post-hoc control) % (2) a structure, in which every recording corresponds to a...
694a2270bf3e686d990e1e0472bb0de64ad24e0841271fe4b8e98d2e0757d908
MATLAB
2,632
77
function mesh = prepare_mesh_tetrahedral(cfg, mri) % PREPARE_MESH_TETRAHEDRAL % % See also PREPARE_MESH_MANUAL, PREPARE_MESH_HEADSHAPE, % PREPARE_MESH_HEXAHEDRAL, PREPARE_MESH_SEGMENTATION % Copyrights (C) 2016, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the docume...
7ebc0f02d1173c8d60b82eb17d10dd9e0477f0506b832507eb0e98e7bea05d49
MATLAB
2,633
91
%% Compare the class separations induced by PCA and Fisher LDA respectively. % %% % This file is from pmtk3.googlecode.com function fisherLDAdemo() % %% Generate data setSeed(0); mu = [1 3; 3 1]; Sigma = repmat([4 0.01; 0.01 0.1], [1, 1, 3]); mixweight = [0.5 0.5]; nsamples = 200; [X, Y] = mixGaussSample(mu, Sigma, ...
95458b2597214d7714b597e8f9a7307fe109db3ed1d2ac678526f5a8cc3ad912
MATLAB
2,633
68
%% 非线性(动力学)特征:基于时频的熵 | nonlinear features: time-frequency-based entropy %% 希尔伯特-黄谱熵 | Hilbert-Huang Spectral Entropy (HHSE) (P227) % 1. 对于非平稳时域信号x(t),经EMD将其分解为一系列IMFs(1,...,N) % 2. 对IMFs分量进行Hilbert变换,得到IMF的解析表示 % 3. 基于IMFs的解析表示,计算归一化后的Hilbert-Huang spectral % 4. 将香农熵算法应用到Hilbert-Huang spectral中,即得到Hilbert-Huang spectra...
a53db048013f9a4cc393e5c5f970928e073e3a5e3081b6dc198c8dcb4432c9f9
MATLAB
2,635
82
% Main script for the state switching EEG experiment (Ocober 2017) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% enter subject ID & task variant %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% prompt = {'Enter subject ID:','Enter paradigm (dynamic/words/visual):'}; dlg_title = 'StateSwitch Input'; num_lines = 1; defaultans = {...
adddb4cf9f8040b19e179f3d1aa94d9a30a163ff436aa4011662cb9b10bf4aef
MATLAB
2,635
108
%%% This script alets the user enter the name of the images (base name, numbering scheme,... % Checks that there are some images in the directory: l_ras = dir('*ras'); s_ras = size(l_ras,1); l_bmp = dir('*bmp'); s_bmp = size(l_bmp,1); l_tif = dir('*tif'); s_tif = size(l_tif,1); l_pgm = dir('*pgm'); s_pgm = siz...
9ee7f7f4498aea846d015e1906e2a45271bb2e32b22482b1dbfd53bbb3867f25
MATLAB
2,636
94
function cMap = makeColorMap(varargin) % MAKECOLORMAP makes smoothly varying colormaps % a = makeColorMap(beginColor, middleColor, endColor, numSteps); % a = makeColorMap(beginColor, endColor, numSteps); % a = makeColorMap(beginColor, middleColor, endColor); % a = makeColorMap(beginColor, endColor); % % all colo...
52e4a52ca1e1b400503c3a842ac6c926a8175ef2f7862b306ffc94c13edf4f75
MATLAB
2,637
88
% Author: Birgit Nierula % nierula@cbs.mpg.de function other_prepro_findpeak(subject, condition, srmr_nr) %% finds CNAP/SNAP peaks %% set variables subject_id = sprintf('sub-%03i', subject); analysis_path = [getenv('OTHERDIR') subject_id '/other/prepro/']; if ~exist(analysis_path,'dir'); mkdir(analysis_path); end r...
8d90a07825c64acbaf282b5ea4e31236741f517801fd8b4da78d718ef7930479
MATLAB
2,637
98
function [P,err,Pfront,Pside,ptfront_re,ptside_re] = dlt_2D_to_3D_point(dlt_front,dlt_side,ptfront,ptside,varargin) [geometricerror,Sfront,Sside] = myparse(varargin,'geometricerror',true,... 'Sfront',[],'Sside',[]); if size(ptfront,1)==1 && ndims(ptfront)==2, ptfront = ptfront'; end if size(ptside,1)==1 && ndims(...
c2d408903a56573e1ecc4f46f40063648bce2e31cd51fff3c0b6d126197f0cfb
MATLAB
2,637
91
% inputs: % x is the N x 1 matrix of N unidimensional data points % l is the N x 1 matrix of N corresponding labels, where l(i) can % be either -1 or 1 % thresh is the best threshold such that almost everything on one % side of the threshold is of one class and almost of everything on % the other side is the other clas...
97a53b1472e6235b43b253fefb834b6bfa979888b26cb75124f54aafb9d4dbc1
MATLAB
2,638
90
function [data, stamps, f] = fmf_read( filename, f_start, nframes, incr, show_progress ) % [data, stamps, f] = fmf_read( filename, f_start, nframes, incr, show_progress ) % % reads FlyMovieFormat data from FILENAME % % starts with frame F_START (1-based) [defaults to 1], reads NFRAMES [defaults to inf] % % DATA is HxWx...
af259385d239cf863cab9994b6ccda49d9c0fa76e610d137c2eb8175d67c2faf
MATLAB
2,638
64
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef TagType < uint16 %TAGTYPE Enumeration of the types of tags that are known. enumeration %Deleted: Tag revision where this TagGUID has been deleted %remarks: This is a sp...
c057a5f76bf1c7953bb7cc6304a6b88fba0223fac875cfefd6eb830e3f9568db
MATLAB
2,638
80
%_______________________________________________________________________ % % screenInfo = openExperiment(monWidth, viewDist, curScreen) %_______________________________________________________________________ % % openExperiment initialize screen settings for new experiment %_____________________________________________...
34c37489a956081ea2ba9074f88bf4c635b57b2f8b0019a987b1e17355c48a39
MATLAB
2,640
70
function trial_summary = trialSummary(paths, excel, excel_path) % This function generates a summary of the number of correct trials, % incorrect trials and total trials per participant. % How to use: % call the function with the following command in the command window or as % presented in the main_template: trialSumm...
cbe55ff634bcd1d6a402b03b1189a611e4f83f0bb39c57106bb28d92abb19f3b
MATLAB
2,640
93
function ms_view_clusters_0(features,labels) %MS_VIEW_CLUSTERS - 2D or 3D view of clusters in feature space, colored by %labels % % Syntax: ms_view_clusters(features,labels) % % Inputs: % features - RxL array of features (R>=2), e.g., optained by % mscmd_features or ms_event_features % labels - 1xL...
128ae44cf7ed7e4ec76938744102238c17376cf01b7984da08b1b7fec858a116
MATLAB
2,641
78
function mni2sub_GM_WM(out_path) %MNI to subject's space coregistraion using FSL FLIRT. it requires WSL to work in Windows Systems % %out_path: folder which contains the Pseudo_STATIC PET image. It will be used to store the coregistered images and the transformation matrix % %template_path: folder which contains the MN...
1ce3fa533937c58788bc0d985491e8a4fdcebc15819b48519a0b6443fa0e7795
MATLAB
2,641
68
function CBIG_RF_make_xyzIndex_vol(template, output_dir, output_prefix) % CBIG_RF_make_xyzIndex_vol(mask, output_dir, output_prefix) % % This function creates index volumes from a template (e.g. MNI152) % The index files contains matrix of x/y/z RAS coordinates of each voxel % in the template's space, i.e. with the s...
0fa72e0532e384351557dc099b426c04e565f5d9b3e1c143a0806dd41c8c47dc
MATLAB
2,642
56
function Obj=SOFAconvertTUBerlin2SOFA(irs) % OBJ=SOFAconvertTUBerlin2SOFA(irs) converts the HRTFs described in irs % (see TU-Berlin HRTF format) to a SOFA object. % % SOFA API - demo script % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or –...
171843f08b15d63924c34abf35f31e351f5afedf192c264f0f33e13ccd274c5c
MATLAB
2,642
113
% 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,...
3f7b7ff4b83ce18350804bff920db24e6e7287e348295f4689713405b948958c
MATLAB
2,642
71
function [a,res_out,k,field_theo]=dipole_fit_highlevel(sc,f,ndip,par); % forwpar=sc.fp; % fits an n-dipole model to a given surface potential or magnetic % field at one time-point using the Levenberg-Marquadt method. % % usage: [a,res_out,k,field_theo]=dipole_fit_highlevel(sc,f,ndip,par); % % input: % f: nx1 vecto...
4a43eae605f1121b71872dc7fa29811c6e1874f889737ed77fecb263bf0fccdb
MATLAB
2,643
62
function [row, col] = getTilePositionFromTerastitcherXML(tileNum, xmlStruct) %getTilePositionFromTerastitcherXML: Process terastitcher input xml %file, which includes the row and column orders from. The input, %xmlStruct was loaded by parseXML.m, which was originally taken from %the MATLAB documentation...
a9d0190a46ea0a7df371c2f892321504cb3f9befde0661023e2adc490e301caa
MATLAB
2,643
118
%load data: contact lead author %% figure for n=1:length(allCellTypes2) subplot(1,3,n) a=allCellTypes2{n}; c={}; c{1}='both';%common c{2}='ao';%unique c{3}='vs';%unique c{4}='none';%unique if n==1; color=[1 0 1]; elseif n==2; color=[0 1 0]; else color=[0.5 0.5 0.5]; end color...
a63cf1cb9a454137337a3f8dd3b5d78a071ed166cf1eb42f126e93e9de1f1eb9
MATLAB
2,644
58
%% ·ÇÏßÐÔ£¨¶¯Á¦Ñ§£©ÌØÕ÷£º»ùÓÚʱƵµÄìØ | nonlinear features: time-frequency-based entropy %% С²¨ìØ | Wavelet Entropy (WE) (P226) % 1.¼ÆËãÿһ¶ÎÐźų߶ȵÄС²¨ÄÜÁ¿ % 2.½«¸÷С²¨ÄÜÁ¿³ýÒÔ×ÜÄÜÁ¿£¬ÒÔ»ñµÃ¸÷³ß¶ÈjµÄÏà¶ÔС²¨ÄÜÁ¿ % 3.WE¼´²»Í¬³ß¶È¼ä·Ö²¼µÄìØ % µ±ÄÔµçÐźűíÏÖ³ö¸üÇ¿µÄ¹æÂÉÐÔʱ£¬¼´Éñ¾­Ôª»î¶¯³öÏÖͬ²½µÄÏÖÏó£¬Ð¡²¨ìØÖµ½«½µµ...
b4847c84713cf94e819634961abe8541e0cc03cc5cd2c0c81e93362a06080aa9
MATLAB
2,644
72
% evalargs.m % % usage: evalargs(varargin) % by: justin gardner % date: 12/13/05 % purpose: passed in varargin, returns a string % that once evaluated sets the variables % called for. Thus, allows arguments like: % % fun('var1','var2=3','var3',[3 4 5]); % ...
e05921fbbecb3a63e259ad631bbd1646e35006bec185e32b04b013d5d9be10c2
MATLAB
2,644
76
% Finding Patches from IRES Solution % Abbas Sohrabpour % 20/2/2018 % Zhengxiang Cai % 30/10/2018 % This version has been vastly improved by removing extra for loops by % using cell arrays and using the unique command and more importantly by % defining a global pointer that avoids checking all global indices by ...
cc91e6e973e336bc8f9a35f48f9dea09024832d5a3ed7b8c5e0e5759b02a6900
MATLAB
2,646
100
% this script averages the fluorescence traces for npulses light pulses. % takes in the BG corrected fluoro trace (from get_fluoro_changes), % and the pulse image starts and ends (from get_v_trace_ORCHID), % and averages the light responses for each optogenetic activation/ % NB - if the trace has a . extension (ie 004...
50dfb1214c021bb9432b97938320f51398e6e8c419b27c4a2cca0ae3c2f28526
MATLAB
2,647
85
%% GSA_Init_MultiOut_MultiSI: initialize the variables used in the GSA computation % % Usage: % pro = GSA_Init_MultiOut_MultiSI(pro) % % Inputs: % pro project structure % % Output: % pro updated project structure % % -----------------------------------------------------------------...
826aacf7b2d9815398fd73bdd2770355bbb719e55495c0c5ff022378c740e387
MATLAB
2,648
70
function imData=read_file(path_to_file,sframe,num2read,options) % Reads uncompressed multipage .tiff, .hdf5, .avi or .raw files % Usage: my_data=read_file('path_to_data_file, start frame, num to read); % INPUTS: % path_to_file: location of file to be read % sframe: first frame to read (optional, defau...
a19629be15a79815e4e8e614a8bf1e8b6dedfaa4826794e7b01883e57c807c24
MATLAB
2,648
73
function [Kernel, features, D] = build_kernels_main(datadir, hmmdir, kerneldir, HMM_name, only_1st, Fn, Kn) % [Kernel, features, D] = build_kernels_main(datadir, hmmdir, kerneldir, HMM_name, only_1st, Fn, Kn) % % build kernels from HMMs (wrapper for hmm_kernel.m) % % Input: % datadir: directory for HCP rsFMRI timec...
f4412f819860348f436b9ead1562ef16f8a716e170a399c8b4fd086e2e6f08c7
MATLAB
2,648
83
function SleepCheck(sessionDir) ecogStr = 'eco'; targetEcog = 'ECoG1'; lfpFs = 500; bytesPerSample = 2; scrsz = get(0,'ScreenSize'); scrWidth = scrsz(3); scrHeight = scrsz(4); vScale = 0.000195; % identify task-based data folders fileDat = dir([sessionDir filesep 'IM*']); idx = arrayfun(@(f) f.isdir, fileDat); folde...
2cb3c3c26e76ff8adc211d7c642028b8e30e231dac3793b30f2f78256ec4e88d
MATLAB
2,649
87
function [vw_nuisance, vw_nuisance_comps] = canlab_extract_ventricle_wm_timeseries(mask_image_dir, imgs, varargin) % function [nuisance, nuisance_comps] = canlab_extract_ventricle_wm_timeseries(mask_image_dir) % % This function extracts data from ventricles and white matter for each % time series. You can include vw_n...
42979e89ed421d899a6f371802909d7be78a806be748beee9cc36ac5edfcd46e
MATLAB
2,649
74
function egrad = getPartialEuclideanGradient(problem, x, I, storedb, key) % Computes the Euclidean gradient of a subset of terms in cost function. % % function egrad = getPartialEuclideanGradient(problem, x, I) % function egrad = getPartialEuclideanGradient(problem, x, I, storedb) % function egrad = getPartialEucl...
49f9581296ccaf2b88dea55a8d35ccdb0763613b82bd74560e5ef91d01064ef4
MATLAB
2,650
106
function M=make_transformation_matrix(t,r,s,h) % This function make_transformation_matrix.m creates an affine % 2D or 3D transformation matrix from translation, rotation, resize and shear parameters % % M=make_transformation_matrix.m(t,r,s,h) % % inputs (2D), % t: vector [translateX translateY] % r: vector...
03f85aad1f0ac83ddeb4ec270af3534fb997e5c8cecb5aeed176e795d3f9b508
MATLAB
2,651
83
function PlotFigure2(vars, varNames) % Plot figure 2 %% load up if not given if nargin==0 load('Figure 2 - Source Data 1.mat', 'vars') % vars is struct with fields of [nPP, nConds, nDrug, nTr] varNames = {'depAngle'}; % just this end %% first plot fig2b - calling PlotFigure1 on mean...
3a0e50aea3e6feeb9708b81762785747f67c0a1f6e9ea94ee0900d3d8c2bcf14
MATLAB
2,652
100
function wlPlot_plotEventsWithAux(cfg, evlist, evstride, ... topcurves, midcurves, botcurves, figtitle, filelabel) % function wlPlot_plotEventsWithAux(cfg, evlist, evstride, ... % topcurves, midcurves, botcurves, figtitle, filelabel) % % This function plots a series of events, making three-pane plots with % select...
8d83548a9bb0d3428141cf7ffd79dd85304a2de127bdcfee38cdabe3eccfdae8
MATLAB
2,652
56
function h_addToCurrentGroup3(handles, filename) global h_img3; if ~iscell(filename) % this way so that it can handle many filenames at a time. filename = {filename}; end [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); if isfield(h_img3.(currentStructName),'activeG...
527a8065882b2d74e152500fc18344e378ed53fd4711250f349dad2a17331cf9
MATLAB
2,654
84
function [jtree, logZ] = jtreeCalibrate(jtree) %% Calibrate a junction tree % jtree is a struct as returned by e.g. jtreeCreate % % logZ - log of the partition sum %% % This file is from pmtk3.googlecode.com cliques = jtree.cliques; preOrder = jtree.preOrder; postOrder = jtree.postOrder; preO...
70acadcfcbd810e55d1e6a0bf5a72f16a8d6aae88ad4443190f1e60e5af1bd01
MATLAB
2,654
116
function LAN = dividir_eeg2lan_old(EEG, pr, sg, op, filename1, filename2) % function dividir % EEG = datos en estructura eeglab (EEG.data) % pero con campo EEG.time segun formato LAN % pr = epocas de la primera divici??n % sg = epocas de la segunda divici??n % op == 1 separa la primera divici??n % == 2 separ...
7864747cbdadd7afa266074e4139f354d43560813d5d8a9793ccbcfa8458fcb2
MATLAB
2,654
93
%CONVNSEP Separable N-dimensional convolution. % C = CONVNSEP(h,V) performs an N-dimensional convolution or matrix V % with N kernels defined in the cell array h. % C = CONVNSEP(h,V,'shape') controls the size of the output. (See help % for Matlab's CONVN function). % Example: create a random 4-D array, conv...
6401bdc095601aa8a439cb01d69c3d90691d520e2d21ca80aa8e851fedaed3c9
MATLAB
2,655
68
% mexSptxModal help file for mexSptxModal MEX-file. % % Finds best 2 way split in matrix of floating point numbers % along 2 of the dimensions/columns hereafter referred to % as measurements % % % % OUTPUT ARGUMENTS % % X - an integer for the 1st of 2 measurements where best split is found % ...
cac5dee64b4555f45f0482b5bb127f10b2bfdd0ac1fd4032d55351e1d815971c
MATLAB
2,655
87
function [params]= fitgaussrf(spx,spy,img, varargin) %DOGRECEPTFIELD %========================================================================== %define ranges cx = median(spx); cy = median(spy); dx = abs(mean(diff(spx))); dy = abs(mean(diff(spy))); [X,Y] = meshgrid((spx-cx)/dx,(spy-cy)/dy); %=======================...
6aa58ac64a2c2053068231ba92d23b040c776418c12662f8ece8b91dbc90266a
MATLAB
2,656
92
function [output,state,EE,F,SMA] = ACC_Activity(X,Fs) %% = Estimate Activity from ACC and adaptively adjust bandpass Filter = %% %% ============================== Method ============================== %% % Uses the Signal Magnitude Area (SMA) Or Energy Expenditure to estimate % the Current activity level of the subject...
91d6f187792c14f7e3a0960e970d856400e45e44671fc4093b15a39f2636305f
MATLAB
2,656
83
function boxplotScatter(data, Title, yaxe, withlines, sumstats, errstats) % this is a function to plot a box and a scatter plot of the data % data is a table with labels corresponding to the categories % title is the title of the plot % yaxe is the yaxis label % withlines is boolean to indicate if to plot with conn...
e18b1959911b4d336adf7ca5d033ae9db31b86dd37b859b3b2978c4ceaf71d8d
MATLAB
2,656
84
function mdlparams = fitDoGModel(mdlparams, stiminfo, stimorder, yy) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here %========================================================================== mdlfit = mdlparams; rmax = mdlparams.rmax/2; mdlfit.surrktwts = -mdlfit.ktwts/20; %small sur...
3bd952dbe2812abbb3faa85b34df33aa11b6869f3134fdbfeea0a03f4f1276ae
MATLAB
2,658
59
function DataStructure=LinearFit_ZN1(Xdata,Ydata) if size(Xdata,1)<=1&&size(Xdata,2)<=1&&size(Ydata,1)<=1&&size(Ydata,2)<=1 warning('Need to provide more than one data point to fit!') DataStructure=[]; elseif size(Xdata,1)~=size(Ydata,1)||size(Xdata,2)~=size(Ydata,2) warning('Need to pro...
ff3366b8bafcb78e313a2fa20ee19b8ff577be192fb644113e938e90c5ef30a2
MATLAB
2,658
105
% this class fits an exponential curve to fluoro data and subtracts the curve, % this corrects for photobleaching/trends function [corrected, uncorrected] = correct_photobleaching_zeroed (data, zeroed, savedir, timef) N = size (zeroed, 2); %N=size (zeroed,1); n = (1:1:N); g = false; uncorrected = false; while g == f...
1313f9b188ee279d095c54d073115c41b6db5c995c85c0bdbb6f6d3c1b250fb4
MATLAB
2,659
79
%new googlenet for feature extraction28/5/2020 %acuracy data set of 10 printer clc close all clear % images=testreaddata(); images=imageDatastore('D:\Doaa_PHD\PHD2020\2nd paper\code\custom cnn48\KDEF','IncludeSubfolders',true,'LabelSource', 'foldernames') images.ReadFcn = @(filename)readAndPreprocessImage(filen...
80c73ef10fb9c09f0a59fd7423ccbf8b73f76782d02996291ae0472031f997f3
MATLAB
2,659
115
% This script produce a few panels of figure 2 (remaining panels require large-files) %% Initialization clear all ignit % ignit_cribay % papignit_effcc % ignit_datsrv %% figure plate clf %% load the data load(fullfile(pds.data.rep.effcc, ['avData_allEcn', '.mat'])) load(fullfile(pds.data.rep.effcc, ['summaryInfoTab...
904452bf7b9d88ddff66ac2b703a8153243dc932842502b635a65fc4e51b8170
MATLAB
2,659
77
function [PathwaySignal,PathwayGwave,PathwayTrans] = PathwayGenerateOrder(Signal,State,Gwave,Trans,opt) %% %Set initialisation Parameters ind=1;ind2=1;ind3=0; start=1;finish=1; PathwaySignal=[]; PathwayTrans=[]; PathwayGwave={}; GOrder=State{1}(1); %% %Estimate E1 & E2 E1=exp(-opt.TR/opt.T1); E2=exp(-opt.TR/opt.T2); %%...
410434829bce0fcebcf39da96716bba93381144b026cb75e438c648bf346a91b
MATLAB
2,660
98
% Author: Birgit Nierula % nierula@cbs.mpg.de function figure_cortical_isopotentialplot(dat, subjects, condition, srmr_nr, is_au) % get info [cond_info] = get_conditionInfo(condition, srmr_nr); cond_name = cond_info.cond_name; [eeg_chans, ~, ~] = get_channels(15, false, false, srmr_nr); %% merge data all_chanvalue...
036f9cf588230fb9e545f659c6704c8ff2931bead2fa81d371c7f86c6ecf6352
MATLAB
2,661
97
function model = bpb4parcs(model,k,B,alpha) % Block-Permutation Bootstrap for PARCS, Algorithm 3, as % described in Toutounji and Durstewitz (2018) Front Neuroinform. % Please refer to 10.3389/fninf.2018.00067 for details % INPUT: % model: PARCS model structure; % k : block size for bootstrap % B : number of b...
16f7331542d1c27240f7308d829aba926473146f114fb8c9634a03d6c70d725e
MATLAB
2,661
90
function pmtkPublish(file, varargin) %% A modified version of the builtin publish command % For every foo.m found in the comments, if foo.m is part of the PMTK % suite of google code repositories, it is replaced with its full html % link. Similarly for foo.html. % This allows us to write 'see foo.m for details' % and t...
5ffa1a4955093cf807b5369db944b0a5520bb2c92744301965475c586f25cdd5
MATLAB
2,661
113
%SUPTITLE Puts a title above all subplots. % SUPTITLE('text') adds text to the top of the figure % above all subplots (a "super title"). Use this function % after all subplot commands. % Drea Thomas 6/15/95 drea@mathworks.com % Warning: If the figure or axis units are non-default, this % will break. function hout=su...
6473cb1abbf5806167a34296e5795f2202383a0df613b92389280774a9255137
MATLAB
2,661
112
function value = getConfigValue(var, ignoreLocal) %% Return the value of a configuration variable stored in config.txt % If a config-local.txt file is found, its values override config.txt's % values. %% Example % path = getConfigValue('PMTKsupportLink'); % This file is from pmtk3.googlecode.com if nargin < 2, ignor...
8964f1f77a6b06305da8de1d8ac997511864b1a161b1fe428140ff5a3e5d530d
MATLAB
2,661
125
function [fv,bp,yy,myfft] = splineDetrend(v,varargin) % What it does: % A spline detrend with knot points every 2 s (hard coded number) % I made this up too - it's not the FDA approved method. % % :Usage: % :: % % [fv,bp,yy,myfft] = splineDetrend(v,'p' [opt]) % % :Input: % % **v:** % a vector to be detrend...
c5ccfd7a30f60c9bae26d36118919f2f2d347aa89cdbac15eab43062e1171038
MATLAB
2,661
93
function gtdata = GTGetMFTInfo(lObj,gtdata,vwi) if ~exist('vwi','var'), vwi = 1; end if isstruct(lObj), labeledpos = cellfun(@SparseLabelArray.full,lObj.labeledposGT,'uni',0); else labeledpos = lObj.labeledpos; end nets = fieldnames(gtdata); nnets = numel(nets); for neti = 1:nnets, net = nets{neti}; ...
ed5f7a866e350594ea9cb11907443a5fdcb2557f187e992f9c7c08d76cbc388e
MATLAB
2,661
76
% Purpose: Calculate the Autonomy Index (AI) following formula in Wang et al. 2014. % Inputs: An averaged FC matrix (fsaverage6) for each participant. % Outputs: rh_labels and lh_labels containing AI values for each vertex. % % Written by M. Peterson, Nielsen Brain and Behavior Lab, under MIT License 2022 % To run: %...
336c6f3919ec91c71073863c177b7132541a664d01df136f5aa51888fb77ea77
MATLAB
2,664
55
function test_adjust_contrast_tool_placement() % Test that the Adjust Contrast tool opens at its aligned position. % % imcontrast_kb() aligns the tool window to the target figure with % iptwindowalign() (left edges aligned, tool top at the target figure % bottom, clamped to stay onscreen). On >=R2025a, figure windows ...
524683d46589d9c3df36eaf6fbece397cd251d1ab8142a95be9c770c0764c006
MATLAB
2,665
92
% this script demonstrates the simulation and inversion of a k-ToM learner clear all close all clc K = 1; % depth of k-ToM's recursive beliefs PERS = 0; % flag for additional perseveration component payoffTable = cat(3,[1,0;0,1],[0,1;1,0]); % game payoff matrix (here: hide-and-seek) role = 1; % player's role (here: ...
586397908c8fb7ff0fdea1dfaefa3509af0ea4d5d2a2ae3dd86f62fb693da512
MATLAB
2,665
62
function sdgm = dgmSeqCreate(intra, inter, slice1CPDs, slice2CPDs, emission) %% Create a sequential directed graphical model, (aka a dynamic Bayes net) % *** work in progress *** % To create the model you need only specify the two-slice dgm, (2TDBN) as % follows, and it will be automatically unrolled by e.g. dgmSeqFit...
8f78b23469405c5f30ceb7065ef93bb12a7eed4c34cd7ad2b8ae1cb4e367e431
MATLAB
2,666
34
%% parameters governing spike detection ops.spkDetectSignal = 'SNLE'; % signal used to detect spikes ops.relSpkThr = 6; % threshold for detecting spikes by NLE or voltage, in units of signal standard deviation ops.deadTime = 0.5; % min interval bewtween spikes, in ms %% waveform alignment parameter...
2b1485a0cf93ceec67d7cb538c9c6759d9be5fe9832b05314b044d3f7898a7b0
MATLAB
2,667
84
function outfiles = split_ufmf(infile,outfilestr,chunksize,varargin) [startframe,endframe,dooverwrite] = ... myparse(varargin,'startframe',1,'endframe',inf,'dooverwrite',false); % read in the header header = ufmf_read_header(infile); endframe = min(endframe,header.nframes); noutfiles = ceil((endframe-startf...
8eec8997f109038270c619a6b126544b4ba7815312251ed6a06f8515b656b896
MATLAB
2,667
80
function [posterior,options,dim,suffStat] = VBA_odeLim2NLSS(posterior,options,dim,suffStat,u,flag) % recollect posterior structure from ODE limit % function [posterior,options,dim,suffStat] = % VBA_odeLim2NLSS(posterior,options,dim,suffStat,u,flag) % This function checks the options structure, and returns the correct %...
13ab14b4188f3bb0ee7da2061e93a74261073718658890454346ecd725d993bf
MATLAB
2,668
66
% SearchForData.m % Sarah West % 6/21/22 % Function that searches through your iterators for the inputted file % names. Does NOT use RunAnalysis, but has similar input structure. function [] = SearchForData(parameters) % Make a loop list from iterators. looping_output_list = LoopGenerator(parameters.loop_li...
438d015a6a3508e852085f94b468df4b16f8bd5bcf928eed7ddc6963b8032ded
MATLAB
2,668
43
clear all %% %Define default 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...
2c4de46a475e0b53fb8d52a86b2ddeed2bb9f9f5e6f210c3fc5440f3682e07b6
MATLAB
2,669
83
function P = khatrirao(varargin) %KHATRIRAO Khatri-Rao product of matrices. % % KHATRIRAO(A,B) computes the Khatri-Rao product of matrices A and % B that have the same number of columns. The result is the % column-wise Kronecker product % [KRON(A(:,1),B(:,1)) ... KRON(A(:,n),B(:,n))] % % KHATRIRAO(A1,A2,...)...
6399907d35b877d5330919129b17c3680e10ec17b60a6bd24f3cd85c676cb32a
MATLAB
2,669
49
function [params, exp_log_likelihood, q] = CBIG_AuthorTopicEM_ExpEstep(w, paradigm, params) % [params, exp_log_likelihood, q] = CBIG_AuthorTopicEM_ExpEstep(w, paradigm, params) % % Perform E-step of the Author-Topic model on a given experiment. % % Input: % - w = 1 x 3 cell array of experiment's activatio...
c4f4b46fe0889d45c684fd1868baf565b810c4738ddcb71944413b9f78743d41
MATLAB
2,669
85
function [KendallW] = y_KendallW_AcrossImages(RaterImages, MaskData, AResultFilename) % Calculate Kendall's W across images. (e.g., different raters or Test Re-Test) % FORMAT [KendallW] = y_KendallW_AcrossImages(RaterImages, MaskData, AResultFilename) % Input: % RaterImages - Cells of raters (nRater * 1 ce...
c32d2484bfc4d76040af04f3be263e0e5813d48ea937e7b406f1a05abf826f19
MATLAB
2,670
96
% Function: wavelength2color.m % Author: Urs Hofmann % Mail: hofmannu@biomed.ee.ethz.ch % Date: 08.07.2020 % Version: 1.0 % Description: converts a wavelength in nm into a color % input arguments: % - maxIntensity: maximum intensity of colorspace % - gammaVal % - used colorSpace (either 'rgb', or 'hsv')...
79e52ca5d5c8bb475ad067adbad340b3cd4c41141149489037367f13cb89cc50
MATLAB
2,672
81
classdef TempoHelp < Singleton properties (Access=private) window toolbar browser helpPath end methods function obj = TempoHelp() obj = obj@Singleton(); if isempty(obj.window) % Get the ...
84ca2bae3bf9db8207168b9d2a4d467c87e8916040312929a2cb7a2ff72c3043
MATLAB
2,672
125
Q = load('/groups/branson/bransonlab/mayank/PoseTF/RomainLeg/Jun22Sep16Sep15Sep13Aug26Sep07Sep05.lbl','-mat'); %% jj = []; for ndx = 1:numel(Q.labeledpos) valid = squeeze(~all(isnan(Q.labeledpos{ndx}(:,1,:)),1)); jj = cat(3,jj, Q.labeledpos{ndx}(:,:,valid)); end %% p1 = jj(:,1,:); p1 = p1(:); p2 = jj(:,2,:); p2...
b5c19203b1a7f5e78d890da0e3c9812b7f267f8cb554e5bcf4ca7d699c08d592
MATLAB
2,672
95
% rd_runTADetectDiscrimAnalysis.m % subjects = {'co','ec','hl','rp','sf','mr','jz','ps','nms','yh','jp','pv','nc','rl'}; subjects = {'rl'}; nSubjects = numel(subjects); runs = 411:419; combineDates = 0; % 1 to combine all dates from each subject plotLevel = 1; % 1 is all plots, 3 is fewest plots saveFile = 0; saveF...
60d4c910430ddad97821f1f7e882d87dc5c2968edd0383526d871eb12f50554f
MATLAB
2,673
69
%% % This demo creates an artificial HRTF set. % It shows how to use SOFAgetConventions and SOFAsave % The HRTF set contains single pulses placed at sample index of 100 % which results in a broadband delay of 100 samples. % Each IR is 256 samples long (i.e., N=256) % SOFA API - demo script % Copyright (C) 2012-2013 A...
7a71d3852c5e4afa603c7b3ec0736ca78e3d0b653435a6af012098e89ea1e070
MATLAB
2,674
91
% Optional 1st step of the multivariate moderation model: % the script identifies for every participant in how many voxels its beta % coefficient would be considered an extreme outlier (based on 2nd quartile % - 3*IQR or 3rd quartile + 3*IQR) in the distribution of all participants' % beta values % saves this number ...
1106d87ac62ff0b5f27b2ec031412253270e736c3394833da73c6211d128e452
MATLAB
2,675
90
function [vol,vol_ratio,zeroflag,badfaces]=checkmesh3d_solid(e,p,type,nodemap) % If type=0 then it will only check the volume of each tet, otherwise it % will also check the quality and output some general ifno global TetrahedronFailQuality TetrahedronZeroVol if isempty(TetrahedronFailQuality) TetrahedronFailQualit...
264e0ee6693c8787e8c822fe61a81ecf1237b92ad404b64d99d60d35741bd743
MATLAB
2,675
86
function prepro_separate_sensoryConditions(subject, nerve) %% set variables srmr_nr = 2; subject_id = sprintf('sub-%03i', subject); savepath_eeg = [getenv('EEGDIR') subject_id '/']; savepath_bs = [getenv('ANADIR') subject_id '/bs/prepro/']; savepath_esg = [getenv('ESGDIR') subject_id '/']; savepath_other = [getenv('O...
36465798e91229fa6cb1cd439d9149b56ef1c677ba63a02d3f36f21f6ee0cfaf
MATLAB
2,675
95
function preds = predict_box(box, modelPath, saveConfmaps) %PREDICT_BOX Evaluates model predictions on a stack of frames. Wrapper for predict_box.py. % Usage: % preds = predict_box(box, modelPath) % preds = predict_box(box, modelPath, saveConfmaps) % % Args: % box: 4-D array or path to HDF5 file with '/box' datas...
afbb8a1e8e6d34b201639801e48aa71bde7ff56e750683740c6f61f1c58460b8
MATLAB
2,675
61
%-------------------------------------------------------------------------- % Author: Brandon S Coventry % Date: 06/01/2023 % Purpose: This function calculates I(R|Sx) the mutual information given % a stimulus as outlines in Borst and Theunissen 1999. We use the direct % method here with quadratic estimation bias ...
377084f920be068ee3df6bb2260e8f3cdf293d3cfb5623520972030ae2103386
MATLAB
2,676
60
function S = parse_optional_arguments(args, argNames, argDefaults, identifier) %PARSE_OPTIONAL_ARGUMENTS args should be a cell array with the structure % {'valName1', val1, 'valName2', val2}. % % % --- % Copyright (C) 2020 University Zurich, Sepp Kollmorgen % % Reference (please c...
74e6afcf89bcdfc46a7f5e87d35c62a2dd1e8a5047b283b72788d20f71094f4c
MATLAB
2,677
77
classdef DataSource < handle % DATASOURCE is the abstract base-class for data-containers in Dataspace. % The main subclass is dspace_data.TableDatasource. % % See also dspace_data.TableDatasource. % % % %<PRE> % This file is part of dspace-core. % % Copyright (C) 2020...
4dabf1f862ce5250a029f2217edbb1d1639ab72fd4c13f97480b2a325d0ed138
MATLAB
2,678
74
function CBIG_ASDf_plotCorrWithBest(inputDir, k, r_final, corr, outputDir) % CBIG_ASDf_plotCorrWithBest(inputDir, k, r_final, corr, outputDir) % % This function plots the correlation between final estimate and other % solutions, sorted from highest to lowest likelihood. % % Input: % - inputDir: % Absolut...
858242358d8b9b5525271e4222d05c720833f1e41efdb6d4379f73c40b0c8a6d
MATLAB
2,678
76
function IC = clusterMontage( I, IDX, nElem, pad ) % Used for visualization of clusters of images and videos. % % Organizes the matrix I, which is either MxNxR for images or MxNxTxR for % videos, into a [M x N x T x nElem x nCluster] array IC, where each % element IC(:,:,:,:,i) is the set of objects belonging to cluste...
01c95dae9fc362eeca6b1275ee589f0920f7c1a1f45e1b8f1a7f3686f69a9357
MATLAB
2,679
113
function sparsePostPlot % Code for Plotting Gauss, Laplace and "Very Sparse" Prior and Posterior %PMTKauthor Florian Steinke 2005 %PMTKslow % define fine grid to evalute distributions %(grid extends outside the targeted field of view for a better % normalisation of the distributions!) ext = 3; pext = 10; N = 1000; ...
578b1f00f4c1230979b409df608dbe70d16dca7ca0f357c2c5051506c90b3e4d
MATLAB
2,679
90
<<<<<<< HEAD % function sigOUT= gen_ramp_signal(sigIN, fs, durONramp, durOFFramp, verbose) function [sigOUT, ramp_vector]= gen_ramp_signal(sigIN, fs, durONramp, durOFFramp, verbose) if ~exist('verbose', 'var') verbose=false; end if nargin <3 error('Not enough input parameters'); end if ~exist('durOFFramp', 'va...
9b786f4abd15412df1d5a8a66dd26294aea756139a2c0d40ddfe39abc99a67a9
MATLAB
2,679
106
% plot the quality of fit in each cluster center using interpolation and % angle-based distance %% load bem-fmm engine clear all restoredefaultpath; addpath('Engine'); subject = '110411'; %% load data table data_table = readtable('dip_4000.csv'); errors = data_table.Dist_mm; %% load cluster data CL = load(fullfi...
647df8fc272c26c90c52d1f678833aebf9f946174679b495f93a3e1379f12987
MATLAB
2,680
69
function Obj=SOFAconvertSCUT2SOFA(root,r) % OBJ=SOFAconvertSCUT2SOFA(root,pinna) loads the SCUT HRTFs saved in a % directory ROOT for the radius R and converts to a SOFA object. % R must be in meters. % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences; % Licensed under the EUPL, Ver...
e8511765f0f427f6a578f158def19e1bd2c1d5d58025acbb7b175607da47befa
MATLAB
2,680
79
function [fm,am,iflaw]=doppler(N,Fs,f0,d,v,t0,c); %DOPPLER Generate complex Doppler signal. % [FM,AM,IFLAW]=DOPPLER(N,FS,F0,D,V,T0,C) % Returns the frequency modulation (FM), the amplitude % modulation (AM) and the instantaneous frequency law (IFLAW) % of the signal received by a fixed observer from a moving ta...
6ccd9ae848f5658327d58fef1e6efbdcf6cecf4037ca938f9ea16a689a0bdbbb
MATLAB
2,681
76
% Registration_Manual_Redo.m % Sarah West % 8/24/21 % Takes the across-day registrations that weren't done very well by the automatic % registration and let's you re-do them manually. Adapted from % "lines_register_multiple_forbackwards.m" function []=Registration_Manual_Redo(redo, parameters) % Assign para...
8c37aab6c89806e6b432d66de0a8b6a46af9c01d1a2f40e14ed38ed9f764df99
MATLAB
2,681
63
function out = boney_segment_simpleBone(seg8t, Ym, Yp, refine) %simpleBone. First simple version that worked surprisingly well. % There is a basic correction of the SPM bone segmentation to avoid % misclassification of high-intensity bone marrow as head tissue. However, % there is no further masking of critical regio...
1c0b0a93dfb57f7735c700f4fe645ee838b0a43ffaf53336b1ee1dfa601a6d66
MATLAB
2,682
68
classdef TensorPatch < diffgeometry.TransformableCP % TransformableCP that transforms as a tensor %--------------------------------------------------------------------- % license %--------------------------------------------------------------------- % Copyright 2015 Idse Heemskerk and Sebas...
20ca91cacaceafe5265428cbfb28967955102f12509d1660980f67b2f99cfc5b
MATLAB
2,682
109
function [fid, tree, dir] = fiff_open_le(fname) % % [fid, tree, dir] = fiff_open_le(fname) % % Open a fif file and provide the directory of tags % % fid the opened file id % tree tag directory organized into a tree % dir the sequential tag directory % % This is a modified version, specific for opening 'littl...
2530a04a7ad694c81d7eb52f501e47803f2f861ca3d24302baf76dd328ed5e7d
MATLAB
2,682
64
function [data_filter_above,data_filter_below] = loc_list_clusters_filter_aspect_ratio_Area(data) answer = inputdlg({'Major Axis to Minor Axis Aspect Ratio Threshold:','Enter Minimum Area per Cluster:'},'Input',[1 50],{'1.5','0.2'}); if isempty(answer)~=1 min_aspect_ratio = str2double(answer{1}); min_are...
85700386ca8ba17e7aa2193739d461ebef5fc4524a82a6c4f8d9675d954b0616
MATLAB
2,682
118
function writenodelm_mesh_medit(infn,elm,p,nodemap,nnpe) % writenodelm_mesh_medit(fn,tet,p) % Writes a tetrahedral mesh defined in 'tet' and 'p' to a file called 'fn' % in medit format (.mesh) so it can be viewed using medit. % Note that this routine renumbers the node numbers from 1 to N and accordingly % adjust the n...
ae0c29c9efcf17c8aa01fac85ca3eb37b9e0507cbd5f681db8407b07bac3648f
MATLAB
2,682
71
function [D,S,Q] = perform_fast_marching_mesh(vertex, faces, start_points, options) % perform_fast_marching_mesh - launch the Fast Marching algorithm on a 3D mesh. % % [D,S,Q] = perform_fast_marching_mesh(vertex, faces, start_points, options) % % vertex, faces: a 3D mesh % start_points(i) is the index of the ith...
be4b32915e337d35d39b8e188737390b5790e1c0e2a23f45ddcf424718049f4c
MATLAB
2,682
97
% fitting_wrapper.m % carry dipole fitting using FieldTrip for every dipole taken from clusters % of subject 110411. %% initialize FieldTrip Engine clear all; restoredefaultpath; addpath(fullfile('fieldtrip')); ft_defaults; %% prepare leadfield matrix LFM = load(fullfile('data/LFM/LeadField_matrix4000.mat')).LeadFiel...
9ce738321a4167f8dcee5a366d7f5393393046328c46be324b3bfd7713595fdf
MATLAB
2,683
93
function [C, ss, M, X,Ye] = ppca_mv(Ye,d,dia) % Implements probabilistic PCA for data with missing values % using a factorizing distribution over hidden states and hidden observations. % % - The entries in Ye that equal NaN are assumed to be missing. - % % [C, ss, M, X, Ye ] = ppca_mv(Y,d,dia) % % Y (N by D) N dat...
d2f99215fdb66fff8b90e826d2d4c12c3c8434383a85bf1e41aae4abc7b532bc
MATLAB
2,683
59
%% 非线性(动力学)特征:基于时域的熵 | nonlinear features: time-domain-based entropy %% 模糊熵 | Fuzzy entropy (based on Sample Entropy) % 表征时间序列数据的复杂性(complexity)和规律性(regularity),值越大,时间序列越复杂、越不规律 % X: single channel EEG signal (either a row vector or a column vector) % opts.r:相似容限阈值,通常r在0.1std(X)和0.25std(X)之间时,En有比较合理的统计特性,默认0.2std(X) ...
1cae1e737c2c8dda3137e2dfe3ba0da4b6660d541a65909aee3b37e4ec0268ed
MATLAB
2,684
76
%%%% load "Example_..." files in "Data" folder. % following could adjust as needed pre_data_time=-100; post_data_time=100; pre_lim_time=-300; post_lim_time=300; FSN=4; REP=20; % number of trial bin_size=50; bin_step=5; PSTH_Y_LIM=110; % following will auto-adjust when the upper change pre_lim_time1=35...
5ce9b20c84a57d1b33a980cd67877d9a854be6155690c4b0fdf9031ef96e25e8
MATLAB
2,684
125
function [] = plot_logreg(logreg_results,type) %%% this function plots the results of the logistic regression of behavior ylimi=[-.2 1.45]; slope_results=compute_slope(logreg_results); dif_d=(logreg_results.thetadd-logreg_results.thetadf)/2; dif_f=(logreg_results.thetaff-logreg_results.thetafd)/2; dif_d_se=(logr...
94325c2903467bbb3e4817400325a2cd68d00c275e2385b0a34bf0bc423ac8ed
MATLAB
2,684
103
% 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,...