sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
932096097a4e8d87c0d1b26678940180fa947988042046fa30c55f3edd87ea8c | MATLAB | 1,732 | 51 | function [adjusted_pvals, rejected] = benjaminiHochberg(pvals, fdr)
%% Adjust p-values according to the Benjamini-Hochberg method
% This method aims to control the false detection rate (FDR) of a set of hypothesis tests to a given
% level. The FDR is the expected proportion of false discoveries among all discoveries, w... |
bb656b49d41e5e0ddee599e6ba568cb9e03d0dea65c7af7eb39d4cf3e3b1c478 | MATLAB | 1,733 | 68 | %% Permutation entropy–based fitness function
function [ff] = PermutationEntropyCost(c, data)
X = data;
alpha = fix(c(1)); % Penalty factor (moderate bandwidth constraint)
K = fix(c(2)); % Number of modes (IMFs) for decomposition
%--------------- Perform VMD decomposition on the input signal --... |
58dc543136916d8b13f88452c19de0f9446af65401e71e7ec0c905f1583cf453 | MATLAB | 1,735 | 42 | function [PNactivity, spontanFRate, odorList] = propagateORNs2PNs(varargin)
%% get PN activity from ORNs. Accepts ORN input as argument, as a K-by-M
% format with K response patterns in M ORNs (or glomeruli)
% When no argument is given, it will operate on the Hallem dataset
if length(varargin)==0
tb = readtable('... |
3aecde30959018d3ef434a7d51d7ee588653d1c04d28b3a163799e949d51e427 | MATLAB | 1,737 | 34 | %% By Joachim Ahlbeck <3 (Adapted from Nicole Cichon <3<3) and improved by Kay Sieben and Samuel Reincke <3<3<3
function recording_filtered=ZeroPhaseFilter(recording_unfiltered,samplingrate,cutFrequencies)
%% Filter signal using filtfilt
% frequency = [low_cut high_cut]
% zp2sos is necessary if user is working with 3 o... |
5cbd6d36dc6dd800bdd644c89b432eeb6c216b3d996308dd6a93fbca6828561f | MATLAB | 1,739 | 56 | function powTraceLFP(suffix)
% LFP POWER - BURSTS
% Find bursts in power.
% Criteria: Must exceed 2 sd of trial mean for 3+ cycles.
% Burst def: Half-max to half-max.
%
% AUTHOR: Charles D Holmes
% EMAIL: chuck@eye-hand.wustl.edu
%
% Turn off warnings
%warning off all
% Import Parameter... |
6bcb0df08b489802b38880c69aa2344f5202bd7e3908ac42d9d680663a8d7365 | MATLAB | 1,739 | 41 | function plotTimingPolar_all(config, MuseStruct)
t = table;
for ipatient = 1 : size(MuseStruct, 2)
config{ipatient}.plot.label = {'template1', 'template2', 'template3', 'template4', 'template5', 'template6'};
for ipart = 1 : size(MuseStruct{ipatient}, 2)
for idir = 1 : size(MuseStruct{ipatient}{ip... |
213a9c71f5ebe331ec356a80f97136a2982bdd458216c66f54bc768bed3cead1 | MATLAB | 1,743 | 55 | function [A,B,RR]=nt_cca_crossvalidate2(xx,yy,shifts)
%[A,B,RR]=nt_cca_crossvalidate2(xx,yy,shifts) - CCA with cross-validation
%
% A,B: transform matrices calculated on first half of trials
% RR: r scores (3D) for second half of trials
%
% xx,yy: cell arrays of column matrices
% shifts: array of shifts to apply to... |
b92929c1d969775ed741def90b9c0b477c9a337f67ad18360e4610806ee1e7a5 | MATLAB | 1,743 | 46 | function [spikes] = load_spikes(trial_file, spike_file, time_interval, fs, trial_index)
% LOAD SPIKES: Load spikes as a an array of 0s (no spike) and 1s (spike).
% Each number is an LFP sample index.
%
% Input:
% trial_file = the temp file with data for each trial
% (trial stamp, start time... |
da61de279f9b438b1f411ea0f54950a4f1d15f633650277e289afd0c47030b0c | MATLAB | 1,744 | 68 | function varargout = crop2box(inmask)
% OUTMASK = CROP2BOX(INMASK)
% [OUTMASK EXTENTS] = CROP2BOX(INMASK)
% [OUTMASK ROWS COLS] = CROP2BOX(INMASK)
% Simple tool to crop a mask to its bounding box.
%
% INMASK is a binarized image of any standard image class.
% Multichannel and multiframe images are supported, ... |
e86fff3393ac975a737d18140d0b3e5d567af9767f410863297c19b7a48762c7 | MATLAB | 1,744 | 52 | function map = colormap_helper(map, len, lims)
%COLORMAP_HELPER Helper function for colormaps
%
% Examples:
% map = colormap_helper(map);
% map = colormap_helper(map, len);
% B = colormap_helper(map, A);
% B = colormap_helper(map, A, lims);
%
% Given a concise colormap table (i.e. one that contains al... |
4208ba120547db58a52947dcd8265fba5fab099d2e1765413d1bf67585ac848a | MATLAB | 1,745 | 61 | function outpict = freecb(sout,varargin)
% OUTPICT = FREECB(SIZE,{SQUARESIZE},{OFFSET},{OPTIONS})
% Generate a simple 2D checkerboard image of any size, without constraints on symmetry
% or size.
%
% SIZE is a 2-element vector specifying the output image size in pixels
% SQUARESIZE optionally specifies the ... |
e72ea15f5944f8449d7516dd0e90b5cdb4c533fb7b11664c8bb96e048f4ed314 | MATLAB | 1,747 | 52 | % SVReg: Surface-Constrained Volumetric Registration
% Copyright (C) 2016 The Regents of the University of California and the University of Southern California
% Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy
%
% This program is free software; you can redistribute it and/or
% modify ... |
a8d235cdd3560b36fe3870f9192882527d2d749995c34d62bd8b8bc33d7c4d4e | MATLAB | 1,750 | 53 | % SVReg: Surface-Constrained Volumetric Registration
% Copyright (C) 2016 The Regents of the University of California and the University of Southern California
% Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy
%
% This program is free software; you can redistribute it and/or
% modify ... |
b2ae311f5af88e7b2b9b262c5caeec0fdc8d70c22c41e00864d2221e55e770b4 | MATLAB | 1,750 | 50 | function [data, X_vol, Y_vol, Z_vol, res, Tvol, vol] = get_original_grid_data(vol)
% Returns the actual sampling grid points (in real-world coordinate) and the data at those grid
% points. This function only uses information from sform matrix of nifti header. qform matrix
% is ignored, even if present. No reslicing or ... |
3379f23779bf18256010eb53d20a1cba0d2a655758811dc59c18a20be5f87d49 | MATLAB | 1,756 | 67 | function outpict = imcheckerboard(varargin)
% OUTPICT=IMCHECKERBOARD({SQUARESIZE},{BLOCKS},{OPTIONS})
% Generate a symmetric checkerboard image in the fashion of the IPT tool
% checkerboard(). The right hand half of the board is tinted.
%
% SQUARESIZE optionally specifies the size of the individual squares in p... |
f4d70fb4ee9bc584388f6c162454df294e8da39ed9901b53a4fbb09f76ef56ec | MATLAB | 1,757 | 63 | %%
%
function [f] = gaussfit(x, y, yError2, zeroError2, mu, sigma, isOrdered, varargin)
% fitFunction object (static)
% Note that just for fun, MatLab reorders the parameters such that what
% it calls coefficients is alphabetically (?) sorted
persistent fitFunction;
if isempty(fitFunction)
fi... |
5ea3b9ce870856cd99ab298cc07f98fc54bb1d76454b1b427ba43a29b5d58c3a | MATLAB | 1,759 | 78 | function [plot_axes,figure_num] = set_up_fig_or_axes(fig_or_axes,clear_it)
% set_up_fig_or_axes Clear figure or axes and return handle to the axes.
%
% usage: [plot_axes,figure_num] = set_up_fig_or_axes(fig_or_axes,clear_it)
%
% arguments: fig_or_axes - axis or figure handle
% If 0,... |
2ffe2349779fbf91954f084475f373deb30192181563424c1e89de24afccdaa5 | MATLAB | 1,763 | 61 | % COMPARE SPECTRAL METHODS
% Compare Matlab's pmtm to Chuck's DFT method.
%
% Initialize
clear all; close all; clc
addpath(genpath('~chuck/code/matlab'));
prepOutput;
initDir = pwd;
%%%% PARAMS %%%%
grabArgs = 'grab -at2 -ms -mc -i-300:1300 -ot500 -of5:120:5 -d2';
sFile = 's971.1';
appendix = '971.1_2'
%%%% RU... |
6b4a79e9a50bebab0adf83da3b4d70a7a553d20ad571a38c6fcbf94b52303890 | MATLAB | 1,764 | 46 | function katia_project
restoredefaultpath
if ispc
addpath (genpath('\\l2export\iss02.charpier\analyses\vn_pet\EpiCode\shared'))
addpath (genpath('\\l2export\iss02.charpier\analyses\vn_pet\EpiCode\external'))
addpath (genpath('\\l2export\iss02.charpier\analyses\vn_pet\EpiCode\templates'))
addpath (genpa... |
18b8803abdfebdd38338ed8f91b6780fe1d748e6b6d904dec41a182201db31ce | MATLAB | 1,766 | 34 | % This file is a helper function. It takes grayordinates for the volume
% part from one sample cifti file. They grayordinates are specified in 2mm
% MNI space. They are transferred to the BCI space. For this purpose, first
% we coregistred BrainSuiteAtlas1 to BCI atlas and then used the svreg map.
clear all;close all;c... |
ddcd98ea6dcf83246c50314443be18e5619b4e051223c80c1ab4eb19b0da0ccc | MATLAB | 1,767 | 55 | function highestPointMatrix = HighestPeak(start,stop,OriginalSignal)
% USAGE
%
% highestPointMatrix = HighestPeakV3(start,stop,OriginalSignal)
%
% Find the maximum and minimum value between a start point and a stop
% point. Keep the time and value of the higher point between the absolute value
% ... |
570dd01c0b6e3a422f2ccecf5115080ea0b5228c148134b58ca083f880920930 | MATLAB | 1,768 | 50 | function image = read_image(socket)
header = gadgetron.external.readers.decode_image_headers(read(socket, 198, 'uint8'), 1);
attribute_string = read_attribute_string(socket);
data = read_data(socket, header);
image = gadgetron.types.Image(header, attribute_string, data);
end
function attribute_string =... |
a24d8e9d763e6fa01ce9c501086870292cc2ca7cb1273ab07e42af88ac7d8113 | MATLAB | 1,778 | 56 | function savefigure_own(fig, fname, varargin)
%default close_fig is false, will become true later if some varargin == 'close'
close_fig = false;
%remove extention on case there is one
[filepath,name] = fileparts(fname);
%remove '..' (and previsous folder in path) from path because it does not work with 'print'
filep... |
7e9db15a18aa6d0f1ca9f1e91c0a71babbf130c60565e60d11b68bcc7f19e58d | MATLAB | 1,789 | 57 | %TEMP Blue-pale-dark red colormap
%
% Examples:
% map = temp
% map = temp(len)
% B = temp(A)
% B = temp(A, lims)
%
% A colormap designed by Light & Bartlein for visualizing data such as
% temperature, with good contrast for colorblind viewers.
%
% The function can additionally be used to convert a r... |
d7224c4fbe5533262fd4ae1b331c91c748550038cce2fb5c728ba41c3edd6f7a | MATLAB | 1,789 | 52 | function saveaerdat(ts,addr,filename,dir)
% function saveaerdat(train[,filename])
% write events to a .dat file (tobi's aer data format).
% run this script, which opens a file browser. browse to the .dat file and click "Open".
%
% argument train is the data, an Nx2 array.
% train(:,1) are the timestamps with 1us ... |
1762796475096da3d8c13bd1b866e2359a59c8f058600dcdc2260766ac11a69b | MATLAB | 1,792 | 46 | function outpict = gray2pcolor(varargin)
% OUTPICT = GRAY2PCOLOR(INPICT,CT,{INRANGE},{MODE})
% Convert a grayscale image to a pseudocolored RGB image by uniform
% quantization and colormapping. This is comparable to displaying
% an image with imagesc(), except the output is an RGB image.
%
% INPICT is a grays... |
bdbf074406a15ff9eb72d6417059e2e81cb60c3210666d94ad26b5a9459398ab | MATLAB | 1,792 | 87 | function [hfig] = signalFigure(signal,xAxis,plotProp)
%
% Open figure. Determine plot colors.
switch (length(signal))
case 1
hfig = makeFigure([8,3]);
nPlots = 1;
case 2
hfig = makeFigure([8,6]);
nPlots = 2;
otherwise
error('SIGNAL_FIGURE can only handle 1 or 2 signals!!');
end
%%%%%%%%%%%%
% A... |
01da0e82881c08f4fe8b87e64a4c7db32a7c3f12659b8d334ee50e5833044975 | MATLAB | 1,796 | 39 | function create_hdf5(EEG, inner_loop_idx, participant, save_path)
%% Create hdf file with data for model training
%
% **Usage:** create_hdf(EEG, inner_loop_idx, participant, save_path)
%
% Input(s):
% - EEG = EEG struct
% - inner_loop_idx = index in which to add the data in the h5 file
% - participant = participa... |
06ce8240552abd2b49a5754dff019e24c88e5d3486c291c47743fce88a9f5c58 | MATLAB | 1,796 | 68 | function Data = load_app_data(app)
%LOADS IMAGE used for GraFT functional application GUI
% Takes in structure with .nam and .files, indicating path and file name
% for images under said directory. Creates a simple uiprogressdlg figure
% which reports progress.
%
% Created by Alex Estrada 10/19/2022
%%
%% I... |
6714fec1cf653366eb5b9279cd83782a5a76fa3eaaf993d1e75ac1f6ef549816 | MATLAB | 1,797 | 56 | function corr_kern = mkCorrKern(kern_opts)
% corr_kern = mkCorrKern(kern_opts)
%
% Create a convolutional correlation kernel that relates neighboring
% points.
%
% 2018 - Adam Charles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Check parameters
if nargin < 1 || isempty(kern_opts)... |
dc03e79614f1eb1079cfccedbf2d812f3277cbb0baad6e29b9e7cfdc73a112b7 | MATLAB | 1,802 | 51 | classdef WiringPIPairs
properties
WiringPISource (:,:) double %[#Region, DimCCAComponents]
WiringPITarget (:,:) double %[#Region, DimCCAComponents]
end
methods
function obj = WiringPIPairs(wiringPISource,wiringPITarget)
arguments
wiringPISource (:,:) doub... |
eb94aa937f6b6a94adce99420f875df61455b600cde8f08bf25b34938765792e | MATLAB | 1,804 | 48 | function [low_bound, upp_bound] = CBIG_bootstrap_confidence_interval(input_data, alpha, nsamples, stat_functor, varargin)
% Calculate the confidence interval from bootstrap distribution.
%
% [low_bound, upp_bound] = CBIG_bootstrap_confidence_interval(input_data, alpha, nsamples, stat_functor, varargin)
% Input:
%... |
08eb203710040b341020504cb488aaeff62e6344f2d3ee79d5c1507c73b5699f | MATLAB | 1,808 | 60 | function z=nt_multismooth(x,smooth,alignment,diff_flag)
%z=nt_multismooth(x,smooth,alignment,diff_flag) - apply multiple smoothing kernels
%
% y: result (time * channels * nsmooth)
%
% x: matrix to smooth
% smooth: vector of smoothing kernel sizes
% alignment: 0: left [default], 1: center
% diff_flag: if true... |
580bd2612c446b736aa31babca1c27c76a89c7a07355fddb9d7eec87ce10cf11 | MATLAB | 1,809 | 68 | %% Load dataset
path = '/Users/woojaejeong/Desktop/Data/USC/DARPA-NEAT/Code/Decoding/svm/Result/svmDecoding_sentiment_sen_3pc_lepoch_congruency_linear_commonPCA.mat';
load(fullfile(path))
% Subject Index
% load(fullfile('/Users/woojaejeong/Desktop/Data/USC/DARPA-NEAT/Data/Behavior/subject_index.mat'));
%% Cluster-ba... |
cae7e3b083363b20392742550d471c581d04ae9769590ade8d2eb2acd188192a | MATLAB | 1,810 | 77 | function [X1,Y1,Z1,maxk1]=InterpolateGappedTracings(X,Y,Z,maxk,mode,Max_num_dots)
J=length(maxk);
X1=X;
if mode == 0
Y1=0;
else
Y1=Y;
end
Z1=Z;
maxk1=maxk;
%calculate the length along each PF
dXt=(diff(X));
dZt=(diff(Z));
if mode == 1
dYt=(diff(Y));
dL=sqrt(dXt.^2+dYt.^2+dZt.^2);
els... |
4bb3ced73d7d962a42392c1b0df02649e798d696cab367ec7e80bf3fdad720d0 | MATLAB | 1,811 | 71 |
%% Config
numDigits = 10;
numRuns = 10;
% Matrices de resultados
mean_u_out = zeros(numDigits,1);
std_u_out = zeros(numDigits,1);
mean_time = zeros(numDigits,1);
std_time = zeros(numDigits,1);
mean_loss = zeros(numDigits,1);
std_loss = zeros(numDigits,1);
u_in_runs = zeros(numDigits, numRu... |
b2de7d5ea1aece0f83b8632f9cda6424562a799e8275a7a6bb48b4dacc5bc47d | MATLAB | 1,811 | 45 | function optimalBins = niceBins(range, numDivisions, numSignificantDigits, epsilon)
if nargin < 3
numSignificantDigits = 1;
end
if nargin < 4
epsilon = 10^-(numSignificantDigits + 2);
end
% Safety against empty ranges
if range(1) >= range(2)
range ... |
02e1f68ac22022910f0793dc5e3da23581e9107f1c533fba55ae4cab578800a3 | MATLAB | 1,815 | 57 | function dtx_savefigure(fig, fname, varargin)
%dtx_savefigure(fig,fname, varargin)
%default close_fig is false, will become true later if some varargin == 'close'
close_fig = false;
%remove extention on case there is one
[filepath,name] = fileparts(fname);
%remove '..' (and previsous folder in path) from path becaus... |
6b3fdd3351adb5a135164b9fa2a900c3a53f0c95e5c612838b38f5d250bee1fb | MATLAB | 1,816 | 61 | function data_out = prefilter_data(data,trigTimes,prebuffer,postbuffer,basefreq,harmonics,bpfreqs,makenan)
% FILTER_DATA filters only filters during the
%
% Author: Jeffrey B. Wang
%
% Inputs:
% data: Original EEG, in the Fieldtrip "raw" format
% trigTimes: Time (in seconds) for when the artifacts o... |
b82ab57532e83e7f6aa7342053a542b264040225c348591059f99dc5c807c805 | MATLAB | 1,818 | 55 | function output = strjoin_KY(input, separator)
%STRJOIN Concatenate an array into a single string.
%
% S = strjoin(C)
% S = strjoin(C, separator)
%
% Description
%
% S = strjoin(C) takes an array C and returns a string S which concatenates
% array elements with comma. C can be a cell array of strings, ... |
124efefbaad213102feee78112b4943ccc04a0da84dddedc6587b26ea8039ab4 | MATLAB | 1,820 | 66 | %%
%
function [hAssoc] = findAssociates(hAxes, varargin)
%----- Get axis handles if none are provided
if nargin < 1
hAxes = vca;
end
if nargin < 2
tags = {'legend', 'Colorbar'};
else
tags = varargin;
end
%----- Loop through axes
hAssoc = ce... |
fbcc084113ac2f5614c22b76a30b3b8cc78e980fa85c61bae85770bfac3d17bf | MATLAB | 1,820 | 45 | function [] = create_hdf_MA(EEG, inner_loop_idx, participant, save_path)
%% Create hdf file with data for model training
%
% **Usage:** create_hdf_MA(EEG, inner_loop_idx, participant, save_path)
%
% Input(s):
% - EEG = EEG struct
% - inner_loop_idx = index in which to add the data in the h5 file
% - parti... |
9d04fe6cf510f84ceb8dce818b60088333e4f4166159fc7f5fa5704c869e71e3 | MATLAB | 1,821 | 47 | function [trialinfo] = writemicroforspykingcircus_allmarkers(cfg)
fname_output = fullfile(cfg.datasavedir,[cfg.prefix,'all_concatinated_trialinfo_allmarkers.mat']);
if exist(fname_output,'file') && cfg.force == false
fprintf('Loading trialinfo: %s \n',fname_output);
load(fname_output,'trialinfo','circuspath')... |
a97fb4a3597bd7df4bda930dfae3d6dc1fb62a8e7bf02b2c35494640a1e9c346 | MATLAB | 1,823 | 47 | % SVReg: Surface-Constrained Volumetric Registration
% Copyright (C) 2017 The Regents of the University of California and the University of Southern California
% Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy
%
% This program is free software; you can redistribute it and/or
% modify ... |
dd8c0995e45a6775b7b5887d05bd83aa03a352d6d76950c16d1bd145338fb710 | MATLAB | 1,826 | 54 | function [ sample_graph, sample_index ] = connectivity_sampling( full_graph, sample_rate, para_sigma, v_conn_ext_list )
%TEST_MAX_SAMPLE Summary of this function goes here
% Detailed explanation goes here
%%
[size_1, size_2] = size(full_graph) ;
if size_1 ~= size_2
T = size_2;
full_graph = (full_graph ... |
6d9e7119244460d7bf0631a485b5100f685ba13ce2593892cb509d7a69097b3b | MATLAB | 1,827 | 49 | % Cosine similarity for matrices, treating all elements of the matrix (first and second dimensions)
% as if they were concatenated into a vector. Third and higher dimensions are treated as independent
% slices of the matrices. That is, for each slice i of the arrays A and B, the following is
% computed:
% sim(i)... |
4da1bcfcfcac5a19b5903545d1a1d83704bffeab260c4d55f9d15565272c09ac | MATLAB | 1,831 | 78 | function outpict = unsharp(inpict,varargin)
% OUTPICT = UNSHARP(INPICT,{OPTIONS})
% Sharpen an image using unsharp masking.
%
% INPICT is an image of any standard image class.
% Multipage and multiframe images are supported.
% OPTIONS includes the key-value pairs:
% 'sigma' optionally specifies the size of th... |
3b3d96eba5751c2a11d58792f2846d7e5a420786eb9629c22cd16744f93ee649 | MATLAB | 1,832 | 60 | function outFile = excel2csv(inFile, outFile, sheet)
%% Convert Excel file to CSV file
%
% SYNTAX
% outFile = excel2csv(inFile, outFile, sheet)
%
% INPUT
% inFile (char) Path to input file. Must have suffix ".xls" or
% ".xlsx"
% outFile (char) Path to output file. If no suffix is given, ".... |
8b9fe30e268ba7435b9691925a844d0da3a52b5970722c82487e5e0ffb3916c3 | MATLAB | 1,832 | 39 | function PET_verify_markers
% Create a table with the wrong marker timings in
% \\l2xport\iss02.charpier\analyse\vn_pet\data\wrong_markers
restoredefaultpath
if ispc
addpath (genpath('\\l2export\iss02.charpier\analyses\vn_pet\EpiCode\shared'))
addpath (genpath('\\l2export\iss02.charpier\analyses\vn_pet\EpiCod... |
12976b5905dfc0aca5704a17fb7de0f68d5475f0629a8b5e15b1e586dc866327 | MATLAB | 1,834 | 56 | function CBIG_ComputeCorrelationMatSingleSub(src_mask, src_fMRI, targ_mask, targ_fMRI, output_file)
% Compute correlation matrix between source and target fMRI for a single subject.
% CBIG_ComputeCorrelationMatSingleSub(src_mask, src_fMRI, targ_mask, targ_fMRI, output_file)
% Input:
% src_mask : mask of so... |
4026461dfb7385e4f7c70f19802c73051f7b510d0598c0333c617926cb7179a2 | MATLAB | 1,836 | 42 |
% This example script computes spike-triggered population average and population coupling
% (measures of how single spike trains are in synchrony to the overall population firing
% rate), as is described in Okun et al., 2015 (Nature)
%% load experiments and set a few variable
clearvars -except SUAtable
klusta = 1;
... |
66836f2bb46046864091a793027d658f5360fb1fdc6d213a244fae07bc6f10b5 | MATLAB | 1,841 | 53 | %% Add a title to a legend object.
function [hTitle, hLegend] = ltitle(hLegend, label, varargin)
%---- Get the legend handle
narginchk(1, inf);
if nargin < 2
label = hLegend;
hLegend = findAssociates(gca, 'legend');
if isempty(hLegend)
return;
end
hLegend = hLegend{1}... |
d112b8fb1f091379cd4158320836b3316a82d60ba4cbc6a0ad456160d4971a57 | MATLAB | 1,844 | 53 | function ES = getEventSynchronization(animal_name, spike_matrix, maxLag, repeatCalc, save_data, output_folder)
% as in Quian Quiroga et al., 2002
if exist(strcat(output_folder, animal_name, '.mat'), 'file') && repeatCalc == 0
load(strcat(output_folder, animal_name, '.mat'))
else
% get full matrix
spik... |
2236820d41e268a2c75b9ccd3150c7d063a817edcc04625414c3296b3a883492 | MATLAB | 1,846 | 36 | % GCMI Gaussian-copula mutual information estimators.
%
% Core helpers:
% setup_gcmi Add matlab/ (and optionally matlab_examples/) to the MATLAB path.
% gcmi_version Print the package version.
%
% Continuous estimators:
% gcmi_cc Gaussian-copula MI, continuous/cont... |
965901f3686185c00efc01207870330e0eaa271d0156c9a08c0ef0fae01cd09c | MATLAB | 1,853 | 58 | function [spectral_slope, freq, amplitude, bw, num_peaks] = compute_spectral_slope_fooof(signals, fs, f_range)
% signals: Matrix of input signals (each signal is a column)
% fs: Sampling frequency
% f_range: Frequency range for analysis
num_signals = size(signals, 2);
spectral_slope = zeros(1, num_... |
696bf0e1b06003d6a31007914842eac60fc7fee53e2b1d91df78162156ab1392 | MATLAB | 1,855 | 59 | function nifti2eig(L1, L2, L3, V1, V2, V3, outputFilebase)
%
workDir = tempname();
tempFile = fullfile(workDir, [Random_String(10) '.nii.gz']);
if ~mkdir(workDir)
error('Could not create temp dir: %s', workDir);
end
[~, L1] = check_nifti_file(L1, workDir);
[~, L2] = check_nifti_file(L2, workDir);
[~,... |
8d1eb86cabf97903f9584a90b56c00498963c957c01794480831e1aea20a3577 | MATLAB | 1,860 | 52 | % SVReg: Surface-Constrained Volumetric Registration
% Copyright (C) 2019 The Regents of the University of California and the University of Southern California
% Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy
%
% This program is free software; you can redistribute it and/or
% mo... |
1301ae7ede19fd3d2b307c17af339d21c1ef3d1956552e50229279ccf3bf41de | MATLAB | 1,865 | 56 | function plot_ReaChR_PSTH(data, reachr_id, trigtimes, flash_type, trigS_R, trigS_P, varargin)
% subplot of ReaChR response PSTH
%
% arguments: data - datarun structure
% reachr_id - id's for plotting
% trigtimes - triger times for the different trig sets
% trigS_R - trig ... |
630f59ba1204997f0794c7fc3a9bb69873ec7e48ac2f6fd3b21ab3a595d4eec0 | MATLAB | 1,867 | 58 | function sureis = ismono(inpict,tol)
% ISMONO(INPICT,{TOL})
% Returns a logical value, true when INPICT is an I/IA logical or
% numeric array, or when INPICT is an RGB/RGBA image and all three color
% channels are identical to within a given tolerance. 4-D arrays of
% mono images return true... |
d3eea939d65e75337858bf73fdcc7f253e5364609292d7e1196bb6c7892fe91e | MATLAB | 1,868 | 42 | function Muse2txt(MuseStruct)
%% Text files for overview markers
startend = {'BAD__START__','BAD__END__';...
'VF1__START__','VF1__END__';...
'VF3__START__','VF3__END__';...
'VF4__START__','VF4__END__';...
'VF5__START__','VF5__END__';...
'P','P';...
'PP__START__','PP__END__';...
'RR__START_... |
d9da390516df1d41f18148ad891fa6ae1891c630d57944441ae8bf081ff364c2 | MATLAB | 1,868 | 63 | function [h,h2] = spm_plot_quartiles(E,x,varargin)
% Plot median (as a circle) and inter-quartile range (as a bar)
%
% E - data matrix [observations x data points]
% x - domain (x-axis)
% options - Plot options
%
% Returns:
%
% h - handles of the data points
% h2 - handles of the error bars
%
% -... |
0f55c5102198dfc4e91d0b38cecc697ab7a8249b1f2305f2273c670aee690acd | MATLAB | 1,869 | 40 | % PET_classification_celltype
% Try to separate units between putative PN and putative IN according to
% their waveform shape.
% To use with the maximum quantity of data as possible (do not use
% with only few patient, wait to have almost or all patients included)
% To use AFTER PET_project_per_patient because it ... |
d5cffdcc7c4d713ea637326f854e56f3a41a8d90cf239d559ef7bdea7628292e | MATLAB | 1,869 | 33 | function outtext = cp437(intext,rev)
% OUTTEXT=CP437(INTEXT,{REV})
% Simulate the use of IBM CP437 as utilized by textim().
% Input text is converted to UTF8 characters visually
% corresponding to those in CP437.
%
% INTEXT is a character or numeric vector in the range [0 255]
%
% The key 'rev' will rev... |
a481fe523ff2c9f028eb96776731ceda2f6a8c6d14dfbafb225679e7ef17bedc | MATLAB | 1,870 | 42 | function hOVM = alphamask(bwMask, colour, transparency, axHandle)
% ALPHAMASK: Overlay image with semi-transparent mask
%
% Overlays a semi-transparent mask over an image. By default the
% currently displayed figure is overlain.
% Options include overlay colour and opacity.
% Returns a handle to the overlay mask.
... |
aebc2220bd917150be4e6822b04ca745bd28c60c56a79805cf9500355be0bc17 | MATLAB | 1,871 | 72 | function BMdirection(subjectname, runnum, runtype)
%e.g., BMdirection('TEST', 1, 1)
% 12 mini blocks per run, (see below) each consisting of four main block
% types repeated 3 times. Must run both run types to acquire complete set.
%runtypes: 1 IdealCutting/BMLscramble x Upright/Inverted
% 2 ... |
617ad2e337c9416e0e13573240a391b3b0a3abfdc0c8bde379216eaf5cace227 | MATLAB | 1,872 | 49 | %% =========================================================================
% 目标: 使用PEB检验神经-行为相关性在两组间的差异 (交互作用分析)
% =========================================================================
% --- 准备GCM文件和行为学数据 ---
clear;clc;load('SubjectsBehaviorData.mat');load('GCM_Flight_airTraffic.mat');
%% 1. 构建PEB设计矩阵 M... |
dfea87f6bbd1e223b29b245e66283646fcb02e9f1f9415bf679dcdfba6be7268 | MATLAB | 1,874 | 54 | function [s] = find_ams_n_nams(taps, params, precision_am, vicinity)
%% Find the position of ams and nams
%
% **Usage:** [s] = find_ams_n_nams(taps, params, precision_am, vicinity)
%
% Input(s):
% - taps = position of real taps
% - params = cell with the results of findpeaks, peak local maxima and location
% - pr... |
15c47603b6af26bf6a107b42380732b48b15e1364af3e3f82b5b1c34485b15ee | MATLAB | 1,877 | 66 | function CT = hex2uint(hexc,nbytes)
% UINTCT = HEX2UINT(HEXCT,{NBYTES})
% Convert a hexadecimal representation to a numeric array of integers.
% This is primarily useful for converting RGB tuples.
%
% HEXCT is a color table represented as one or more tuples in hexadecimal.
% This may be a char vector, or a cha... |
3ce7cbcb6babd6fe365208a42c54c9cb37c72bad02bccfb7a6853e3f69562bc2 | MATLAB | 1,879 | 48 | % SVReg: Surface-Constrained Volumetric Registration
% Copyright (C) 2017 The Regents of the University of California and the University of Southern California
% Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy
%
% This program is free software; you can redistribute it and/or
% modify it... |
d59cacb2dd7c1572a46a09718257fc1b17c8ef7327ca523e455badbd0729b7a2 | MATLAB | 1,879 | 48 | function Cov = getCov(result)
% this function calculates the covariance matrix
%function Cov = getCov(result)
% result should be a standard result struct which contains the whole
% posterior
% the function then returns the covariance matrix of the posterior believe
% about the parameters
% If result has a precalculated... |
3aee2470a882e213f17bd551aac60893b12d0e08d5e668342cea6c9ec4ce3e19 | MATLAB | 1,881 | 71 | function I = mi_gg(x, y, biascorrect, demeaned)
% MI_GG Mutual information (MI) between two Gaussian variables in bits
% I = mi_gg(x,y) returns the MI between two (possibly multidimensional)
% Gassian variables, x and y, with bias correction.
% If x and/or y are multivariate rows must correspond to samples, colum... |
ad75df5316ef4d848f4317a6cd656b8f8b8c85a5fc97ecca2d00f875b548949d | MATLAB | 1,885 | 71 | %% Example
% This example illustrates how simple it is to do
% continuous wavelet transform (CWT), Cross wavelet transform (XWT)
% and Wavelet Coherence (WTC) plots of your own data.
%
% The time series we will be analyzing are the winter
% Arctic Oscillation index (AO) and
% the maximum sea ice extent in the Baltic (B... |
d22f2a19a10d11ab9fdc39609ca477d9a305df540394ae3a5b91f28337b95cd3 | MATLAB | 1,893 | 53 | function outpict = jpegger(inpict,quality,sluramt)
% JPEGGER(INPICT, QUALITY, {SLURAMT})
% simply returns a copy of INPICT as subject to degradation
% by jpeg compression at QUALITY level
% when a nonzero SLURAMT is specified, behavior changes
% exploits a reversed pixel shift operation in or... |
08d0f925040c903dd5c04b775ea2b959f88b5fd200aa615f13875d9c98354d6e | MATLAB | 1,895 | 41 | function [timestamps, amplitude] = getMUAspiketimes(signal, fs, FrequencyBandMUA, thr)
% by Mattia, based on an old Joachim's function
% INPUT
% MUA : - unfiltered, not downsampled signal
% fs : - sampling frequency in Hz (should be ~32000)
% FrequencyBandMUA : - the frequency ... |
ac477809c63a67cc1292e93b7d4da67ed477155c6e7b8404088c0ee57b1391b6 | MATLAB | 1,895 | 58 | % SUBCAT Concatenate subsets of input arrays along the provided dimension.
%
% Inputs
% ========
% dim : dimension along which to concatenate the selected subsets.
% subset : a cell array {dimension, range, ...} to be provided to the subarray() function.
% Alternatively subset ... |
ddd309d15ee1f773ffc2c1e7a1d96b17d004cfe41236a7916593816078c3fae8 | MATLAB | 1,897 | 48 | function MuseStruct = merge_MuseMarkers(cfg, MuseStruct)
% Use as :
% MuseStruct = merge_MuseMarkers(cfg, MuseStruct)
%
% merge_MuseMarkers merges several different muse markers into a new one
%
% Input :
% cfg.markers_to_merge = {'marker1', 'marker2', 'marker3'};
% cfg.newmarker = 'new_name';
%
%... |
9378b2425ceb65382d05e4fe74042bb3670c6c5dd990832fd60232c1ae70e54d | MATLAB | 1,899 | 80 | function [xx,yy]=nt_relshift(x,y,shift)
%[xx,yy]=nt_relshift(x,y,shift,flag) - delay x relative to y
%
% xx, yy: shifted matrices
%
% x,y: column matrices to shift
% shift: amount to delay x (can be negative or fractionary)
%
% If shift has multiple values, xx and yy are 3D matrices, one shift per
% page. Shifted... |
7fa8328c402b49ede4a979da77096996324acf925a03145f1837fde19d99bd37 | MATLAB | 1,901 | 55 | function [inpict hgram] = imhistmatchFB(inpict,ref,varargin)
% OUTPICT=IMHISTMATCHFB(INPICT,REF,{NBINS})
% [OUTPICT HGRAM]=IMHISTMATCHFB( ... )
% Adjust the contrast of an image such that its intensity distribution conforms to that described
% by a given histogram. If no histogram is given explicitly, a flat (... |
b3d4aca50439366802647c14c71cc80c240f85b913d28a1880d1cbc4cf369648 | MATLAB | 1,903 | 49 | function CBIG_SPGrad_construct_cifti_format(mesh, mask, data, filename)
% CBIG_SPGrad_construct_cifti_format(mesh, mask, data, filename)
%
% This script write data as cifti format
%
% Input:
% - mesh:
% resolution of surface mesh, e.g. 'fsaverage6', 'fs_LR_32k'
%
% - medial_mask: (#num_vertices x 1 binar... |
336ef60872e8df49539a6a186e4265791e684dc6ccd06111c9ad98f4da7069b9 | MATLAB | 1,905 | 76 | function [eigvector, eigvalue] = PCA(data, options)
%PCA Principal Component Analysis
%
% Usage:
% [eigvector, eigvalue] = PCA(data, options)
% [eigvector, eigvalue] = PCA(data)
%
% Input:
% data - Data matrix. Each row vector of fea is a data point.
%
% options.ReducedDi... |
7f06c4e77a3dfbe4150620cb78819ed2e0421d1b04043ad2a833c4d6ed90091c | MATLAB | 1,907 | 82 | function [c2_idx] = gmm(x, varargin)
p = set_default_parameters(varargin{:});
% Initialize
c=0;
c2_idx = zeros(size(c1_idx));
c_sub_idx = zeros(size(c1_idx)); % Subclustering results after GMM. Contains 'local indices'
% Run through the clusters
for i=1:max(c1_idx)
if ~p.quiet, display_progress(i, ma... |
083fc4b431a4b51e12364264d26a577a2d4a213d7ddb8dd6ba2d7a581ceaf976 | MATLAB | 1,908 | 55 | function yred=rednoise(N,g,a);
% REDNOISE: A fast rednoise generator using filter.
%
% example: rednoise(N,g);
%
% Description: generates a rednoise series
% with zero process mean.
% note: statistical mean&variance will be different.
%
% Inputs: n - desired length of time series
% g - lag-1 autocorrelation
% ... |
9791952129337e0bfbe48e64d4fcb9963437e1b56389353e64858a5a40011e43 | MATLAB | 1,908 | 62 | function ha = tight_subplot(Nh, Nw, gap, marg_h, marg_w)
% tight_subplot creates "subplot" axes with adjustable gaps and margins
%
% ha = tight_subplot(Nh, Nw, gap, marg_h, marg_w)
%
% in: Nh number of axes in hight (vertical direction)
% Nw number of axes in width (horizontaldirection)
% ga... |
05826dcca7817514d926061d703612e7efdb2b99dd1c5b6bbc8e5a278b7fd562 | MATLAB | 1,910 | 63 | %%
% plot() with units. If provided, the first argument must be a cell array
% of the form {u, xU, yU} where u is the units structure, and xU and yU
% are strings identifying the **target** x and y units respectively. That
% is, the input is assumed to be in standardized units, and will be
% converted to... |
bc34cd8ded2d75619662a93f4b0f3dd805e106d3bd51aa68f646d132a2885a88 | MATLAB | 1,910 | 63 | function [H0] = contrasts_wald(fitmodel,emm,L)
% Hypothesis testing using Wald t/Z-tests on specified joint coefficients
% (i.e. on input contrasts)
% Copyright 2019, J. Hartman, Cornell University
% % written using Matlab version R2016a
%
% INPUTS:
% fitmodel is a GeneralizedLinearMixedModel object
% emm is struct o... |
16708a9ce56b256a518bb0d5be3d74e65a184db5a9a5a76e75639cf2ec48392d | MATLAB | 1,912 | 107 | function H=demo_shadedErrorBar
% demo function for shadedErrorBar
%
% function demo_shadedErrorBar
%
% No input or output arguments.
%
%
%
rows=2;
cols=2;
clf
subplot(rows,cols,1)
%Plot the mean and standard deviation then overlay the raw data
y=randn(30,80)*5;
x=(1:size(y,2))-40;
yP = sin( linspace(-2*pi,2*pi,l... |
5f3cc33eec07edb5a3e44b55ff69e649a5116156c92238e1c65b25ad9103c96e | MATLAB | 1,912 | 57 | function [normX,Bx,By]=normalizepdf(X)
% Forces the pdf of data to have a normal distribution using a data adaptive lookup table.
%
% [normX,Bx,By]=normalizepdf(X)
%
% normX=N(X) where N is an data adaptive monotonically increasing function.
% normX will have zero mean and unit variance.
%
% Bx,By describes the lookup ... |
aed30d8d9ebf1686030698c49632595ab6015495c76f2394604e2dbbb4b2ab5c | MATLAB | 1,914 | 65 | function CBIG_Smooth3DFrames(input_prefix, start, stop, input_file_type, output_prefix, mask_file, outside_mask_type, method, filter_size, arg)
% CBIG_Smooth3DFrames(input_prefix, start, stop, input_file_type, output_prefix, mask_file, outside_mask_type, method, filter_size, arg)
% This function is used to smooth a 3D... |
b924b6f4c36100687e0384cd43842310094b78b2790659b0734321ca2a1d28ac | MATLAB | 1,916 | 44 | function [randinds_verts,randinds_FC] = CBIG_SPGrad_set_downsample_params(num_vertices,sub_verts,sub_FC)
% [randinds_verts,randinds_FC] = CBIG_SPGrad_set_downsample_params(num_vertices,sub_verts,sub_FC)
%
% This script sets up the downsampling parameters for speeding up gradients.
%
% Input:
% - num_vertices:
% ... |
0b97fff769057217ba681c134701d32a412f1d4e9b242c047dbaa94b08864240 | MATLAB | 1,917 | 58 | % A script to make activity maps for many files at once
% specify the files you want to run in a text file
%
% Currently for movies with two odor pulses (easy to change)
% You can use this as a template for your own movies with different stimuli
% Written by Andrew Lin
% This script processes multiple movies all with ... |
5d767fcf3d52900de4bd9bf583663cd3538c5b4286fba97951b21ebe8ecf02e4 | MATLAB | 1,921 | 67 | function plot_ReaChR_raster(data, reachr_id, trigtimes, flash_type, trigS_R, trigS_P, varargin)
% subplot of ReaChR response rasters
%
% arguments: data - datarun structure
% reachr_id - id's for plotting
% trigtimes - triger times for the different trig sets
% trigS_R -... |
5aa7d7fdb1a6bd4500be2052f14d6af71e712f170eec260ee9f0278225b8d3ed | MATLAB | 1,924 | 44 |
% ‘Optimizer’
%%
clc
clear
close all
%%
%%
Fun_name=“F7”; % Function name of test functions: “F1” to “F23”
SearchAgents=30; % Function name of s (population members)
Max_iterations=1000; % maximum iteration count for Fun_name
[lowerbound,upperbound,dimension,fitnes... |
da11bd6fd8deea5c4a40e336196b73243300a597028e9a147810b81e06c0914b | MATLAB | 1,924 | 77 | %
% Plot a motor trajectory on top of the image
%
% Input
% I [105 x 105] image (double or binary) (large numbers are BLACK)
% drawings: [ns x 1 cell] of strokes in motor space
% bool_start: [logical] (default=true) show start position?
% lw: [scalar] (default=4) line width
%
function plot_motor_on_image(I,draw... |
7e9d787d0f0a6b14e53c15abd48be59aec130610a8153508f4c2d99adadf1fbd | MATLAB | 1,925 | 55 | function [trialinfo] = writemicroforspykingcircus_allmarkers(cfg)
fname_output = fullfile(cfg.datasavedir,['SC_trialinfo_allmarkers.mat']);
if exist(fname_output,'file') && cfg.force == false
fprintf('Loading trialinfo: %s \n',fname_output);
load(fname_output,'trialinfo','circuspath');
else
for ichan... |
27a501be8a5c4c1901ade2060bc0a0b3e1e2ab84148319b54856397862831416 | MATLAB | 1,927 | 65 | function [cornerX, cornerY] = barCorners(xPos, height, widthFactor, offset, maxHeight, minHeight, subtractOffset)
% Default arguments
if nargin < 3
widthFactor = 1;
end
if nargin < 4
offset = 0;
end
if nargin >= 5
height = min(height, maxHeight);
end
if nargin >= 6
he... |
17d5d92ba6e652564a6a07ac95b96c56e7447c126d2e0450752baad75cad02b3 | MATLAB | 1,928 | 66 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Inverse Short-Time Fourier Transform %
% with MATLAB Implementation %
% %
% Author: M.Sc. Eng. Hristo Zhivomirov 12/26/13 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
d8f9e35e2702ca730bea689636ba6fa532a4568f697670e3b219e7ab31d4ff80 | MATLAB | 1,929 | 58 | classdef BrainSpace3D < handle
% BrainSpace3D
% Handles 3D spatial structure of brain regions independently of their attributes.
properties
VoxelSize (1,3) {mustBeInteger} % [LR, AP, DV] dimensions
DomainDefineTags3D (:,:,:) logical % Logical mask for defined voxels
RegionIndex3D... |
1101d6825c0059bc3f40415f4b648c6da0c84dbff1e154c58ca163ee00337dbc | MATLAB | 1,933 | 70 | function [y_hat, beta] = CBIG_regress_X_from_y_train(y, X)
% [y_hat, beta] = CBIG_regress_X_from_y_train(y, X)
%
% This function regress covariates X (e.g. head motion) from y (e.g.
% behavioral scores) in the training set (for any preditive model).
%
% Inputs:
% - y
% A #TrainingSubjects x 1 vector. Each ro... |
1adc366714d32916dc62864e2011689634f723d3df3b9f3f6cc54b54f8c6ed21 | MATLAB | 1,933 | 45 |
% ‘Optimizer’
%%
clc
clear
close all
%%
%%
Fun_name=“F4”; % Function name of test functions: “F1” to “F23”
SearchAgents=30; % Function name of Pelicans (population members)
Max_iterations=1000; % maximum iteration count for Fun_name
[lowerbound,upperbound,dimensi... |
84d97fe82c621355227f996c65935a3236d62f581c68aa9a0881308a90665ff2 | MATLAB | 1,935 | 60 | function [cfg, LFP] = alignClusters(cfg, LFP)
cfg.orientation = ft_getopt(cfg, 'orientation', 'landscape');
t = [-0.15 0.10];
% t-zero LFPs
fig = figure;
papersize = 800;
set(fig, 'PaperPositionMode', 'auto');
if strcmp(cfg.orientation, 'landscape')
set(fig, 'position', [20 -60 papersize*sqrt(2) papers... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.