sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d3e7297a1a77c77b12f38d59e0083f8d26586f52b5e40fcd21b39087c7b6903b
MATLAB
2,728
61
%% Mutual Information Demo 3 % This demo goes through calculating the mutual information for two % continuous data streams. This example demonstrates the use of predefined % null models. % Data Type: Continuous % Number of Variables: 3 % Information Analysis: Mutual Information % Trial Based or Single Trial: Single Tr...
7484727010c888aa1d15e66526f90018bfb2c12e85c3ed9e4604a62f3bc0f29b
MATLAB
2,729
72
%% PaCER/EXAMPLE_1_1.m - Example file for using PaCER - Precise and Convenient Electrode Reconstruction % to reconstruct precise curved electrode trajectories % and contact locations from post operative CT imaging % of DBS electrodes % % Andreas Husch % ...
c3d08e31ff6668eb043a9a973183c82303e5f63772455e67da47090e64db793d
MATLAB
2,729
73
function CBIG_ASDf_visualizeFactors(inputDir, outputDir, k, scalelim) % CBIG_ASDf_visualizeFactors(inputDir, outputDir, k, scalelim) % % Function to compute factor-specific RSFC patterns and visualize the % factors for K = 2 and 3. % % Input: % - inputDir: % Absolute path to the directory where factor est...
b453a3ecee57276a68ed02d66fe065f343f047e6bb44b69cfcda4ab728821f12
MATLAB
2,730
103
classdef ea_symmat < handle % symmetric matrix object % A. Horn properties (GetAccess='private', SetAccess='private') halfmat=[]; % stored half matrix end properties (SetObservable) size % size of the original matrix end methods function obj=ea_symmat(inmat) % generator function ...
f3f066c2794e70188ac14583d36e036331642422b135e79f47cfc81459a2ff32
MATLAB
2,730
96
function n = palm_effectiven(nP,EE,ISE,islog) % Given a number of shufflings, compute the effective % sample size. % % Usage: % n = palm_effectiven(nP,EE,ISE,islog) % % Inputs: % - nP : Number of shufflings (permutations, sign-flippings % or permutations with sign-flippings). % - EE : Boolean indicati...
7a7f883a378ca69532bc2ffc222e014342924a8d9e3eade386ec626c79259419
MATLAB
2,731
110
% Example 6.6: Comparison of worst-case robust, Tikhonov, and nominal least squares % Section 6.4.2, Figure 6.16 % Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX Argyris Zymnis - 11/27/05 % (a figure is generated) % % Consider the least-squares problem: % minimize ||...
247d60978726a8269db57c4bf25fae49732bfc06289ade94c66c972fd352ca07
MATLAB
2,732
67
function dir_angles = ea_diode_lightmarker(roll,pitch,yaw,marker) vizz = 0; %% create vectors symbolizing the gaps between directional contacts at 60, 270 and 300 degrees % and transform them to match lead trajectory and directional level marker = marker(1:3); ven = [0 0.65 -0.75 ]'; dor = [0 0.65 0.75 ]'; [M,~,~,~] ...
eafe980d5568ee8e70c8d087f2e883c8ed8aae4b4bbf699c747ed5b54e1407ff
MATLAB
2,734
145
function trainmodel %% %scheme = evalin('base','scheme'); d1 = 0.5+(0:0.05:1)*2.5; d2 = 0+(0:0.05:1)*3; d3 = 0.15+(0:0.05:1)*2.5; v = 0:0.05:1; [D1 D2 D3 V] = ndgrid(d1,d2,d3,v); nt = 10^6; D1 = 0.5+rand(nt,1)*2.5; D2 = 0+rand(nt,1)*3; D3 = 0.25+rand(nt,1)*1.5; V = rand(nt,1); %idx = find(abs(D1-(D2+3*D3))<1.5); idx =...
0b9b7bf3dc3d5afff8837db46366202c7bfb870e024955e0e1546e0df6d05ece
MATLAB
2,737
70
function ea_firstrun(handles,options) % check if a newer version is available.. local=ea_getvsn('local',1); web=ea_getvsn('web',1); vcheck=0; if strcmp(local,'Unknown') vcheck=1; elseif ~strcmp(web,'Unknown') vcheck=(local<web); end try if vcheck set(handles.updatebutn,'Visible','on'); set...
13be7ad1cafa1986db12e68ca757eef5b78eb6bf3a9f4d0da9196d3ba69a794c
MATLAB
2,737
74
function [fulltrial,types] = CEM_concat_analysis(thedata,frames) % This is a function form of the script I run to get my concatenated % dF/F data, specifically to process columnar data. % First, navigate to the folder containing the folders of data you want to % concatenate. % example t...
0334f6d307e580d4a96d98c85061171baf73f7ebd75a33c70a837c4d25b53d18
MATLAB
2,739
87
function test_validity_of_datasource(ds) % A helper function that tests whether a given data source returns any of the same data % in the training and test data. Obviously if some of the same data is in the training % and test sets then there are major problems with the datasource! % % The input of this function s...
c84507b5871759ddf5701555fdb6c84f141dddb0a03281fd1f3b1f673218b14b
MATLAB
2,739
69
function [R, scale]=arqr(v, p, mcor) %ARQR QR factorization for least squares estimation of AR model. % % [R, SCALE]=ARQR(v,p,mcor) computes the QR factorization needed in % the least squares estimation of parameters of an AR(p) model. If % the input flag mcor equals one, a vector of intercept terms is % being fitt...
96bfe73023c41476e228d2e0e05102253d1ed1582593f23ac90f946b1d92bdb2
MATLAB
2,740
33
function [matlabbatch]=CalculateVDM(b) %----------------------------------------------------------------------- % Job saved on 15-Jan-2022 16:17:57 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch...
e8cd49c431167ba725fda3b58e666883675e094ac5644a4b2debe9523734c169
MATLAB
2,742
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) 201...
26843c7fd507488129aecfcf577640cf9ddf0ad9d196334e0dafcfcf3c2a0db8
MATLAB
2,743
61
function flags = CBIG_MMLDA_check_example_results(out_dir) % % This function compares the example results saved in <out_dir> with the % reference results. % % Input: % - out_dir: % The output directory where example results are saved. % % Output: % - flags: % flags is logical 5x1 vector that indicat...
d386e2fea2652e36554107bdf9b61de002ea9b0a39e5ce2933e34da3a06b974a
MATLAB
2,743
113
%%********************************************************** %% SDPT3soln_SEDUMIsoln: convert SQLP solution in SDPT3 format to %% SeDuMi format %% %% [xx,yy,zz] = SDPT3soln_SEDUMIsoln(blk,X,y,Z,perm); %% %% usage: load SEDUMI_data_file (containing say, A,b,c,K) %% [blk,At,C,b,perm] = read_s...
243d0b11e6cc466866544f0dc62e0950a5c1eb45f93e8f1bbc8cd3edd416fa7f
MATLAB
2,744
90
function h = nifti(varargin) % Create a NIFTI-1 object %__________________________________________________________________________ % Copyright (C) 2005-2012 Wellcome Trust Centre for Neuroimaging % % $Id: nifti.m 4986 2012-10-05 17:35:09Z guillaume $ switch nargin case 0 hdr = empty_hdr; h = struct('hdr',h...
64199eb11a7f5fb8b6104b3b995f2859be52615b1c52a6f06dbded1bc3ad75ec
MATLAB
2,744
78
%% Left Turns % TO DO THIS, YOU NEED TO RUN THE CONTENT OF COMPUTETURNBOUTS2.M Lturns = {}; leftPB = []; rightPB = []; turnLdata = []; PBcols = []; Ltrials = []; Lflies = []; count = 1; for k = [1,2] % for these trial types A = allflies([allflies.trtype]==k); for n = 1:length(A) for i = 1:leng...
970c7595d2833a0e4e3ab62e9e95a26e12c29d2c57eb02550da06877f62dfe9e
MATLAB
2,746
95
function palm_hemimerge(varargin) % Merge data for lh and rh (left and right hemispheres) into a % single file. Various input files can be given, starting with % 'lh' and/or 'rh'. The script finds the correct pair, removes % repeated files, and merges them into files beginning with 'bh'. % % palm_hemimerge <files> % % ...
2c4c8c00594d8bdf5f177a9d3c95ceea048a13da6647cb07c85a09f884960ae4
MATLAB
2,747
85
% quantile() - computes the quantiles of the data sample from a distribution X % % Description: % If F is the cumulative distribution function (CDF) of X, % the p-th-quantile Qp of distribution X is the value for which holds % F(x) < p, for x < Qp, and % F(x) >...
7360b1cb8b99926e740d1c2a3a061d2d788b62b630e7f473766fdc2d27eb47cc
MATLAB
2,747
52
function outinfo = cifti_diminfo_dense_get_volume_all_info(diminfo, cropped) %function outinfo = cifti_diminfo_dense_get_volume_all_info(diminfo, cropped) % Get information on how to map cifti indices to voxels. % The volsform1 field is adjusted so that 1-based voxel indices (as returned % in voxl...
e3782ca8b8eefbb54947f8fbd4b0aef7ab441f7ffe5feda9400db743a83e7071
MATLAB
2,747
77
function selected = SelectSpikes(spikes,varargin) %SelectSpikes - Discriminate bursts vs single spikes. % % USAGE % % selected = SelectSpikes(spikes,<options>) % % spikes spike times % <options> optional list of property-value pairs (see table below) % % ======================================...
d1a3170e674c4a08c15593a15ad7c005761008f15ef122098094d7ac6d650a52
MATLAB
2,748
54
% Get the visual connectivity for each condition %[featureLabels,selectFeatureMat,conditionFeature,conditionFeatureMat,featureLabelIndex] = getFeatureLabel('C:\Users\yh19218\MATLAB Drive\PG\2_Codes\2019 Autumn\Task 1_Measure Classification\Alpha(LOO)',0.5); map = imread('Empty.tiff'); load('channelPositions.mat') c...
4aedd1147c950e4e4af75954caf564ecdf4eb2275a97eb19c084587953f871a3
MATLAB
2,749
80
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
6839aa956d8e8a9d00bf49428d0a90297787c641746bccd00f0672ee3617bd8f
MATLAB
2,749
61
classdef CBIG_MMLDA_unit_test < matlab.unittest.TestCase % Written by Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md methods (Test) function test_example(testCase) CBIG_CODE_DIR = getenv('CBIG_CODE_DIR'); load(fullfile(CBIG_CODE_DIR...
9d688bfbedadfc8ea9611edd91955bd3e9cb6d1cddd136edf5c53aba4298edf8
MATLAB
2,749
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 EUP...
344208954b8a0a0f991dd8d340ecda36afe9122db42ad5476b1895aa6c5970fd
MATLAB
2,751
67
function [waveformDuration_peakTrough, peakLoc_forDuration, troughLoc_forDuration] = ... computeWaveformDuration_peakTrough(thisWaveform, peakLocs, troughLocs, PKS, TRS, ephys_sample_rate) % COMPUTEWAVEFORMDURATION_PEAKTROUGH Compute waveform duration from peak to trough % This function implements the sophisticated...
070bef992268a89bc7bab532bad626505ab4de28ffcbb1444a9f143ce85dca87
MATLAB
2,752
77
function pvals = palm_datapval(G,Gvals,rev) % Compute the p-values for a set of statistics G, taking % as reference a set of observed values for G, from which % the empirical cumulative distribution function (cdf) is % generated, or using a custom cdf. % % Usage: % pvals = palm_datapval(G,Gvals,rev) % % Inputs: % G ...
1b060af628eceb55254b5b78a790ea663cf089a022e616629dfa10341c201022
MATLAB
2,752
71
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
9a291a94f7d8ef5208639ca2a98310c64acdf10a191eca1d9df2424917886208
MATLAB
2,752
85
function data = AFOFdata_struct_CL_3(inputdata, filenames) % USE THIS FOR EXP9 (CEM) % how it works: % fly = AFOFdata_struct_CL_3(data,filenames) where data and filenames are % outputs from AF_OF_importer() for e = 1:length(inputdata) for t = 1:size(inputdata{e}{1},1) trial.filename = filenames{e};...
425fbf9937d0f7533c28a55c2d1da44b0b85b545d61833dbb1acae17a25cdf63
MATLAB
2,754
76
function [confRadTmp,centerTmp] = estimConfRad(tracks,probDim,confRadMin) %ESTIMCONFRAD estimate confinement radius of tracklets % %INPUT: tracks (.tracksCoordAmpCG) % Matrix indicating the positions and amplitudes % of the tracked features to be plotted. Numb...
c063568c0a17d0ebd5a6d80d76e0c0860d1242ca3ed21436436d45dde3e9cf3e
MATLAB
2,754
76
function trainModel(params, split) % trainModel(params) % % ---------------------------------------------------------------------- % Matlab tools for "Predicting human gaze beyond pixels," Journal of Vision, 2014 % Juan Xu, Ming Jiang, Shuo Wang, Mohan Kankanhalli, Qi Zhao % % Copyright (c) 2014 NUS VIP - Visual Inform...
f8efb0276385255dd9b6c8d9ad28f88e5e9729f045965aec40568aa77c8ad039
MATLAB
2,755
112
xBF = spm_get_bf(struct('dt', 1, 'name', 'hrf (with time and dispersion derivatives)')); % A canonical response hrf = xBF.bf * [1 0 0]'; %[.6 -.6 -1]'; create_figure('hrf'); plot(hrf, 'ko:', 'MarkerSize', 6, 'MarkerFaceColor', [.4 .4 .4], 'LineWidth', 2); set(gca, 'YColor', 'w', 'FontSize', 18); xlabel('Time'); %% ...
1408586987383c0e911e806d3582a1d884479377b273f6bfef1a1a2492442e70
MATLAB
2,756
86
function mov=videoread(fname,varargin) %VIDEOREAD Read an video file in a mannter compatible with Matlab's % built-in AVIREAD function, but using a videoReader object to do % the work instead. % % MOV=VIDEOREAD(FNAME) % Read the video file FNAME into the Matlab movie structure MOV. MOV % h...
5256ae6a003947b812b8479963f232183b63bda477a1352aee72a7b245faf8ce
MATLAB
2,756
85
function ea_mod_tex(fname,options) if exist([fname,'.aux'], 'file') delete([fname,'.aux']); end if exist([fname,'.tex'], 'file') delete([fname,'.tex']); end fID=fopen([fname,'.tex'],'w'); [pth,fn,ext]=fileparts(fname); [~,patientname]=fileparts(pth); % document header: fprintf(fID,'%s\n','\documentclass{a...
8487bdcb8b6a66fd6fab8dc93b9e4211c3d4342133e81c5c158bb9941df9dec8
MATLAB
2,756
69
function obj=stat_density(obj,varargin) % geom_point Displays an smooth density estimate of the data in x % % Example syntax (default arguments): gramm_object.stat_density('function','pdf','kernel','normal','npoints',100) % the 'function','kernel', and 'bandwidth' arguments are the % ones used by the underlying matlab ...
9d6e5879c7bb0a96be929af85ff69817490e08ad7f7b7d8522f7b0ee7db9543b
MATLAB
2,757
72
%% PaCER/EXAMPLE_1_1.m - Example file for using PaCER - Precise and Convenient Electrode Reconstruction % to reconstruct precise curved electrode trajectories % and contact locations from post operative CT imaging % of DBS electrodes % % Andreas Husch % ...
a62e120bf42272c7c2adf8f620d945a53a88a730f16343454c84ba4c94ef7480
MATLAB
2,757
107
function [X, Y, Z] = domain2meshgrid(domain, resolution) %DOMAIN2MESHGRID(domain, resolution) generate meshgrid on parallelepiped % [X, Y] = DOMAIN2MESHGRID(domain, resolution) creates the matrices % X, Y definining a meshgrid covering the 2D rectangular domain % domain = [xmin, xmax, ymin, ymax] with resol...
b00d11a4009268b70c134cdf55c390e28215db9c253cd9dc88c00be80f54763e
MATLAB
2,759
72
function run_tests(varargin) %RUN_TESTS Headless entry point for the NONAN MATLAB test suite. % % From a shell, at the repository root: % matlab -batch "addpath('tests/matlab'); run_tests" % % Optional name filter (substring match on test name): % matlab -batch "addpath('tests/matlab'); run_tests('Surr'...
b867e0538c7da5c6f33d0803595ed7fa2b2b7c1890a8992bfcd2b31eed13343b
MATLAB
2,759
88
function ea_warp_vat(b0rest, options, handles) directory=[options.root,options.patientname,filesep]; if strcmp(b0rest,'rest') % processing rest files b0rest=ea_stripext(options.prefs.rest); end stims=get(handles.vatseed,'String'); stim=stims{get(handles.vatseed,'Value')}; % check which vat-files are present: vat...
1bae0763a732473839bbe034ad5900230eeb1525e4ee842eda0b54b1575b5d6b
MATLAB
2,761
80
function saveNEVTetrodes(NEVFullFilename) % saveNEVTetrodes % % Opens saves a new NEV file and splits it into smaller NEV files % containing only the tetrodes according to the associated CCF file. The % CCF file should have the same name as the data file. % % NEVFullFilename: The full path to the NEV to be opened. %...
bf469df91d3b83d617a0210d264510c35e76c0c0b9ee2a489c06c7d9aadff3e9
MATLAB
2,764
55
% Session data handling functions for FMAToolbox. % % FMAToolbox provides a number of functions to handle data files stored % in the open and hardware-independent <a href="http://neuroscope.sourceforge.net/UserManual/data-files.html">formats</a> used by <a href="http://klusters.sourceforge.net">Klusters</a>, <a href="h...
ff44dc1fa1d62a002fb1f68987b1d642556302b59d51e04d85a9fd94bae18d62
MATLAB
2,765
101
function y=calcRadius8(im,inv_flag,thr,imselect) % Usage ... y=calcRadius(im,inv_flag,thr,imselect) % % This function measures the vessel diameter (in pixels) of im which % is the image only including the vessel to measure % thr(1) is the normalized projection threshold (default=0.5) % additinal arguments include thr(2...
6ab14b8b9a61775696ac608b08e2f6ac91249d7022ba583004c23180784c30a4
MATLAB
2,766
73
function [all_erp_all_midi] = Trinh_MiniTrialMakerAmpEnv(data,note_onsets,code_corresponding_to_midi,n_offsets) % % midi_names = cell with strings containing the names of the files of % interest % code_corresponding_to_midi = trigger codes, present in the FieldTrip % data structure, associated to the midi_names (N...
49c7597d95083b452e8da0be78e1e8ba2e5e12e2479347a3277b81dbbc616caf
MATLAB
2,768
93
function [lab,q] = psdeig(x,K) % [lab,q] = psdeig(x,K) % % PSDEIG Computes spectral coefficients of x w.r.t. K % Arguments "q" is optional - without it's considerably faster. % FLOPS indication: 1.3 nk^3 versus 9.0 nk^3 for nk=500, % 1.5 nk^3 9.8 nk^3 for nk=50. % % ********** INTERNAL ...
869e77820276e9a08772e0cbebf121931f0a33a84035fd822171d7e06c34b790
MATLAB
2,770
70
function nice %NICE Custom plot prettification. % The function NICE is a macro for Matlab graphics settings, and its % behavior depends on the contents of the current axes. % % If the plot contains only 2-D objects (i.e., objects with empty ZData) % NICE sets the Y-limits depending on the data: % ...
f5358a7bef34320972ed7f94d51ed673b98af85dba0f8e59e319d97bb46b6148
MATLAB
2,770
89
function derivative = Diff(samples,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 table below) %...
daca56f9af4998c5ea08760765976a5e935aec205cf975b2bca5562a950c0f1c
MATLAB
2,774
79
function epochs = SelectEpochs(epochs, validepochs, partials) % Takes epochs that exist within valid epochs, % CMBHOME.Utils.SelectEpochs(epochs, validepochs) % % % INPUTS % epochs - Nx2 array, epochs (time1 time2;...) % validepochs - Mx2 array, epochs % partials - (default 1) logical, 1==return pa...
ffa1ef0c470be600ee30e65d871f2ba1d7dbb2202fbc01ebc1496755eb34bb56
MATLAB
2,775
79
function [res, errStr, verStr]= ftrstruct_istype(dataIn, fiberType) %function [res, errStr]= ftrstruct_istype(dataIn, fiberType) % % function determines if dataIn is a valid ftrStruct or fiberStruct. If this is the case, % also the type name is returned as the second return value. % % Type Explanation: % ftrS...
bc2026678632d9790862f83dc8ec321d6916b077a7a18b7f51fd899115266a93
MATLAB
2,777
73
function [AllX,space]=ea_exportefieldmapping(vatlist,obj) EFthresh = 50; templateresolution = .5; if size(vatlist,2)>1 sidesuffices={'_r','_l'}; else sidesuffices={''}; end disp('Need to export Efields in proper format, this may take a while'); outdir=[fileparts(obj.leadgroup),filesep,'sweetspots',filesep,obj.I...
389cf23742cbb19844efeba372a0fecfa78517078355628953bcc6c934fa7024
MATLAB
2,778
111
function [n, nm, nl, ts, names, m] = nex_marker(filename, varname) % nex_marker(filename, varname): Read a marker variable from a .nex file % % [n, nm, nl, ts, names, m] = nex_marker(filename, varname) % % INPUT: % filename - if empty string, will use File Open dialog % varname - variable name % % continu...
4daaa34dd99e2baa2a2197ab95f7664e5050310eb6000be34a496af05627216e
MATLAB
2,779
58
% SOFA API - script demonstrating the usage of variables in the API % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may no...
3edd8ee35ab6b8af43fbf2146fd6114c72aeab017cd2740a0f3b5909a3e48269
MATLAB
2,780
52
function isargchar(varargin) %ISARGCHAR tests if the given arg is a char and returns an error otherwise % % Usage: isargstruct(arg1,arg2,...) % % Input options: % args - list of args % % ISARGCHAR(args) tests if all given args are a char and returns % an error otherwise. % % see also: ...
0dc69709d66d5fce274847089cdb8fe897fecf7d5d568005c559dc3045151726
MATLAB
2,782
94
function [im,info]=readOIS3(fname,imno,prec,do_write) % Usage ... [im,info]=readOIS3(fname,imno,prec,do_write) % prec=[1:uint8,2:uint16,4:single,8:double]; if nargin<4, do_write=0; end; if isempty(do_write), do_write=0; end; do_transp=1; if strcmp(fname(end-2:end),'raw'), if nargin==1, imno=1; end; ...
7f095bc1a373c889fe436f1040142df153d6cd20a60ab187ecc4e9f9274f4b7e
MATLAB
2,782
102
function [ent_samp_value] = ent_samp(data, m, r, flag) %SAMPEN Calculate the sample entropy of a time series. % % ent_samp_value = ent_samp(data, m, r, flag) % % Inputs: % data - A vector containing the time series data. % m - Embedding dimension. % r - Tolerance threshold. If flag is 'prop'...
712b8e190b18f44e2887c2eb487e57e4085d2038fd43c11fe8c292e146f9eb8a
MATLAB
2,783
78
% useage: % printFigs(figNums, folderName) % printFigs(figNums, folderName, format) % printFigs(figNums, folderName, format, fileTitles) % % figNums is just a list of the figure numbers (e.g., 1:10) % if folderName doesn't exist, it will be created, and you will be told % % fileTitles is a cell array of str...
15647287602077c6d61df19aeaf74e56a14f82e0684f581cffeee518ace0e5d9
MATLAB
2,784
101
function [d, ax] = gridDistance(self,Pd,thresh,fromCenter,ifplot) % Calculates and returns the distance from the center Acorr peak to the % % Inputs: self -- CMBObject, function assumes self.cel is set % Pd -- "PeakDistance", the minimum distance between peaks. % Defaults to 7, which works for most ce...
3b4c6f5f0ec569346ceb8724dd943c3a27f4aedb6d057a0a66e1a6ff9c8b1094
MATLAB
2,784
101
%% figure S4 % Consistency of wave motifs across individual sessions. % (A) Awake state: session-level motif frequency with chance level % (B) Anesthetized state: same as (A) load('figureS4_data') %% Parameters n_time = 300; chance_val = n_sessions / n_clus; % 45/7 ~ 6.43 % Colors: gem palette motif_colors = ...
de05e4bb7ccee850f015bfce14ff1142241a35f7447d439caf517bc6a66ff839
MATLAB
2,784
70
function analyzeCalciumExperiment_newThor(headpath,fileexpnum,imskip,expskip,correction,fluor,copy,savemode) %give this function the experimental path you want to start in %and the filename and experiment number (ie vt019532_f3e4) %correction if the motion correction needs to be done, fluor if the dff %hasn't been extr...
09590bb00e4832560fe87183f263389f6dd526c9ec0b3287464cd0405d44e979
MATLAB
2,788
91
%% Add all folders to path addpath(genpath(pwd)); %% Load raw data data = data_WT_raw(); k = 1000; % scaling factor alpha = 0.01; % filtering parameter %% Process all NSC counts and fractions proc = process_NSC_frac_data(data, k, alpha); %% Define scenarios for comparison scenar...
2d1208c2bd65f612751e16b57cf07ccdfd98aeca3595f5fbfcfba1e5faaeeec4
MATLAB
2,788
89
%%****************************************************************** %% randlowranksdp.m : creates random feasible SDP problems where the %% constraint matrices are low-rank matrices of the %% form V*diag(d)*V'. %% %% [blk2,At2,C,b,blk,At] = randlowranksdp(n,m1,m2,r); %% %% blk2,...
7421e8c647eafd247040b1b86c84c6cd31c5f9546460d7aa318930eff20fa8e0
MATLAB
2,789
97
% posact() - Make runica() activations all RMS-positive. % Adjust weights and inverse weight matrix accordingly. % % Usage: >> [actout,winvout,weightsout] = posact(data,weights,sphere) % % Inputs: % data = runica() input data % weights = runica() weights % sphere = runica() sphere {...
f80fb55210c583415fb4aa3852251a702baf495334b6db5a4b95d1086292ef6c
MATLAB
2,789
124
function y = log_sum_exp( x, dim ) %LOG_SUM_EXP CVX internal version. narginchk(1,2); cvx_expert_check( 'log_sum_exp', x ); sx = size( x ); if nargin < 2 || isempty( dim ), dim = cvx_default_dimension( sx ); elseif ~cvx_check_dimension( dim, true ), error( 'Second argument must be a valid dimens...
2f75938e299bb5781d290ff0dc1e978db99fff199792527aabcc7d8117af91d2
MATLAB
2,790
55
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
3323a59c1e37a0204d839bd571161a5855b899a481324c64e876b729a1476917
MATLAB
2,790
65
%% Transfer Entropy Demo 1 % This demo goes through calculating the transfer entropy between 2 % continuous time series with time locked trials. % Data Type: Continuous % Number of Variables: 2 % Information Analysis: Transfer Entropy % Trial Based or Single Trial: Trial Based % Significance Testing: On % Delays: Off ...
380a5f3a11507388a48ab5705ac1f595b8962e08aee0c6868bff513ddc2bcc46
MATLAB
2,790
52
function isargstruct(varargin) %ISARGSTRUCT tests if the given arg is a struct and returns an error otherwise % % Usage: isargstruct(arg1,arg2,...) % % Input options: % args - list of args % % ISARGSTRUCT(args) tests if all given args are a struct and returns % an error otherwise. % % ...
a9b251236cfe9444da32912ff80c9161ec7b429250484834ff5f132e3770c2a4
MATLAB
2,792
111
function [V,t,Err] = evoked(data,Fs,win,width,plt,err) % Function to calculate the evoked response given continuous data in the % form time x channels % Usage [V,t,Err] = evoked(data,Fs,win,width,plt,err) % % Inputs % Note that all times can be in arbitrary units. But the units have to be % consistent. So, if wi...
9ddb1479b658a553d5f50012015c83531cbcea4c8975396bbe9baa77283dd55e
MATLAB
2,793
108
function y = cumprod( x, dim ) % Disciplined geometric programming information for PROD: % CUMPROD(X,DIM) is a vectorized version of multiplication, % so in most cases it would be incompatible with DCPs. Therefore it % has not been implemented to support DCPs. DGPs however support % product...
6e7ee5b1e0cddd0dbe825aa9a3c0fc33b71093edf39b1dd8839df9606a1d8846
MATLAB
2,794
87
%% Example 2 of applying author topic model (AT) % % This example shows how to run the AT Gibbs sampler and extract samples % from the same and different chains. load 'bagofwords_nips'; % load the nips word document dataset load 'authordoc_nips'; % load the author-document pairings for nips load 'words_nips'; ...
7d3e63c714d59f723e385a3a350219e3b65e72209f20f43fc53798452569fdf3
MATLAB
2,794
115
function [HIPshank, ECshank]=getshankECHIP_LV(animal) if strcmp(animal, '3xTg1-1')==1 HIPshank=3;%2 ECshank=5; %5 elseif strcmp(animal, '3xTg1-2')==1 HIPshank=4;%3 ECshank=6; elseif strcmp(animal, 'WT45-2') == 1 HIPshank =3; ECshank =5; elseif strcmp(animal, 'AD-WT-1-0') == 1 ...
a9baafc49a6455090fab34a1353ed97e1b0cdaf0931b803b2ab8ba82e06a82bf
MATLAB
2,795
122
function out = HTML(in,format) %HTML - Create HTML formatted string. % % Important note: Matlab UITables are buggy! Therefore, HTML formatted table % cells will not be rendered satisfactorily (e.g. you will experience problems % with alignment and cell width). This function does not try to compensate for % these b...
7bebe138185ed87d726a20c17ca443ba640cb3bd590d00bf6371338e70db2fde
MATLAB
2,797
72
function [r] = ea_circcorr(y,X,exponent) [~,score] = pca(X); if ~exist('exponent','var') exponent=1.5; end res=ea_nanzscore(ea_resid(score(:,1:5),y)); weights=abs(res).^exponent; cnt=1; chunks=40; % a chunk of 40 seems to be a good speed tradeoff for this operation. %ea_dispercent(0,'Iterating voxels'); nsz=siz...
b1d4f0cfa665ae5fde14ae1d323df882e30b43f6375c143d67bfbf9976f90eea
MATLAB
2,797
83
function CBIG_IndCBM_cifti2nifti(cifti_file, mask_file, output_file, colortable) % CBIG_IndCBM_cifti2nifti(cifti_file, mask_file, output_file, colortable) % % This function write cerebellar parcellation/confidence in cifti file into % a nifti file. % % Input: % - cifti_file: % Path of the cifti file ne...
a3ce9ea7c82950ac88c24a8bc250a56ef00e08b1b4553781361db9dcc3d8e173
MATLAB
2,798
57
function avgCorr = CBIG_ASDf_indivCorr2avgCorr(lh2lh_corr, lh2rh_corr, ... rh2rh_corr, lh2subcor_corr, rh2subcor_corr, subcor2subcor_corr) % avgCorr = CBIG_ASDf_indivCorr2avgCorr(lh2lh_corr, lh2rh_corr, % rh2rh_corr, lh2subcor_corr, rh2subcor_corr, subcor2subcor_corr) % % This function averages hemispheric/subcortica...
0c1d5d5ed193709d282d29e9b44e7ebd322d38883ac526ff1e13942e85766f71
MATLAB
2,799
105
function [zeitgeberTime relativeTime absTime] = bz_getZeitgeberTime(basename,downSampleFactor,samplingRate) % assumes pwd is basepath for now %% get timestamps for recording starts parts = strsplit(basename, '_'); date = parts{end-1}; if strcmp(parts{end},'merge') % if multiple sessions are merged, find the start ti...
388b7082b2428e04a16935c0abb25abbf50cdca04f4650b7adbf36c504065580
MATLAB
2,799
93
function [p_shuf, r_dist] = shuf_test(map1, map2, varargin) % % Usage: % [p_shuf, r_dist] = shuf_test(map1, map2, varargin) % % Description: % Shuf permuation (author: @saratheriver) % % Inputs: % map1 (double array) - One of two map to be correlated % map2 (double array) - The other map to be correlated % % ...
951afedfc98fc955947a08388bf513421780c8809a08f150719d1cbe8646d655
MATLAB
2,799
75
function [up,down] = ZeroCrossings(data,varargin) %ZeroCrossings - Test zero crossings in a given time series. % % This assumes a minimum of 10 samples per positive/negative phase. % % USAGE % % [up,down] = ZeroCrossings(samples,<options>) % % samples an Nx2 matrix of (timestamp,value) pairs % <optio...
e9899557af3f53915080eb8eecaabfd21403cc57f7e5c3d8570e28c53c78fb38
MATLAB
2,800
94
function Par = LoadPar(FileName, varargin) % % LoadPar(FileName) % % loads the specified par file and returns a structure with these elements: % % % % .FileName -> name of file loaded from % % .nChannels -> number of total channels % % .nBits -> number of bits of the file % % .SampleTime -> time, in...
210ab4276746c4047f786fff0d08ffec168f227ff867482ef0643f70dc79500a
MATLAB
2,802
81
% pcsquash() - compress data using Principal Component Analysis (PCA) % into a principal component subspace. To project back % into the original channel space, use pcexpand() % % Usage: % >> [eigenvectors,eigenvalues] = pcsquash(data,ncomps); % >> [eigenvectors,eigenvalues,com...
77240ebd291a9d04bfe03ae25c3368f9472451e95fb46c4eaf094880d79340bf
MATLAB
2,802
73
function varargout = getsamples(filename, varargin) % Read samples from acq file % filename - acq file % varargin - channel names % Returns column vectors of all channel data samples of requested channels. % Example: % [SourceR, EMG_L, EMG_R] = getsamples('myfile.acq', 'SourceR', 'EMG_L', 'EMG_R'); % Note:...
840fb724493a915653e058ed8082954644185ccbd2471ef2314db90a572c6490
MATLAB
2,802
52
function isargfile(varargin) %ISARGFILE tests if the given arg is a file and returns an error otherwise % % Usage: isargfile(arg1,arg2,...) % % Input options: % args - list of args % % ISARGFILE(args) tests if all given args are a file and returns % an error otherwise. % % see also: is...
c571f89f533b69cb0730f3b7effdaa7df06060cf99ab59c873a50eb779ed8744
MATLAB
2,802
82
function [rev,file] = headRev(folders,strs,rec) %HEADREV Retrieve the head revision for specified files % % This function finds the most recently committed file in the specified % folders(s) and returns its revision and filename. The files must % contain the 'Revision' and 'Date' keywords. % % REV = IOSR.SVN....
8943f7ecc57c9e45b4f2434307f69c30c4172af8e47da7165559edd2829bda16
MATLAB
2,803
116
function [a, b] = isintent(this,intent) % Correspondance between fieldnames and NIfTI intent codes % FORMAT ind = isintent(this,intent) % this - GIfTI object % intent - fieldnames % a - indices of found intent(s) % b - indices of dataarrays of found intent(s) %________________________________...
58f125d2f2abaf7ce821271732ac7ab4e145d6bb580689c50d50d71e425551f0
MATLAB
2,804
60
function ea_set_ANN_training(reco_file,stim_folder,minCylindricCurrent,maxCylindricCurrent,minSegmentedCurrent,maxSegmentedCurrent) % Set ANN training parameters and prepare OSS StimSets (Should be moved to GUI) % By Butenko, konstantinmgtu@gmail.com arguments reco_file % Lead-DBS options for ele...
9f7a555bff5574939a0835813a42c63e928a6832ef27f2f468545b08759376a5
MATLAB
2,804
84
function test_layouts %% msgid = 'matlab_bgl:test_layouts'; %% circle_graph_layout X = circle_graph_layout(sparse(4,4)); Y = [1 0; 0 1; -1 0; 0 -1]; if norm(X-Y)>5e-6, error(msgid, 'circle_graph_layout(4) bad coords'); end %% fruchterman_reingold_force_directed_layout G = cycle_graph(10,struct('directed',0)); X = f...
8ecd36766af8d0c492b0cfe6d7448be2a1035740efef33ca5a497c4b684a46c7
MATLAB
2,807
123
function [xyz_minmax, dim] = axes_extremal_xyz(ax) %AXES_EXTREMAL_XYZ Minimum and maximum coordinates of graphics objects. % % usage % [xyz_minmax, dim] = AXES_EXTREMAL_XYZ(ax) % % input % ax = axes object handle % % output % xyz_minmax = coordinate extremals of objects in axes ax % = [xm...
964637525958bc5b46b119ab375cad3fceba59ccbef9eee90529d5a52927da7e
MATLAB
2,808
91
function tree = struct2xml(s,rootname) % STRUCT2XML Convert a structure to an XML tree object % FORMAT tree = struct2xml(s,rootname) % % Convert the structure S into an XML representation TREE (an XMLTree % object) with ROOTNAME as the root tag, if provided. Only conventional % objects (char, numeric) are accepted in S...
ab6a511c0ba913f257e5e3327f7f87dcb7b6f8c9cf1b54bfe34eb5591db51057
MATLAB
2,808
68
function ea_plot_prob_fiber_state(varargin) % example % ea_plot_prob_fiber_state('/media/konstantin/Konstantin/StimFit_Cohort/StimFitBIDS/derivatives/leaddbs/sub-SBN7F4E4/stimulations/native/gs_20230506011354/sub-SBN7F4E4_sim-fiberActivation_model-ossdbs_hemi-L_tract-cerebellothalamic_left.mat', 125) fib...
8b2914279fd1228d5724d9c61f17b2c114fd1b3448f0ba386923ce22ad34e2ff
MATLAB
2,811
91
function tree = struct2xml(s,rootname) % STRUCT2XML Convert a structure to an XML tree object % FORMAT tree = struct2xml(s,rootname) % % Convert the structure S into an XML representation TREE (an XMLTree % object) with ROOTNAME as the root tag, if provided. Only conventional % objects (char, numeric) are accepted in S...
c77e6d3cfc1fec4ee0b5885e5cdd5c46c86ab1b5aaacd43787f62027e5f4d437
MATLAB
2,812
87
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...
1175a8a4824b8647651d686b66c43cc8c604bb2c944ed760b9032d886c9404db
MATLAB
2,815
84
%%******************************************************************* %% detect_ublk: search for implied free variables in linear %% block. %% [blk2,At2,C2,ublkinfo] = detect_ublk(blk,At,C); %% %% i1,i2: indices corresponding to splitting of unrestricted varaibles %% i3 : remaining indices in the linear ...
4abea88e10989d6004867696b08fd1086e693e45c7d971f4463fa2b8f2192e81
MATLAB
2,815
63
%Baseline %load 'StimSM', stimAllTrials'; tstart_i=-2; tstop_i=0; % (StimCombined.m, stimAllTrials.mat) rr1a_percentmeansBase=nanmean(all_rr1a_percent(tt>=tstart_i&tt<tstop_i,:)); rr1a_percentsemBase=nanstd(rr1a_percentmeansBase)/sqrt(size(rr1a_percentmeansBase,2)); yproj2max_percentmeansBase=nanmean(all_yproj2...
3a6df272d3c7b5b8bba103f26011319b90eb2e521637f87c567ad120156e88a0
MATLAB
2,816
67
function ea_get_field_from_csv(ref_image, Field_array_file, Activation_threshold_VTA, sideLabel, outputBasePath, source_index) ea_dispt('Creating nifti header for export...'); % create nifti [~, ~, endian] = computer; switch endian case 'L' endian = 0; case 'B' endian = 1; end % split to corrd...
827e8531f7b4bcafc8de4b030147fb76662a70703a2fab4c7ff7940c09b09727
MATLAB
2,816
87
function data = AFOFdata_struct6(inputdata, filenames) % USE THIS FOR EXP6 (CEM) % how it works: % fly = AFOFdata_struct6(data,filenames) where data and filenames are % outputs from rotoball_importer() for e = 1:length(inputdata) for t = 1:size(inputdata{e}{1},1) trial.filename = filenames{e}; ...
11c918ee2d2ebb9b9cb06cac9af4406a5b3c88a0e544183b6ce1a38975752b77
MATLAB
2,818
69
function lscovalldat(alldat) rhos={}; pvals={}; colours=colormap(hsv(numel(alldat))); %colormap(gray(101)); f=figure; hold on; for k=1:numel(alldat) eightcols=linspace(1,8,numel(alldat{k}.mavgx)); x1=eightcols';%make to column format for lscov y=alldat{k}.ang'; X=[ones(size(x1)) x1]; a=X\y; ...
130d2459191a158087ed35587f6297517494e93f9bcfc44187041b82d8bfc816
MATLAB
2,818
93
%% Fast Spiking Interneuron (FSI) Izhikevich Model Neuron % Produces simulated data for a simple model of a fast spiking interneuron % from Izhikevich 2007, page 299, Figure 8.27. % % Syntax: [mv,spkCt,spkLoc] = simpleModel_FSI(vInput,T,tau,PLOT,nzInput) % % Input: % vInput (1 by number of time steps double vector) -...
3a2a2a35c2eb2a2a4ba33dc3e6651b78730ed009176034d7f381d9151b28ac7c
MATLAB
2,818
91
function p = MultiPlotXY(varargin) %MultiPlotXY - Plot two columns of each input matrix against each other. % % Plot the second column of each input matrix as a function of the first column. % Optionally, alternative pairs of columns can be plotted against each other. % % USAGE % % p = MultiPlotXY(X,columns,Y,colu...
8d6bfe2ea1320a9ec319a3961f8e01aaee8aae65b156fd80c6a9ca96b974bb07
MATLAB
2,818
88
%%******************************************************************* %% HKMpred: Compute (dX,dy,dZ) for the H..K..M direction. %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%******************************************************************* func...
b6f85238055bcbfa90015d81a260aae03663d58531c93a23f23d4ab00ea220d3
MATLAB
2,818
98
%% Getting started: add paths addpath(genpath('/Users/wani/github/canlabrepo/CanlabCore')); %% Reading images (you don't need this part now) % basedir = '/Volumes/engram/labdata/current/BMRK3'; % imgs = filenames(fullfile(basedir, 'Imaging/*/Models/Temp/beta_000[1-5].img')); % mask = fullfile(basedir,'pain_2s_z_val_...
0dcd72ee785381bfac232544e76564e49c72367c1af4a581950a23874aa5bbb1
MATLAB
2,819
115
%% THIS IS an ad hoc script for organizing an existing set of fmri_data objects into % a cell array in DATA_OBJ dofullplot = 1; DATA_OBJ = {}; DATA_OBJ = {ant_Baseline_HH ant_E heat_Baseline_HH heat_E}; n = length(DATA_OBJ); for i = 1:n DAT.imgs{i} = DATA_OBJ{i}.fullpath; end % add placeholder wildcards fo...