sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c04a5158ba05e7e7ae66d0ab93afe863c4c17a56093ada7b511098dd8844a302
MATLAB
2,844
77
%% 非线性(动力学)特征:基于时域的熵 | nonlinear features: time-domain-based entropy %% 样本熵 | Sample Entropy (similar to Approximate 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....
332a17088afaa4da57ccbceadf2c731d6b9ff8219a9a90161e24659f333ccac7
MATLAB
2,847
130
if ~exist('calib_name')|~exist('format_image'), data_calib_no_read; return; end; check_directory; if ~exist('n_ima'), data_calib_no_read; return; end; check_active_images; images_read = active_images; if exist('image_numbers'), first_num = image_numbers(1); end; % Just to fix a minor bug: if ~e...
184d30946db8061b76081e24ee9fc43050004edb47ba39ec930c199fc15362d5
MATLAB
2,848
108
% C = myconv(A,B,...) % One-dimensional correlation/convolution of vector a with filter B % Options: % Type of filtering: % 'corr': perform correlation [default] % 'conv': perform convolution % Output size: % 'same': output vector C is the central part of the correlation that is % the same size as A [default] % 'full':...
d2fc288023b4d0bcf4ca15c8f5c56895ca39c1116bff5008a84f8ade1c760418
MATLAB
2,848
81
function generatePmtkStats() %% Generate an html page showing PMTK3 statistics such as LOC by directory. % % PMTKneedsMatlab %% Settings % This file is from pmtk3.googlecode.com excludeComments = false; %includeMatlabTools = true; directories = {'toolbox', 'demos\bookDemos', 'dem...
0c4b3e33768e0a2766ae3922d1e6781df1c50a7a19c545742afee41e7cb90fb8
MATLAB
2,849
97
function PlotTemplates(spkDat, varargin) % convert waveform data from int16 to double-precision floating point spkDat.waves = double(spkDat.waves); sameScale = true; convertToVolt = true; clustList = setdiff(unique(spkDat.id), 0); clustListIn = clustList; for i = 1:2:length(varargin) switch varargin{i} c...
1fb35fa9745214a126954616b948e1db59e525554bbd303086622dd5e84b6914
MATLAB
2,851
100
%%%Prostate cancer clc;clear all;close all; [file path]=uigetfile('*'); [X X1 X2]=xlsread([path file]); inc=0; for i=1:size(X,2) if(length(find(isnan(X(:,i))))<(size(X,1))/2) inc=inc+1; inn(inc)=i; end end data=X(:,inn); tic data1=knnimpute(data); dd= find(strcmp(X1(1,:...
dfaf1a578bc024a1ce0c82111de158b18fe22cfddaf6f59fa215e8605e74acc7
MATLAB
2,851
81
function fmf_animate( filename, f_start, nframes, incr, flip, cm, aoi ) % fmf_animate( filename, f_start, nframes, incr, flip, cm, aoi ) % % F_START is the starting frame (1-based) [default 1] % NFRAMES is the number of frames to animate [default inf] % INCR is the frame index increment to plot [default 1] % FLIP is a ...
261348318b1765ebb64d5d4f3c458999824ca0b07d15268299caa3af32e677cc
MATLAB
2,852
143
% 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,...
7bda5431a6409db69719cb6fc7f97c1d60a4f4bf1ee17d98ff62e69a60332d8e
MATLAB
2,852
67
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef ContractilityWaveform < Waveform % ContractilityWaveform: Waveform class for contractality data methods function this = ContractilityWaveform(aChannel, aStart, aData, aSource, aSubs...
80027714031df8ed6747e6ac1d005e647683e0f436ac4df7a3a463e95609c8f8
MATLAB
2,852
59
% domain_split_newprocessing.m % 8/24/20 % Sarah West % splits the color mask ICs with multiple regions into % individual regions. Use on the SVd compressed then ICA data. %% load data %close all; clear all num_sources=50; z_score=3.5; a_thr=150; downsample=0; mice={'13'}; %'14';'15'; '20'; '21'; '22'; '23'; '24'}; ...
bd91387bf0ed4016e3106ca6addba991406e929828e2f0467f45125cead4b1ae
MATLAB
2,852
75
tic clear all global trsh m_size trsh = 0.05; m_size = 6; N_exp = 4; ini_arrays; time_max = 100; sim_name = 'Cat loco model results'; read_file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % after parsing the current file of simulation results % we will have simulation time, number of populati...
dbc29f2bb821770ae56aac517e93d002d0e5ab64daf06f48e300d69a937a2786
MATLAB
2,852
129
% Field Trip-related test scripts - Synthetic FT data - Data generation. % % Includes. % FIXME - Assume init has already been called. % % % Configuration. % Burst type definitions. % These are band-agnostic. % Short pulses, not chirped or ramped. burstpeep.trange = [ 1.0 2.0 ]; burstpeep.framp = [ 1.0 1.0 ]; bur...
f65258c6b11e92eeb2b7a061849cc44eb43d87ca59908ff3f6cc71fe2ca5fc07
MATLAB
2,852
84
function cost = getCost(problem, x, storedb, key) % Computes the cost function at x. % % function cost = getCost(problem, x) % function cost = getCost(problem, x, storedb) % function cost = getCost(problem, x, storedb, key) % % Returns the value at x of the cost function described in the problem % structure. %...
fee5e88a5654190b6adc6147078d9f90fe6fd247e2719d0678cdf52c10b76b75
MATLAB
2,852
97
function M = shapefitfactory(VJt) % Linear manifold structure for optimization over the ShapeFit search space % % function M = shapefitfactory(VJt) % % Input: VJt is a matrix of size dxn, such that VJt * ones(n, 1) = 0. % % Returns M, a structure describing the Euclidean space of d-by-n matrices % equipped with...
0fcdc9e732fd42146eae438f282369a88fc3cd1177acca29051b891cad2ff9bd
MATLAB
2,853
66
%% SAT - app_input:: %% helper.filterCharIndex % Name: Phone Kyaw % Date: 09/19/2024 % Description: Remove the char/str row until only one is left in 'data' % and 'char_index', one is intentionally left to split into % trials % Parameters: data - all th...
2351df99fcc91b2113b88bc5ef84d563448a0555d77f82e800e31ecca3f77040
MATLAB
2,854
106
%% sta-plot scratch % Generic Method to plot the interspike interval (ISI) from the 'SpikeTimeCell' % % --> Also called as a method for ppDataCell % --> Future stability upgrades will be needed. % Copyright (C) 2023 Trevor S. Smith % Drexel University College of Medicine % % This program is free software: y...
7d3287168e24a92d5cd5bdc0950b3a5b486e312c8a9b00fb93f88454bc2e5653
MATLAB
2,855
92
function [clu, tree] = run_cluster(features, cfg) % NOTA: este script es un PLAGIO % NO DISTRIBUIR BAJO NINGUNA CIRCUMSTANCIA % % ************************cfg************************ % - fname_in : input file name (doesn't have to exist, most like an output) % - fname : output file % - mintemp : minimum temperature % - ...
f47a1c1f817852f7e8ce53edae348183d27a460214bfb88e9827741ec281e47e
MATLAB
2,855
61
addpath(genpath([pwd '/Utils'])); addpath(genpath([pwd '/Data'])); addpath(genpath([pwd '/SubRoutines'])); clear;close all genotypeName = {'R22D03AD_R20E08DBD Retinal Male','R22D03AD_R20E08DBD Retinal Female',... 'L320 Retinal Male','L320 Retinal Female',... 'L188 Retinal Male','L188 Retinal Female',... 'L219...
fda9503d1e4588782b36d3e94a13f6e85aa5ffc3c627854f152e1b6c1fab15b0
MATLAB
2,855
68
clear close all clc %% Load atlas % path to MRI template - must include hdr and img files atlas = niftiread('/Users/jstrohl/Documents/20230908 Pipelines for neural data analysis/Dependencies/ATLAS-MICE 2/2011-10-30_MRI-template3.hdr', ... '/Users/jstrohl/Documents/20230908 Pipelines for neural data analysis/D...
8f90f7070d5b808bcb432a8fb2372579cb8fe1f8756abe38a48a0dbf336b0c76
MATLAB
2,856
75
% function [Montage] = ExtractMontage (csdFileName, eegLabels) % % This is a generic routine to determine any EEG montage from a *.CSD % ASCII file (cf. Kayser & Tenke, 2006a) using an ordered list of channel % labels (i.e., a cell string array). % % Usage: [ Montage ] = ExtractMontage ( csdFileName, eegLabels )...
08989051ede2fefddcb84e5b389a78ed0cdd9257c590de931a6b6271dc136e0a
MATLAB
2,858
86
sem_name = sprintf('/%s.gc',getenv('USER')); semaphore(sem_name,'open',1); ret = semaphore(sem_name,'getvalue'); if ret ~= 1 semaphore(sem_name,'unlink'); semaphore(sem_name,'open',1); end %fn = fullfile('/mp/nas1/share/ExSEQ/ExSeqAutoFrameA1/3_normalization/exseqautoframea1_round006_ch03SHIFT.tif'); %fn = fu...
717a56c1809b2ffb28c29c382aeea6aca2784cf0b3b8fcd64d98c5c826067671
MATLAB
2,858
66
% Author: Birgit Nierula % nierula@cbs.mpg.de %% Removes stimulus artefact by interpolating from pre (in ms) to post (in ms) % IN: % cnt: continuous signal in eeglab structure % eventType: name of event in trigger channel cnt.event.type % interpol_window_msec: [pre post] -stimulus interpolation time in milliseco...
aa5522c0b9b68f0e180dad95cc75c3f60cefe89e19ffd6ba9beb10ac3d0fe727
MATLAB
2,858
91
function derivative = Diff(samples,timestamps,varargin) %Diff - Differentiate. % % USAGE % % derivative = Diff(samples,<options>) % % samples data to differentiate % measured in number of samples (default = no smoothing) % <options> optional list of property-value pairs (see tab...
c87ecb02307bb2ed342a0aa63c751c88fb2059e7d92dcffdcd441c8d089b8d92
MATLAB
2,859
79
function [x,iflaw] = fmhyp(N,p1,p2) %FMHYP Signal with hyperbolic frequency modulation. % [X,IFLAW]=FMHYP(N,P1,P2) generates a signal with hyperbolic % frequency modulation : X(t) = exp(i.2.pi(F0.t + C/log|t|)) % % N : number of points in time % P1 : if the number of input arguments (NARGIN) is 2, P1 is a % vect...
6d3c5a1671a3e37b91dc37caa6071562777c744a468595291ab0ab82cde4e204
MATLAB
2,860
89
% FluorescenceContinuousAverageHemispheres.m % Sarah West % 8/23/23 function [parameters] = FluorescenceContinuousAverageHemispheres_Inverted(parameters) MessageToUser('Hemisphere averageing ', parameters); data = parameters.data; comparisons_continuous = parameters.comparisons_continuous; variables_...
eb533ca9c381c0f48e2ef16bb2afb95fcd3f6e34c918ccf92c523881dfc7156e
MATLAB
2,860
118
function hout=suptitle(str) %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 % John Cristion 12/13/00 modified % Mark Histed 03/13/04 ...
259818e9a2a5e49e79cbc32a2f0fe9edbbc62abf9db0fa00d9376b88638d7c64
MATLAB
2,861
93
function [latth,X,Y] = plot_lattice_grid(ax,sites,simParam,pcolorArgs) % [h_sites,h_steps,food_start_ph] = plot_arena(ax,sites,simParam,colorMapSites,colorMapSteps,minmaxSiteMarkerSize,minmaxStepLineWidth,siteArgs,stepArgs) if isempty(ax) fh = figure; ax = axes; end if (nargin < 4) || isempt...
cc0bad246aa76e8ed18cd97895258d17d57fe2bd1eaa8df3c9fed47c04e471e2
MATLAB
2,861
79
% Run for ToR-ORd+Land electro-mechanical model % (Margara, F., Wang, Z.J., Levrero-Florencio, F., Santiago, A., Vázquez, M., Bueno-Orovio, A., % and Rodriguez, B. (2020). In-silico human electro-mechanical ventricular modelling and simulation for % drug-induced pro-arrhythmia and inotropic risk assessment. Progress in...
2d95bbfe6c705b7504c5a6b3c4649a8f5602bb7fe5339d4c2ee5f2b6d77b3bc7
MATLAB
2,863
115
%% quadsr % % Trapezoidal rule quadrature (numerical integration) with sub-range specification % % <matlab:open('quadsr.m') code> % %% Syntax % % [q,xrsupp] = quadsr(x,y,xrange) % %% Arguments % % _input_ % % x vector of evaluation points % y vector of values corresponding to x % xrang...
905f9c5d3c78678f8338ed6dc87c807417de1c5b0cac218b044f1d2f258b63cb
MATLAB
2,863
1
function TSsetdefaulteventcodes ( filename ) % TSSETDEFAULTEVENTCODES( filename ) % This function works essentially the same way as TSimporteventcodes % except that the codes are saved to a Matlab preference setting specific % to this computer. Whenever an Experiment is not currently loaded, these % codes will ...
bb92256531e824f556ce0944c2f293beef4b6fe58e055ca25ce8494e940d8208
MATLAB
2,863
86
function [p,f,gridx] = VBA_PPM(m,v,t,form,disp,ha) % computes (and displays) P(x>t|m,v) or 1-P(t1<x<t2|m,v) % FORMAT [p,f,gridx] = VBA_PPM(m,v,t,disp,form) % IN: % - m/v: sufficient statistics of the pdf % -> if form='gaussian', m=E[x] and v=V[x] % -> if form='beta', m=counts for y=1 and v=counts for y=0,...
2b73f8b879c370e5396194e05f5eb98ad58e5eb53a6fc5e973e408c221c6b55b
MATLAB
2,864
80
clear close all rate = 0.25; sigma = [0 10 20 30]; load('D:\Codes\CSCNN\CSCNN_test\phi_suhas\phi_0_25_1089.mat'); addpath(genpath('D:\Codes\CSCNN\BM3D')); addpath(genpath('D:\Codes\CSCNN\TV_AL3\TVAL3_beta2.4')); %Dataset for testing test_images_dir = 'D:\Datasets\CSCNN\Images_for_CS_recon'; test_images = dir...
a417b4c41d27905b6875de7ae5f58302579f19bc4e5acdfb408163d652d53363
MATLAB
2,864
67
function [X,fVal,exitFlag,solverOutput] = exgauss_fit(y) % EXGAUSS_FIT fits the ex-Gaussian distribution to a vector of data % % DESCRIPTION % Optimizes fits between the data (y) and the ex-Gaussian distribution, % using maximum likelihood estimation and a bounded Simplex algorithm. % % SYNTAX % [X,fVal,exitFlag,...
f8ea2a811cc44513ced42cb41284e5b234bf007a439fec80d37f8b52b87ebddb
MATLAB
2,864
82
function digitalIn = process_digitalin(basepath,fs,varargin) % code adapted from getDigitalin.m in neurocode % (https://github.com/ayalab1/neurocode/tree/master/preprocessing) p = inputParser; addParameter(p,'dat_name','digitalin.dat',@ischar) %snlab rig wiring for events addParameter(p,'filter_channels',[1 2 3 4 5 6 ...
0eb3f1fb8de36a027c888914b4f7147ec622f0fa00e468b1453eec438640ce19
MATLAB
2,865
67
function [X,fVal,exitFlag,solverOutput] = exgauss_fit(y) % EXGAUSS_FIT fits the ex-Gaussian distribution to a vector of data % % DESCRIPTION % Optimizes fits between the data (y) and the ex-Gaussian distribution, % using maximum likelihood estimation and a bounded Simplex algorithm. % % SYNTAX % [X,fVal,exitFlag,...
16b5c44757a0bc0cc48b4ad0ec9a510c4055744c99617208b3039d927323fbe7
MATLAB
2,865
75
% This script plots mesh cross-sections and NIfTI data when availble % % Copyright SNM 2017-2022 addpath('../engines/graphics'); addpath('../engines/bem_fmm_engine'); VT = VT1; f = figure('WindowState','maximized'); x = X(1); % Display NIFTI slice I = round(-x/d1d2d3(1) + N1N2N3(1)/2); % minus here! S = squ...
43069a4ca13eb10138bb8e3fdefd9c11430398476d9ca8eaf4845b7993ce8b54
MATLAB
2,866
96
%% Joining old training data with new one datadir = '/home/mayank/work/poseEstimation/headTracking/'; Q = load(fullfile(datadir,'FlyHeadStephenCuratedData_Janelia.mat')); tt = dir(fullfile(datadir,'trainingData_fly*.lbl')); newfiles = {}; for ndx = 1:numel(tt) newfiles{ndx} = fullfile(datadir,tt(ndx).name); end ...
557cbe76acc62bd190c4f24fd3e7b55516ad1b32b0ed63a91d0b6a19237a6718
MATLAB
2,866
122
function [omckk,Tckk,Rckk,H,x,ex,JJ] = compute_extrinsic(x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter,thresh_cond), %compute_extrinsic % %[omckk,Tckk,Rckk,H,x,ex] = compute_extrinsic(x_kk,X_kk,fc,cc,kc,alpha_c) % %Computes the extrinsic parameters attached to a 3D structure X_kk given its projection %on the image plane x_kk and...
2139496e6cd04ba89abdf5584ccf9c83945e1b2ce2ad9af143e2ca0de8de591c
MATLAB
2,867
89
% extractMotorData.m % Sarah West % 11/16/21 % Function that takes the output files from the Arduino serial monitor % during motorized treadmill experiements and saves data as .mat files. function [parameters] = extractMotorData(parameters) putty_flag = parameters.putty_flag; % Display progress message to u...
4e5110dd84f485dcf93a3505a816ab1cb83b1124bb648ff61aac46336e92ba36
MATLAB
2,867
52
function H = readIBWbinheader(FFN); % readIBWbinheader - read BinHeader segment of Igor IBW file % H = readIBWbinheader('foo') reads BinHeader of file Foo.ibw % IBW version 2,5 only MAXDIMS = 4; fid = fopen(FFN,'r'); H.version = fread(fid,1,'int16'); switch H.version, case 2, % typedef struct BinH...
1fbaa2121a9043d5953ec360ecc49103f807e3a8fe4d5650b4b98c0675aa1d3a
MATLAB
2,868
79
function hessfd = getHessianFD(problem, x, d, storedb, key) % Computes an approx. of the Hessian w/ finite differences of the gradient. % % function hessfd = getHessianFD(problem, x, d) % function hessfd = getHessianFD(problem, x, d, storedb) % function hessfd = getHessianFD(problem, x, d, storedb, key) % % Retu...
85347d4cbb41f02dbbd1dbb4e1b7a092b1caef9112c5513f92e2faa154ff9806
MATLAB
2,868
73
function [GTA] = y_GraphTheoreticalAnalysis_bu(G,RandomTimes) % function [GTA] = y_GraphTheoreticalAnalysis_bu(G,RandomTimes) % Perform graph theoretical analysis based on Brain-Connectivity-Toolbox (BCT, http://www.brain-connectivity-toolbox.net) % Input: G - The binary undirected connection matrix % R...
75cb1de9528643c105142498c4a655bcc9cac36a38a2b3013a13a02283d3af78
MATLAB
2,869
61
function h_zoomIn3(handles) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); try h = findobj(handles.imageAxes,'Tag', 'zoomInBox3'); if isempty(h) k = waitforbuttonpress; point1 = get(gca,'CurrentPoint'); % button down detected finalRect ...
c5b63cb6f3c4161938e45a66638e39e8c3b590458ba8d740e5aec66c8d0ef124
MATLAB
2,869
131
function gibbsGaussParamsDemo() % Gibbs sample mu and Sigma given complete observations of an MVN % We use the reading comprehension dataset % from Peter Hoff's book p113 % This file is from pmtk3.googlecode.com %PMTKauthor Emtiyaz Khan %PMTKneedsStatsToolbox iwishrnd data = [59 77 43 39 34 46 32 26 42 38 38 ...
ff5dd670a292be2691f525c35e1cd981a10d68881eb9c4bc178e7a38a5cae3b0
MATLAB
2,870
104
function convexFnHand %% ==================================================================== % Figure 1 % ===================================================================== x = (-10:1:13) + 10; y = convexFn(x); x0 = 3; y0= convexFn(x0); x1 = x0 + 8; x2 = x0 + 17; y2 = c...
c0d5f730ccff0993bbc30b2e5e16395d34c83506d55fca8021bab499e8ce2cf8
MATLAB
2,871
98
% Demo for delay embedding % This demo inverts a model of a linear oscillatory system, which operates % with delays, i.e. its evolution function is of the form: % x(t+1) = f(x(t-delay)), % where the delay can be specific to the entry of the state vector x. % VBA_NLStateSpaceModel.m uses embedding to model such delaye...
de6c0ccb485bd48e7113f957ebc5e93ba9e5d194f0c16f3743be7c6c309d0503
MATLAB
2,871
107
function C = rdivide(A,B) %RDIVIDE Array right division for sparse tensors. % % RDIVIDE(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. % % See also SPTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This i...
12bde6af04738347c3f78beca64c92637ed643ffd90a0a2fcd40afae1b83d678
MATLAB
2,872
85
%% stashiftmat % % Used to generate a 'constant' shift (STA) operator from an SDO matrix. % This is the dpx 'STA' (rowsum of dSDO), then sheared about its center of % mass to produce a 'dSDO' which provides a constant shift (of mu) for the % probability distributions provided. % % % INPUTS % sdomat - The sd...
d0063db64d1c2fc7b54ccd9496fc2994c5d3079e70a2cfd87e98f8eff58a33ba
MATLAB
2,872
94
% Function for editing figure options % <??LAN)<] % % Call from GUI bottom, e.g.: % % editF({'E','Jet'}) % or % uicontrol('Style','pushbutton','Position',[0,0,20,20],'String','E','Callback',{@editF}) % % The string is the specifit function for the bottom % % Avalable options: %...
c7b3bf9d9aed3767234da8e3eec5afc943bfd1a13b3720d50607ecfb33f9c86b
MATLAB
2,873
130
% this function converts data in non .crab formats into % .crab format (an uncompressed HDF5 file) % usage: % % crabsort.convert2crabFormat % crabsort.convert2crabFormat() function convert2crabFormat(options) arguments options.DataDir char = pwd options.UseParallel (1,1) logical = false end allfolders = dir(...
63d3aa71a47b0df9ced8d75ee48585679073c237c7ae5a8c66d2e08b2a2dd066
MATLAB
2,874
80
% This script plots mesh cross-sections and NIfTI data when availble %; % Copyright SNM/WAW 2018-2023 % addpath('../engines/graphics'); VT = VT1; f = figure('WindowState','maximized'); %% below is XY-code z = Z(1); % Display NIFTI slice I = round(z/d1d2d3(3) + N1N2N3(3)/2); S = VT(:, :, I)'; % choose the...
d1f8bdda31b701da805e726e6401193111d06179bb46abf8a1c04db02a298cd6
MATLAB
2,875
91
function ff = prec_rec_plot(precisions, recalls, labels, varargin) % AUTHORSHIP % Math Lead & Primary Developer: Connor Meehan <connor.gw.meehan@gmail.com> % Secondary Developer: Stephen Meehan <swmeehan@stanford.edu> % Bioinformatics Lead: Wayne Moore <wmoore@stanford.edu> % Provided by the Herzenberg Lab ...
6642fa4e21e704e7fed8b8663069de3b414c9c449714aea6a8ebf12e2a9a3f55
MATLAB
2,876
81
lwidth = 1; txt0 = 4600; txt1 = 100; txt2 = IminV+33; txt3 = txt2-17; %% PLOT CONTROL PIC = min(Itotal(1:t_array(2)*10)); PICdesc = min(Itotal(t_array(2)*10+1:length(Itotal))); subplot(5,5,pos1); plot(timeV,IKdr_VC,'g','LineWidth',lwidth); hold on; plot(timeV,IM_VC,'Color',[102,153,102]/256,'LineWidth',lwidth); hold o...
f0b9370fb4052ffcfd782b80ef0c7ea5a0c0d981bf199a99e727ae4676dd97d2
MATLAB
2,876
87
function [dat,baseline] = ft_preproc_baselinecorrect(dat, begsample, endsample) % FT_PREPROC_BASELINECORRECT performs a baseline correction, e.g. using the % prestimulus interval of the data or using the complete data % % Use as % [dat] = ft_preproc_baselinecorrect(dat, begin, end) % where % dat data matrix...
218abd82bab73d38652a4572b0ad9e124ce4a104ee77d72d34b7d7edc077df32
MATLAB
2,877
88
function [x] = ft_struct2double(x, maxdepth) % FT_STRUCT2DOUBLE converts all single precision numeric data in a structure % into double precision. It will also convert plain matrices and % cell-arrays. % % Use as % x = ft_struct2double(x) % % Starting from MATLAB 7.0, you can use single precision data in your % comp...
448c9512980dd38c09d7db1273c932aedba6fab6bccfe3faffcbb70d5120547b
MATLAB
2,877
96
% Demo for colorspace.m - the CIE xyY "tongue" % Pascal Getreuer 2006 N = 800; Nx = round(N*0.736); Ny = round(N*0.84); % Generate colors in the xyY color space x = linspace(0,0.736,Nx); y = linspace(0,0.84,Ny); [xx,yy] = meshgrid(x,y); % i = (xx + yy <= 1.01 & (xx - 0.2)/2 - yy <= 0.02); % Convert from...
4b9bb9e6e1ef0caa81c50fb3576b8eea5d5a36e6ccf8d99aa26de2fc981163cf
MATLAB
2,877
105
%% MH Sampling from a mixture of two 1d Gaussians % using a 1d Gaussian proposal with different sigma. % Based on code by Christophe Andrieu and Nando de Freitas. % This file is from pmtk3.googlecode.com function mcmcGmmDemo() mixweight = [0.3, 0.7]; %mu = [-50, 50]; mu = [-20, 20]; K = 2; Sigma = cat(3, 100, 100)...
83486fb15b28cd17598934261a2aec3a1f3e773c29722c7f02b4dbc4884a56ce
MATLAB
2,877
100
%% var_to_tsdata_nonstat % % Generate random multi-trial non-stationary Gaussian VAR time series % % <matlab:open('var_to_tsdata_nonstat.m') code> % %% Syntax % % X = var_to_tsdata_nonstat(A,SIG,N) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % A ...
a1a75f3bea75a973992c5f6e43a15deac0850dccc27ec9eada6455546e694014
MATLAB
2,877
89
% This is an electrode processor script: it imprints an arbitrary number % of electrodes. % % Copyright SNM GCNP 2012-2024 elec_path = fullfile(dipole_folder,strcat(patno,'_',model_name,'_', ... dipole_name,'_electrodes.mat')); %% load BEM-FMM Engine addpath(fullfile('...
b22efce4c8a0c28fc6055755de48e559e9b8adfc4015d8306e52eb1e5bdfc5c6
MATLAB
2,877
86
function [ ] = saveFiles( ws ) %create a dir for output files and save files in it mkdir(['./output/', ws.params.output_dir]); %% save nifty files template = ws.images.template; %output images are three dimensional; template.hdr.dime.dim(1) = 3; template.hdr.dime.dim(5) = 1; template.img = zeros(size(ws.images.mask)...
276abb0c5b29edf76bd78ff8a2fc69dca64ab0eff996ae12cc85eccec806d200
MATLAB
2,878
108
function newevents = wlProc_getEvParamsUsingHilbert(data, samprate, ... hilmag, hilfreq, hilphase, oldevents, gridsteps) % function newevents = wlProc_getEvParamsUsingHilbert(data, samprate, ... % hilmag, hilfreq, hilphase, oldevents, gridsteps) % % This function estimates oscillatory burst parameters given a list...
55a127b6b3f14d7ac5a5a63c426c0269d54252af9c8f3e00f15c5bd3f7a9e932
MATLAB
2,878
112
function asc = read_eyelink_asc(filename) % READ_EYELINK_ASC reads the header information, input triggers, messages % and all data points from an Eyelink *.asc file % % Use as % asc = read_eyelink_asc(filename) % Copyright (C) 2010-2015, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtrip...
889f2368de2c8fbe3cfa48440d62d6c91f034dd6b85267318841a987771e8bb2
MATLAB
2,878
136
function [inF] = prepare_dcm(A,B,C,D,kernelGroup) % prepares matrices and indices vectors for DCM (without HRF) % function [options] = prepare_fullDCM(A,B,C,D,TR,microDT,homogeneous) % IN: % - A: binary matrix indicating where the connections are % - B: cell-array of binary matrices of modulatory effects % - C: b...
8ec9be0d334d4a0c3d0c661af80aeadd1bde8a78f8b64710a104578a005260c8
MATLAB
2,880
98
%% plot a representative single-trial with ephys + calcium %% clear %load data load('D:\InVivo\Imaging\2022-08-23_Grids-Imaging\FOV1-225um\imaging\trialDf.mat'); load('D:\InVivo\Imaging\2022-08-23_Grids-Imaging\FOV1-225um\ephys\Grid-LFP-DS.mat'); gridMapping = [15 0 16 31 ... 1 14 30 17 .....
227698c5afc1b8a85001c18a4718e396d69af291538ebedde9d6cce3d44418f7
MATLAB
2,881
80
function dataout = ft_annotate(cfg, datain) % FT_ANNOTATE returns the same output data as the user has provided as input, but allows % to add comments to that data structure. These comments are stored along with the other % provenance information and can be displayed with FT_ANALYSISPIPELINE. Adding comments % is espe...
8ba4c2c5dc639e684375669b1558ee01e7109b3e79056678c9d21c0523928fab
MATLAB
2,881
75
function checkretraction(M, x, v) % Check the order of agreement of a retraction with an exponential. % % function checkretraction(M) % function checkretraction(M, x) % function checkretraction(M, x, v) % % checkretraction performs a numerical test to check the order of agreement % between the retraction and t...
9c8c2427e43784122cb7ea9469010ab8e182b26978eba1f384cc9c55448026af
MATLAB
2,881
116
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % shows or hides axes based on self.common.show_hide_channels function showHideAxes(self, bottom_...
39327a73a6956d7c0e2da1da7ede8b0e3c2d44ee636b79fb5a252732a2f99de7
MATLAB
2,882
81
function rawData = readHSD( fn, numWires, dataOffset, Fs, timeLimits, varargin ) % function to read in raw data from an hsd/hsdw file given the filename, % number of channels, data offset, sampling rate, and timelimits % % data = readHSD(filename, numWires, dataOffset, Fs, timeLimits, varargin) % % INPUTS: % fn = nam...
d173f7d833dc1d82ac0601424ced844fea9ddff6a0e6682ee3166920027c003c
MATLAB
2,882
107
function [points, pos, indx] = intersect_line(pnt, tri, pnt1, pnt2) % INTERSECT_LINE finds the intersection points between a mesh and a line. % % Use as: % [points, pos, indx] = intersect_line(pnt, tri, pnt1, pnt2) % % Where pnt (Nx3) and tri (Mx3) define the mesh, and pnt1 (1x3) and pnt2 % (1x3) define the line. T...
5b180cb2b8dd9d3b5ed3a04594da647003fd94034506758ac3e77b7c119deef0
MATLAB
2,883
57
%% Apply a new atlas to an image % Here the atlas HCPex_SUIT_AGBT was applied to the PET scan, % which means that the scan was masked. % Each parcel of the new image is now the average voxel intensity % of the corresponding parcel on the PET scan. % 08.04.2022 - JVH %% SPM is needed for Lead DBS, which we use to read ...
bb5b8a4c90c6fb04ef92bbfed303a62502d8662c3a7a28a0c09ac5670cc5df70
MATLAB
2,883
123
function dx = DF(t,x) global mV12 mk mtau mtauV12 mtauk hV12 hk htau htauV12 htauk global mpV12 mpk mptau mptauV12 mptauk hpV12 hpk hptau hptauV12 hptauk global nV12 nk ntau ntauV12 ntauk global nMV12 nMk nMtau nMtauV12 nMtauk global aKCa bKCa lambdaKCa tauKCa global qV12 qk qtau zV12...
c1edc92f9c2dc4421cf3ce6fcc6cfe64c8dd251afc5210bcdc9efef457289c37
MATLAB
2,883
96
%% Empirical Bayes for hierarchical Binomial model % Based on % https://docs.pymc.io/notebooks/GLM-hierarchical-binominal-model.html % which is based on BDA p102 clear data data.y = [0 0 2 0 1 1 0 2 1 3 0 1 1 1 54 0 0 1 3 0]; data.n = [1083 855 3461 657 1208 1025 527 1668 583 582 917 857 ... 680 917 53637 874 39...
01c1e71906a538780f106b42f8c829fa93fc884efcc414adf162285de2a2e7e8
MATLAB
2,884
93
function [naf,tau,xi]=ambifunb(x,tau,N,trace); %AMBIFUNB Narrow-band ambiguity function. % [NAF,TAU,XI]=AMBIFUNB(X,TAU,N,TRACE) computes the narrow-band % ambiguity function of a signal X, or the cross-ambiguity % function between two signals. % % X : signal if auto-AF, or [X1,X2] if cross-AF (length(X)=Nx). % T...
2fdf5d8e96536d3c0cb30e13d5197a57c184f966ab4bc876f4a70e765ae992fe
MATLAB
2,884
61
%% 功率谱密度 | power spectral density %% 参数方法-AutoRegression model-burg法 % 使用AR模型中的burg方法[pxx,f] = pwelch(x,window,noverlap,nfft,fs)进行功率谱估计 % 调用调用bandpower(pxx, f, [f_low, f_high], 'psd')提取相对average band power特征 % 由于相同order下的pburg和pyulear得到的pxx估计基本完全相同,所以只使用其中一种 % X: single channel EEG signal (either a row vector or a colu...
31477aac9717f1f90ff8e77df0b643fe93acbc8e5989e6b1258ee37a56f37a4c
MATLAB
2,884
105
%models = [1 2 3]; models = 4; n = [30 50 100]; reps = 100; tic; for i = 1:length(models) for j = 1:length(n) for k = 1:reps x = randn(n(j),2); if models(i) == 1 y1 = log(abs(randn(n(j),2))); y2 = log(abs(randn(n(j),2))); elseif models(i) == 2 ...
2933ea1b3767e515fc15628ff6daec847e30809c71e624dae1e9897cafff299d
MATLAB
2,885
84
function [rm, pm, tm, cellidxm] = createSpatialMatrices(animalprefix, hpidx, loadDir, day, eprun, modelParam) % [rm, pm, tm, cellidxm] = decode.createSpatialMatrices(animalprefix, day, epoch); % %-----create the ratemaps [nPosBin x nHPCells]-----% % rm: ratemap matrix % pm: position matrix % tm: track matrix % cellidxm...
3d481993d6adff4c77c9032e853ccd735a746eaa46f84a1683742cd4dc7c5817
MATLAB
2,885
101
%% Cramer-Von Mises % Here, we measure the 'goodness of fit' between an EDF (observed) and % model(s) pdf to give as a proxy for likelihood of observation of a % probability distribution as a fundamental object (i.e. we are measuring % the probability of observing a -distribution- rather than the probability % of ...
1f22f25d2dd33cfb88dadb3a37a95b50936bd427d8294d9a33ebdf33c81e663f
MATLAB
2,886
86
clear all; close all; clc %Loads the dataset load 'dataset_MPPT_references.mat' %Extracts the variables Irradiance (Ir), Panel Temperature (Tc), MPP Voltage (V_MPP) and MPP Current (I_MPP) Ir=data(:,1); Tc=data(:,2); V_MPP=data(:,3); I_MPP=data(:,4); % The input variables to perform the regressions...
5473b7e6b53f53a0d2f1009eeaa729295f2f1cdc9df8509afaac3c38349c39be
MATLAB
2,888
86
function View_Clear_Brain_ROI_Corr_Multi(Anat,IM,M,Pnn,Proi,C,Pmax,params,g) % % This function draws ROIs on the brain and connecting rods colored by sign % of correlation values in C. This can be the fc correlation itself if that % is passed, or it can be the correlation of brain fc with behavior if that % matrix is...
0a377605fe4f177cd4cb168986ca496d26cc0d200d3707420a2d273cb132220b
MATLAB
2,891
99
function M = euclideancomplexfactory(m, n) % Returns a manifold struct to optimize over complex matrices. % % function M = euclideancomplexfactory(m) % function M = euclideancomplexfactory(m, n) % function M = euclideancomplexfactory([n1, n2, ...]) % % Returns M, a structure describing the vector space of comple...
45d19e82da1a2fe628c4b77715694c04d34ae6fe1cfe677ec4c6e7d8b94f82fa
MATLAB
2,895
79
function plotiqr(X, varargin) [annotate] = process_options(varargin, 'annotate', false); sigma = std(X); iqrplot = axes('Position', [0.1, 0.6, 0.8, 0.3]); distplot = axes('Position', [0.1, 0.1, 0.8, 0.4]); set(iqrplot,'YTick',[]); switch class(X) case 'double' % Data is simply numeric % This file is from p...
7c608278194f5f759fb9191f8cc17d2193d9af78f97e5e1809fb50b1e1ad8c8c
MATLAB
2,895
85
function [x,t] = tfristft(tfr,t,h,trace); %TFRISTFT Inverse Short time Fourier transform. % [X,T]=TFRSTFT(tfr,T,H,TRACE) computes the inverse short-time % Fourier transform of a discrete-time signal X. This function % may be used for time-frequency synthesis of signals. % % X : signal. % T : time instant(s) ...
abb3e6538faf3a8ac74f6aed6b39af93ec178ff43baeace6a01abb509187dc0a
MATLAB
2,895
102
%% Spread orientation % Author: Antonio Martinez Sanchez % I: Segmented (binary) input tomogram % V: input normal vectors (unoriented) % p: initial point % n: initial normal vector (should have 1 norm) % N: output normal vectors function [N,H] = spreador( I, V, p, n ) %% Initialization [Nx,Ny,Nz] = size( I ); N = zero...
4de4747ba0df85209be980aae06ce6c1fc393308741823834db6f5f80350c375
MATLAB
2,897
118
clear clc res=2; dur=66; all_trials.glm_dd=nan(dur/res,3495); all_trials.glm_df=nan(dur/res,3495); all_trials.glm_fd=nan(dur/res,3495); all_trials.glm_ff=nan(dur/res,3495); all_trials.glm_time=nan(length(-1:res/100:2),3495); all_trials.glm_context=nan(length(-1:res/100:2),3495); all_trials.glm_choice=nan(length(-1:...
94dc59b03152b498d37423cec43637141dc44893ec09c9f59722c03211d53ac1
MATLAB
2,897
59
function [curr_dat_sz, curr_lab_sz] = store2hdf5(filename, data, labels, create, startloc, chunksz) % *data* is W*H*C*N matrix of images should be normalized (e.g. to lie between 0 and 1) beforehand % *label* is D*N matrix of labels (D labels per sample) % *create* [0/1] specifies whether to create file newly ...
1588a2064f7bc63875d52c4e2f04f25063d2ec2bfdd098889e5ae8fed94bdf6d
MATLAB
2,898
96
function info =mha_read_header(filename) % Function for reading the header of a Insight Meta-Image (.mha,.mhd) file % % info = mha_read_header(filename); % % examples: % 1, info=mha_read_header() % 2, info=mha_read_header('volume.mha'); if(exist('filename','var')==0) [filename, pathname] = uigetfile('*.mha', '...
3002f14ec74e9a3ae2b1fb7c64c0e408d17b5daa6c4322f9919308f7de44291b
MATLAB
2,898
82
function tsq = read_tdt_tsq(filename, begblock, endblock) % READ_TDT_TSQ reads the headers from a Tucker_Davis_technologies TSQ file % % tsq file is a heap of event headers, which is ?40 byte each, % ordered strictly by time % % Use as % tsq = read_tdt_tsq(filename, begblock, endblock) % Copyright (C) 2010, Robert ...
556e9d3b4e0b9097c4ce82bc4f91350bda7af7e74e0086721d712a391ee93208
MATLAB
2,899
74
function SOImask = SOImask3D(mesh, onionOpts, maskSize) % this function was used to check that 2D methods correctly sum % intensity % % SOImask = SOImask3D(mesh, onionOpts, maskSize) % % SOImask: binary mask % % mesh: structure with field f, v, vn for faces, vertices, % ...
30c402d77b05145c53f82e538e5c9248cfb8aee545cae2fe1a84c91c18ca8788
MATLAB
2,900
99
function outdata = luisFilter(data, TR, cutoff, verbose) % This is a low pass FIR filter using the Parks Mclellan design algorithm % The phase introduced by the filter is linear and is un-done by % filtering the data again, backwards % if you want to see what it does to the data, use verbose=1 % if just want to filte...
613be4f5ffc04e8e8c3c81c58bb7f18f831e44ecfdfdc030cc010c957dde761e
MATLAB
2,900
81
function dataout = ft_annotate(cfg, datain) % FT_ANNOTATE returns the same output data as the user has provided as input, but allows % to add comments to that data structure. These comments are stored along with the other % provenance information and can be displayed with FT_ANALYSISPIPELINE. Adding comments % is espe...
15a133a9f72e1d5fd7ce5f84f00e06efd4e4d023e2e7fc9e0eba6d7024328f94
MATLAB
2,902
85
function M = obj_read(filename) % Read Wavefront OBJ-formatted data from disk % FORMAT M = obj_read(filename) % % filename - OBJ-formatted file name % M - data structure %__________________________________________________________________________ % % Wavefront OBJ Format Specification: % https://en.wikipedia.org...
de9ce3b4374bf7d5f61df86b8df83ae7ec94999adcabeb23bf352ebf7e9e24d1
MATLAB
2,902
83
function ft_select_voxel(handle, eventdata, varargin) % FT_SELECT_VOXEL is a helper function that can be used as callback function % in a figure. It allows the user to select a voxel from a (resliced) 3-D volume. % % Use as % voxel = ft_select_voxel(h, eventdata, ...) % The first two arguments are automatically pass...
58626120ebdc1abae4e42274994da637c94803f7448594aa655b23b72af3eaf7
MATLAB
2,903
94
function [Va] = volumewrite_spm(filename, data, transform, spmversion) % VOLUMEWRITE_SPM writes anatomical or functional MRI volume data to analyze or nifti format % using the SPM toolbox. % % Use as % [Va] = volumewrite_spm(filename, data, transform) % Copyright (C) 2006, Robert Oostenveld % Copyright (C) 2011, Ja...
ded5341b6294b1f1577a99da7c12d6f17715a9ba89347104dbb9544d2ccb50af
MATLAB
2,903
86
% this small class will count the number of images in a camera ttl trace % it will also get the image on which a puff starts and ends %input a camera trace cut off just after the last image for max efficiency function [num_imgs, steps] = count_images_get_vSteps (camera, voltage, numswps) dps = size (camera, 1); sdv...
350ec77445d3dc385c8ea6a35bc65e1890f92180c74ff4d7c51906e76bddb4f5
MATLAB
2,904
80
function [ titleStr, settings, results ] = graphDomainToLabel( dataview, settings ) % Creates an indicator variable that is 1 only for points inside the % domain of the given graph. % % The current pointfilter has no effect. % % If no variable name is provided, domain will be named domain_...
140f4ef49f16302627dfb71646808436645f4e06d16b42db7e5bef87884b1238
MATLAB
2,905
106
function [cs,csn,nave]=data2bs_event(data,segleng,segshift,epleng,freqpairs,para); % calculates bispectral-tensors from data for event-related measurement % % usage: [cs,nave]=data2bs_event(data,segleng,segshift,epleng,freqpairs,para); % % input: % data: ndat times nchan matrix each colum is the time-series in one % ...
2abbdf9fabfd11e86046b2395e8d86dd216c306c300a0c638ef79b496caa9e3e
MATLAB
2,905
120
function h = scattercloud(x,y,n,l,clm,cmap) %SCATTERCLOUD display density of scatter data % SCATTERCLOUD(X,Y) creates a scatterplot of X and Y, displayed over a % surface representing the smoothed density of the points. The density is % determined with a 2D histogram, using 25 equally spaced bins in both % dir...
5c05f57f8c3eb23ba25afd9bff4a5bf868ff5fac4e3300c06050c6467c9d59a5
MATLAB
2,905
82
function parameters=list_of_parameters %for place field calculations % parameters.speed_threshold=.5; %should be 2 cm/s % parameters.place_field_smoothing=21; % parameters.min_smooth_peak=1; % parameters.min_raw_peak=1; % parameters.max_mean_rate=1; parameters.MUA_filter_length= 41; % in samples (ms) parameters.MUA...
6731c227ca0b1857bc79337476ce829fd0b701d6aef0091e9965565ffcd57519
MATLAB
2,906
81
%% addpaths and load variables addpath C:\Code\wjn_toolbox-master addpath C:\Code\spm12 addpath(genpath('C:\Code\leaddbs')) % run ECoG_Atlas_data file % run create_master_table file % to load all vars value = '_maximum_peak_amplitude'; % strings of all the names of the frequency bands freqbands = strrep(info.range_v...
7edf034699bf6041b0a4251629aea1087d6618828c5481574443db544ff84637
MATLAB
2,906
71
function varargout = pvalue_stddev_of_uniform_angle_less_than_S(S,N,n_sample,n_bins,nbins_filter,use_rho_filtered_for_p,return_distribution) % this function gives a numerical estimate of the probability p that the standard deviation s of N uniformly % distributed variables (with zero mean) is less than or equal to S % ...