sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
495ddbd3afcc7b46593124cbc2f42fb5cf14485dc0d58b083d7787f666da984c
MATLAB
1,781
61
%% Global Default Options GlobalOpts.Subject='p1';%'p1','p3'; GlobalOpts.TaskName='FaceScratch3'; % used for folders and file names GlobalOpts.TaskFileName='FaceScratch3'; % To use with LoadConvertedData % Analyses phases and windows for trial response and temporally resovled % response (TR) GlobalOpts.Pha...
cd0c2ec8f35b5bf8d79cc7e0d83189b1b88aa393e8953c3f0fc574b53d2f7993
MATLAB
1,781
97
function [indmin, indmax, indzer] = func_extr(x,t) % [indmin, indmax, indzer] = EXTR(x,t) finds extrema and zero-crossings % % inputs : - x : analyzed signal % - t (optional) : sampling times, default 1:length(x) % % outputs : - indmin = indices of minima % - indmax = indices of maxima % -...
6644c869409cda735288c75a6506b9273639596b875db334ceef1e38195129e9
MATLAB
1,782
49
function [PP] = VBA_PP0(posterior,out) % derives the posterior probability P(param==0|y) % function [PP] = VBA_PP0(posterior,out) % The posterior probability P(param==0|y) is derived from a Bayesian model % comparison between the original (full) model and a reduced model that % assumes a priori P(param==0)=1. Note: thi...
772d0eafa6209b64d14df21e43ea9f0076182f19bf937606c829ace26d15807c
MATLAB
1,782
47
function v = env_distances(v) SquareWallVectors = [v.env.dx_sq,0, -v.env.dx_sq,0; 0,v.env.dy_sq, 0,-v.env.dy_sq]; SquareWallStart = [0,v.env.dx_sq,v.env.dx_sq,0; 0,0,v.env.dy_sq,v.env.dy_sq]; Interval = 1.0; SquareXYmax = max(SquareWallStart'); SquareXYmin = min(SquareWallStart'); [SquareSpaceX,SquareSpaceY] = meshg...
918b17c99aa2b5e72a34ef643b62e64144182ac858413a240198b8f60d1f3720
MATLAB
1,782
54
function fcBx_PercFC_Scat2(pairsOut,IM) % This function creates a scatter plot of the proportion of positive fcMRI % values against fcBx correlation from the output of % pairsOut=View_Clear_Brain_ROI_Corr2a. % tp is the time point of interest (set to 1 if only 1) % IM is the infomap structure. %% Parameters...
d259cacc8037683129a458eb24260df21c3108fdc2ca062dbf8f631d8bef0611
MATLAB
1,782
62
% HIFIE_IDX Compression function for HIFIE2X and HIFIE3X. function [sk,rd,T] = hifie_idx(K,K1,K2,rank_or_tol,Tmax,rrqr_iter) n = size(K,2); % scale compression tolerance ratio = 1; if rank_or_tol < 1 && nnz(K2) nrm1 = snorm(n,@(x)(K1*x),@(x)(K1'*x)); nrm2 = snorm(n,@(x)(K2*x),@(x)(K2'*x)); ratio ...
0bf0f3ad4e4ba0db4632c8448908ff16954cc098ba616e1c74b2cdb121f7bc25
MATLAB
1,783
59
% Plot bar graphs of mean across session mediation RT only barCols = {[233 149 53]/255, [76 0 153]/255, [0 153 76]/255, [233 53 149]/255,... [0 149 233]/255, [76 0 153]/255, [0 153 76]/255, [233 53 149]/255}; Y = []; labs = []; cols = []; d = 0; for dim2 = medDims d = d + 1; Y = [Y XpercMed_adj{...
3a763df036d66f42de39c58f8fe99b35e4aa0710ecf4e7c447ceb6f6ec045267
MATLAB
1,783
53
% this class will give you the option to select the min or max of a %(usually puffing wcp) trace, or both, in which case it will plot %each sequentially and ask if you want min or max function [psp] = get_min_max (output, time, numswps, bs) correct = false; psp = zeros (numswps, 1); last = size(output, 1); timeint =...
5ca32309ad74a4821d7fc21ef161ad43f0a2adc12a5b52b6769977ba67572322
MATLAB
1,783
72
clear all; for s=1:180 load(sprintf('results_eff_hopf_fcrev_movie_MOVIE1sub_%03d.mat',s)); DataMOVIE1(s,:)=EffectiveConnectivity(:); end for s=1:177 load(sprintf('results_eff_hopf_fcrev_movie_MOVIE4sub_%03d.mat',s)); DataREST2(s,:)=EffectiveConnectivity(:); end task_nsubn={180,177}; trainno=167; val...
d3acf53a09a11fca963b100e2bd19f7e6518b6bf55accc3dc8f181b09dd003e2
MATLAB
1,783
78
% produce fig 5.1 from Rasmussen and Williams book %PMTKauthor Carl Rasmussen n = 61^2; D=2; [x1,x2]=meshgrid(-3:0.1:3,-3:0.1:3); x=[x1(:),x2(:)]; h = figure(1); clf set(gca,'FontSize',24); randn('seed',37) Q = zeros(n,n); for d = 1:D Q = Q + (repmat(x(:,d),1,n)-repmat(x(:,d)',n,1)).^2; end Q = exp(-0.5*Q); y = ch...
2b9535e97f8258416955c05ee450ca5373bda06c4af036c8a85462fa8c137a1d
MATLAB
1,784
50
% OptimizeSubplotNumbers.m % Sarah West % 3/18/22 % A small function to determined the optimized subplot dimensions for a % given number of plots to fit in one figure. Ratio is row:column ratio, % depending on user's input (optional, default = 2/3). function [subplot_rows, subplot_columns] = OptimizeSubplotNumbers(n...
bd373fcfab000a1f8dfdfcda994c73818feec942cd4e033ba16b0468c8f76a48
MATLAB
1,784
55
function w_ExtractROITC(ImgFiles, MaskFile, ExtractType, OutputFile) % Format w_ExtractROITC(ImgFiles, MaskFile, ExtractType, OutputFile) % Input: % ImgFiles - ImgFiles, 3D Files' Cell or 4D file % MaskFile - The absolute path of mask file % AnonyFlag - 1, Single label in mask; 2, Mul...
deba0129b43796e083fce1d1a0aed79c438b5b784c0016b59afd267885065f6b
MATLAB
1,784
63
function HumanOdorRep_sync_axes_limits(figurehandle, axishandles, ylimits,xlimits, ... do_zero_x, do_zero_y) %% function HumanOdorRep_sync_axes_limits(figurehandle, axishandles, ylimits,xlimits, ... %% do_zero_x, do_zero_y) % takes a figure handle (figurehandle = gcf) ...
e604a2203c3ee7675b97325329a1aa995c07673b1f714cfb954d9bf9e311305d
MATLAB
1,784
65
% Add dependencies addpath('C:\Code\spm12') nii1 = 'resliced_D1_SCH23390_hc13_kaller.nii'; nii2 = 'resliced_D2_flb457_hc37_smith.nii'; nii3 = 'resliced_D2_raclopride_hc7_alakurtti.nii'; nii4 = 'resliced_DAT_fepe2i_hc6_sasaki.nii'; nii5 = 'resliced_DAT_fpcit_hc174_dukart_spect.nii'; nii6 = 'resliced_FDOPA_fluorodopa_...
6cf0a7c588a218ad41d8461b44ad8341b03ca354b29ef05020af72af4762a0ed
MATLAB
1,785
68
%% var_specrad % % Calculate VAR spectral radius % % <matlab:open('var_specrad.m') code> % %% Syntax % % rho = var_specrad(A) % [A,rho]= var_specrad(A,newrho) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % A VAR coefficients matrix % ...
9a6cfc9550cf881e1d1c0ba2e9d3d295d8a5a83720df53a38a07eb44422b522b
MATLAB
1,785
78
function newvec = wlProc_calcDeGlitchedVector(oldvec, maxglitch, maxdrop) % function newvec = wlProc_calcDeGlitchedVector(oldvec, maxglitch, maxdrop) % % This function removes spurious gaps (drop-outs) and brief events (glitches) % in a one-dimensional logical array. Durations are specified as sample % counts. % % "ol...
9b6dbf0cc0c585dbf3d1780adf22d486f5991f426df2f2d1b2ec8cc8ac46fe18
MATLAB
1,785
50
function [h,hc,hl] = plotEllipse(cRow,cCol,ra,rb,phi,color,nPnts,lw,ls) % Adds an ellipse to the current plot. % % USAGE % [h,hc,hl] = plotEllipse(cRow,cCol,ra,rb,phi,[color],[nPnts],[lw],[ls]) % % INPUTS % cRow - the row location of the center of the ellipse % cCol - the column location of the center of the e...
9df32c7e4a45d63a60fc2c1ff885d1d0d688a44394e09a649311f9c85b50870d
MATLAB
1,786
44
function [p_pos, p_neg, observeddifference, randomdifferences] = permutationTest(sample1, sample2, permutations, varargin) % parsing input p = inputParser; addRequired(p, 'sample1', @isnumeric); addRequired(p, 'sample2', @isnumeric); addRequired(p, 'permutations', @isnumeric); addParamValue(p, 'sidedness', 'both', @...
b2bd1eeee72cf3e8c8043acdadc50caec9b4f74c1b80bdd1ba87d84c40eaacc6
MATLAB
1,787
55
function Images = load_flatten_filter(parentfolder,folders,normalization,maxes,savename,subtractmean) for fidx = 1:length(folders)%loop through all folders fnames = dir([parentfolder folders{fidx} filesep '*.tif']); Iflat = []; for imidx = 1:length(fnames) %loop through all files fname = fnames(imi...
d5f4def037c1af3133a9a239851a370916a992348b48996453ddca8085678789
MATLAB
1,787
75
%clear all %close all clear Nz=size(raw_traces,2); NCell=size(raw_traces,1); Tr=zeros(NCell,Nz); for i=1:NCell Tr(i,:)=raw_traces(i,:)/median(raw_traces(i,:)); end %load('Speed'); %% [NCell,Nt]=size(Tr); dt=200; [M4,PCout] = step1_PCA(GaussBlur1d(Tr,Nt/20,2),10); P=PCout.pc_TimeCourse'; %% SigRef=diff(P(1,:)); % ...
2a3bf19de1c4238de1303e854fdb63ba7e43f13730cc019fb5f2c83470adb544
MATLAB
1,788
50
function yidx = pointMatch(X, Y) % find vertex closest point in Y for each point in X % % yidx = pointMatch(X, Y) % % X: Nx3 or Nx2 matrix of positions % Y: Mx3 or Nx2 matrix of positions % % yidx: Nx1 matrix of indices into Y %--------------------------------------------...
2d66ea60bb315fbcca91755b2bc39d1e54ec366addf84771b17b53607991bcb0
MATLAB
1,788
60
function gfdata = getframe_initialize(haxes) inputType = getInputType(haxes); if strcmp(inputType,'figure'), hfig = haxes; haxes = get(hfig,'children'); if length(haxes) > 1, haxes = hfig; %error('Figure has multiple children, please input handle of axes instead of figure'); end else hfig = g...
23acb2454f577b1546b603a81a4f4ad92f321fdc143d8c5508d4f6518fd0b790
MATLAB
1,791
48
% DetermineChannel.m % Sarah West % 8/25/21 % Takes two images (must be 2 sequential images from a 2-channel % recording and determines which belongs to which channel depending on the % brightness in a region of interest over the brain. % blue_brighter -- a boolean. Is true if the blue channel is expected to be % br...
c18e92117e48d5e6989cdd49035adffd8c54bf05ec81f80d27efd8e4f2184820
MATLAB
1,791
84
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % this function gets called every time the mouse is clicked function mouseCallback(self,~,~) i...
139af9e521a7c8077090d94d08edad0de63ae8dca05db901c08a3f24fbeb7b54
MATLAB
1,792
70
%% pxTools_KLDiv % % Calculate the Kullback Leibler Divergence (KLD) between two input % distributions (Using Log2, which estimates the bits) % % varargin can be one input which determines the dimensions that form % distributions, other dimensions are just pointing to different % distributions in p1 and p2 % if I don'...
42b3b5956c8d505d32b5f85299b56faae7b78f9209177f4884e15e781d782ac2
MATLAB
1,792
56
function contrastFixation(display, stimulus, frame) % Generates new dot fixation; called in 'showScanStimulus' %7 = green; 6 = red; % pixelsPerDegree = 1/d.pixelSize; pixelsPerCm = 1/display.pixelSize; degPerCm = atan(1/display.distance)*180/pi; pixelsPerDegree = pixelsPerCm/degPerCm; % FIXATION % make frame rect rec...
8afb1e98468c6714f504ba34c8830fb6929be0a04ca897bacb3f1c5f1caab3a0
MATLAB
1,792
74
function z = gt(x,y) %GT Greater than for sptensors. % % See also SPTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the terms of C...
13b38c667d31f0a25fb03fe68ed87320d2f8c7f70d951edb3cd1084c9a44dc06
MATLAB
1,793
79
function CBIG_MFMem_rfMRI_run_1000_simulation_testGrp_resLow_ut() %-------------------------------------------------------------------------- % CBIG_MFMem_rfMRI_run_1000_simulation_testGrp_resLow % % This function will run 1000 simluations of FC with estimated parameter and % SC of test group, simulation will run in l...
1f7dabc1979386a9c70ccb773d564a834b0eae5c82e297a644804805d90a29c2
MATLAB
1,793
68
function indexloc = ufmf_write_index(fp,keylocs,framelocs) DICT_START_CHAR = 'd'; ARRAY_START_CHAR = 'a'; indexloc = ftell(fp); % write a 'd': 1 fwrite(fp,DICT_START_CHAR,'char'); % write the number of key frames fwrite(fp,numel(keylocs),'uchar'); for j = 1:numel(keylocs), % write the length of the key name: ...
4bc69ce68de3cb860d65b8640bbf426b7ae305a0100479a000f89dc34a75f8ee
MATLAB
1,793
38
% 根据白化法或目标函数法构造出的空间滤波器矩阵CSPMatrix,提取CSP特征 function features = func_extractCSPFeatures_seg(EEG, CSPMatrix, nbFilterPairs,seg_len) % Input % EEG: 训练集或测试集 % EEG.x: (times, channels, trials) % EEG.y: trials*1 % CSPMetrix: 学习到的CSP空间滤波器矩阵, cell, {1,nsegments},每个都是channels*channels % nbF...
b3c804688bd6b88e021961123b826fc2050a5f842f7c08a9076b53bb363ca8f6
MATLAB
1,793
52
function result=nc_reslice_probabilitymap_and_extract_common_mask_major_voting(workdir, subj_folder_prefix, ... wm_file_prefix, subj_mask_threshold, voting_threshold, out_file, sp_LR, sp_AP, sp_SI, IsRegenrate) result=[]; wm_nii=[]; subj_folders=dir(fullfile(workdir, [subj_folder_prefix, '*'])); if isempty(sub...
f49c9c4c7d1a5816f07000fd9783714178f74f90f8b7200e87ba71173461fe06
MATLAB
1,793
73
function answer = isCondInd(G, A, B, C) %% Is A conditionally independent of B given C in the dag G % We check the moralized ancestral graph for dseparability % % A, B, C can contain multiple vars: answer is a bit vector the same length % as A so that A(isCondInd(G, A, B, C)) gives the vars from A that are % condition...
5c3025b8a15411592b6ba66a76523aff8f2fa741d6d6ffbe1288fd030ee3ff4f
MATLAB
1,795
44
function [allMean,allMeanZ,allT] = afxLnmSecondlevel(firstlevelInfo,groups) if nargin < 2, groups = []; end if nargin < 1 || isempty(firstlevelInfo) firstlevelInfo = spm_select(1,'^firstlevel_info.mat$','Select firstlevel_info.mat',{},'results'); end % load firstlevel information inf...
7c255d9c9bb9ee23d9d38fe0f057048d32dfeec3ebae313b618c81486c2bc2ba
MATLAB
1,795
62
function [varargout] = read_16bit(varargin) % READ_16BIT read a stream of 16 bit values and converts them to doubles % This function is designed for EDF files and is implemented as mex % file for efficiency. % % Use as % [dat] = read_16bit(filename, offset, numwords); % % See also READ_24BIT % Copyright (C) 2007, R...
1a2a5606740cb0786b2fa1a26f8e1689730c8941c311310248fca954f770f7b8
MATLAB
1,796
81
%% Robust linear regression demo % PMTKneedsOptimToolbox linprog %% % This file is from pmtk3.googlecode.com function linregRobustDemoCombined() requireOptimToolbox seed = 0; setSeed(seed); x = sort(rand(10,1)); y = 1+2*x + rand(size(x))-.5; % add some outliers x = [x' 0.1 0.5 0.9]'; k = -5; y = [y' k k k]'; n = l...
76ae392e633874c5263aefa61bc8a3b4c4d435c0f7dd6634cdade46241643c5e
MATLAB
1,796
41
function CBIG_LiGSR_LME_unittest_intelligence_score_cmp_w_reference_GSP( all_stats_mat ) % CBIG_LiGSR_LME_unittest_intelligence_score_cmp_w_reference_GSP( all_stats_mat ) % % This function compares the variance component model results of Shipley % Vocabulary and WAIS - Matrix Reasoning measures in GSP dataset that th...
2963ecba10694d634a2afd256249ba1e7c56ec87db5353a16e6a26290e1e0f6c
MATLAB
1,799
81
function binlist = wlFT_getTimeBinList(ftdata, time_bin_ms, offset) % function binlist = wlFT_getTimeBinList(ftdata, time_bin_ms, offset) % % This generates a list of time bin spans that covers a set of Field Trip % trials. % % "ftdata" is a ft_datatype_raw data structure produced by Field Trip. % "time_bin_ms" is the...
b2ffdae5980788346fcf8d654d801c3d2cd8180674d168f630a4b0b0a8c62a02
MATLAB
1,799
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,...
e74d41916f1c33979483bc4a64745e963ce38df4b1dd33b630ce5686f96fd896
MATLAB
1,799
69
%% [NCell,Nt]=size(Tr); dt=200; %default:200 [M4,PCout] = step1_PCA(GaussBlur1d(Tr,Nt/10,2),10); %default: step1_PCA(GaussBlur1d(Tr,Nt/10,2),10) %[M4,PCout] = step1_PCA(conv2(1,gausswin(10),Tr,'same'),10); P=PCout.pc_TimeCourse'; %% SigRef=diff(P(Pcn,:)); % Calculate Shifted trace Cor1d=zeros(1,NCell); Shift1d=zeros(...
eabe92901c029114c9662153c3176aa71e556312bd01f5b27d30546979b053e7
MATLAB
1,799
51
function [xyc_min, num_channels, tiling_info] = get_xyc_lc(images_folder, x_res) lc_channel_list = dir([images_folder, '/*']); lc_channel_list = lc_channel_list(~startsWith({lc_channel_list.name}, '.')); lc_channel_list = lc_channel_list([lc_channel_list.isdir] == 1); lc_x_list = dir([lc_c...
eced1b50baa22813b17c70cc40183c47f4a000e49cd08f082d66274b81b84f8a
MATLAB
1,799
86
function makeResultsMovie(movfile,movout,varargin) % Create tracking/label results movie % % movfile: full path, input movie % % movout: full path, output movie [trkfile,framerate,gamma] = myparse(varargin,... 'trkfile',[],... % full path to trkfile holding labels 'framerate',24,... 'gamma',[]); % input mov mr...
fd8ec59591393a3ff2027930d0691958b874132f3cc64020c6843db27dc8f871
MATLAB
1,799
100
function xend = filter_hilbert_2(x,Fs,Fp1,Fp2) % En proceso % % Hilbert filter % (1) Realizar filtros pasabanda de la senal x, Entre Fp1 yFp2, % Fs como frecuencia de muestreo % (2) Aplica transfomada de hilbert para general se??al analitica (Sa) % de la se??al (S), forma: % % Sa(t) = S(t) + i*H(S(t...
0babd14f0b378fab421be336f2af668cf6b3042c1acc59663fa371c6a746b833
MATLAB
1,800
73
function formatted = printf(str, varargin) %PRINTF Prints formatted output. % Usage: % printf(str, ...) % formatted = printf(str, ...) % % Formatting: % - Surround text with '*' for bold or '_' for underlining % - Set flags by adding '#[flagname]' to the END of the string % Flags: % '#nonl': Will no...
426a1269fbdc31ef346699457807c6cd66c2ca220473a6ea818829c69518568d
MATLAB
1,800
56
% organize_gait_data_forPrism.m % Sarah West % 8/29/23 function [parameters] = organize_gait_data_forPrism(parameters) % within each group: % # mice x mean, SD, N % 5 groups: spon, 1600, 2000, 2400, 2800 concatenated horizontally MessageToUser('Organizing for Prism ', parameters); % Inputs ...
5c3b67e2090b0ac4da070748a35e15fca3f0cea0579eb5a0e7c922c7460d1e9f
MATLAB
1,800
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,...
6edc27cc971a9fbefde9ecc428e9127f9d3c67f06e5a5246b552299ce6c27dd1
MATLAB
1,800
70
function [logZ, nodeBels, clqBels, cliqueLookup] = libdaiInfer(tfacs, varargin) %% Bare bones interface to libdai % %% Input % % tfacs - a cell array of tabular factors % varargin - all other args are passed directly to dai % %% Outputs % % logZ - log of the partition sum % % nodeBels - all single marginals (no...
d36086343c81b1961390281a2a218c0de1466815cd67262c19127d9d30e3e20f
MATLAB
1,800
48
function [ rawwave, hilmag, hilfreq, hilphase ] = ... wlProc_calcNoisyAnalytic(data, samprate, sigband, noiseband, noisesnr) % function [ rawwave, hilmag, hilfreq, hilphase ] = ... % wlProc_calcNoisyAnalytic(data, samprate, sigband, noiseband, noisesnr) % % This function adds band-limited noise to a signal and the...
058e1844dab6165adb89dbba6718064d9b33057e5244e05d8abb14d70db83b94
MATLAB
1,801
62
function u = nvecs(t,n,r,opts) %NVECS Compute the leading mode-n vectors for a sparse tensor. % % U = NVECS(X,n,r) computes the r leading eigenvalues of Xn*Xn' % (where Xn is the mode-n matricization of X), which provides % information about the mode-n fibers. In two-dimensions, the r % leading mode-1 vectors a...
b7b0bdb65738feb42610a9567dcfa6f8b80e6a2f993cc2145f6cac02f16576d5
MATLAB
1,801
54
% separate_plots = true; r = corr(traces.all(:,mvm.restEpochsIndex)'); % r = corr(traces.all(:,mvm.mvmEpochsIndex)'); % r = corr(traces.all'); distance = pdist(pos.all); %Eucledian distance between cells distance = squareform(distance); %colour = lines(length(nCells.int)); % colour code for different cells r_all = ...
23a9261987f820c698e69d41dd9f7f6609dc60fed5fd2fff1dd1728540276103
MATLAB
1,802
64
function [ newlabel newtitle ] = wlAux_makeSafeString( oldstring ) % function [ newlabel newtitle ] = wlAux_makeSafeString( oldstring ) % % This function makes label- and title-safe versions of an input string. % The label-safe version strips anything that's not alphanumeric. % The title-safe version replaces stripped...
f4d81ef3e91524e5057e8039f4255fc6d407a872ea1466ae2748a0230a0678a9
MATLAB
1,802
48
function prf = wiCSpkProf(tsd,at,nses,SesStrt,CSon,CSoff,Pk) if isnan(at(1)) prf = nan(1,10); return end sesstrts = find(tsd(:,2)==SesStrt); tsd = tsd(sesstrts(end-nses):end,:); % only "terminal" sessions (2nd half?) LVpk = tsd(:,2) == Pk; LVon = tsd(:,2) == CSon; % flags tone onsets LVoff = tsd(:,2) == CSo...
07e07d749122858adeb21b7f9f7188507d1a6659bda26524af31999bd70803e5
MATLAB
1,803
62
function [varargout] = read_24bit(varargin) % READ_24BIT read a stream of 24 bit values and converts them to doubles % This function is designed for Biosemi BDF files and is implemented as mex % file for efficiency. % % Use as % [dat] = read_24bit(filename, offset, numwords); % % See also READ_16BIT % Copyright (C)...
7ee340618d8234ceaa06349eb543c39a3f79c5df57871b2e1b33c9b9ac03ae88
MATLAB
1,803
60
function [F,Vx,Vy,Vz] = membflt_kernel( I, s, t, v, m, w, e, d ) % MEMBFLT_KERNEL Kernel code for TOMOSEGMEMTV. Do not call this function directly, call tomosegmemtv instead. % INPUT: % I - Input tomogram (foreground dark), input data must be single and double % s - Scale factor % t - Membrane th...
bde5d6f9bfc63a8799e218444edc1ea3593919ab9914853457afc4ac4d765bb2
MATLAB
1,803
46
% Edited by Jerry. 07/04/2022 function avgs = GetAvgByClass_220704(A,classIDs) %******************************************************************** % Average an array by 'type'. % Class could be seizure: % Array elements corresponding to certain seizures % and each element corresponding to one s...
ac88180480e7424fe471669587573cff85805f2525c8d3364183ac8a6d043372
MATLAB
1,804
55
function fitprms = fitOutputNonlinearityML4(xvals, spikes, guess) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here %========================================================================== foptim = @(p) optimizeNonlinearity(p, xvals, spikes); %=========================================...
f651eee56eb0a3c98a72f5abf415601b41aae29c1fa8930092fe4d4e8843c849
MATLAB
1,804
50
function [y,iflaw]=fmodany(iflaw,t0); %FMODANY Signal with arbitrary frequency modulation. % [Y,IFLAW]=FMODANY(IFLAW,T0) generates a frequency modulated % signal whose instantaneous frequency law is approximately given by % the vector IFLAW (the integral is approximated by CUMSUM). % The phase of this modulation is suc...
2c1f05183d2d25e36d0bb4ba5cf1497868679ad81cc1f48918adb258303df2c4
MATLAB
1,805
68
function [w, mseTrain, mseTest, df] = ... elasticNetPath(Xtrain, ytrain, Xtest, ytest, lambda1s, ... lambda2s, doStandardize) % Elastic net for multiple parameter values (not optimized!) % w(:,i) for lambda1s(i) and lambda2s(i); first element is w0 % This file is from pmtk3.googlecode.com if nargin < 7, do...
2fed231efa5b29f56bcbd291e2eb64cc119b99929e4d6abfabc11dfc98ee3a78
MATLAB
1,805
55
function [S] = FreedDWSSFP(G,tau,TR,alpha,D,T1,T2) % % calculates steady-state magnetization with diffusion weighting % for monopolar diffusion gradient based on the Freed model. (Appendix 1) % % input: % G = strength of diffusion gradient (mT/m) % tau = duration of diffusion gradient (ms) % TR = repetition time (ms...
53da68148f7d65be25fc9c1cce11130be6826aff1ff040925baa22fca94f6748
MATLAB
1,805
73
function [g1, g2,wall,fminmax]=sica(f1, f2); % decomposes two neural densities according % to a minimum overlap criterion; % % usage: [g1, g2,wall]=sica(f1, f2); % Input; % f1,f2: two dipole fields each having dimension Nx3 where N is % the number of voxels; % Output: % g1, g2: decomposed dipole fields w...
69e3ca826d7a64b6f4d065ba46d7430cf4ffae40a015c22dd4ebf1cbce64b5f1
MATLAB
1,805
63
%% Coins Model Selection Demo % Attempt to determine if a coin is biased or not as we accumulate more and % more data, (coin flips). %% % This file is from pmtk3.googlecode.com theta = 0.7; N = 5; alpha = 1; alphaH = alpha; alphaT = alpha; for i=1:(2^N) flips(i,:) = ind2subv(2*ones(1,N), i); % convert i to bit ...
91ea69ca9bc3471008affcc0e913d88f65b091b961374112ec245bf66c84a52d
MATLAB
1,805
47
% % generalized phase (GP) demo % lyle muller % 18 february 2020 % clearvars; clc % load example channel load( './data/exampleChannel.mat' ); % parameters filter_order = 4; Fs = 1000; lp = 0; dt = 1 / Fs; T = length(x) / Fs; time = dt:dt:T; % preprocessing - lowpass + notch [b,a] = butter( 4, [5 200] ./ (Fs/2) ); x...
0b21ca7e855c95346fa4301883b7d77f48b126dd973c3eacb4d4cb73a4ea7f8e
MATLAB
1,806
81
function hFig = easymontage(I,p,nr,nc,varargin) [mrkr,mrkrsz,clr,idstr,hFig,doroi,roixrad,roiyrad,axisimage] = myparse(varargin,... 'marker','.',... 'markerSize',10,... 'color',[1 1 0],... % either [1x3], or [nptx3] 'idstr',[],... 'hFig',[],... 'doroi',false,... % if true, zoom in on label centroid 'roix...
4fb2eb0d499c61ff64c25b957876e5cdf14787212c04a5ed4eb8df2541d0c2b5
MATLAB
1,806
49
% Plot Correlation Matrix % Produce the input lower triangular matrix data C = -1 + 2.*rand(12,12); C = tril(C,-1); % tril returns the lower triangular portion of the data C(logical(eye(size(C)))) = 1; % Set [min,max] value of C to scale colors clrLim = [-1,1]; % load('CorrColormap.mat') % Uncomment for custom CorrCol...
512e9b80b5694b83b7c80d4884bfc24a88b8cd885240841dce0da0e757bd8334
MATLAB
1,806
60
function [F,Vx,Vy,Vz] = membflt_kernel( I, s, t, v, m, w, e, d ) % MEMBFLT_KERNEL Kernel code for TOMOSEGMEMTV. Do not call this function directly, call tomosegmemtv instead. % INPUT: % I - Input tomogram (foreground dark), input data must be single and double % s - Scale factor % t - Membrane th...
c8c770fae93bb5099d56004932c49d6eefcca22ea494d2703bcebd1f108fd584
MATLAB
1,806
61
function segments=Segment_Overlap(X,Y,lseg,ovlp) %Segment_Overlap Splits the trajectory in segments of length % lseg with an overlap of ovlp % % Returns an structure of xy coords for each segment % % From MWM-ML-GEN, edited by Ryan H 2017 % figure(1);plot(X,Y);hold on Z=[X,Y]; n = size(Z,1); % compute cumulative di...
dc370a531737e090d4ae49eef5dfd17be1f1c6d14e99b01c2c537afaa5357bca
MATLAB
1,806
63
classdef GTSetNumFramesType enumeration Total PerMovie PerTarget end methods function tblsamp = sample(obj,tbl,n) % Sample n frames from an MFTtable % % tbl: input MFTTable % % tblsamp: output MFTTable, sampled rows from tbl nBase = height(tbl); ...
ef57d2fc23b19b3f1af4e1cde0c790023f8bbec0a426eed7a0e50628150c6119
MATLAB
1,806
87
% Demo for DAVB Henon state-space model inversion... clear variables close all % Choose basic settings for simulations n_t = 2e2; f_fname = @f_Henon; g_fname = @g_sigmoid; u = []; alpha = 1e8; sigma = 1e4; theta = [1.4;0.3]; phi = []; inF.deltat = 1; inG.scale = 50; inG.slope = 0.1; % Build options s...
0674929701239ad4d454e3f69a24f27b7e2ada642bab43a0924623836bff7318
MATLAB
1,807
66
function varargout = mixexpPredict(model, X) %% Predict using mixture of experts model % If the response y is real-valued, we return % [mu, sigma2, post, muk, sigma2k] = mixexpPredict(model, X) % mu(i) = E[y | X(i,:)] % sigma2(i) = var[y | X(i,:)] % weights(i,k) = p(expert = k | X(i,:) % muk(i) = E[y | X(i,:), e...
f0d266ecd696a809a00819bfcc914b6dccaf5ac6283dd2680b8d3ae6c897269d
MATLAB
1,807
71
% 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,...
03c8f714c850a915579c5dff40a0360d543f96e32451caf6f8044452b487b994
MATLAB
1,809
58
%H5: Markov Operator; %_______________________________________ % 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 Public License as published by % the Free Software Foundation, ei...
89122e251ea3cd420cc782e2b69b5334a6fe9a4d52ecc4b1918afd2d9bccd85a
MATLAB
1,809
57
function [h, p, stat] = regress_clustercorr(dat1, contrast, subjidx) % wrapper around fieldtrip's cluster-based permutation test on a % timecourse, behaves similarly to matlab's ttest % input: nsubjects x time addpath('~/Documents/fieldtrip'); ft_defaults; % ============================================= % % RESHAPE D...
4cb46538b728306e86ab820a2efc2b0c5ddc9383769ab571917a5992f28cf8d4
MATLAB
1,810
39
function [act, paradigm_by_exp, num_studies_per_paradigm] = CBIG_AuthorTopicEM_CollapseAct(act, paradigm_by_exp) % [act, paradigm_by_exp, num_studies_per_paradigm] = CBIG_AuthorTopicEM_CollapseAct(act, paradigm_by_exp) % % Summarize input data by unique task paradigms to reduce storage size for the variables % % Input:...
66de5376a5cc5357cdeaa4c58229ee3455ab6c0dbd5d550af9238891bdfb5435
MATLAB
1,810
41
function [fly] = plotXYZPosition(bodyPts_xyz_allFlies,stimFileName_allFlies,flyID,figureFile) for fly = 1:size(bodyPts_xyz_allFlies,1) bodyPts_xyzP = bodyPts_xyz_allFlies(fly,:); bodyPts_xyzP = bodyPts_xyzP(cellfun(@(x) ~isempty(x), bodyPts_xyzP)); figure;set(gcf,'Position',[2 42 838 924]); for t...
8f7e76ded7b35d7d3cacb315a2f5c5f087dee4b3f78898e0b941e9a5f52c4e5d
MATLAB
1,810
44
function [completedParPool] = clusterParPool(varargin) datetime; pause(1); drawnow; maxRandomWaitTime = 15; % seconds - try to prevent parpool initialization collisions distcomp.feature('LocalUseMpiexec', false ); pause(1); drawnow; parPoolTest = gcp('nocreate'); pause(1); drawnow; if (~isempty(par...
50569f75cb6e76eda21e5f26f82ac0a6a0f98f3622294e31b0a399f71c1e4095
MATLAB
1,811
69
function [stack, maxFrameNumber] = read_qcamraw(fn, frameNumber) % % % fn: string file name of QCAMRAW binary file. % frameNumber: vector of frame numbers. % % % % fn = 'JF8635_green01_.qcamraw'; pf = fopen(fn, 'r'); fseek(pf, 0, 'eof'); fsize = ftell(pf); gotThreeData = 0; %get header infomation f...
75399210abae3ecb84a6ea264c798ef4fed343c1e52c06c1ae6e34a5278f0e4d
MATLAB
1,811
55
%% choose session datRoot = '/Volumes/LaCie/Farries recordings/'; %srvRoot = '/Volumes/Recordings/Michael/'; rat = 'IM1261'; sesList = dir([datRoot rat '/20*']); sesList = arrayfun(@(x) x.name, sesList, 'UniformOutput', false); %sesList2 = dir([srvRoot rat '/20*']); %sesList2 = arrayfun(@(x) x.name, sesList2, 'Unifor...
f57636c987b310eb00a4e1ce9500fdd4dafe1c2ca590e0dd7a2e9c839244eec8
MATLAB
1,811
57
function val = surfaceorientation(pnt, tri, ori) % SURFACEORIENTATION returns 1 if the triangulated surface is outward % oriented, -1 if it is inward oriented and 0 if the orientation cannot be % determined. % % Use as % surfaceorientation(pnt, tri) % or % surfaceorientation(pnt, tri, ori) % Copyright (C) 2007, R...
6c6658fc38097c2bf2a1591d7cfc06db87096ae298ef20b8ebe13323bfcb3f37
MATLAB
1,812
56
function C = minus(A,B) %MINUS Binary subtraction for sparse tensors. % % MINUS(A,B) is called for the syntax 'A - B' when A or B is a sparse % tensor. A and B must have the same size, unless one is a scalar. A % scalar can be subtracted from a sparse tensor of any size. % % Examples % A = sptenrand([4 3 2],...
61c02253ee72b81ac6c5096918dd5624fc3ce577c8203f6851e8c0298a1fef47
MATLAB
1,814
59
% Author: Birgit Nierula % nierula@cbs.mpg.de %% EEG preprocessing wrapper script clear; clc delete(gcp('nocreate')) % clear parallel pool %% variables that need to be changed % loop loop_number = 1 disp(['loop number = ' num2str(loop_number)]) % subject, condition, and block info subject_idx = 1:36; condition_idx ...
91360ff1660a18d39f0768f425f089eda7a153e1ac797f730704368414a9faf8
MATLAB
1,814
65
function LAN = lan_add_ref(LAN,references,chanlocs) % <*LAN)<] toolbox % v.0.0.1 % Read coordinates for iEEG electrodes % 09.10.2012 if nargin == 1 realk= []; [FileName,PathName,FilterIndex] = uigetfile({'*.reflan','ref-file';},'open ref - file','LAN.reflan'); if isequal(FileName,0) || isequal(PathName,0...
9328d343166f5e205a7ce331b288d386039ee3c74cfece03ae94b39c033af57c
MATLAB
1,814
66
function y_hat = CBIG_regress_X_from_y_test(y, X, beta) % y_hat = CBIG_regress_X_from_y_test(y, X, beta) % % This function applies the regression coefficients "beta" generated from % the training set (see CBIG_regress_X_from_y_train.m) to regress the % nuisance variables X from the target variables y. % % Inputs: % ...
a5011da8cfc6827d7a2cf396a640bd69d26352a852fe49a88e2796aa8c8dd06c
MATLAB
1,814
63
function histmat = hist2(x, y, xedges, yedges) % function histmat = hist2(x, y, xedges, yedges) % % Extract 2D histogram data containing the number of events % of [x , y] pairs that fall in each bin of the grid defined by % xedges and yedges. The edges are vectors with monotonically % non-decreasing values. % %EX...
eb87de65b0350f8faaeac702bda09a986f519488d5afe6e273aa03936f980647
MATLAB
1,814
66
function stage_downsampling_and_color_correction() loadParameters; %Save the loadParameters into the output director in case we need to do %later debugging copyfile('loadParameters.m',fullfile(params.colorCorrectionImagesDir,... sprintf('loadParameters.m.log-%s',date))) [ret,messages] = che...
f68f1233bc651436e9231bf6d57b1c3eba72c090e9ce6d3d14755f650ec63d40
MATLAB
1,814
49
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % To reapply the filters of each motor unit over the EMG entire signal % Input: % EMG = raw EMG signal % EMGmask = flagged EMG channels with artifacts or low signal to noise % ratio % PulseTold = previous pulse trains of the motor uni...
33a2c2a07b03f0e972924a19fb55b1b92eeafd46a6d96a4c7d70c9f49d4103b4
MATLAB
1,815
53
function y=rfft(x,n,d) %RFFT Calculate the DFT of real data Y=(X,N,D) % Data is truncated/padded to length N if specified. % N even: (N+2)/2 points are returned with % the first and last being real % N odd: (N+1)/2 points are returned with the % first being real % In all cases fix(1+N/2) points are return...
3dead392d20477bac181d705a20ad60daaf44cbb093ab954a848b075ca9e6a52
MATLAB
1,815
49
function [xOuter, yOuter, xInner, yInner] = generateNestedSquares(basepath, ep,varargin) % GENERATENESTEDSQUARES Generate points on outer and inner square sides % Inputs: % basepath: location of behavioral data kept in CellExplorer format. % ep: integer indicated behavior epoch that contains maze_coords ...
4bba13071f76d36144df311ec1f54f71bc196c01dce53633cb9ce55de34f5a5f
MATLAB
1,815
65
function [data, label] = gmmsamp(mix, n) %GMMSAMP Sample from a Gaussian mixture distribution. % % Description % % DATA = GSAMP(MIX, N) generates a sample of size N from a Gaussian % mixture distribution defined by the MIX data structure. The matrix X % has N rows in which each row represents a MIX.NIN-dimensional samp...
52a8d6246b99fe122755ce605638a2fb015c73a51ff914ece57e04a7f77f13c7
MATLAB
1,815
99
% ITPC cartoon figure set(gcf,'Position',[100 100 300 400]) grey = cmocean('-gray',14); lineWidth = 1.5; lineWidthAvg = 2; xli = [-3.5*pi 3.5*pi]; clear y subplot 211 figureStyle hold on ylabel('Power') xlabel('Time') yticks('') xticks('') xlim(xli) ylim([-1 1]) x = -8*pi:0.1:8*pi; y0 = sin(x); yScale = [1.7...
593caed8adaa7a568fadd2589ab340342130482e7060eed99f42d5c01afc8993
MATLAB
1,815
44
%Purpose: Implement Hungarian Matching Algorithm for MSHBM and k-means parcellations %parcellations. %Inputs: MSHBM and k-means parcellations (run directly following %parcellation BEFORE visualization) %Outputs: Individual parcellations with matched values (e.g., network 1 is the same across parcellation methods. % %...
2cdeb6a119a73fff95620335b6de8ceac6ce01f1c89bd6ef9614603ef809359d
MATLAB
1,816
22
clear;clc;close all ROOTPATH = strcat(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 4), "Data\Processed Data\"); cd(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 2)) protStr = "Active duration"; temp = NoveltySU.utils.dirItem(strcat(ROOTPATH, protStr), "spkData.mat"); popRes = cell2mat(cellfun(@(x)...
64be37740b4e766e320dfe04d7cd9e4860d66dbadd73b2cb871ec33b5e9db135
MATLAB
1,816
57
classdef ParameterVisualizationKeypointParams < ParameterVisualization % Embeds the LandmarkSpecs keypoint-specification UI (skeleton, % head/tail, swap pairs) in the visualization pane of the parameters % dialog. Edits are handed back through cbkClear when the pane is % cleared, and are written to the Labeler...
01432028f05e7d988dc5c9c689bdee158ae38153decd42e610320d9e73b1d4bb
MATLAB
1,817
52
function varargout = finding_crap(s,n) %DETCOEF2 Extract 2-D detail coefficients. % D = DETCOEF2(O,C,S,N) extracts from the wavelet % decomposition structure [C,S], the horizontal, vertical % or diagonal detail coefficients for O = 'h' % (or 'v' or 'd',respectively), at level N. N must % be an integer...
65550810f9316128e60d1e1eeb43f583a61d10679bbb1f4890feb184a84a7563
MATLAB
1,817
53
function logNorm = logMvnPdfWithMissingData(data, obs, mean_, precMat, logDetPrecMat, covMat) % Computes log of Multivariate Normal Pdf when data contains missing values. % logNorm = logMvnPdfWithMissingData(data, obs, mean_, precMat) computes the % logPdf for data (#dim x #measurements). 'obs' contains the indexes of ...
ccca0c5ef254928e000092dadb86845881574b934d4b9c7ac37b72d663f11f46
MATLAB
1,817
82
function [res,c_theo]=lm_res_comp_general(a,c,forwpar,ndip,type); F=fcnchk(forwpar.method); [npar,ndum]=size(a); if type=='real'; nc=ndip*(ndip+1)/2;nc_R=nc; ar=a(1:nc_R); elseif type=='imag' nc=ndip*(ndip-1)/2;nc_I=nc; ai=a(1:nc_I); elseif type=='comp' nc=ndip^2;nc_R=ndip*(ndip+1)/2;nc_I=ndip...
d9d4c1d432a2f2e08536268d66485f032a8c1ba023c9da54f4e66fe5b7671b93
MATLAB
1,817
66
%% setup fieldtrip restoredefaultpath; addpath(fullfile('fieldtrip')); clear ft_hastoolbox; addpath(fullfile('../engines/fieldtrip')); ft_defaults; %% read STLs csf_file = fullfile('data/110411_csf_remesh.stl'); skull_file = fullfile('data/110411_skull_remesh.stl'); skin_file = fullfile('data/110411_skin_remesh.stl'...
f91f0f03dcfe6c703e3bee9a4d93969547003e2c1cb23f3ccd17f24c328453a8
MATLAB
1,817
65
function [Samp, Sph, EjeF] = spctr(s, FreqRes, SampFreq, FreqRange) % spctr Computes the spectral amplitude and phase % of a signal or matrix of signals 's' based on fft transform. % if 's' is a 2D or 3D matrix, fourier proceed on each column independently. % % NOTE!! Asumes that there are more points than in...
1d59de01e956eee20312fb1c4d544befad897c9ca54dcbebcfaf888e72285ad5
MATLAB
1,818
64
function data1 = setup_MISA_MISA1(M,X,W0,dist_type) nComp = size(W0{M(1)},1); S = cell(1,max(M)); % Cell array: each cell contains a matrix K x C(m). % Each k-th row has 0's and 1's to indicate what sources go within the k-th subspace in dataset m for mm=M % S{mm} = sparse(1:nComp,1:nComp,1,nComp,nComp,nComp); ...
05d85006177cbfbfc4bf0603520bc9cbe7f5862eb985e69ae8b27d15744b364e
MATLAB
1,819
44
%Purpose: Implement Hungarian Matching Algorithm for MSHBM and k-means parcellations %parcellations. %Inputs: MSHBM and k-means parcellations (run directly following %parcellation BEFORE visualization) %Outputs: Individual parcellations with matched values (e.g., network 1 is the same across parcellation methods. % %...
4de66aa2f9cdd47b8489c20a0ee81d20aabeb51de3ad8ec6ba054ae736601d32
MATLAB
1,819
36
function test_DeepTracker_twining() linux_project_file_path = '/groups/branson/bransonlab/apt/unittest/four-points-testing-2025-04-12-with-rois-added-and-fewer-smaller-avi-movies-lightly-trained.lbl' ; [project_file_path, replace_path] = localize_test_project_path(linux_project_file_path) ; [labeler, controlle...
7696699d540a9e9010a50941d6248af2315f2192974d3442937aaee8db00acdb
MATLAB
1,819
44
%Purpose: Implement Hungarian Matching Algorithm for MSHBM and k-means parcellations %parcellations. %Inputs: MSHBM and k-means parcellations (run directly following %parcellation BEFORE visualization) %Outputs: Individual parcellations with matched values (e.g., network 1 is the same across parcellation methods. % %...