sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
694412b58631733a4df2b2b4aaee9c3b548c0e7f7027651988b46ce61d3a4e35
MATLAB
2,576
97
function [] = test_elasticnet() clc; clear; close all; %% Set algorithms if 0 algorithms = gd_solver_list('ALL'); else algorithms = {'APG-BKT', 'APG-TFOCS-BKT', 'CD-EasticNet', 'FISTA'}; end %% prepare dataset if 1 % generate synth...
0e4b7b1096247017dfcb1d6eb9329dc7b4a3f4829e71a692324ef3900193dfe1
MATLAB
2,577
97
clear,clc num_trials = 20; Fs = 30000; num_channels = 4; trial_dur = 20; load waveform Fr = 20; scaler1 = [6 3 1 4]; scaler2 = [2 6 3 1]; data = []; for j = 1:num_trials data{j} = randn([Fs*trial_dur num_channels]); end % make waveform block ws = []; for j = 1:num_channels ws1(:,j) ...
ffedc8b57b450ed9cd25e8e4ce4f6317cf5c5516e02017419e0a14261ace9817
MATLAB
2,579
86
function handles = updateResponseHistory_SanesLab(handles,HITind,MISSind,... FAind,CRind,GOind,NOGOind,variables,... ntrials,TrialTypeInd,TrialType,... REMINDind,varargin) %handles = updateResponseHistory_SanesLab(handles,HITind,MISSind,... % FAind,CRind,GOind,NOGOind,variables,ntrials,TrialTypeInd,.....
fa6e52da7a51e5cd26ebf335ea6ac39a10363d4654a743151558da29c2d15b45
MATLAB
2,581
83
function [iht, ihbas, ihbasis] = makeRaisedCosBasis(nb, dt, endpoints,b, zflag,symm) % [iht, ihbas, ihbasis] = makeRaisedCosBasis(nh, hdt, endpoints, b, zflag); % % Make nonlinearly stretched basis consisting of raised cosines % Inputs: nb = # of basis vectors % dt = time bin separation for representing basis...
09a505db8eb42bb9f705671f32910fc543949923af0e335909bbe458df06d400
MATLAB
2,582
75
function inputStruct = getCurrInput(sceneStruct, obsStruct, frameNum, samplePath) arguments sceneStruct struct obsStruct struct frameNum double samplePath char = '' end %GETCURRINPUT Returns a struct containing the current input. For optic flow, this is x, y, dx, dy frameLabel = getFrameLabel(fr...
00028f581aba4bb96bf662bc421cd344a1e1a20f198d413a39a95d539686b8be
MATLAB
2,585
76
function subdirs = epsych_startup(rootdir,showsplash) % epsych_startup; % epsych_startup(rootdir [,showsplash]) % newp = epsych_startup(...) % % Finds all subdirectories in a given root directory, removes any % directories with 'svn', and adds them to the Matlab path. % % Typically, it is a good idea to call th...
ffc720b9787a337469b4f5e2f37957c65e8338ac8ae0a702cc7e45cdeb8da56e
MATLAB
2,587
73
%% Generate Data from raw EEG records % For running this demo, please uncomment and change the address. % This script is intended to convert the raw EEG files in data matrices. % It was used within the experiments presented in [1] % Per each subject, the output file is an EEG data struct in which the EEG % trials are ...
620879e5225e19db78d4d68c40703a736f036665f30c3b913edb966daa4f9993
MATLAB
2,590
70
%% gets combinations of parameters to optimize for MLE/MAP estimates function [optSetup, opts_empty] = getOptimizationSettings(obj, alternating_opt, trial_weights, optStruct, includeHyperparams) if(nargin < 5) includeHyperparams = false; end if(nargin < 4 || isempty(optStruct)) optStruct = obj.getComputeOption...
5c9601c8367d7e46afccffc76f528b6fab6b8aef0f6a13a8b216ba0f428373ad
MATLAB
2,591
72
function [embedding, lambdas] = laplacian_eigenmaps(data, n_components, random_state) %LAPLACIAN_EIGENMAPS Performs non-linear dimensionality reduction using Laplacian Eigenmaps % % [embedding, lambda] = LAPLACIAN_EIGENMAPS(data, n_components) % % Performs non-linear dimensionality reduction using Laplacian Eigenmaps. ...
795990fb18deda51689c82948cd63fdbd721f8a1879d517a13ba54ff97971e84
MATLAB
2,591
69
function [trials_resp,tot_trial_time,timings,tot_run_time] = sample_lists(... trial,isi,resptime, IRI) % Define when the behavioral questions are asked to the subjects and % compute the timeline of the experiment. % % Inputs % trial total nb of trials in a sequence. % isi (sec) vector of possible ...
d4069dff19e6e7880f222aaf734af1c79ca66270906ec81e4d2918e2f147934f
MATLAB
2,592
83
function copySuite2pdata2PrairieView(suite2p_exper_dir, suite2p_source_dir, new_exper_dir, prairie_target_dir_list, channel_in, channel_out, doit); if nargin<7, doit = 0; end; disp(['Working on Suite2p directory ' suite2p_source_dir '...']); % Step 1: count the number of suite2p frames suite2pdir = fullfile(suite...
22c0290f5675c8117236def27bb2eb7e1d131fd815b9192f659e60b736c42bff
MATLAB
2,595
57
function [DataL,SF]= Arranging(Data,mainFolder, CSV_filepaths) SF = strings(1,numel(CSV_filepaths)); % CSV_filepats contains the information about the participant, foot, % trial (including walking surface), and gait. These information are extracted from the % CSV_filepaths string and 4 new columns are added to the ...
e8e20037cb8da55014e953ec24b3572d465724c3003916f5055974a7288ff447
MATLAB
2,595
116
%% Enter Tank Info tank = 'DILL_MGB_1'; % Specify tank name block = 'Block-2'; % Specify block name win = [0 0.2]; % Specify peri-stimulus window for field potentials % optional: electrode remapping (leave empty for no remapping) emap = []; % emap = [17 31 19 29 21 27 23 25 18 32 20 30 22 28 24 26 1 15 3 13 5 11 7 9...
fdf5d7198b37b4ab5f1f021dbce4269a5b4341990da90fb652bbb8b7d1ed90d4
MATLAB
2,595
68
function imData=read_file(path_to_file,sframe,num2read,options) % Reads uncompressed multipage .tiff, .hdf5, .avi or .raw files % Usage: my_data=read_file('path_to_data_file, start frame, num to read); % INPUTS: % path_to_file: location of file to be read % sframe: first frame to read (optional, defau...
545c4b59eed13a2d7230cfdfaa9779ee71278010d3a3ee34e7755c205d392487
MATLAB
2,597
96
%% Reconstruction usePCAProjections = false; if exist('reconstructionPCABasis') usePCAProjections = true; end if ~exist('reconstructionPlotIndices') reconstructionPlotIndices = 1:size(saveData.FinalStream,1); end numTrial = max(saveData.TrialData); trialLength = size(saveData.FinalStream,1) / numTrial; plotT...
a71185f735a9d6fe9ee0093bc26b5a4160de2a727c9161935abda0bbb50cac70
MATLAB
2,599
97
function filename = mySaveasFlex(varargin) %%% 26-01-23 first commit %%% variable arguments pairs % 'dimXY' -> vector of two num. Default: see below. If both dimXY and size are specified, size is ignored. % 'size' -> str: S, M, L, XL (dimXY and size mutually exclusive). Default: M % 'res' -> num. Default resolutio...
cd1c38bc895062f9b47bb4f145fd79045affb7308ca1d8cd9da0d14edb27de74
MATLAB
2,599
90
function ax = createAxes(N_figs, N_rows, N_cols, ax_properties, single_index) % This function creates a new set of axes for plotting - axes created are % equal in size and positioned according to the sizing properties provided. % Properties that aren't provided are assigned default values, which may be % changed here ...
5e6462143fe884023487ff86ceb5da03d3b19efcf0271bc313afd6179ced88a9
MATLAB
2,601
66
clear pat = 'C:\Analysis\AssemblyAnalysis\raw\'; fileList = dir([pat 'allTimestamps' filesep '*SHORT*.mat']); N_SHORT = [];N_SHORTerr = []; for iFile =1:length(fileList) load([pat 'allTimestamps' filesep fileList(iFile).name],'t'); Delays_ = fieldnames(t); N = zeros(length(Delays_),2); Ne = ...
3536fbc56da06bdcccbff3b23ecc8e2c4da8e3c67fd75e0b36a5e23ec1db4797
MATLAB
2,604
73
function y=roundsd(x,n,method) %ROUNDSD Round with fixed significant digits % ROUNDSD(X,N) rounds the elements of X towards the nearest number with % N significant digits. % % ROUNDS(X,N,METHOD) uses following methods for rounding: % 'round' - nearest (default) % 'floor' - towards minus infinity % 'ceil' - towards ...
4460632e417c30b073f7ecb34aebfd5001de72b386c4b27880ff450d1a255751
MATLAB
2,604
105
function plot_nodes_in_cortex_rsn (V,orient) % % Set up the paths to static data, functions and libraries % addpath('/Users/HDF/Dropbox/Fran/Academics/PhD/matlab/', genpath('/Users/HDF/Dropbox/Fran/Academics/PhD/matlab/functions'), '/Users/HDF/Dropbox/Fran/Academics/PhD/matlab/static_data','/Users/HDF/Dropbox/Fran/Ac...
e74dd7dfff6923864d2581846e899beb1bc8c1630b507464dc0be830d2c2bfd2
MATLAB
2,606
74
function [pos_signal, neg_signal, region_mask] = run_flatt(signal, window_size, var_threshold) % RUN_FLATT_SLOPE_VARIANCE Labels signal using linear regression parameters. % % Inputs: % signal - 1D vector containing the input data[ % window_size - Size of the overlapping window (e.g., 16) % var_threshold...
88da52367c850cd9e4147edde466181dc74b63fff098a56aec8042549f07de58
MATLAB
2,608
86
clc; clear; close all Fig3d=figure(); Ntrials_2 = 10000; %Ntrials_2: number of learning cycles to learn the background containing the embedded pattern (step 2). xax=(1:1:Ntrials_2); N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simulations) %%%%%%%%%%%%%%%%%%%%%%%%%%%...
7d37d10dbcb6b15befd91c7498e47f2bb067398fe5ec51b3d8cdecf9305c7053
MATLAB
2,609
106
function noise_spectrograms % function noise_spectrograms % % Draws example spectrograms to illustrate the three noise conditions (clean, temporally restricted and continuous) % % Stephen Town - 2018 % Options fS = 48848.125; t_max = 1.25; % seconds offset = 0.25; noise_attn = 10; vowel_attn = 10; window_s = 256; %...
c418593712dbe1f6f4df4e93014ea8ac495340ac8c9ba29d64be86ccbf9d89f6
MATLAB
2,611
104
%% 1. Move select files from subdirectories to another directory indir = 'D:\ownCloud\BIG_DATA\MRI'; outdir = 'D:\DataProcessing\NII'; d = dir(indir); d(1:2) = []; % get rid of dots d(~[d.isdir]) = []; dname = {d.name}'; disp(dname) %% istr = cellfun(@fullfile,repmat(cellstr(indir),size(dname)),dname,repmat({'NII'},...
39dbd9e65dd0dc158f7b0d4ec0d72a99b98ead50efef9ecf25a1ec10777a502e
MATLAB
2,612
87
% Quality control Q3 % Plot time series from fMRI images and head motion % Xin Di, July 13, 2022 clear subjfolder = dir('F:\fMRI_QC\fmri-open-qc-rest_bias_corrected\sub*'); figure for subji = 1:length(subjfolder) fprintf('Processing subject %d ...',subji) % load the raw functional images and calcul...
b4358ee40f4947de2ced004df3f42e513a35b504492d1dd370f0ef1db49ecffe
MATLAB
2,612
87
function plot_AMJitter_stimWaveform(buffer) % Plots a polar histogram of spiking during the AM portion of a stimulus. set(0,'DefaultAxesFontSize',10) set(0,'DefaultTextInterpreter','none') % if nargin<5 % savedir = '/Users/kpenikis/Documents/SanesLab/Data/processed_data'; % savename = sprintf('%s_sess-%s_ra...
c807f1b7decc456d87b3b429af06535e0a56edfc1ee7196c18854a13ee774bee
MATLAB
2,612
63
function beta_distributions(dataDir, rootexpnam, betaseries, num_cond) %% beta_distributions % % INPUTS: % dataDir - default directory by startup.m % rootexpname - shared experiment name folder prefix (e.g., 'M1_' ...) % betaseries - was the GLM a beta series GLM? input is binary % num_cond - number indicating h...
9b57d250d7790a4bf303da9e1d3257641e9bd54de04391cae4d0552c685c9019
MATLAB
2,618
70
function view_3d_model(model, ax) if nargin < 2 figure; ax = gca(); else axes(ax); end hold on; axis equal; ax.Clipping = 'off'; cmap = colormap(ax, flipud(parula)); c = colorbar(ax); c.Label.String = 'Charge threshold [nC]'; idCrossStep = 5; % Plot z-resolution, change at will idCrosses = 1:idCrossStep:si...
4eeffe0336e91523b4e2b67d40325c3e1c295ce1d1ecf6cbbe82c32bcd2702dd
MATLAB
2,626
36
% REMOVE BAD CHANNELS - MIXED METHOD % function [channel_amp_data_Cutoff_logical, channel_grad_data_Cutoff_logical, low_sig_range_all_channels_val_logical] = ... bst_ast_remove_bad_channels_mixed_formula(all_amp_data, all_grad_data, chanAmpDevThreshold, chanGradDevThreshold, method) if method == "mix mean"...
a3227cf76d6b7be523375b410a8dad3f58042301cc4daa076b05955f25a9b3ed
MATLAB
2,626
73
function [z,dof] = plot_distances( spikes, show, method ) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % plot_distances - Histogram the distance of waveforms from cluster center. % % Usage: % [z,dof] = plot_distances( spikes, show, method ); % % Description: % Plots histogram of Mahal...
672603f43f1ddb8db00d333b014351920d5f2e267592546dbb3bb00b43ce1c61
MATLAB
2,627
61
function [freq, q, qLo, qUp, effRecrMean, effRecrLo, ... effRecrUp, collRecrMean, collRecrLo, collRecrUp] = ... linearCharge_stim(t, var_in, var_in_min, var_in_max, q_min, q_max, ... freq_stim, recrNormIa, recrNormIb, recrNormAlpha, recrNormII, ... recrNormIII, recrNormTouch, Q) % INPUT: % ...
79778856cb526003c20ccfcbb5022a36c7c52019153e46b37ceebd8e7c9ba322
MATLAB
2,627
76
%% demo_003 fields of the results struct - Which information is contained in the result of Psignifit % to have some data we use the data from demo_001 data = [... 0.0010, 45.0000, 90.0000;... 0.0015, 50.0000, 90.0000;... 0.0020, 44.0000, 90.0000;... 0.0025, 44.0000, 90.0000;... 0...
76dc40e8143d3181ec550b8734294bfe0175161c748e25af6caaaa8ce6687080
MATLAB
2,628
79
function plot_comparison_per_fiber(model1, model2, normalization) %PLOT_COMPARISON_PER_FIBER compares models fiber per fiber % (must have the same distribution) % See HISTOGRAM for allowed normalization methods. if nargin == 0 model1 = select_and_load_model(); model2 = select_and_load_model(); end if ...
2efa258c9c57e41574147d0652a2f4f98f0adfc9099327df73e868f4f92af534
MATLAB
2,631
74
%% Setup util.clearAll; outdir = fullfile(util.get_paths().figs,'chord_modularity'); util.mkdir(outdir) c = util.plot.getColors(); %% Get the correlations beta_tables_taste = util.load.all_taste_betas(); taste_names = beta_tables_taste.sep_table.Properties.VariableNames; % Note: Correlations are between tastant (high_l...
a1cbe8c34bec9ea3f05d3e6ce09d1e10ea020c3fb9646d366aaf0901dae89281
MATLAB
2,633
80
%% clear all close all run(['..' filesep 'def_local']) addpath(path_fieldtrip) ft_defaults %% allfiles={'405','406','407','408','409','410','411','412','413','414','415','416','417','418','419','420','421','422','423'}; % params frqBand = [1,3; 4,9; 10,15]; filt = []; filt.hpfilter = 'yes'; filt.hpfilttype = '...
f371f79742d41b7ceedf4a95a2c5661331c54f89fdfea01062cd7ed453258d8b
MATLAB
2,633
90
function plotPatternLocs(allLocs, pattTypes, realTime, ntrials, nspacebins, cortexMask, smoothScale) % Takes the patterns cell array ALLPATTERNLOCS from findAllPatterns.m and % produces a number of plots plotTime = true; if isscalar(realTime) realTime = 1:realTime; plotTime = false; end if ~exist('ntrials', 'v...
0053364454b104aa8ef693b0e56ee2799806ce0c394cf2599e6544a561514092
MATLAB
2,634
91
function [ims,channels] = tppreview_stdprojection(dirnames, tpparams, channellist, parameters, shortname, dirname) channels = []; fnameparameters = {}; % lets find parameter files, get the file name prefix pattern for j=1:length(channellist), good = 0; try, myfnameparameters=tpfnameparams(dirnames{1},channellist...
6cb885fbce0d49ebc5bc82081a8d25b36962f4d1093f6f2781aab7bef355dcc8
MATLAB
2,634
92
function [WMD,mf] = f_interpolate_WMD(L,ED) N = size(L,1); % correct for fibers that are shorter than the ED ff = find((L>0)&((L-ED)<0)); minED = min(min(ED + (1000*eye(N)))); L2remove = find((ED(ff) - L(ff)) > minED); L(ff(L2remove)) = 0; ffmask = find(triu(ones(N),1)); [~,orderEDind] = sort(ED(ffmask),'...
c4eb58556195147685b821954665bada03860566f53d63c41da0a34a91ece457
MATLAB
2,634
95
%% Bar Sweeps % Bars moving across the screen. % % Daniel.Stolzberg@gmail.com 2016 barwidth = 50; % pixels (1x1 integer) angle = 0:30:340; % starting angle in degrees (1xN) rate = 1000*ones(size(angle)); % rate, pixels per flip (1xN) contrast = 100; % contrast between background and bar [window,ScreenRect,fra...
fa699cdd3d9c916f0c94cd7685a4eefd54fc7b174ee93ec94944e8ea94c2fffd
MATLAB
2,636
95
function make_chord_plots % % Function to make mode chord plots % Fran Hancock % July 2022 % fran.hancock@kcl.ac.uk % PROJECT = '/Users/HDF/Dropbox/Fran/Academics/PhD/matlab/projects/COBRA_COMPLEXITY_PHASE_FD/'; CondMax=2; N_areas=116; Smax=5; CON_PROJECT = ([PROJECT 'RUN1']); PAP_PROJECT = ([PROJECT 'RUN2']); % co...
9d25c2f39c661fdf375a0871759e859f472d481ad08c6d9f6ec74367538b2cea
MATLAB
2,638
85
% run codes in "Model simulation programs" to get simulation data % run codes in "model analysis" to obtain the data for figures % load intermedia data for reproduce the results in a quicker way (Deposited data links provided in the paper) load('fig7ac.mat') %% Fig7a,plot example % plot example mean+std % variable f ...
fa197e5d091fefa8b9fc9f9d288d153ae3a769ee36191cdb9bae663eee1c1685
MATLAB
2,638
94
function plot_axonal_sel_cross(model, args, plotArgs) arguments model Model args.iActiveSites = [] args.Fasc = []; args.SeparateElectrodes (1,1) logical = false args.SavePlot = true; args.PlotDir = []; plotArgs.?CrossPlotProps; plotArgs.LabelAS = true; plotArgs.clabel...
08875431ea0ae1429d8492e1dd58fbda2aa734a0e5de9f7d027ba6e07197c7f6
MATLAB
2,639
77
addpath('./utils'); %%%%%%%%%%%%%%%%%%%%%%%%% Substacks Parameters%%%%%%%%%%%%%%%%%%%%%%%%%%%%% substack_depth = 61; overlap = 0; z_sampling = 1; dx = 11; Nnum = 11; range_adjust = 0.9; rotation_step = 90; rectification_enable = 1; rotation_enable = 0; complement_stack = 1; flip_x = 0; flip_y = 0; flip_z = 0; save_p...
fb5f7987de014b7845502b207c041b3020b4491fc59a6203ab9b2a32c9863793
MATLAB
2,641
117
function [y,xf,cf,t] = ERBgram2(x,fs,compress,lowfreq,numchan,smoothcut,envcut,toPlot) % function [y,xf,cf] = ERBgram2(x,fs,compress,lowfreq,numchan,smoothcut,envcut,toPlot) % Plots a gammatone filterbank output of signal x, plus marginal spectrum % and envelope. % fs: sampling frequency [default 44100] % compress: app...
b858db0c4479aa6642e9288a6bc8d82d2ced366508d4841e07c0a1aaf32e4612
MATLAB
2,645
95
function [log_rate, xx, R] = computeLogRate_host_v2(obj, params) obj.setupComputeStructuresHost(); LL_info = obj.LL_info; X_groups = obj.X_groups; X_lin = LL_info.X_lin; Y = LL_info.Y; J = numel(X_groups); D = [X_groups(:).dim_D]; A = [X_groups(:).dim_A]; T = size(Y,1); P = size(Y,2); isPop = P > 1; %% linear term ...
6a2aabe4be259e664747c7360d68be316056ba06036f1780a53f9fdb2d36b89c
MATLAB
2,648
81
%==================== MF3D_PlotResponses_PCAIdentity.m ==================== % Plot face-space object tuning for STS cells tested in 'StereoFace' pilot % experiments. % %========================================================================== close all clear all %================= SET PATHS AND LOAD DATA if isma...
f94beab0d8e12b078a9413cc77227928f91e845e68e7f9b5e97b128a20801132
MATLAB
2,652
81
function [VG] = fast_HVG(signal_var,coords_var,weight) % Code edited from the following: https://www.mathworks.com/matlabcentral/fileexchange/72889-fast-horizontal-visibility-graph-hvg-for-matlab % % Implementation of horizontal visibility graph based on: % Luque, B., Lacasa, L., Ballesteros, F., & Luque, J. (200...
129bd094ef431986602534bb2018f4e7e51d71307b7aa64e562ce1a94eddd463
MATLAB
2,653
72
% Get the number of sessions per animal segmented by the taste quality util.clearAll; cur_save_dir = fullfile(util.get_paths().figs,'betas_taste_animal'); util.mkdir(cur_save_dir) % Get the beta tables from matfiles beta_tables_taste = util.load.all_taste_betas().combined; %% return locations of which set for all rows...
6df33fe32d09f1b9a723e2989beb2abd44ee642d8bd155e6930c8c52b7ab8ac9
MATLAB
2,654
92
% PURPOSE: Creates default Y ticks for EStudio plotting GUI % % FORMAT % % def = default_amp_ticks_viewer(yrange) % % INPUTS % % yrange - min and max ERP amplitudes [ymin ymax] % % OUTPUT % % def - tick values to show in Y axis (string via vect2colon) % % *** This function is part of ERPLAB Toolbox *** % Auth...
1ee853c44e49c86b1c01098f14d82a1bef78a0840d9f356f24ad97c70b53a10a
MATLAB
2,657
82
function [order, meanMag, meanDir, fullStruct] = orderParameter(vx, vy) % ORDERPARAMETER calculates order parameters of a vector field. % % INPUTS: VX and VY are NxMxtime vectors giving the x and y components of % the vector field. If VX and VY have more than 3 dimensions, extra % dimensions will be reshaped into t...
56269850d9d517dd318192866b018b3e6edb5e6a64efbc7bc60fa67affb219f5
MATLAB
2,657
84
function decoder = train_probClass(cfg0, X, Y) % [decoder] = train_probClass(cfg, X, Y) % Trains a multiclass probabilistic classifier. It (if I'm not mistaking) is identical to logistic % regression under the assumptions that 1) the data within each class are Gaussian distributed % and 2) the covariances are ...
9f228a4f122b05a27adce76f506f04502f4d33c1b9635b8ea4f3f74b3247d0bb
MATLAB
2,657
67
function [ DOM ] = CreateColladaFile( ) %CREATECOLLADAFILE Summary of this function goes here % Detailed explanation goes here DOM = com.mathworks.xml.XMLUtils.createDocument('COLLADA'); DOMNode = DOM.getDocumentElement; DOMNode.setAttribute('version', '1.4.1'); DOMNode.setAttribute('xmlns', 'ht...
f974eab516404c7ac3e54cb4c80c4352cb2f918a32188cc55b07091d36b6e0cd
MATLAB
2,662
125
function h = PlotRaster(varargin) % PlotRaster(raster,values) % PlotRaster(ax,raster,values) % PlotRaster(...,colors) % h = PlotRaster(...) % % Plots raster (a cell array of spike times relative to some event onset) % against associated values (numerical array matching size of raster) on % the y axis. % % colors can...
9c51178281e4527022c8298758abe5f42b19e5e0f4d7b4490aa1cf72a925d92b
MATLAB
2,664
96
function varargout = ep_CompiledProtocolTrials(protocol,varargin) % cp = ep_CompiledProtocolTrials(protocol,varargin) % [cp,fail] = ep_CompiledProtocolTrials(...) % return and/or view compiled protocol trials % % Parameter ... Value % showgui ... true/false (default = true) % trunc ... truncate to some sca...
268cd386cc098e3a9a51d7e0047385847b798768127a0b730334acb3b9f72e28
MATLAB
2,667
78
function show_clusters(spikes, clusters, alt_assigns) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % show_clusters -- creates a figure to plot various statistics of a set of clusters % % Usage: % show_clusters( spikes, clusters, alt_assigns ) % % Description: % Builds a figure with...
ad1a20a19395bf0c05635278d72086cc04507aa9ed19fae01507b074b7ec8d88
MATLAB
2,668
94
clc; clear; close all Fig7a=figure(); Ntrials=5e3; %number of learning cycles N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simulations) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %R=1 yline(1,'--','LineWidth',2,'HandleVisibility','off'); hold ...
9dc8ab0acfb7bcac7380aad6654ef645199808c727a3f827eacd7a220d77b8dc
MATLAB
2,671
104
classdef o_EEGDATA < handle properties ALLEEG EEG CURRENTSET count_current_eeg eeg_panel_message eeg_two_panels Reset_eeg_paras_panel end events alleeg_change eeg_change current_change count_current_eeg_ch...
0e832b0b8c25df36bc13abe60d8b70700d5d3557e84bed6b2d572c4771ea291a
MATLAB
2,672
95
function [t] = ieeg_curry2tsv(t1File,pomFile) % % Function writes a tsv file with electrodes names and xyz coordinates that % should match the T1. % % Inputs % t1File: name of the t1File that was used to localize electrodes % pomFile: name of the .pom file created by Curry with electrodes in XYNo coordinates % % O...
79f97f2cee462386d5fff9fe7cdded75216a2c043ca301587481aea2b1948e78
MATLAB
2,674
69
function invariants = compute_invariants(model) % function compute_invariants() % % returns the invariants derived from the estimated D and C tensors % reshape model for convenience siz = size(model); mreshape = reshape(model, prod(siz(1:3)), 28); % extract D and C & change units D = mreshape(:,2:7) * ...
738438158e46e8b2c3519a7d8b1a290e5a4052e8a23c0dc4504b6c34746eacee
MATLAB
2,677
83
function tptilefigs(tile,border) % Tiles all figure windows except main TP analysis windows % (twophotonbulkload and analyzetpstack). % % GS / modified tilefigs script below: % % <cpp> tile figure windows usage: tilefigs ([nrows ncols],border_in pixels) % Restriction: maximum of 100 figure windows % Without arguments,...
459cd5bac364fc65569471e42f86aa0861201a6633ab556ec15b76450d69e353
MATLAB
2,683
68
function Dist = lme_mass_RgDist(Surf,maskvtx,vtxInd,Dtype) % Dist = lme_mass_RgDist(Surf,maskvtx,vtxInd,Dtype) % % This function computes the distances among all vertices inside a region. % % Input % Surf: Triangular surface. It is a structure with Surf.tri = t x 3 matrix % of triangle indices, 1-based, t=#triangles...
9a32130ae69a083bb310a4a4c19b75a46547947d6cd66b70ba5446bb4a2ca6d3
MATLAB
2,683
108
function [C,dX,X,Error]=ReadMesh(Set) % Reads Mesh data from GID datafile using 'embryo' problemtype % OUTPUT: % C(e,:)=connectivity of element e % dX=mean size of one element % X(i,:)=(x,y,x) coordinates of node i Error=0; if Set.Dimensions==2 dX=Set.dx*[1 1]; nx=floor(400/dX(1)); ny=floor(72/dX(...
afeaee36af57c5f18ce87ac80c8d3f40d4c55927cf287902438203e08068f627
MATLAB
2,687
87
function [avgFR,seFR,Ft2,Rt2,Ft2ciL,Ft2ciH,TS,dfnum,dfden]=DecodeStats(FR,evt0,reg) % Fisher F-test based classifier/decoder % % (c) 2014, Daniel Durstewitz, Dept. Theoretical Neuroscience, CIMH % Mannheim/ Heidelberg University % Edited by Aleksander PF Domanski PhD UoB 2015 % aleks.domanski@bristol.ac.uk % % Input Va...
92ca30b7ed67fd8343f1eaa2ccc07c757ecdc9c14395fd4700d1d354e88af1ed
MATLAB
2,688
82
% UNDER CONSTRUCTION % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2009 %b8d3721ed219e65100184c6b95db209bb8d3721ed219e65100184c6b95db209b % % ERPLAB Toolbox % Copyright © 2007 The Regents of the Univers...
553cd20ea2c54f954106351e07d63a7ed5d1f7df11e5945aec449c69492763d0
MATLAB
2,690
84
clear subjfolder_task = dir('F:\fMRI_QC\fmri-open-qc-task_bias_corrected\sub*'); for subji = 1:length(subjfolder_task) rp = load(['F:\fMRI_QC\fmri-open-qc-task_bias_corrected\' subjfolder_task(subji).name '\func\rp_' subjfolder_task(subji).name '_task-pamenc_bold.txt']); fd_trans = fd_calc(rp(:,1:3)); fd_...
2c95d827712d8f28638b5dda3404a0038bd1083d01dd716a616481c392aa3721
MATLAB
2,691
79
function [ims,channels] = tppreview_filter(dirnames, tpparams, channellist, parameters, shortname, dirname) channels = []; fnameparameters = {}; % lets find parameter files, get the file name prefix pattern for j=1:length(channellist), good = 0; try, myfnameparameters=tpfnameparams(dirnames{1},channe...
303529f1de8ba065400767c757dd9a43334577e3ecd5f4fce2172b08c529bcbe
MATLAB
2,696
73
% PURPOSE: Simple function to squeeze your EEG event codes. % The number of apparition of each code (eventtypes) is accumulated into a counter (histo). % Useful for counting a histogram of your event codes (you have to work with EEGLAB/ERPLAB of course). % % FORMAT: % % [eventtypes histo] = sque...
b023a61c6d76b9a9b8a5295631a76c553c8fe206d31b4cf0aac56e57eb83428f
MATLAB
2,697
113
%% Read a PLX file and estimate how many spikes are likely to be missing based on thresholding errors % Fits a normal distribution to peak amplitudes of spikes and estimates how % many peak amplitudes would be expected above the threshold. DJS 5/2016 [fn,pn,fi] = uigetfile('*.plx','Plexon File'); plxfilename = fullfil...
731d8d9572aedd11f293912e0309ee028dc1eb5d69dafce1946f939f0a4ea67d
MATLAB
2,699
85
% UNDER CONSTRUCTION % % subroutine for pop_summarizebins.m % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2009 %b8d3721ed219e65100184c6b95db209bb8d3721ed219e65100184c6b95db209b % % ERPLAB ...
8f9725b22c8dd9e7b6a0a7adf026697bcbb34b16c74dac699bfbd608e6965336
MATLAB
2,699
84
function plot_selectivity_and_recruitment(model, Q) if nargin == 0 model = select_and_load_model(); end if ~exist('Q', 'var') Q = linspace(0, get_max_threshold(model)); end [fascIdsByAs, activeSites] = load_active_sites(model.paths); elecIds = unique([activeSites.elecId]); separateElectrodes = nu...
850c209d11dcdc632638b6f775c18092b9316d0f2362115254ca4339e0ee9d23
MATLAB
2,703
76
function checkPriors(data,options) % this runs a short test whether the provided priors are functional %function checkPriors(data,options) % concretely the priors are evaluated for a 25 values on each dimension and % a warning is issued for zeros and a error for nan and infs and negative % values if options.logspace ...
5efc6c0288194b86379ab218d678326c1803e6b5d672d1b16a32bef36bcb7bf1
MATLAB
2,705
94
function [ verts,normals,Faces ] = HemispherePatch( numPts, radius, axis ) %UNTITLED Summary of this function goes here % Detailed explanation goes here axis = axis ./ norm(axis); RhoStep = (pi/2) / ((numPts/2)+1); ThetaStep = (2*pi) / numPts; numVerts = numPts * (numPts / 2) + 1 vert...
633ca3ff88f968ad14741ecca3474797083ba7d5cdd95d8701233b275d5e27df
MATLAB
2,707
111
function [A_hat, E_hat, iter] = inexact_alm_rpca(D, lambda, tol, maxIter, verbose) % Oct 2009 % This matlab code implements the inexact augmented Lagrange multiplier % method for Robust PCA. % % D - m x n matrix of observations/data (required input) % % lambda - weight on sparse error term in the cost function % % to...
302044e2973cc3d02b6dfbb862c13af7e5a1cfdcea834309cded809232d1f9f7
MATLAB
2,711
69
% generate test diffusin MRI data for TOD prediction uisng trained neural network clc;clear; % because of the memory limitation, we segment the data into several slabs to run. % Users can update the code to remove the slab segmentation. repeat = 1; %repeat is the slab number sample_img = 1; function flag = gener...
2b56cf3dc1900aae9aa80fa79a51d7b953317c2acc8e95955003cb68d7fc67ee
MATLAB
2,712
81
function y=RoundDecimalSD(x,n,method) %ROUNDSD Round with fixed significant digits % ROUNDSD(X,N) rounds the elements of X towards the nearest number with % N significant digits. % % ROUNDS(X,N,METHOD) uses following methods for rounding: % 'round' - nearest (default) % 'floor' - towards minus infinity % 'ceil' - t...
029b47bf666952aa281c90c85cd2090522609a6c8b7b76bae90389814a13fe04
MATLAB
2,713
70
% Goal: Do an anova test to find regions with correlations affected by the taste %% Setup util.clearAll; cur_save_dir = fullfile(util.get_paths().figs,'ANOVA_correlations'); util.mkdir(cur_save_dir) % Get the beta tables from matfiles beta_tables_taste = util.load.all_taste_betas().sep; %% get the Z transform of the c...
e433afde13382f9f2f7f0e2d029f0ab9816a6b5d50b694ceeec6d9020f0c9c6b
MATLAB
2,714
104
% % % Created: % 2021-06-??: Jennifer Bizley % Modified: % 2021-06-14: Stephen Town % - Added column headers and documentation % - Implemented correction for logging error in BlockWE-127 in data % - Added consistent column headers to source data % - Saved concatenated data as csv file cd...
80563dbc3728a3406809d74e48e8f1e34d3e95dc5fcac347a8b441ba6ea9bd1e
MATLAB
2,716
88
function [ims,channels] = tppreview_rgb(dirnames, tpparams, channellist, parameters, shortname, dirname) channels = []; % lets find parameter files, get the file name prefix pattern % allow user to choose R, G, and B image; user can choose among other preview images from directories recorded at the same time % ...
d51034147f99928e5ca5738602cfd3229c8e55f227211d1c72437d34ee98a40f
MATLAB
2,716
76
% Magno bar fixation analysis script - originally written by MR 07/27/2020 % Adapted by DL 12/2021 and Last Updated by DL 07/2022 clear ; clc; close all; root = 'C:\Daniela\Data\Ir68aKir_SD\'; % where the angles of heading trajectory are saved dirAnaly = 'C:\Daniela\Data\Ir68aKir_SD\angHeadCircAnaly\...
4905330945c3baaf720dbb9daa78daeadec840c49b39676dd5b64c9af2172da5
MATLAB
2,719
70
function [DOM, ParentNode, Node] = AddColladaNode( DOM, ... ParentNode, ... StructID, ... GeometryTarget, ... Mater...
dd985a785b53fdb3ab92522e40926c642f3dd4178f1d6c7521a7edf8837e2148
MATLAB
2,720
97
%Test2 expects two variables to be present, Verts and Links function Test2(Verts, Links) nmPerPixel = StructureObj.nmPerPixel; nmPerSection = StructureObj.nmPerSection; iID = 1; iParentID = 2; iX = 3; iY = 4; iZ = 5; iRadius = 6; iType = 7; iSectionX = 8; %These are the co...
414c2dd3cf891b6689ad1b0e6643966ddeb64eddf32376524d0e514f1c8466e7
MATLAB
2,722
93
% ALPHA VERSION. ONLY FOR TESTING % % Usage: % % >> ERP = smootherp(ERP, spanvalue); % % % Inputs: % % ERP - input average (ERPLAB's) erpset % spanvalue - number of points used to compute each new (smoothed) sample. It must be odd % % Outputs: % % ERP - (smoothed) erpset % % % Also...
5000708382fcb6009258e81b657db4eb501b807711e06277aa6d26b8e794fcfd
MATLAB
2,728
89
function [C,X,Bij]=GenerateMesh(dx,dy,dz,nx,ny,nz) % USAGE: % [X,C]=GenerateMesh(dx,dy,dz,nx,ny,nz) % INPUT: % nx = number of elements (divisions) along x (Horizontal) % dx = size of each element along x % ny = number of elements (divisions) along y (Vertical) % dx = size of each element along y % nz = number...
7e141b0b1dcd4af9243973c5e71136f3f45854a8a33d3db5c78a51e0fe10aae2
MATLAB
2,728
113
function [] = test_group_lasso() clc; clear; close all; %rng('default'); %% Set algorithms if 0 algorithms = gd_solver_list('ALL'); else algorithms = {'SHOOTING-GROUPLASSO'}; end %% prepare dataset if 0 data = importdata('d...
2291589a32360137fa0654490296324a230515ddd9f89db331d0b36d040154c5
MATLAB
2,729
104
function [detvtx,sided_pval,pth,m0] = lme_mass_FDR2(pval,sgn,maskvtx,rate,tail) % [detvtx,sided_pval,pth,m0] = lme_mass_FDR2(pval,maskvtx,rate,tail) % % Two-stage FDR approach to achieve tighter control of the FDR. This % procedure is more powerful than the original FDR procedure implemented in % lme_mass_FDR. % % Inpu...
2387985acfde0119dd4564508c5d2e2e1e1395164afc19c26aa6ea08b6735302
MATLAB
2,729
78
% Plot the L/R preference of each single unit. % % Aleksander PF Domanski PhD UoB 2015 % aleks.domanski@bristol.ac.uk % clear fn='JaroslawLONG2_PFC_iFR50.mat'; % fn = 'JaroslawLONG2_PFC_iFR50_behavOnly.mat'; critCvBW=1e6; % critical max bound on kernel width drift over time (variance) minFR=0.01; % minim...
6246c98e9c9fb1a6b982f422db6d0ba1e18203b64c61b7a2c4184ff7598b3305
MATLAB
2,729
96
load(['../data/behaviorData.mat']); tmp = zeros(1,500); hori_p = [tmp repmat(16.003,1,700)]; hori_n = [tmp repmat(8, 1, 700)]; vert_p = [tmp repmat(0,1,700)]; vert_n = [tmp repmat(-13.86,1,700)]; for n = 1:14 n tDur = [1:1200]; valid_u = cat(3, hori_p-Sub(n).dir(1).valid.hVel100, vert_p-Sub(n).dir(1...
0f4ab32675b6199c1bf99c4b6ae67a5b6a65c5fc1d85101f6f9b1d38379f781c
MATLAB
2,732
77
function [filtx,filtstd,filtstderr,newimage] = prairieviewoptfilter(slowdir, fastdir, channel) % PRAIRIEVIEWOPTFILTER - Creates an optimal filter for prairieview files % % [FILT,FILTSTD,FILTSTDERR]=PRAIRIEVIEWOPTFILTER(SLOWDIR,FASTDIR,CHANNEL) % % Creates an optimal linear filter for data acquired quickly in % Prai...
bcdcf749249d1883fcfb32f4ee40fa542ab631bc835cd69e6a504a0eb6279a83
MATLAB
2,733
103
function ProgressBar(currIdx, endIdx, varargin) p = inputParser; addOptional(p, 'TotalUpdates', 1000); parse(p, varargin{:}); persistent ProgressBar if currIdx == 1 || isempty(ProgressBar) ProgressBar = struct; ProgressBar.Start = tic; ProgressBar.PrevLineLength = 0; end if endIdx > p.Results.TotalUpdate...
d8a24074ffc90fab51a6b1c1a0e981040359f26f711354ca25064ee3984f579a
MATLAB
2,733
86
inputname='Gi17546'; timepoint='wk7'; %detect stops(no=0, yes=1) stopdetect=1; inputname2=strcat(inputname, '_stimtb.mat'); load(inputname2) %time resolution for z-score analysis (+/- in sec) timeres=1 %extract value for control period d=0; for c=1:length(LocoSynth); if LocoSynth(c).time==timepoint; ...
71066b8fc15326443e5bd21f2413b7a6be3e8b989a3457ce194474f86bfc8960
MATLAB
2,734
66
%% load dependencies addpath(genpath('/scratch/janine.bijsterbosch/WAPIAW_2/heterogeneity/src_matlab')) basedir = '/scratch/janine.bijsterbosch/WAPIAW_2/heterogeneity'; sublist_name = 'sub_list'; target = 'x20016_2_0'; restdata = 'resting_state_separate_proj'; disp(['base directory is ', basedir]) disp(['target = ',...
3e137299c4e0810d217325d78d4a4a0f7fed2b1f400cc110120d61adc81fbbbc
MATLAB
2,735
100
% PURPOSE: updates MVPCset menu function updatemenumvpc(ALLMVPC,overw) if nargin<2 overw=0; % overwrite MVPCset menu? 0=no; 1=yes; -1=delete end % % Checks MVPCset menu status % MVPCmenu = findobj('tag', 'mvpcsets'); statbestm = get(MVPCmenu, 'Enable'); if strcmp(statbestm,'off') set(MVPCmenu, 'Enable...
e08d993df7976a29c186bf038124a9fffd85ea9e25eb799a8d6ce04a1918558c
MATLAB
2,736
71
function [numFibersAtPercepThreshold, placements, percepThresholds] = num_fibers_for_perception(nerveModel, electrodeType, plot_all) % returns numFibersAtPercepThreshold(iOrientedPlacement, iElectrode, iAS) % num_fibers_for_perception(1, 'D:\'); nrnModel = 'MRG'; percepThresholds = load_percep_thresh(nerveModel);...
976d1bed03e4ccb2a6fe2a1127caa11b1a282d1457f5e267a8a7147e0f4b0664
MATLAB
2,737
100
% PURPOSE: updates BESTset menu function updatemenubest(ALLBEST,overw) if nargin<2 overw=0; % overwrite bestset menu? 0=no; 1=yes; -1=delete end % % Checks BESTsets menu status % BESTmenu = findobj('tag', 'bestsets'); statbestm = get(BESTmenu, 'Enable'); if strcmp(statbestm,'off') set(BESTmenu, 'Enabl...
03a0417fa0465e148d747a504a4981c1c4894425bf526d8eaf4c9cb7df135ea3
MATLAB
2,738
126
%% Generate random colors for 3d Catlas in Slicer 3D % This script will read the specified atlas txt file and generate random % colors and save it as a new file called 'CATLAS_COLORS.txt' in the pwd. % Manually copy this new file to the Slicer 'ColorFiles' subdirectory. % Slicer 3D will have to be relaunched if it is a...
b9ec9298a74d1b1b77b406435945292a7bc8e0f456a38c42b7830559d643083f
MATLAB
2,739
93
function [datobs, datrnd] = cluster_test_helper(dat, nperm, diffstat) % CLUSTER_TEST_HELPER is a helper function for doing cluster-corrected % permutation tests in arbitrary dimensions. The randomizations are % generated under the assumption that input dat was computed using a paired % statistic T for which T(a,b) = -T...
bb09da5f59fe54a64d525b42fa73be2c02fe242bdb291f14371e35ff65fec0bd
MATLAB
2,741
88
outname='Gi17546'; outname2=strcat(outname, '_stimtb.mat'); %%last update october 21, 2020 nbpulse=1; %check the directory, count nb of file datalist=dir; nbfile=length(datalist); nbelem=0; LocoSynth=[]; %read directory. How many file do we have? create a database. for a=1:nbfile if datalist(a).isdir...
26b1877f907cc7e8b7c87bfffe570cec1379e822904e351265e71f3f4d3db6d7
MATLAB
2,745
94
function TRIALS = TrialFcn_IncrementReward_EXAMPLE(TRIALS) % TRIALS = TrialFcn_IncrementReward_EXAMPLE(TRIALS) % % Increases reward size (within bounds) with consecutive hits. % % A miss resets the reward size to a minimum specified value. % % See inline comments for more details. % % Daniel.Stolzberg@gmail.com 11/2015...
db73b74208d31906f1c8507fa8e13005a708243c1c6e6ec896ec75cd0d23f9d3
MATLAB
2,745
95
function varargout = PLX2MAT2(plxfilename,trodes) % [units,ts] = PLX2MAT2(plxfilename) % [units,ts] = PLX2MAT2(plxfilename,trodes) % [...,waves] = PLX2MAT2(plxfilename,...) % [...,waves,channels] = PLX2MAT2(plxfilename,...) % % Reads Plexon PLX files % % If 'trodes' is not specified, all channels from the plx ...
92dda66f390e6548cd004183d573026d51acd5007b4828663ec99c4d4afac92d
MATLAB
2,746
87
function p = plot_detection_criterion(spikes,clus) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % plot_detection_criterion - histogram of detection criterion applied to % each waveform % % Usage: % [thresh_val,m,stdev,missing] = plot_detection_criterion(spikes,...