sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ba71e0168b5291b49f67607406852977653d597cf531ed9bd491ab2f1ab54397
MATLAB
3,642
99
function [subj pathfilename] = move_pattern_to_hd(subj,patname,varargin) % Moves the pattern MAT to the hard disk % % [SUBJ PATHFILENAME] = MOVE_PATTERN_TO_HD(SUBJ,PATNAME,...) % % Saves the pattern MAT field as a file, and removes the mat field % from the pattern cell, to save hard disk space. It also adds a field % ...
3142ae1a3aa51642d3460737fb81d3f30bf1d8c61f5cbb6a23d3a8c752581a3a
MATLAB
3,645
145
function [errmsgs warnmsgs] = unit_create_spatial_avg_pat(varargin) % USAGE :[ERRMSGS WARNMSGS] = TEST_CREATE_SPATIAL_AVG_PAT(...) % % This is a script that tests the spatial averaging functionality. % % INPUT ARGUMENTS: % % STDOUT (optional, default = true) If true, prints errors and % warnings to screen as they occ...
d3b0072ce5c1e555a6d45438a0e10f7837d0d6a8ef19b872411789e8c6133d27
MATLAB
3,646
106
% Preprocessing unit test % % average_samples tol = 10e-10; N = 256; X = randn(N,1); % Get default parameters pparam = mv_get_preprocess_param('average_samples'); %% if a class has less than group_size samples, it should disappear from the averaged sample pparam.group_size = 5; clabel = ones(N,1); clabel(N-30:end)...
732c4a049bcc8961ef59a5e3f51a5014723915a37aa6a258136d3954cdfd5285
MATLAB
3,651
137
% This file is part of the Matlab Toolbox for Dimensionality Reduction v0.7.2b. % The toolbox can be obtained from http://homepage.tudelft.nl/19j49 % You are free to use, change, or redistribute this code in any way you % want for non-commercial purposes. However, it is appreciated if you % maintain the name of th...
b87c227716cfbe4a978f0cbe0070a1df4b8a63e657f4d9ea87cd0e6241d9fea2
MATLAB
3,655
130
%% Resonance analysis single files (raw nwb files) fn= '/Volumes/Expansion/Ephys from 226/H23.29.244.01_6 /H23.29.244.11.01.01.nwb'; nwb = NWBfile(fn,[{'CHIRP'}]); %% Zorg dat hiervoor de traces individueel al bekeken zijn of ze vergelijkbaar zijn %(indien niet, geen average trace nemen) % Bij errors 'expected in...
311cf240903e3c8e4a456b8d69437f90b27463d09324abab6d02a6a0158a9f10
MATLAB
3,658
78
%Estimates flicker modulation of single units, using PSTH plots an circular statistics. %2024/02/25 function modulation_singleunits(fnames) %CONTINUE WORKING ON THIS... %SHOW VISUAL AND AUDIO RESPONSE FOR SAME UNIT, OR SHOW A SUBSET OF %CONDITIONS FOR SAME UNIT, SO READER CAN COMPARE. MOREOVER, RANDOM SHO...
ec678869af4850ffb63c0376e8f21184430bc9e6cff035fc5e6e899d69607f8b
MATLAB
3,660
116
function h = plot(this, varargin) %PLOT plot an ACTI object % % $Author: Peng Li % $Date: Dec 02, 2020 % % axes if nargin == 2 if isa(varargin{1}, 'actigraphy2') if isempty(findobj('Tag', 'actigraphyFig')) h = actigraphy2(this); else h = varargin{1}; ...
2f7d176a61562287f69d659b8d7e77ad946ebcf4bea8db22664d82f3c57a80c9
MATLAB
3,662
125
function [modelToLoadFolder] = downlaodModelResultsImages(resultsPath,isCorrectAspectRatio2To1,outputFolder,scaleBar) % This function downloads test and train images from aws. Saves locally for % further analysis % INPUTS: % resultsPath - path to model result, get using s3GetPathToModelResult % isCorrectAspect...
405189cabd512ec744d7526f26239b9d8a55c10f1a863c7f00487e590a4d70f6
MATLAB
3,662
117
function [subj] = create_thresh_mask(subj,map_patin,new_maskname,thresh,varargin) % Create a boolean mask by thresholding a statmap % % SUBJ = CREATE_THRESH_MASK(SUBJ,MAP_PATIN,NEW_MASKNAME,THRESH,VARARGIN) % % Adds the following objects: % - mask object OR mask group (if PATGROUP == true) % % Takes the MAP_PATIN stat...
37cb8416b80a7e7a1629dc82d2987d0a8bc68a9442bf035c33f98fb9a239301f
MATLAB
3,663
81
function [G,h] = build_G_h_quadratic2d(A,delta_b,transformationModel) % BUILD_G_H_QUADRATIC2D Builds the equation system G*p = h % % [G,h] = build_G_h_quadratic2d(A,delta_b,transformationModel) % % INPUT ARGUMENTS % A - A = [A22 A21] % [A12 A11] % delta_b -...
38754174501ce58f73638277521e9019fdd791866c16889583cc8d72cac703ae
MATLAB
3,664
116
function [t_cluster, clusters] = find_significant_cluster(data, tail) % function [t_cluster, clusters] = find_significant_cluster(data, tail) % % Find clusters of subsequent time points with above-chance reconstruction % accuracy based on t-tests. % % Input: % - data: 2-D data array, 1st dimension are subjects and ...
3651e3da02b2a02d3255dfdf9ef432f25d09bdf63e7afdfdaf5bec596c88e6c0
MATLAB
3,667
62
%Plots PSDs along with occluded condition, for all electrodes, and saves figure. %2024/02/25 function plot_depthelectrode_occluded(PSD_results,outputFolder) depth_electrodes=extract_clinLFP_labels(PSD_results.label); %organize electrode contacts by detph electrode fig=[]; for i=1:length(depth_electrod...
8c6f0de39982528ee8b222c5086b2d4229fd46f856b8467577212a1eb30b4471
MATLAB
3,667
76
% Fit a utility logit choice model for binary risky choice data % % 'type' : String input indicating the model to fit. One of 'E','R','W','H' % 'E' : Expected Utility Theory: U = p * A^alpha. % 'R' : Classic Risk-Return Model (aka Mean-Variance Model): U = EV - b * Var. % 'W' : Elke Weber's Coeffic...
44b14e6ed2ea5c7ae1ad60da78bb83d42acf46d267791b7254fd53a865f62f3a
MATLAB
3,670
89
function univ_pe_1st() cfg = load('neurovar_cfg.mat').cfg; for i_sub = 1:44 fprintf(strcat('1st Level PEs Sub_', string(i_sub),'\n')); pipeline_dir = fullfile(cfg.global.deriv_dir, 'univ_pe_1st',... strcat('sub-',sprintf('%02d',i_sub))); mkdir(pipeline_dir); mult_cond_dir = fullfile(pip...
d294038a96cabc14cb7d232ba385e01ef19903bc952ac44be25bd3f613403a14
MATLAB
3,671
112
function this = cosinorActi(this) %COSINORACTI Perform cosinor analysis on an ACTI object % based on cosinor class methods % % $Author: Peng Li % $Date: Nov 11, 2022 % period = this.CosinorInfo.HarmonicsInHour; minLen = this.CosinorInfo.MinimumLengthInDays; alpha = this.CosinorInfo.CIAlpha; epoch ...
9cd8a2d0e3976ef65541cfc885877d708d463a87a942ca4d5b9408ddaef26bc7
MATLAB
3,675
121
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This code generates a kymograph. % % @v = the video % @rect = specifies the area in the video that should be analyzed. % @startTimeMin = the minute at which the kymograph should start. Decimals % permitted. % @endTimeMin = the minute at which the kymograph should end. May...
ab40207d72ba944ddb404c6bca5a0e00e96ded53b2ef5c99ccade984336e6424
MATLAB
3,676
166
function [mu, Kappa, pval, Rmean, delta, sigma,confDw,confUp] = CircularMean(theta,varargin) % [theta, Kappa, pval, Rmean, delta] = CircularMean(t) ciricualr mean, dispersion % and significance of a circular datasets % % INPUTS: % t: a column vector of angles (in radians) or a n x p matrix, n: samples / % p:variables...
c36aa5e4e756a6d40f52ef8d2c9195e37c3240725dad8d8c48a12fbbbaa7241e
MATLAB
3,676
112
%% Bar Plot of d' and LR Bias (Pooled + JK errorbars) data_path = 'E:\Adi\Copy_of_V4_FEF_Project\Code_Plotting\data'; functions_path = 'E:\Adi\Copy_of_V4_FEF_Project\Code_Plotting\functions'; addpath(functions_path); addpath(data_path) %% Initialize variables par_all = cell(1,2); par_all_mi = cell(1,2); ...
c79fb5c9fbb1e68edcb93c74e7bf3e3f268ef060e49358286783613048933619
MATLAB
3,676
68
function PlotTSMean_PreVPost_ChooseStat( TS_mean_preVpost, TS_idx, TITLE, YLABEL, YLIMS, stdOrsem, STAT ) % Michelle Cahill 20200601 %PlotTSMean_PreVPost plots the mean value of each t-series pre-stim and % post-stim & the mean+-std or +- sem of all t-series. A paired t-test is carried % out for identified pre/...
243c64399ca1ef9e4f06b71bdd0fb2c8aa87ae804713d293e4aef4911d057b7e
MATLAB
3,678
134
function this = qc(this) %QC qc an ACTI object % % $Author: Peng Li % $Date: Feb 07, 2022 % $Modif.: Aug 13, 2025 % output data length in day % len = length(this.Data); qcMessage = ""; % check data length len_in_day = len * this.Epoch / 3600 / 24; %% 1: consistant off-wrist during ni...
ab5fe28a4b2eec06060898ee76853f97d3a6fb13c4d8a64452ecebb3ebe6f017
MATLAB
3,679
95
function [bincountmatrix, channel_Out, xbin_ISI,keep_times]= create_conduction_time_histogram_210712( folder_name, length_rec_sec) %Edit made to original: added output channel name channel_Out=[]; %Creates conduction time histogram for matched units present in %matching_table_wNMI present in folder indicated by fold...
5f250f1d5bfdf9a4aefff5dd5c5d41bcadc8aeba78156cc47699abfdbd327d08
MATLAB
3,689
141
%% Replicate result from Zhang et al: %%% Zhang S, Liu Z, Grant A, Keupp J, Lenkinski RE, Vinogradov E. %%% Balanced Steady-State Free Precession (bSSFP) from an effective field %%% perspective: Application to the detection of chemical exchange (bSSFPX). %%% J. Magn. Reson. 2017;275:55?67. addpath(genpath('li...
70f2bbda226ca926c8c8933a29e8b904b05f9ef8df83aae82cd83a483773aec1
MATLAB
3,702
77
function [A,h] = build_A_h_2d(dphi,cert,phiGrad,transformatioinModel) % BUILD_A_H_LINEAR2D Builds the equation system A*p = h % % INPUT ARGUMENTS % dphi - Phase-difference % cert - Certainty % phiGrad - Phase gradient % transformationModel - Transformation model (transl...
176a7091eb330443a9da153a62fdab54c5bf9e2d0bfcd1ae080e93462c47690c
MATLAB
3,705
99
function Image5and6_SingleCellsWithFlow_and_WithFlowColoredByDirection(imageExportFolder, fileParams, flowFigureImageParams, numA, imageAshow, vxMatShowA, vyMatShowA, relMatShowA, numMicrons, imageNumber) %% Import parameters % File Params pxPerMicron = fileParams.pxPerMicron; % Flow Figure Params frameNum = flowFigu...
25808c2ad0367bf2e081e6c23b57eb67ecbb90c0926249fb8c54b1a3362a1f22
MATLAB
3,707
128
function [omega, tbl, pVals] = calOmegaSquare(response,labels,labelNames, varargin) p = inputParser; defaultPartial = false; addOptional(p,'partial',defaultPartial,@islogical); defaultSstype = 2; addOptional(p,'sstype',defaultSstype,@isnumeric); defaultIncludeTime = true; addOptional(p,'includeTime',defaultIncludeT...
9473230cd132405e1e199874204b0c85cdc4eb30f663c7a2d372659260c297ee
MATLAB
3,708
124
function [perfmet] = perfmet_maxclass(acts,targs,scratchpad,varargin) % This is the most basic performance metric. % % [PERFMET] = PERFMET_MAXCLASS(ACTS,TARGS,SCRATCHPAD,...) % % The classifier is considered to guess correctly if its maximally % active row (the unit that it guessed) corresponds to the most active % ro...
21edf6aff0145a15648fbc4f727806b319a8da5698f88ca959882801e5442a0f
MATLAB
3,715
86
% function p = stats_permutation(n_correct,reference,tail) % % Function to calculate p-value for a permutation test. % The permutation sample needs to have been calculated already, e.g. using % make_design_permutation.m % The minimal p-value provided by this function is 1/(n+1) where n is the % number of existin...
173074ad1a2529def2dd55b792f4145bdad7c1ffd7cb931251b3d9eef75a212a
MATLAB
3,720
124
function chk = testfun(fnh) % Test function for NATSORT, NATSORTFILES, and NATSORTROWS. Do not call! % % (c) 2012-2022 Stephen Cobeldick % % See also NATSORT_TEST NATSORTFILES_TEST NATSORTROWS_TEST chk = @nestfun; wrn = warning('off','SC:natsort:rgx:SanityCheck'); itr = 0; cnt = 0; if feature('hotlinks') ...
54fce581c255f5271a3aa9d2b325283fed58c2e53eed0cddb3cb761d4f24dd47
MATLAB
3,722
115
%DEMOLGD1 Demonstrate simple MLP optimisation with on-line gradient descent % % Description % The problem consists of one input variable X and one target variable % T with data generated by sampling X at equal intervals and then % generating target data by computing SIN(2*PI*X) and adding Gaussian % noise. A 2-layer ne...
4c80fce35f8b24e812b251aff71ca74638e20d224c2a724bc2aa73413a8cbf0f
MATLAB
3,726
104
function ttest_to_bar_210226(table1,table2,ttable) % Assumes tables 1 and 2 are already organized % IMPORTANT NOTE: UP AND DOWN REGULATION WERE SWITCHED DURING CREATION, % NAMES IN SAVED PICTURES SWITCHED BUT VARIABLES HAVE NOT BEEN if all(~ismember({'Electrode Pairs','Spike Area','Conduction Time','Unit Pairs','Direc...
1cdcb0d201706a9e75409d470c383728513f569d42be0ab9011af7b9b2893947
MATLAB
3,729
114
function yOCT2Dicom (data, filepath, dimensions, c) %This function saves a grayscale version of data to a Dicom stack file. %Dimensions are (z,x) and each frame is y %INPUTS % data - scan data (dimensions are (z,x,y) % filpath - filepath of output Dicom file (including 'name.dcm') % dimensions - describing the in...
1c05efaedc1b28def1246414846b3285b01328077bae6ca52430e4ac6b66d77d
MATLAB
3,733
112
function RasterPlot(S, varargin) % RasterPlot(S, height, bar, tstart, tend) % % Plot spike trains as rasters. % INPUT: % S: tsdArray of ts objects, spike trains % OPTIONS: % Height: the height allocated to each cell (includes spacing), default 1 % BarFraction: the fraction of height occupied by a cell, default 0.8 % ...
4f93af2ff86d999279ea073dc512f6f89e49827b97b3130dc1eabe8e67491b57
MATLAB
3,738
128
function [r_CI, m_CI, k_CI] = ME_vMMM_CI(y, r_est, m_est, k_est, m, alpha) % _ % Confidence Intervals for a von Mises Mixture Model using Wilks's Theorem % FORMAT [r_CI, m_CI, k_CI] = ME_vMMM_CI(y, r_est, m_est, k_est, m, alpha) % % y - an N x 1 vector of angles (domain: -pi <= y_i <= +pi) % r_est - a 1 x...
80ac8ff91921e6e9a69a2f9d8e52b986b788050834c7eb89f9b65b5749c6750a
MATLAB
3,740
126
% Resps = []; Typs = []; for i = 1:7 for j = 1:5 ids = gtyp == i & gsiz == 1 & gfrq == j; if j == 1 ncel = sum(ids); cresp = nan(ncel, 5); end cresp(:, j) = y(ids); end Resps = [Resps; cresp]; Typs = [Typs; i*ones(ncel, 1)]; end ke...
1c32fe1f5a297da37cc8ba0feeca9ce599d483433e0c757271230c5a5f7caab5
MATLAB
3,741
126
%% Wave Clus Output Plotting % load both the raw data and times files manually %this is for wells %clc %close all %% loading current_program=dbstack(); current_program=current_program.name; % load spike dyn from folder above current in dir spike_dyn_path=fullfile('..\','well_spike_dynamics_table*.mat'); dir_spike_dyn=...
18a685157fca1e82445a2a3de852ef9a875be470b8fb281e69460c9240441700
MATLAB
3,742
112
%ACTIGRAPHY2 % % Descriptions tba % % $Author: Peng Li, Ph.D. % $Date: Jan 01, 2022 % % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % (C) Peng Li 2019 - % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % classdef actigraphy2 < handle ...
25debdf4fd2ed52329124b503fc91c6d8ff19c4a0125930f0eac836efc868ac5
MATLAB
3,744
103
function model = pp_realign(sub_id, p) % function model = pp_realign(sub_id, p) % % Runs SPM realignment (i.e. head motion correction) on unprocessed fMRI % images. % % Input: % - sub_id: ID of the current subject. % - p: Structure with analysis parameters. % % Output: % - model: Structure with all SPM settings ...
59ce94a91ee88901121beb517a9ea7e5da9c90242362de680bc09c7b1ac32a13
MATLAB
3,745
132
rng(42) tol = 10e-10; nsamples = 100; nfeatures = 10; nclasses = 2; prop = []; scale = 1; do_plot = 0; [X, clabel] = simulate_gaussian_data(nsamples, nfeatures, nclasses, prop, scale, do_plot); %% BINOMIAL: accuracy = 0.5 should give p=0.5 when N uneven cfg = []; cfg.test = 'binomial'; % create fake result resul...
e95e909a00bd7c2f89e1f2c5fc92206e137162490fcdc6041e25c7937cc6b5a2
MATLAB
3,751
133
function fig = plot_transients_fragments(step1, step2, Eventname) i1 = step2.(Eventname).i1; i2 = step2.(Eventname).i2; D = step2.(Eventname).D; x = step2.(Eventname).x; zscored = step2.(Eventname).transients_PETA.zscored_matrix; baseline_period_start_msec = step2.(Eventname).baseline_period_start_msec; baseline_perio...
ca36881c0a62d693824b79d1a17244c91bf062023610fc32e6c8030c4a4c4e5e
MATLAB
3,756
110
function [OCTSystem, OCTSystemManufacturer] = yOCTLoadInterfFromFile_WhatOCTSystemIsIt(inputDataFolder) %This function goes to inputDataFolder and figures out which OCT system is %it (from the OCT systems that are supported by this code package) %% Input checks %Modify for compatability, this function works even ...
c7158ebaf4eea4fbcfbcb8460a4eb19b7a676997532fe54522739194247a2550
MATLAB
3,758
113
function [interferogram, apodization,prof] = yOCTLoadInterfFromFile_WasatchData(varargin) %Interface implementation of yOCTLoadInterfFromFile. See help yOCTLoadInterfFromFile % OUTPUTS: % - interferogram - interferogram data, apodization corrected. % Dimensions order (lambda,x,y,AScanAvg,BScanAvg). % ...
002a676e246d2beabc44d74e4ed5bd319cd41ef0c0d4b0ca92ab40444070ec1d
MATLAB
3,759
131
function [dimensions] = yOCTLoadInterfFromFile_WasatchHeader(inputDataFolder) %This function loads dimensions structure from xml header % INPUTS: % - inputDataFolder - OCT folder with header.xml file %% Figure Out basic Parameters if (awsIsAWSPath(inputDataFolder)) %Load Data from AWS awsSetCredentia...
0081446e1ad8fb8b19b444c6a509f316b5d9e0dd2d12baf44f5368cdc6b3f4e8
MATLAB
3,763
85
function [ks_stats_D, surr_a_est] = computeKSStatSurrogateData(a_hat, x_min, x_max_val, n_total, n_tail, emp_bins, num_surr) % generate surrogate datasets and measure the KS statistic between model % and surrogate dataset % ks_stats_D: over power law only (eqn 3.9) % ks_stats_Surr: over entire region % tail_bins are t...
68610b9db528206243f9bac872a8000772b978346a7bf2296694fa5909edfd25
MATLAB
3,764
123
%$Release 4.0 % Copyright (c) 2005, Massachusetts General Hospital % All rights reserved. % % Redistribution and use in source and binary forms, with or without modification, % are permitted provided that the following conditions are met: % % Redistributions of source code must retain the above copyright notice, thi...
ae5d98dea8f0b149ea44f2cbb6afb339bd560a468efc02651590331ae1ce526d
MATLAB
3,768
74
%This function creates simulated 40Hz flicker data based on the SPEP %response and the superposition hypothesis. %NEED TO ADJUST DATA VARIABLE SO THAT ITS FIELDS MATCH THE KINDS OF FIELDS %WE GET FOR FLICKER FIELDTRIP DATA. %2024/02/25 function superposition_modeling_data(fnames) %fetch data: load(fnames....
145ae3f0c1af0dba9f2da138c3630f17abfc505835063d40e69886c8cfac2042
MATLAB
3,769
68
function plot_heat_maps(Dataset,geno_names,rec_type,events_names,events_plot) Xnew = -(40*10):1:(60*10); for gg=1:1:length(geno_names) %loop on genotypes for rr=1:1:length(rec_type) %loop on eat or run sessions figure('Name',[geno_names{gg},': Rep. trials ',rec_type{rr}]) %align trials to door open...
2d3010f4254adeb9aff77387eee572cf2fdaa1f5f590b0be317da573a92a7eb9
MATLAB
3,771
129
%% Recalculate the repeat reliability and the shuffle value Diameter = 150; dids = find(ismember(ROITable(:, 8), Diameter)); ndids = length(dids); nFz = size(DMat, 2); Quals = nan(ndids, nFz); rQuals = nan(ndids, nFz); Qualtyp = nan(ndids, 1); mPhis = nan(ndids, nFz); stda = std(DMat(:)); rng('shuffle'); for...
1c470744146af23f1848dbd24be758717d6123df6b098ab1bb418d68a0443694
MATLAB
3,772
121
function [fh, rasterAx, histAx, matVal] = ImagePETH(S, center, TStart, TEnd, varargin) % Displays a PETH/raster plot-like for continuous data. % % USAGE: % [fh, rasterAx, histAx] = RasterPETH_c(S, center, TStart, TEnd, 'ParameterName','Value') % % RasterPETH_c creates a raster plot, triggered on different...
617e8549d75de010ef6c850a23394f323d2e03b2a7b88ffa5faf0816e9c23047
MATLAB
3,773
98
% About % % Descriptions tba % % $Author: Peng Li, Ph.D. % $Date: May 16, 2018 % $Modif.: Nov 15, 2022 % Oct 15, 2025 % simply and adjust layout % % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % (C) Peng Li 2016 - % +++...
ffd8357e9306289eef35324b5690a990b8d73af8b78b428559e1b4243f8a2e14
MATLAB
3,779
161
function [errmsgs warnmsgs] = unit_statmap_xcorr(varargin) % [ERRMSGS WARNMSGS] = UNIT_STATMAP_XCORR(type) % % This is a script that tests the cross correlation statmap. % % INPUT ARGUMENTS: % % STDOUT (optional, default = true) If true, prints errors and % warnings to screen as they occur. % % OUTPUT ARGUMENTS: % %...
310274208e68f9aab87a3b49ca6c183df77631cdd4ab31b5c579436270babec7
MATLAB
3,780
90
function ms = msGenerateVideoObj(dirName, filePrefix) %MSGENERATEMS Summary of this function goes here % Detailed explanation goes here MAXFRAMESPERFILE = 1000; %This is set in the miniscope control software % find avi and dat files aviFiles = dir([dirName filesep '*.avi']); datFiles = dir([dirN...
80c664c8b102a1cb0b86fea0e68b5727c00978e0deed4c058abef44e1567a485
MATLAB
3,780
45
matlabbatch{1}.spm.tools.beamforming.data.dir = {'D:\home\Data\4AshO\Phantom_Images'}; matlabbatch{1}.spm.tools.beamforming.data.D = {'D:\home\Data\4AshO\ROI_sim.mat'}; % 'efROI_tsss_sphere_einner_rsss_spmeeg_uespmeeg_phantom090715_BrainampDBS_20150709_11.mat']}; matlabbatch{1}.spm.tools.beamforming.data.val = 1; ma...
31374acd1f6fd926be25c2545dc5adae95ec99941365114e5e8ba6b0a2bc920f
MATLAB
3,784
146
clear [task_info,supPath,~,task_DB_path] = loadDBAndSpecifyDataPaths('Vermis'); EPOCH = 'targetMovementOnset'; DIRECIONS = 0:45:315; PROBABILITIES = [25,75]; PLOT_CELL = false; TASK = "saccade"; req_params = reqParamsEffectSize(TASK); %req_params.cell_type = {'BG msn'}; lines = findLinesInDB (task_info, req_params);...
ce93d44cd7ac8f87494bf2638db788a2a4e2901ba4227ba9cd0001ccb0b81b04
MATLAB
3,785
83
% This script is a template that can be used for a decoding analysis on % brain image data. It is for people who have betas available from an % SPM.mat and want to automatically extract the relevant images used for % classification, as well as corresponding labels and decoding chunk numbers % (e.g. run numbers). ...
308d2b9cb65551e2b844f49f3b2639ff5129337a3b32d6ec1bf30e799ed4c4bd
MATLAB
3,789
130
function DisplayVisualization(Y, C, marker_size, class_names, font_size, fig_width,augmented, show_legend) % Display 2-D scatter-plot % % DisplayVisualization(Y, C) % DisplayVisualization(Y, C, marker_size) % DisplayVisualization(Y, C, marker_size, class_names, font_size) % DisplayVisualization(Y, C, mark...
34731c28bb8d1546e0c1db17ba4b855f768b10d6be37c328e5abb7b57344a21c
MATLAB
3,791
89
function [BEH] = getBehavior_eegCAT(dir,fin,model) %% Read Behavioral data filename = fullfile(dir.dir, strcat('BEHdata-',fin, '.mat')); fprintf(' Load File: %s\n', filename); load(filename,'BEHdata'); filename2 = fullfile(dir.dir_fits ,strcat('sim-', model, '-',fin, '.mat')); fprintf(' Load File: %s\n', filename...
e174aeea328dab8888b417bf128ae305672deaf6617553e4041677685733f7ac
MATLAB
3,794
143
function barerr(x, y, e, varargin) % BARERR - Bar graph with error bars and significance marks. % % Usage: % % barerr(x, y, e, ...) % barerr(x, y, e, 'p_vals', p, ...) % % BARERR will plot a bar graph with error bars and (optionally) % significance asterisks indicating that a given bar is % statistically significan...
6fc5e4803425e549580955cb6aa584e41e059f50c357f177debb9cc5f67e0570
MATLAB
3,796
84
%% Extract frequency information % Perform time frequency calculation % Check if variable Exclusion_Info exists already. If yes, load it. if exist([output_dir output_specific 'Exclusion_Info.mat']) == 2 load([output_dir output_specific 'Exclusion_Info'],'Exclusion_Info'); end for s=1:length(subject_list...
336045aa2a24c75112dfb3d84d94ad547886c4771d3d53289e4e8f48f0592072
MATLAB
3,800
92
function output=process_MF_data(tracedata,filter_parameter) minPhot=filter_parameter.minPhot; maxPhot=filter_parameter.maxPhot; minStepSize=filter_parameter.minStepSize; photsmW=9; resulttable=[];SBR=[];accepted=0;rejected=0; %initialize arrays and counters for m=1:length(tracedata) %calculate SCE and fi...
f4871dcd3118202d24cd6161c441c004cf61ee9af70619320bb681d78e355e12
MATLAB
3,800
115
function [subj] = average_object(subj,objtype,objname,labels_name,varargin) % Averages together all the sets of TRs with the same LABELS identifier % % [SUBJ] = AVERAGE_OBJECT(SUBJ,OBJTYPE,OBJNAME,LABELS_NAME,...) % % See https://compmem.princeton.edu/mvpa_docs/TutorialAvg % % Adds the following objects: % -...
a9a4af57971fec67847b5514f327a26d7c095234e3d7eeaf0ba95c885ddcab30
MATLAB
3,808
112
function test_suite = test_parse_filename %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> catch % no problem; early Matlab versions can use initTestSuite fine end initTestSuite; end function test_parse_filename_warnings() s...
0b13a27b4a0323ba3538e70ff2fa0c34351eb38ef5c9012ad4e185902f14f404
MATLAB
3,814
98
function this = addSingleGap(this, actigraphy, singleGap) % ADDSINGLEGAP Adds a new gap to ACTIGRAPHY and return the updated .Gap % property % % $Author: Peng Li % $Date: Feb 19, 2026 % $Modif.: Feb 20, 2026 % Add internal verification of SINGLEGAP validity % Mar 10, 2026 % ...
641d572652b4481b955ca42767579b2202b4f70707fa826d9def7aba2d4d7703
MATLAB
3,817
109
function [L,weights] = CrossValidationCrossCorrPrediction_Cells(qPre,qPost,sPost,binT,ep) % [L,params] = CrossValidationCrossCorrPrediction_Cells(qPre,qPost,sPost,ep) % % computes the loglikelihood prediction of an ensemble of target spike trains given another ensemble of (predictor) spike trains % The prediction is ...
816de8763f480b7ec9ab7bcd79d1826de7686fc7be4e9f37bf9c61c4c6a6f90e
MATLAB
3,819
126
%% CLEAR AND INITIALIZE clear;close all;clc;tic; sfreq = 10; % DEFINE INPUTS AND OUTPUTS params.analysis_folder = 'E:\NAS_SD\SuiviClient\Triffilieff\2023\Analyses\RWD_Anna\Exp1'; results_folder = [params.analysis_folder filesep 'RESULTS']; load([results_folder filesep 'RESULTS.mat']); %% OVERWRITE ANALYSIS PARAMETER...
99dc34ad00d765faf3552177579e18e59bb635167648e87a2b12b2928beb6d9e
MATLAB
3,820
90
function PlotCurrentTracks(tracks, frameNum, trackColor, lineWidth, frameFlip, varargin) if isempty(varargin) %% Whole Image Plotting trackIDs = unique(tracks(tracks(:, 3) == frameNum, 4)); for trackIdx = 1:length(trackIDs) currTrack = tracks(tracks(:, 4) == trackIDs(trackIdx), :); currTrack...
deb1638bbd28196bf3616f55e7124204651c228dae603da85dc9bb13270cf73a
MATLAB
3,820
111
function fw_simBEH(dir,fin,model,options) %load behavioral data load(fullfile(dir.dir,strcat('BEHdata-',fin,'.mat')),'BEHdata'); %load fits load(fullfile(dir.dir_fits,strcat('fit-', model, '-', fin, '.mat')),'results'); %build parameter structure (taken from Gershman example) % [~,~,f] = defineModel_eegCAT(model); [...
4c7c3636e0fcdd12b229303d48d978dfd456c67319f958d8fcc33cc830e7fac8
MATLAB
3,821
118
%% Add path addpath(genpath('../../Ionnic Channel'),genpath('../../Tools'), genpath('../../Synapses'), genpath('../../Datas')); %% Import data from neuron (FS) dt = 2^-5; Vmem = -30:dt:60; l_V = length(Vmem); Invtaum_simp = @(v) cosh(1.32+0.04105*v)/(0.08938 + 0.0289*cos...
5abb62add1a5250ec3cccb558f08746134f8f401765a75235cdefe5e93a64327
MATLAB
3,822
185
function [S0, F] = SIMLR_Large_Scale(X, c, k, ifimpute,normalize) %%% if nargin==2 k=10; ifimpute = 0; normalize = 0; end if nargin==3 ifimpute = 0; normalize = 0; end if nargin==4 normalize = 0; end if ifimpute X = X'; [I,J] = find(X==0); Xmean = mean(X); X(sub2ind(size(X),...
bd463f77e806ce7b938b2b74eb16505f6a5ae66d4e45eb81b8121d94121e474a
MATLAB
3,822
114
function [pparam, X, clabel] = mv_preprocess_average_samples(pparam, X, clabel) % Splits samples of the same class into groups and then replaces the data by % the averages within each group. This increases SNR and reduces the sample % size. This approach has been explored by Cichy and Pantazis (2017). % % Note: this a...
8b2be41e09293a64877df9f01b8efa57688879a451b06d5e2650e27a2d1f631e
MATLAB
3,828
86
%Segments and preprocessed LFP from spep task. %2024/02/25 function spep_preproc(fnames) %load data: load(fnames.trials_filename); %organize trial data into fieldtrip format: analysis_trials=[trials.clinrecording.trials_timestamps(1,1) trials.clinrecording.trials_timestamps(end,end)]; analysis_tri...
3d1747b7c3e076ee4908c5991ce13c4ba5d5f05c3d3a2ade11f765e1394f7104
MATLAB
3,829
102
function out=pkfnd(im,th,sz) % finds local maxima in an image to pixel level accuracy. % this provides a rough guess of particle % centers to be used by cntrd.m. Inspired by the lmx subroutine of Grier % and Crocker's feature.pro % INPUTS: % im: image to process, particle should be bright spots on dark backgroun...
1685fa3f4f4ac72ba429af51f0ada7c981943e276c454483ddc6b048c51b02da
MATLAB
3,830
110
function [] = mom_write_minc1_matlab(hdr,vol) % Write a MINC1 file in Octave % To learn more about the MINC format : % http://en.wikibooks.org/wiki/MINC % % SYNTAX: % [] = MOM_WRITE_MINC1_MATLAB(HDR,VOL) % % INPUTS: % HDR (structure) The header of a MINC1 file (see MINC_READ) % HDR.FILE_NAME is the name of th...
702b8c85915769d5e4a98df80d55512265be6e8b2ec97b264680d06a793a0851
MATLAB
3,832
62
%Performs analysis on the persistence of oscillatory activity following offset of flicker stimulus. %Requirements: %MATLAB version 2021b or later because of the pyrunfile function. %Python. To make sure have proper python version/environment, type in: pyversion(<path to proper python.exe file>). %2024/02/25 function e...
6e0f3cbb9da983d3ccdcefb63076addd896cbcbc9fcce36c9bb43f1994f2e68a
MATLAB
3,838
45
%----------------------------------------------------------------------- % Job saved on 20-May-2023 23:13:37 by cfg_util (rev $Rev: 8183 $) % spm SPM - SPM12 (12.6) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{1}.spm.tools.beamforming.data.dir = {'...
f3232483251c103234820343cb7516432c8752469e7cc5186ce57b48cee51a58
MATLAB
3,841
163
function [S, E, M] = findSpindles(EEG, DetectThreshold, LimitThreshold, varargin) % [S, E, M] = findRipples(Filt_EEG, DetectThreshold, LimitThreshold, varargin) % % INPUTS: % Filt_EEG: EEG tsd % DetectThreshold: Threshold for detection of ripples % LimitThreshold: Threshold for finding the ripple boundaries % % PAR...
3ae8660c44a93f1ab7c44538c2aad40badcdc4caaaf4ddd2fe847d6fdd17306b
MATLAB
3,843
102
function out=pkfnd2(im,binaryImage,sz) % finds local maxima in an image to pixel level accuracy. % this provides a rough guess of particle % centers to be used by cntrd.m. Inspired by the lmx subroutine of Grier % and Crocker's feature.pro % INPUTS: % im: image to process, particle should be bright spots on dark...
3c31d501feb5247bb52d0384435a8a6ed545955d8d33aff05695ceecffa29210
MATLAB
3,844
124
% cd sst % A=dir('*.jpg'); % or '*.jpg' or ... % for n=1:length(A) % M{n,1}=imread(A(n).name); % end % % % % for i=1:length(A); % % CB_image_names=[CB_image_names; A(i).name]; % % end % SST_image_names=[]; % for i=1:length(A); % SST_image_names=[SST_image_names; A(i).name]; % end % % % % % batchMaps=batchSali...
62fbd8cb2f0b669f5f1776cb2dab36ec201d15c0acc9575c92775a40c9ed2fc1
MATLAB
3,844
110
%% CLEAR AND INITIALIZE clear;close all;clc;tic; %% DEFINE THE STRUCTURE THAT WILL HOLD ALL THE PARAMETERS params = []; %% DEFINE INPUTS AND OUTPUTS %% DEFINE INPUTS AND OUTPUTS params.data_folder = 'E:\NAS_SD\SuiviClient\Triffilieff\2023\Data\RWD_Enrica\cohort1'; params.analysis_folder = 'E:\NAS_SD\SuiviClient\Triff...
717e7c7a7ed883de84247f80b61359654c966e2d0c0fca8ed179911205147f2a
MATLAB
3,850
98
% This script performs multi-class searchlight decoding for the Haxby 2001 % dataset. % % The data is available free at http://dev.pymvpa.org/datadb/haxby2001.html % and can be downloaded there. Accept their Terms of Use if you like to use % the dataset. % % This script hase been created by just filling out the...
fb42055992493a1990cc84bffcd308d543c32a7761fad0b42e7da7a257c793b5
MATLAB
3,853
137
function [errmsgs warnmsgs] = unit_traintest_corr() % [ERRMSGS WARNMSGS] = UNIT_TRAINTEST_CORR() % % Tests that TRAIN/TEST_CORR are working correctly. % % Why doesn't this use GENERIC_UNIT_CLASSIFIER??? % % ERRMSGS = cell array holding the error strings % describing any tests that failed. If this is empty, % that's a ...
b1a64ad7bc83314e499a194ba47064e412814573b7317c983d5d65c9bd4d9644
MATLAB
3,854
121
function [fh, rasterAx, histAx] = RasterPETH(S, center, TStart, TEnd, varargin) % Display a PETH-raster plot for discrete % % USAGE: % [fh, rasterAx, histAx] = RasterPETH(S, center, TStart, TEnd, 'ParameterName','Value') % % RasterPETH creates a raster plot, triggered on different event times. % % IN...
b4ab918fa16dd35b64bf6a915decc50f7958e18a61725d288c1811e14581c113
MATLAB
3,854
138
function newmap = bluewhitered(m) %BLUEWHITERED Blue, white, and red color map. % Author: Nathan Childress (From Matlab File Exchange) % % BLUEWHITERED(M) returns an M-by-3 matrix containing a blue to white % to red colormap, with white corresponding to the CAXIS value closest % to zero. This colormap ...
949c54886897e76025217828f0f32aada15553f3d1235d8b29218ef3e3983e23
MATLAB
3,855
112
function [displacementField, certainty] = demons2d(moving, fixed, varargin) % DEMONS2D Estimates a displacement field using the original demons scheme % % [displacementField, certainty] = demons2d(moving, fixed) % % INPUT ARGUMENTS % moving - Moving iamge % fixed - Fixed image % % OPTIONAL INPUT ...
3d7413a5a5abcb7148b64363cf4294a09ad62ea2cc65c0817597a83a1c945b71
MATLAB
3,862
142
clear; clc [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); warning('off') POPULATIONS = {'BG msn|SNR','BG msn|SNR';... 'BG msn|SNR','PC ss|CRB';... 'PC ss|CRB','PC ss|CRB'}; BIN_SIZE = 100; DIRECTIONS = 0:45:315; PROBABILIES = [25,75]; raster_params.time_before = 199; raster_params.time_after = 800...
597249950c680df1be2e3e8038e0823a95305e40c10841ea7b340f7af627a4ca
MATLAB
3,867
129
function [subj] = init_object(subj,objtype,new_objname) % Add a new empty object % % [SUBJ] = INIT_OBJECT(SUBJ,OBJTYPE,NEW_OBJNAME); % % Update the SUBJ structure by creating a new object of type OBJTYPE % called NEW_OBJNAME % % Adds the following objects: % - object % % This function will initialize everything to emp...
6d3e804e29e8a20f3a1fb8dbb5fb3497cb4bcbf357e35c9c90ed41d2b19b53ff
MATLAB
3,867
95
% % plot raster and PSTH, grouped by multiple conditions indicated by % different colors. Pulls together various code needed to do this with one % simple call. % % % urut/Oct'22 function [axRaster,axPSTH]=plotSpikeRaster_multiple_simplified( plotMode, offsets, limitRange_forRaster, limitRange_forPSTH, markerPos, times...
e5f6091304956223c2e129d1cc2307e16508ead301dd6096615a02564cbf5f54
MATLAB
3,867
120
function trial_type_list = list_all_trial_types(varargin) % % List all the trial_types in all the events.tsv files for a task. % % USAGE:: % % trial_type_list = bids.internal.list_all_trial_types(BIDS, , ... % task, ... % ...
4dda725cde8515a6a9f6d86df197c8ce04c756bc96bd4c3a3ed9ef6de07aacfe
MATLAB
3,870
125
% goal of this script is to run a boostrapping to estimate how much the % variation of each block related to the total % following by run @Response_BCPlexusComparison & @IdentifiedBCComparison %% [~, g] = max(SliceResp_type == BCTypes, [], 2); %% Test Temporal distribution nIter = 2000; y = SimpleTemporalRio; ...
cf9455c97e2d1f330f71a11d303786b57a5902af74ddb1500c23101d5092907f
MATLAB
3,874
118
%% addpath('\\storage1.ris.wustl.edu\kerschensteinerd\Active\Emily\BasicFunctions'); nIter = 5000; %% IsEncodingSpace = 1; if IsEncodingSpace cResp = Y(:, 1:3); else % [] cResp = Dfull([(1:nBC)'; remids(:)+nBC], :); end TypeDiff_val = nan(nType, nType); TypeDiff_p = nan(nType, nType); rng('shuffle...
778f3f9aec22a7b512f8b8fe9b2257596d64ff5ccce283c90f4715bc7aaf5b94
MATLAB
3,880
73
% Extract single HRF from dcNew variable, the output of GLM fitting function % save to mat file. % For experiment 08 and 10 function createSingleTrialHRF_SSBeta(sbjNum,respData,numClasses) %saveDir = ['C:\Users\mn0mn\Documents\ResearchProjects\spatailAttentionProject\ProcessedDatafNIRS\Experiment' num2str(sbjNum)]; pr...
794709b7262e46e684f64db1001fa3c201bc3db9e678b8828b343f95c2dbd572
MATLAB
3,883
107
function spfOut = spfRealignToStack(varargin) % This function takes a Single Plane Fit (spf) and realign it as best as it % can to the stack average parameters: normal, and single pixel size. % At the output of the process, spfOut will have the same normal as the % stack and same pixel size. % % USAGE (1): Use on...
f635ae67ba0d0b9b37fd6e083c124bd973d1add9eae32fa2095400f8360a12c0
MATLAB
3,883
60
function [ interpulse_duration_ms, num_pulses, pulseduration_ms, uncaging_start_ms, uncaging_end_ms, uncaging_duration_ms, uncaging_frame_start, uncaging_frame_end, max_voltage ] = square_pulse_detection( r, frameRate ) %square_pulse_detection detects square pulses from a voltage recording %(column 1: time points, co...
b2861ab0ef4a30780a2a17e7170bd67e988aa2d9ed5f80e27f557a6e76019e44
MATLAB
3,886
118
% This script is a demo showing some simple decoding on simulated toy data. % The toy data are simple matlab matrices and no "real" fMRI or EEG data. clear all dbstop if error % if something goes wrong fpath = fileparts(fileparts(mfilename('fullpath'))); addpath(fpath) % initialize TDT & cfg cfg = decoding...
3b9d8aea6dc5d1aedcdd2e886afe24e497ad24f72e881f677892b737309d7f65
MATLAB
3,896
93
% redefine stimulus classes into 6 diff. classes % to be runned after generating stimuli marks from aux data in Homer3 GUI % Combined multiple snirf files into one. % strictly for ExperimentXXGUI folder function redefineStimulusClassesCombined(sbjNum,rawDataFN,respData) dir = ['C:\Users\mn0mn\Documents\ResearchProjec...
526fa83325dc55eb2250eafc6041edc5a1c455508794feef5bee4ffe272e5e9a
MATLAB
3,898
149
%% CLEAR AND INITIALIZE clear;close all;clc;tic; %% DEFINE THE STRUCTURE THAT WILL HOLD ALL THE PARAMETERS params = []; %% DEFINE INPUTS AND OUTPUTS params.data_folder = 'F:\Data Anna FR1 Doric old\2022-95_Pavlovien_DATA'; params.analysis_folder = 'F:\Analysis Anna FR1 Doric old\2022-95_Pavlovien_DATA'; params.figure...
a11f456ac7f47720c9d77863c63abedc870820703dee85ec55947b9477e8f3bb
MATLAB
3,899
80
% ----------------------------------------------------------------------- % % M U L T I P L E T E S T I N G % % ----------------------------------------------------------------------- % % Function 'fwer_holmbonf' computes the Holn-Bonferroni correction, also % % known as s...
9e5addb0495a10de910d5d1282494a5d363e09718798d1e708476d2a1bc96834
MATLAB
3,906
122
function [subj] = load_afni_mask(subj,new_maskname,filename,varargin) % Loads an AFNI dataset into the subj structure as a mask % % [SUBJ] = LOAD_AFNI_MASK(SUBJ,NEW_MASKNAME,FILENAME,...) % % Adds the following objects: % - mask object called NEW_MASKNAME % % SUB_BRIK (optional, default = []). By default, you'll get %...
38a23a0c06663a5970463d8b1daa54dd8d50d16969df5019e54b1da7b2f1358d
MATLAB
3,907
142
% 1. Add the path of the current script to the search path % 2. Change the current folder to "Supp Fig9 CFstimulation" % 3. Using ctrl+enter within each function to run each section %% Section 1: open files % ctrl+enter to run this section clear co=lines; co(6,:)=[.5 .5 .5]; cnum=[6 2 4 5]; legendlist=[]; colorlist=[...
1788a00ed2f6ea3c35dfc2e001d2d42addd6c24dcb96d59e86b34206eb8ed234
MATLAB
3,909
131
function [fHandle, subplots, offsets,xlims] = plotInputsData(conds, times, ... head, target, ipsiEye, ipsiPC, sines, light, labels, plotMeans, subplots) d_offset = 4; % spacing between subplots extra_offset = zeros(1,25); extra_offset([6:13]) = 10; extra_offset([5 8 11]) = 30; extra_offset(14) = 40; extra_offset([...
5c208c661f728b175225b6f5a36ffa36fa5faaaedcff4074bab404f4c3d0de43
MATLAB
3,909
126
function [subj betas X] = detrend_pattern(subj, patname, selname, varargin) % DETREND_PATTERN - Remove trends from a given pattern over runs. % % Usage: % % [SUBJ BETAS X] = DETREND_PATTERN(SUBJ, PATNAME, RUNSNAME, ...) % % DETREND_PATTERN removes trends from the pattern PATNAME for each % run specified in RUNSNAME. DE...