sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
d5ecb25bf5a767b72085d26df5ba665bb462942f58cdd32c42026e16f40968ac | MATLAB | 4,212 | 170 | function data = fun_interpolate_data(data, chans, badchans, varargin)
% Interpolate data on bad channles based on the activity and locations of
% other electrodes using a spherical spline method. Based on code found in:
%
% Cohen MX (2014). Analyzing Neural Time Series Data. MIT Press
%
% Required inputs:
%
% data: A ... |
5b455736a718af910c7cebdc6aeddf2f3d9f40cd0e9b7e5dbfa3fb5dfee256dc | MATLAB | 4,219 | 98 | function [fibsvalBin, fibsvalSum, fibsvalMean, fibsvalPeak, fibsval5Peak, fibcell, connFiberInd, totalFibers] = ea_fiberfiltering_calcvals(vatlist, cfile, thresh)
% Calculate fiber connection values based on the VATs and the connectome
disp('Load Connectome...');
load(cfile, 'fibers', 'idx');
prefs = ea_prefs;
if ~ex... |
8457de3c0420b05275ecaf7fe9daa77e1d3b0b8f5ff8207aeba49d4f8a9058df | MATLAB | 4,219 | 129 | function h = SideAxes(a,location,s,varargin)
%SideAxes - Add side axes to existing axes.
%
% USAGE
%
% h = SideAxes(a,location,s,<options>)
%
% Using cell arrays will overlay variable pairs.
%
% a optional target axes (default = gca)
% s size, as proportion of target axes
% lo... |
12136d9bcfdf3581e0d50cd7e4c2b71dcf6cf4eb0da0d8debe9b3d567881aa8d | MATLAB | 4,220 | 82 | clear
gcp;
name = 'granule_love2.tif';
if ~exist(name,'file') % download file if it doesn't exist in the directory
url = 'https://www.dropbox.com/s/mjmtwn4pdgydkny/granule_love2.tif.zip?dl=1';
filename = 'granule_love2.tif.zip';
fprintf('downloading the file...');
outfilename = websave(filename,url);
... |
9ec42f3a9bcd7976935e54090a8b0601e38364e24ef7f91ae5154af02e6906b7 | MATLAB | 4,222 | 137 | function Br = palm_reindex(varargin)
% Reindexes blocks so that each is numbered natural numbers,
% starting from 1. There are two pure possibilities: the numbering
% goes continuously for each level, crossing block definitions,
% or it restarts at 1 for each new block. A third method is a
% mixture of both, i.e., it r... |
56f2cd154d8c364721207b578a48da1d21b43015724d6a69697fac7a05e2eee5 | MATLAB | 4,224 | 116 | % eeg_eval() - apply eeglab function to a collection of input datasets
%
% Usage:
% >> OUTEEG = eeg_eval(funcname, INEEG, 'key1', value1, 'key2', value2 ...);
%
% Inputs:
% funcname - [string] name of the function
% INEEG - EEGLAB input dataset(s)
%
% Optional inputs
% 'params' - [cell array] ... |
fbcfc938efa9fffb2fc03bb01530b1dbbc049f2b7c9223c679d0027965262f66 | MATLAB | 4,226 | 77 | function DECODING_RESULTS = save_more_decoding_measures(cv, DECODING_RESULTS)
% A private method for standard_resample_CV that calculates additional decoding results and stdevs values
% based on the original decoding results. This function is called at the end of the decoding
% procedure (since these results are de... |
5fdc9aae2893c972085e5edf8e4424255b256e938a17944a490852da0b5b8e94 | MATLAB | 4,227 | 117 | function [ ] = calc_linear_stability( cfg )
% This file is a part of the MDSINE program.
%
% MDSINE: Microbial Dynamical Systems INference Engine
% Infers dynamical systems models from microbiome time-series datasets, and
% predicts biologically relevant behaviors of the ecosystems.
% Copyright (C) 2015 Vanni Bucci, Ge... |
3e509327a07310dfa9365c831b0e3e944add4e474a12cbd30861be3c7dbc11ed | MATLAB | 4,228 | 105 | function [V, max_force] = vm_minimize_LE(V, C, KP, P0, KA, A0, max_relaxation_steps, force_tol, strain)
% VM_MINIMIZE_LE Relax vertex positions to (local) mechanical equilibrium
% using the FIRE algorithm, under Lees-Edwards (sheared) periodic
% boundary conditions.
%
% [V, max_force] = VM_MINIMIZE_LE(V, C, KP, P0, ... |
58bee490e0f14cfdb0c4694e2943ac2844f1865cb1a89236bcbc87497c6dcbdb | MATLAB | 4,228 | 127 | %%*******************************************************************
%% detect_lblk: detect diagonal blocks in the SDP data.
%%
%% [blk,At,C,diagblkinfo,blockchange,parbarrier,X,Z] = ...
%% detect_lblk(blk,At,C,b,parbarrier,X,Z);
%%
%% SDPT3: version 3.1
%% Copyright (c) 1997 by
%% K.C. Toh, M.J. Todd, R.H. ... |
dbc204802c577dae9f281779ce89a6336f08007c85874afe4471044e50c90e72 | MATLAB | 4,231 | 103 | % Concept:
% --------------------------------------------------------------------
% This walkthrough explains how to do a "pattern of interest" (POI) analysis
% using an a priori multivariate pattern. It generalizes the "region of
% interest" (ROI) approach. ROI analyses usually involve averaging signal
% over ... |
2c0e1dcda29a6176c6cc257e0e72f3eef160411ff397db951281cb7c59fbf3db | MATLAB | 4,232 | 117 | % % written by Yiyuan Han, Essex BCI-NE Lab
classes = ['O' 'H' 'W' 'S'];
classNum = length(classes);
parIndices = find((ismember(blockTagsAC(:,1),validParticipants))&(ismember(blockTagsAC(:,2),classes)));
classTrials = blockDatasetAC(:,:,parIndices);
classtags = blockTagsAC(parIndices,:);
%% Extract the features in fou... |
4756fa5f2ad289453f68fa9cf21d3b1a16278946f5544fb1c4f825b05b346a91 | MATLAB | 4,233 | 116 | function [lfp,indices] = GetLFP(channels,varargin)
%GetLFP - Get local field potentials.
%
% Load local field potentials from disk (unlike spikes or positions, LFP data
% is usually too large to keep in memory).
%
% USAGE
%
% [lfp,indices] = GetLFP(channels,<options>)
%
% channels list of channels to lo... |
0cd9690900184f9364f5761131a13a1aa5e088445d1a176af85b6208e0ccd0ed | MATLAB | 4,239 | 148 | function [finalMean, stdSample, inlierIdx, outlierIdx] = ea_robustmean(data,dim,k,fit)
%ROBUSTMEAN calculates mean and standard deviation discarding outliers
%
% SYNOPSIS [finalMean, stdSample, inlierIdx, outlierIdx] = robustMean(data,dim,k,fit)
%
% INPUT data : input data
% dim : (opt) dimension along whi... |
27d5fd62f87bf0d775e10ee6b7ebdde97622f5fd5a479881798ac380ae383cbb | MATLAB | 4,240 | 78 | function [S,t,f,R,Serr]=mtspecgramtrigpt(data,E,win,movingwin,params,fscorr)
% Multi-taper event triggered time-frequency spectrum - point process times
%
% Usage:
%
% [S,t,f,R,Serr]=mtspecgramtrigpt(data,E,win,movingwin,params,fscorr)
% Input:
% data (univariate spike data -1d structure array of s... |
e2ffec45e97cb4f75bf5fffa8eab3aac16c01deb95785e9f673fe1714a394541 | MATLAB | 4,241 | 91 | function [binned_data_spike_counts binned_labels binned_site_info] = load_binned_data_and_convert_firing_rates_to_spike_counts(binned_data_file_name, bin_width)
% This function allows one to load binned-format data and convert the binned_data for each site into spike counts.
% The reason this function is needed is... |
8611829f86e0be2278dfd4f2d4a0c1d297c14aa06e699e80d0a9bcbb8622c49a | MATLAB | 4,243 | 92 | function [avgfluorperiod]=fluormean_old(avgfluor,framerate,full,integrate)%this would be better if I took the mean of each trial and then averaged that and put the error on it right? I guess I have the std from before that I could just slap on
%chan
%change mean to integrate under the curve (trapz)
%change the base to ... |
115c0fb0ed715a42849c0fed6f46dfae90234ef90bf98ef58b3595721ee4e890 | MATLAB | 4,244 | 91 | %% Example: this demonstrates the 60th replay candidate from CA1 session 3
% Load data
load('pMat_CA1_session3.mat'); % Pairwise probability matrix (GLM-based)
load('candidate_CA1_session3.mat'); % Detected replay candidates
n_ne = size(x2_pMat_glm, 1); % Number of neurons in the session
x2_sync_e = can... |
58609f309aa854589bb2f88d93f60fa524792f1eef433538f01cbb7a7502d7dc | MATLAB | 4,245 | 151 | function [betanonp, tstats, Fnp, PValues, itration, SRWRfull, PValueF]=ea_nonparamreg(y,x)
%________________ Nonparametric Regression Estimation _____________________
% Inputs:
% x as vectors of independent variables. (without vector of ones) and
% y as a vector dependent variable.
% Outputs:
% betanonp is th... |
13b5efc1cdd5ba00b70de6cc1b5f9bfc624433c2090854cc38d4e4b30c36b2f4 | MATLAB | 4,248 | 134 | % pophelp() - Same as matlab HTHELP but does not crash under windows.
%
% Usage: >> pophelp( function );
% >> pophelp( function, nonmatlab );
%
% Inputs:
% function - string for a Matlab function name
% (with or without the '.m' extension).
% nonmatlab - [0|1], 1 the file is not a Matlab file... |
e1e9ae95011976c5ddc024b744956c35933f803bb525c62367f4095228dfc52c | MATLAB | 4,248 | 139 | function [lfpwhiten] = bz_whitenLFP(lfp,varargin)
% [y, ARmodel] = bz_whitenLFP(lfp,varargin)
% Whiten an lfp signal using an autoregresive model.
% Requires the external package 'arfit'
% INPUT
% lfp a buzcode structure with fields lfp.data,
% lfp.times... |
28b916814e09162380d18fb1bdc4d57e5c90d07eeb5dbc72700cea50270125fe | MATLAB | 4,249 | 111 | function [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossSpecMatc(data,win,params)
% Multi-taper cross-spectral matrix - another routine, allows for multiple trials and channels
% Does not do confidence intervals. Also this routine always averages over trials - continuous process
%
% Usage:
%
% [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossSpecMat... |
f7e56a793a950557db9684d733604a170563fa031e3e7d5199fb7a7b182f3097 | MATLAB | 4,249 | 143 | function [beta,R2,beta_ts,R2_ts] = CircularRegression(x,angles,slope)
%CircularRegression - Non-parametric linear-circular regression.
%
% Fit 'barber-pole' lines to the data. The model consists of three parallel lines
% y = a.x + b + k*2pi (k in {-1,0,1}). The distance of a point to the model is
% defined as the m... |
69282f1eaf26e152cbe031656d21747c53f5989e2f86e858c7af6b800b290712 | MATLAB | 4,253 | 127 | % eeg_mergelocs() - merge channel structure while preserving channel
% order
%
% >> mergedlocs = eeg_mergelocs(loc1, loc2, loc3, ...);
%
% Inputs:
% loc1 - EEGLAB channel location structure
% loc2 - second EEGLAB channel location structure
%
% Output:
% mergedlocs - merged c... |
c2c65469160faff9225ea5c176cd3b674c92e421d03158fd1b2a24966c35215d | MATLAB | 4,253 | 123 | function [varargout] = ndgrid(varargin)
% NDGRID Generation of arrays for N-D functions and interpolation.
% [X1,X2,X3,...] = NDGRID(x1,x2,x3,...) transforms the domain
% specified by vectors x1,x2,x3, etc. into arrays X1,X2,X3, etc. that
% can be used for the evaluation of functions of N variables and N-D
% interpola... |
ca90847686f5952fd544210805f320edc08685eeaed220b084dc49843cd0b95e | MATLAB | 4,253 | 118 | %%*******************************************************************
%% NTrhsfun: compute the right-hand side vector of the
%% Schur complement equation for the NT direction.
%%
%% SDPT3: version 3.1
%% Copyright (c) 1997 by
%% K.C. Toh, M.J. Todd, R.H. Tutuncu
%% Last Modified: 16 Sep 2004
%%***************... |
d3a7732067db18b07627cdc891828fa98ec9d63f33db73678c02e1d19fd02b65 | MATLAB | 4,253 | 104 | % 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... |
f398dae7121d26e829cea5add1bf3def2c7af97a1f782c6794368bc9bcdc224f | MATLAB | 4,253 | 125 | function [ analysisResults,filename ] = bz_LoadAnalysisResults(basePath,analysisName,varargin)
%[ cellinfo,filename ] = bz_LoadCellinfo(basePath,cellinfoName) function for
%for loading cellinfo.mat files. cellinfo.mat files are saved as:
% datasetPath/baseName/baseName.cellinfoName.cellinfo.mat
%
%INPUT
% basePath
% ... |
3016dfb0544ea3f595d551db59ab3cff054eacb7af6aaa708e8b9e3002876d2e | MATLAB | 4,254 | 122 | % Date: 05-10-2026
% export_instr2_task_lesion_uncue2_to_excel.m
% Description: Export two-modality one-layer lesion-result .mat files from
% trained_models/one_layer_models/instr2/task_lesion_uncue2 into a single
% Excel workbook with one sheet per .mat file. This folder corresponds to
% the task-fixed-to-pro analysis... |
8be8564b0de29ca7306051d83188012c882a113cd97597529e46bab5a49a3c7b | MATLAB | 4,254 | 122 | % Date: 05-10-2026
% export_instr2_task_lesion_uncue2_to_excel.m
% Description: Export two-modality one-layer lesion-result .mat files from
% trained_models/one_layer_models/instr2/task_lesion_uncue2 into a single
% Excel workbook with one sheet per .mat file. This folder corresponds to
% the task-fixed-to-pro analysis... |
8efca5fcc571bec03ed6f7547088a3824a17b83dcd8d6feb5a7b9dc773083ae4 | MATLAB | 4,254 | 135 | function tfcestat = palm_tfce(X,y,opts,plm)
% Compute the TFCE statistic, for volume or surface
% data (vertexwise or facewise).
%
% Usage:
% tfcestat = palm_tfce(X,y,opts,plm)
%
% Inputs:
% - X : Statistical map.
% - y : Modality index (of those stored in the plm struct).
% - opts : Struct with PALM options.
% -... |
dc9247768a3d17d9df2929b3a1961273774594be6933b5760e0274a9a10295d2 | MATLAB | 4,254 | 115 | clc
clear
% Load intensity data from Excel files into raster
raster{1,1} = xlsread('intensity-s21_01.xlsx');
raster{1,2} = xlsread('intensity-s21_02.xlsx');
raster{1,3} = xlsread('intensity-s21_03.xlsx');
save original_data
%%
ExpT = length(raster); % Number of experiments/time points
[~, CellNum] = size(raster{1,1});... |
8b15c24a8b060a9982c71af326b8b5fdfb6dfb0394d9c53dd659e00999f0e797 | MATLAB | 4,255 | 86 | function [C,phi,S12,f,zerosp,confC,phistd,Cerr]=cohmatrixpb(data,params,fscorr)
% Multi-taper coherency matrix - binned point process
%
% Usage:
%
% [C,phi,S12,f,zerosp,confC,phistd,Cerr]=cohmatrixpb(data,params,fscorr)
% Input:
% data (in form samples x channels) -- required
% params: structure wi... |
1a96e57a9231dbcf86accf2582caa7087cdc1b656a398c2e1c2a05375656da2e | MATLAB | 4,257 | 91 | % 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... |
c35bc3fa52bf46ceaca2de74a0ad4c3f7aba543b7e200c862a2b33a0ef480930 | MATLAB | 4,262 | 123 | % firfilt() - Pad data with DC constant, filter data with FIR filter,
% and shift data by the filter's group delay
%
% Usage:
% >> EEG = firfilt(EEG, b, nFrames);
%
% Inputs:
% EEG - EEGLAB EEG structure
% b - vector of filter coefficients
%
% Optional inputs:
% nFrames -... |
26bc9f072eeea165b05ccdc7219e197e3502a6f791bfa312e2df4e5605a27691 | MATLAB | 4,266 | 83 | function [dS,f]=mtdspectrumpt(data,phi,params,t)
% Multi-taper spectral derivative - point process times
%
% Usage:
%
% [dS,f]=mtdspectrumpt(data,phi,params,t)
% Input:
% Note that all times can be in arbitrary units. But the units have to be
% consistent. So, if E is in secs, win, t have to be in secs, and Fs has... |
2e234920a448405c75cf3cbb967286500df9654a97a499b9b8fce8050ccd46b8 | MATLAB | 4,266 | 146 | function [] = LogScale( whichaxis,logbase,varargin)
%LogScale(whichaxis,logbase) renames the tick labels on your axes for a
%logarithmically scaled variable.
%
%INPUT
% whichaxis which axis did you log scale (can be 'x' 'y' or 'xy')
% logbase base of the logarithm you used for your points (ex 10)
%
%Options
%... |
8e674040e3986b7878e16ed72b8b1961dc5eb93b858ebab938efa8549b5a1a41 | MATLAB | 4,269 | 127 | function z =surr_theiler(y,algorithm)
% z=surr_theiler(y,algorithm)
% inputs - y, time series to be surrogated
% algorithm - the type of algorithm to be completed
% outputs - z, surrogated time series
% Remarks
% - This code creates a surrogate time series according to Algorithm 0,
% Algorithm 1 or Algo... |
54c7e3b35d628a5ae648d6b3b1342fa39c943504998897daff4ba158e702507b | MATLAB | 4,272 | 117 | function varargout = attributes(varargin)
% XMLTREE/ATTRIBUTES Method (handle attributes of an element node)
% FORMAT varargout = attributes(varargin)
%
% tree - XMLTree object
% method - 'set','get','add','del' or 'length'
% uid - the UID of an element node
% n - indice of the attribute
% key - stri... |
f9425c607387cc3c71091955066080ee15b69f1bebc677224b8d69fa3ef1031c | MATLAB | 4,272 | 154 | function [res, errStr, fName]= maskstruct_read(fNameIn)
%
%function [res, errStr, fName]= maskstruct_read(fName)
%
% Opens a maskStruct from the filesystem
%
% fName: should contain the path and file name. if it is empty or undefined, a file selection dialog will appear
%
% return values:
% res: contains the ... |
7388bebfbcedc609724aef7b729092093e0ab99931949a6fa5bcb8218972902b | MATLAB | 4,273 | 104 | function varargout=ea_ft_deterministictracking_kroon(options)
% __________________________________________________________________________________
% Copyright (C) 2014 Charite University Medicine Berlin, Movement Disorders Unit
% Andreas Horn
if ischar(options) % return name of method.
varargout{1}='Deterministic ... |
286692991d0a1ce7a457e441c37ca78ceda75a94d2d32070d0523cd4df04dec8 | MATLAB | 4,281 | 124 | function prevpath = cvx_startup( quiet )
%CVX_STARTUP Quietly add CVX to your MATLAB path (for startup).
% Running CVX_STARTUP upon startup ensures that CVX is properly included
% in your MATLAB path.
%
% On Mac and PC systems, this function is not necessary, because you can
% simply run "savepath" to sa... |
10e3202564c76040cdd0aec76be54202cc7bc176f10aae01a15c45111fed409d | MATLAB | 4,283 | 160 | %MRSTRUCT_CHECKIN checkin data into mrStruct.
% [mrStruct, errorFlag] = mrstruct_checkin(mrStruct,dataAy,reshapeVc)
%
% Function assigns a data array to a MR-Structure (mrStruct.dataAy=dataAy).
% The modified mrStruct is returned. On errror, the mrStruct will
% be returned without modification. The error statu... |
41fece9843cbb6afac2dfa4144a44e36864bbe1c20225633c5c506715f4c8aaf | MATLAB | 4,283 | 124 | function plotPolygonContourtSNE(allROIs, polygon, contConfig, color, coordField)
% Plots tSNE coordinates for allROIs within a polygon, within one chosen
% color
if nargin < 5
coordField = 'tsneCoords';
end
% Create plot
fig;
hA = gca;
axis square
axis off
alpha = 0.3;
thresholds = sort(contConfig.thresholds, 'd... |
ddd9373509e3bfcfb2255b8cbc44d0d2bc4f7eb9430d713a5c4fa356397d1e63 | MATLAB | 4,292 | 80 | function [S,t,f,Serr]=mtspecgramtrigc(data,E,win,movingwin,params)
% Multi-taper event triggered time-frequency spectrum - continuous process
%
% Usage:
%
% [S,t,f,Serr]=mtspecgramtrigc(data,E,win,movingwin,params)
% Input:
% Note units have to be consistent. Thus, if movingwin is in seconds, Fs
% has to be in Hz. see... |
ddb6750dca70f9768ef5cd58a7f748a36eec4a28c2862956d1f5503cef0e8c93 | MATLAB | 4,293 | 128 | function S = palm_maskstruct(mask,readwith,extra)
% Create a struct for a mask, as if it had been read from a file.
% This is useful to save later the data.
%
% Usage:
% M = maskstruct(mask,readwith,extra)
%
% Inputs:
% mask : A (1 by m) real array.
% readwith : A string telling which function was used to read
% ... |
62cb269b6613fcafc92af149e35867d5ea149562310c1969d388b01defc9c735 | MATLAB | 4,294 | 135 | % getkeyval() - get variable value from a 'key', 'val' sequence string.
%
% Usage:
% >> val = getkeyval( keyvalstr, varname, mode, defaultval);
%
% Inputs:
% keyvalstr - string containing 'key', 'val' arguments
% varname - string for the name of the variable or index
% of th... |
b069c7fcd123926ce451d209ddc49c82b803c6700484f8a38a0ea09183044309 | MATLAB | 4,295 | 170 | function [img2, transparency] = ea_crop_img(img,border)
%
% Crop image by removing edges with homogeneous intensity
%
%
%USAGE
%-----
% img2 = crop_img(img)
% [img2, transparency] = crop_img(img,border)
%
%
%INPUT
%-----
% - IMG: MxNxC matrix (where MxN is the size of the image and C is the
% number of color layers) ... |
2ae64f431b79c229c1d47654053ca56ff3e1f54e6d63465dd5d4669d1c8449ab | MATLAB | 4,297 | 111 | function [data,indices] = GetWidebandData(channels,varargin)
%GetWidebandData - Get local field potentials.
%
% Load wide band data from disk (unlike spikes or positions, raw data is way
% too large to keep in memory).
%
% USAGE
%
% [data,indices] = GetWidebandData(channels,<options>)
%
% channels optio... |
6be399e6921015728266be11cb18a5b17ece90a95f3b74c59b3f6f7d4ca26863 | MATLAB | 4,300 | 128 | clear all;
num = 181;
% string = ['a','c','e','g'];
m = ['1','2','3','4'];
for i = 1:4
retina = load(strcat('retina-CH',m,'.txt'));
% retina = load(strcat('ERG.txt'));
x_mm=-reshape(retina(:,1)*1000+1.5678,num,num);
y_mm=-reshape(retina(:,2)*1000-10.0814,num,num);%注意坐标轴的调换
z_mm=... |
2d4d2838a3e6f6295c6c3b09f635799479f843f3053fa623f2d21e66de3311c9 | MATLAB | 4,301 | 82 | clear
gcp;
name = 'granule_love2.tif';
if ~exist(name,'file') % download file if it doesn't exist in the directory
url = 'https://www.dropbox.com/s/mjmtwn4pdgydkny/granule_love2.tif.zip?dl=1';
filename = 'granule_love2.tif.zip';
fprintf('downloading the file...');
outfilename = websave(filenam... |
ffbb5681c96b0ee35b50ad0a4b0e9d6d7b0b820ab09ca181eb08a19c8158a197 | MATLAB | 4,302 | 86 | % same as demo.m and demo_1p.m but using the MotionCorrection object. Scroll at the end
% to the 1p example
clear
gcp;
name = 'granule_love2.tif'; % two photon dataset
if ~exist(name,'file') % download file if it doesn't exist in the directory
url = 'https://www.dropbox.com/s/mjmtwn4pdgydkny/granule_love... |
ee8f06c23e0333c8afa43a080236a265a84946abb9c64c779f00e87c910bec52 | MATLAB | 4,303 | 126 | % transformcoords() - Select nazion and inion in anatomical MRI images.
%
% Usage:
% mewcoords = transformcoords(coords, rotate, scale, center, reverse);
%
% Inputs:
% coords - array of 3-D coordinates (3 by N or N by 3)
% rotate - [pitch roll yaw] rotate in 3-D using pitch (x plane),
% roll ... |
388f211821d1131d812d898a8b957e341c42f7123d1b0cbdafd7492575de44d5 | MATLAB | 4,304 | 139 | %Detrend - Detrend signal.
%
% USAGE
%
% [detrended,model] = Detrend(samples,<options>)
%
% samples list of (t,v1...vn) samples
% <options> optional list of property-value pairs (see table below)
%
% =========================================================================
% Properties V... |
f8aafe87612c4a3041661f5d5a60f3732d618459f3abe2be4f0801194fa3bffd | MATLAB | 4,304 | 114 | % Find the Least Root Mean Square distance
% between two sets of N points in D dimensions
% and the rigid transformation (i.e. translation and rotation)
% to employ in order to bring one set that close to the other,
% Using the Kabsch (1976) algorithm.
% Note that the points are paired, i.e. we know which point in on... |
f6b2715a5ec55f91738afd3ea6fa62abb06ad4ce8b6df644e8bd94f2238c0753 | MATLAB | 4,305 | 169 | % Equalizer design example
% "Filter design" lecture notes (EE364) by S. Boyd
% (figures are generated)
%
% Designs a frequency-domain and time-domain FIR equalizer for
% a single-input single-output (SISO) channel.
%
% Frequency-domain equalization uses a Chebychev criteria and
% is specified in terms of frequency res... |
237c1169b86d60f7cb16ee067579ae91fa61d32e5fe40b7dc0b70ed47e1e14da | MATLAB | 4,307 | 88 | function SOFAplotGeometry(Obj, index)
% SOFAplotGeometry(Obj) plots the geometry found in the Obj.
%
% SOFAplotGeometry(Obj, index) plots the geometry for the measurements
% given in the index.
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences;
% Licensed under the EUPL, Ve... |
4d792f31b01cd2716bef8dcf473828a6e218cec2f7e52394208dce18e3e4dc3b | MATLAB | 4,307 | 132 | function h=ea_parcellation2surface(nii,surface,sides,colormap)
% surface can be a char (smoothed/full) or a cell pointing to rh and lh
% .mz3 surface files.
if ~exist('surface','var')
surface='auto';
end
if ~exist('sides','var')
sides=1:2;
end
if ~exist('colormap','var')
colormap=ea_color_wes('all');
en... |
0e7fd1a1733edbe00714e1c65b5c11d6696062efd16f79a5449430e9cbaead2d | MATLAB | 4,311 | 76 | function [S,t,f,R,Serr]=mtspecgramtrigpb(data,E,win,movingwin,params,fscorr)
% Multi-taper event triggered time-frequency spectrum - binned point process
%
% Usage:
%
% [S,t,f,R,Serr]=mtspecgramtrigpb(data,E,win,movingwin,params,fscorr)
% Input:
% data (single channel data vector) -- required
% E ... |
f24b537a3790b077e08cfcde87a19a708bf5eceb0e5be054641f42314b7e5e60 | MATLAB | 4,312 | 73 | %get experiment directory for the current animal
function [exp_dir] = get_exp(animal)
if strcmp(animal, '3xTg1-1')==1
exp_dir='H:\data analysis\3xTgAD\3xTg1-1\190830\Recording\';
elseif strcmp(animal, '3xTg1-2')==1
exp_dir='H:\data analysis\3xTgAD\3xTg1-2\190905\Recording\';
elseif strcmp(animal, 'AD-WT-1-0... |
01fcac1ba37930e868e1acd8c04882eeed468c510355296075f1ea9240e84233 | MATLAB | 4,313 | 125 | %plugin_movepath()- Given a path to a plugin folder, this function will
% put the plugin at the bottom of the path.
%
% Usage:
% plugin_movepath('x','begin'); % Put plugin 'x' at the top of the path
% plugin_movepath('x','end'); % Put plugin 'x' at the bottom of... |
b4e6aaa5ea43b8d0f86318856080ad7634f3280b7329be1cfabffb0847883805 | MATLAB | 4,316 | 114 | function [settings,S] = ea_prepare_ossdbs(options,S)
% Import settings from Lead-DBS.
% For StimSets also add a dummy S
% By Butenko and Li, konstantinmgtu@gmail.com
arguments
options % Lead-DBS options for electrode reconstruction and stimulation
S % lead-dbs stimulation settings
end
% Check ... |
1cb7e6fead7a6b4f72574b475c025b5ff93b187229175edfe127cc487e33fbd0 | MATLAB | 4,318 | 143 | % changeunits() - Takes one or more points in one axes and gives its position
% in another axes. Useful for drawing lines between
% sbplots (see sbplot()).
%
% Usage: >> newpoint(s) = changeunits(point(s),curaxhandle,newaxhandle)
%
% Inputs:
% point(s) - two-column vector of c... |
873268fc997b8477b8d6eee6acaa50bc017cdfa842ba6144ffe5b95486815824 | MATLAB | 4,318 | 90 | % makehelpfiles() - generate function help pages
%
% Usage:
% >> makehelpfiles(list);
%
% Input:
% 'folder' - [string] folder name to process
% 'outputfile' - [string] file in which to write the help
% 'title' - [string] title for the help
%
% Author: Arnaud Delorme, UCSD, 2013
%
% Example: Generate ... |
af78ed6a2c65d42a7579bad3a6f39b4e7233b66c42294b1565a99e3c416fb26a | MATLAB | 4,318 | 156 | % logspec() - plot mean log power spectra of submitted data on loglog scale
% using plotdata() or plottopo() formats
%
% Usage:
% >> [spectra,freqs] = logspec(data,frames,srate);
% >> [spectra,freqs] = logspec(data,frames,srate,'title',...
% [loHz-hiHz],'cha... |
e24406f49c4c9d863af6af557668c591b9fcfbd21cd1ea4a4008bd060540c079 | MATLAB | 4,322 | 129 | function splitNSx(splitCount)
% splitNSx
%
% Opens and splits an NSx file in smaller pieces, timewise.
%
% Use splitNSx(splitCount)
%
% All input arguments are optional. Input arguments can be in any order.
%
% splitCount: Defines the number of splits.
% DEFAULT: Splits the file in 2 pieces.
%
% ... |
534c0036366d6e3e0ff6afda8bf0f68a57423aab910542f4e829cbbed4938876 | MATLAB | 4,324 | 95 | % Written by Xiuming Zhang and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
% IMPORTANT This file is specific to our PNAS paper and our computing cluster. As a result,
% you need to modify the paths at places with comment "please change"
close all; clear; clc;
cd ../lib/
%% Pre... |
e24c39a8530c74b03d5478c15ef99c9ee4b56766a7d13cf9efd2b2741a3a1e34 | MATLAB | 4,328 | 166 | % You can run this with a new image set by changing only the two lines below:
figtitlebase = 'CANlab signatures Cosine Similarity';
image_set_name = 'npsplus'; % keyword for named set to pass into load_image_set
[mapset, netnames] = load_image_set(image_set_name);
mycolors = seaborn_colors(length(netnames));
k = ... |
6a7430456cdf87c0d9552edda2f7a370e91cba36ea70bef22783cc3ffada759a | MATLAB | 4,330 | 104 | function CBIG_ASDf_plotFCDiff_NBSThresholded(sub_info_file, id_factor_file, id_con_file, ADJ,...
component, corrMat_dir, scale_lim, output_name)
% CBIG_ASDf_plotFCDiff_NBSThresholded(sub_info_file, id_factor_file,
% id_con_file, ADJ, component, corrMat_dir, scale_lim, output_name)
%
% This function plots 419x419 ma... |
9184b669ac4488afd4d46874a71efaa7ffb9eb459f042d0f121076b5a17b642a | MATLAB | 4,333 | 164 | % Return time frame of a NIFTI dataset. Support both *.nii and
% *.hdr/*.img file extension. If file extension is not provided,
% *.hdr/*.img will be used as default.
%
% It is a lightweighted "load_nii_hdr", and is equivalent to
% hdr.dime.dim(5)
%
% Usage: [ total_scan ] = get_nii_frame(filename)
%
% filen... |
f54ccb50314b6ce48f2d66c3e360abdd3723c2a4fcf4e79c606059eeacf13c9a | MATLAB | 4,334 | 162 | function varargout=shadedErrorBar(x,y,errBar,lineProps,transparent)
% function H=shadedErrorBar(x,y,errBar,lineProps,transparent)
%
% Purpose
% Makes a 2-d line plot with a pretty shaded error bar made
% using patch. Error bar color is chosen automatically.
%
% Inputs
% x - vector of x values [optional, can be left em... |
0ed30fdde9a371fa34cfcc6ec428f574683dee786d787b0761c6a846de133cd5 | MATLAB | 4,336 | 82 | function ea_runfreesurfer(options)
hastb=ea_hastoolbox('freesurfer');
if ~hastb
ea_error('FreeSurfer needs to be installed and connected to Lead-DBS');
end
hastb=ea_hastoolbox('fsl');
if ~hastb
ea_error('FSL needs to be installed and connected to Lead-DBS');
end
presentfiles=fieldnames(options.subj.coreg.an... |
5e8e3172e5616ed61a0328b2a47737923cede965ae867aad00ad05fb6e917c39 | MATLAB | 4,337 | 145 | % This script works with the CANlab batch scripts to add meta-data to
% DATA_OBJ and DATA_OBJsc image data in data_objects.mat and
% data_objects_scaled.mat, and contrast_data_objects.mat
% define basedir and resultsdir first, e.g.:
% basedir = ('/Users/f003vz1/Dropbox (Dartmouth College)/A4_PUBLISHED_KeepHandy/Wager_... |
bac86dfb7ff69d4d3c5b5e3cd4537bfd05fc026af65d44c948bebea6e64dbcc2 | MATLAB | 4,341 | 155 | function [Yc,Ycf]=homocor(vol)
% -----------------------------------------------------------
% to correct for image nonuniformity
% first fills in holes, then generates a low frequency
% background image and makes correction factor
% input image is stored in img, output is Iout
%
% homocor.m rev 0 4/8/00 ... |
73345281de8e28be25aafc2a67a3baa0f615f48f991a88ef9bd158503789465a | MATLAB | 4,342 | 139 | %GHOSTSCRIPT Calls a local GhostScript executable with the input command
%
% Example:
% [status result] = ghostscript(cmd)
%
% Attempts to locate a ghostscript executable, finally asking the user to
% specify the directory ghostcript was installed into. The resulting path
% is stored for future reference.
% ... |
291094102c9dce56513a38c06262cf3bd212b072d25280c36498b42d9149e94f | MATLAB | 4,344 | 181 | function shim = cvx_glpk( shim )
% CVX_SOLVER_SHIM GLPK interface for CVX.
% This procedure returns a 'shim': a structure containing the necessary
% information CVX needs to use this solver in its modeling framework.
if ~isempty( shim.solve ),
return
end
if isempty( shim.name ),
fname = 'glpk.m';
ps =... |
60258977b752308ddd32df22e1068acaf0f8a4e6b4e74f377ea5fe561e50433e | MATLAB | 4,345 | 155 | % promax() - perform Promax oblique rotation after orthogonal Varimax
% rotation of the rows of the input data. A method for
% linear decomposition by "rotating to simple structure."
% Usage:
% >> [R] = promax(data,ncomps);
% >> [R,V] = promax(data,ncomps,maxit);
%
% Inputs:
% ... |
2aa500573bc26ad9269c5325e5046cda273d15cbbd09484b33f4f00e4c9cc0a6 | MATLAB | 4,346 | 122 | function plotAreaContourROItSNE(allROIs, areas, contConfig, colors, coordField)
% Plots tSNE coordinates for allROIs, colored by area, and in a separate
% plot the KDE contours of the area densities, plots are to be combined
% manually
if nargin < 5
coordField = 'tsneCoords';
end
% Create first plot
fig;
axis squ... |
7743a733b3bef076a52dd33b4cd6d4b7c790e49c8ce8b09d525989d9918cc488 | MATLAB | 4,347 | 141 | %% LaBGAScore_juspace_corr_behav.m
%
%
% *USAGE*
%
% This script calculates correlations between behavioral responses to conditions and/or contrasts
% and the results from spatial correlation analysis with PET receptor maps obtained with the JuSpace toolbox
%
% It uses the results file from JuSpace analysis options #4... |
eb4af2e74aff5a3f2a711b8e9a1c0aebaa2ddeca3a422de4a65ca7ac03508f7a | MATLAB | 4,348 | 111 | function [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossSpecMatc(data,win,params)
% Multi-taper cross-spectral matrix - another routine, allows for multiple trials and channels
% Does not do confidence intervals. Also this routine always averages over trials - continuous process
%
% Usage:
%
% [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossS... |
5a5af369193a438b1c7068b9484c25bdce8de2d3dc233e7f18371bd891c4bfd3 | MATLAB | 4,349 | 148 |
function [ csd ] = bz_CSD (lfp, varargin)
% [ CSD ] = bz_CSD (lfp, varargin)
% Calculates the 1D approximation of current source density (CSD) from a
% linear array of LFPs
% INPUT
% lfp a buzcode structure with fields lfp.data,
% lfp.timestamps
% ... |
68437e8a3d3deb072b867340595ade90c984d95fd0b43618b31b6ebe62681621 | MATLAB | 4,349 | 111 | function [data,indices] = bz_GetWidebandData(channels,varargin)
% bz_GetWidebandData - Get local field potentials.
%
% Load wide band data from disk (unlike spikes or positions, raw data is way
% too large to keep in memory).
%
% USAGE
%
% [data,indices] = bz_GetWidebandData(channels,<options>)
%
% channels ... |
955d8f81b53d8dbb85155c5ab3a3d47f64ed34a50847a4b2450bbcbd072cbd0f | MATLAB | 4,349 | 83 | function [dS,f]=mtdspectrumpt(data,phi,params,t)
% Multi-taper spectral derivative - point process times
%
% Usage:
%
% [dS,f]=mtdspectrumpt(data,phi,params,t)
% Input:
% Note that all times can be in arbitrary units. But the units have to be
% consistent. So, if E is in secs, win, t have to be in secs, an... |
e45b860e15033ad3eb7d588d552914278193745e39286371a0114c3ae446456a | MATLAB | 4,349 | 152 | % 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... |
00a777fa8daac0ccf40c447f74109b27bec880c4f4f176efb567444c3859d6a9 | MATLAB | 4,350 | 139 | classdef BoxPanel < uix.BoxPanel
%uiextras.BoxPanel Show one element inside a box panel
%
% obj = uiextras.BoxPanel() creates a box-styled panel object with
% automatic management of the contained widget or layout. The
% properties available are largely the same as the builtin UIPANEL
% ... |
5ed3a42a92628783d6f35d0ee98287b0fafb6419473496245f0202b8453d6d56 | MATLAB | 4,352 | 130 | % readneurolocs() - read neuroscan polar location file (.asc)
%
% Usage:
% >> CHANLOCS = readneurolocs( filename );
% >> CHANLOCS = readneurolocs( filename, 'key1', val1, ...);
%
% Inputs:
% filename - file name or matlab cell array { names x_coord y_coord }
%
% Optional inputs:
% same as caliblocs()
% ... |
74033b22cf5849f8eb348b0fc6173f0980b03bf1306d39019bce48d081a160c5 | MATLAB | 4,352 | 96 | %Exports CSD data to a csv file that can easily be imported into R
%(or whatever you use) to generate final plots and statistics.
% animals = {'3xTg136' 'WT162' 'WT78-0' '3xTg75-1' 'WT77-0' '3xTg79-0' 'WT89-0' 'WT98-0' '3xTg77-1' 'WT158' 'WT153' 'WT157' '3xTg125' 'WT126' 'WT45-1' 'WT45-2' 'WT47-0' '3xTg48-0' '3x... |
45f7e244427526c50927769f557abf09d24bbae6147951534559992f7057d75b | MATLAB | 4,353 | 177 | % Wire sizing and topology design
% Section 5.3, L. Vandenberghe, S. Boyd, and A. El Gamal
% "Optimizing dominant time constant in RC circuits"
% Original by Lieven Vandenberghe
% Adapted for CVX by Joelle Skaf - 11/25/05
% Modified by Michael Grant - 3/8/06
%
% We size the wires for an interconnect circuit with four ... |
942a1e4714cca00acb62dc10ea583c59fcd532c83bc39dbacc547b71b8e04b71 | MATLAB | 4,353 | 117 | % 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... |
606eb386bda4a3e9b0b1fae1ad45df0a5bfd92e8b9592ca2847231a01da4b0c9 | MATLAB | 4,358 | 140 | function ea_surficeoverlay(overlay, threshold, sideCode, showColorbar, colorbarPosition, useSmoothedMesh)
% Wrapper to export mesh+overlay image from Surf-Ice
% Check overlay path
if ischar(overlay)
overlay = {overlay};
end
overlay = cellfun(@GetFullPath, overlay, 'Uni', 0);
% Use auto threshold by default
if ~ex... |
b33bddae4cd568aea81dfb03d0fd5495607554b310847f07a049395b957199a8 | MATLAB | 4,358 | 118 | % eeg_multieegplot() - Produce an eegplot() of a the average of an epoched dataset
% (with optional pre-labelling of specific trials).
% Usage:
% >> eeg_multieegplot( data,trialrej, elecrej, ...
% 'key1', value, 'key2', value ... );
% Inputs:
% data - input da... |
2b9360e713496308aad4d1835a8444fd0e7276d55fb11f239b4ac50aaa41aa8a | MATLAB | 4,359 | 135 | function DebugBatch(mfile,bfile,item,varargin)
%DebugBatch - Help debug a batch job.
%
% This function can be used to help debug a batch. It retrieves the parameters
% corresponding to the required item from the batch file, and either starts
% the batch function with these parameters in debug mode, or simply assign... |
5a651e086b70d40da875ff56e215bcbf9c0fd375c43f75d23275640b3d6bb375 | MATLAB | 4,360 | 83 | function [S,f,R,Serr]=mtspectrumpt(data,params,fscorr,t)
% Multi-taper spectrum - point process times
%
% Usage:
%
% [S,f,R,Serr]=mtspectrumpt(data,params,fscorr,t)
% Input:
% data (structure array of spike times with dimension channels/trials;
% also accepts 1d array of spike times) --... |
68fe6b67bc61204638cc75a2654f4352a9176ced88ca1d198576f23245b8f910 | MATLAB | 4,360 | 207 | function sinterpstruct = sphereInterpolLUT(opos,sym)
if sym,
pos = [opos ; -opos];
else
pos = opos;
end;
N = 150;
beta = 0.5;
s = rescale((1:N)/N,beta);
[x y] = ndgrid([-fliplr(s) 0 s]);
z = sqrt(1-x.^2-y.^2);
X(1,:,:) = x;
Y(1,:,:) = y;
Z(1,:,:) = z;
X(2,:,:) = x;
Y(2,:,:) = y;
Z(2,:,:) = -z;
X(3,:,:... |
af236fee1249588ae7b048678b5d2755f6da62c2f737d6ddb301560e1e869889 | MATLAB | 4,360 | 94 | function GetMD5(varargin)
% GetMD5 - 128 bit MD5 checksum: file, string, array, byte stream
% This function calculates a 128 bit checksum for arrays or files.
% Digest = GetMD5(Data, Mode, Format)
% INPUT:
% Data: File name or array.
% Mode: CHAR to declare the type of the 1st input. Not case-sensitive.
... |
c9c08205ae2d15700cf00b2c22d5f821a289399c0ab9f9207b4ae17bb3192e31 | MATLAB | 4,362 | 98 | function CBIG_IndCBM_example_wrapper(output_dir)
% CBIG_IndCBM_example_wrapper(output_dir)
% This function use fake data to create individual cerebellum parcellation
% based on a group-level cerebral cortical parcellation.
%
% Input:
% - output_dir:
% Results will be saved under this folder. Final cereb... |
f07859b4ab0cc97e4ef3e1f23d1830d0c3e39e0f738adaf90db5033172aabe08 | MATLAB | 4,362 | 111 | function timestamps = readTsyncFiles(filePath)
% Add python script to path
pe = pyenv;
if logical(pe.Status) % If python environment is not loaded, then load
pyenv('ExecutionMode','InProcess',...
'Version','C:\Users\Groh\anaconda3\python.exe');
elseif ~strcmp(pe.Executable,"C:\Users\Groh\anaconda3\pythonw.... |
794073bea07b06a6fa685b85e456bc4fe1fa8cced2f25f3bb5692c20baffe438 | MATLAB | 4,363 | 101 | function ea_get_MNI_field_from_csv(options, Field_array_file, Activation_threshold_VTA, sideLabel, templateOutputBasePath, source_index)
% converts any spatial field (e.g. VAT) to MNI based on available transformations
% the output resolution is defined by options.primarytemplate
% stored in [templateOutputBasePath, '... |
a2cc93b1219c2fca9fe6734f47ab0a9bc5ef43ef628a2a56b7ec0256c25e20d6 | MATLAB | 4,363 | 105 | function ea_merge_PathwayTune_dicts(stimFolder,mainDict,stimSetsDictPath_rh,stimSetsDictPath_lh,fixedSymtpomsDictPath,targetProfilesDictPath,masterDictPath)
% Merge PathwayTune dictionaries into one master_dict.json
% By Butenko, konstantinmgtu@gmail.com
arguments
stimFolder % path to the folder w... |
ed970e921ffa6aa5f1a4dfc06f1cf6147611a0f3732259767431dd1ef3e1ee9b | MATLAB | 4,363 | 161 | function plotexample_theta(animal)
load('W:\bad_chans_table.mat');
bad_chans = table2cell(bad_chans_table);
if strcmp(animal,'3xTg1-2')==1
load('F:\Ephys Analysis\VLSE neuro 4-4 - HPC2\probe_data\ECHIP512_3xTg1-2.mat')
else
load('F:\Ephys Analysis\VLSE neuro 4-4 - HPC2\probe_data\ECHIP512.mat')
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.