sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b72b436b115a28ca0ef859a73bdabb75f72c3acf4483f8068cec908cb6099d38
MATLAB
2,319
60
function [K,dK] = covMask(mask, cov, hyp, x, z) % Apply a covariance function to a subset of the dimensions only. The subset can % either be specified by a 0/1 mask by a boolean mask or by an index set. % % This function doesn't actually compute very much on its own, it merely does % some bookkeeping, and calls anothe...
247d41a537e24c9466a065c4c007302cda5ddb4b59c79fc524d4abf5e246dc3e
MATLAB
2,320
60
function [] = plotBetas(beta, colors) % This code reproduces the analyses in the paper % Urai AE, Braun A, Donner THD (2016) Pupil-linked arousal is driven % by decision uncertainty and alters serial choice bias. % % Permission is hereby granted, free of charge, to any person obtaining a % copy of this software and ass...
4b734f4c48efca527cd9d67122f75728d43c1ade3212af323a74d8586996bfa2
MATLAB
2,320
81
% clear all % load rez % load TT2_1.mat <<<<<<< HEAD % [d, timestamps, info] = load_open_ephys_data(sprintf('100_CH1.continuous')); clear title k = 1; Toler = 1; for icell_1 = [10] % 4 8 19 16 15] for icell_2 = [22] % 26 22 13 30 21] ======= clear title for icell_1 = [7 8 9 23] % 4 8 19 16 15]...
5c2dcb73932778e0642ec74bf5cbb6bda696909fa78840f8d76c095c70836ef5
MATLAB
2,320
71
%% h = sepia_handle_panel_bkgRemoval_SHARP(hParent,h,position) % % Input % -------------- % hParent : parent handle of this panel % h : global structure contains all handles % position : position of this panel % % Output % -------------- % h : global structure contains all new and oth...
89bed2b3045b04bda6e6ae0bb6daf8156fbb9aac095fba3e0a898b630ebce968
MATLAB
2,320
57
function out = DN_Burstiness(y) % DN_Burstiness Burstiness statistic of a time series % % Returns the 'burstiness' statistic from % % Goh and Barabasi, 'Burstiness and memory in complex systems' Europhys. Lett. % 81, 48002 (2008). % % ---INPUT: % y, the input time series % % ---OUTPUT: % The burstiness statistic, B...
ebb3a7fdf9c7ef396f5665ff52e055051e8af15d72e1657fc2dd3c637dbbf29f
MATLAB
2,320
70
function [BetasPro, BetasDi] = DARegressRewardHistory_estrous(ratlist,... Pstruct, Bstruct, auc1, auc2, nback, Stages) %%% Dopamine AUC as a function of late alpha model-predicted RPE % Just mixed blocks % Note: robustfit produces longer taus than regress %Get DA AUC x reward history betas, split by stage for mixe...
1f3d3405dcc11225ace88684273b2b587ac2f73fe52f5c28e4f4a3a482090568
MATLAB
2,321
48
set_up_paths_and_data_directories; emo_types = {'2dtrajMDS'};%{'category','binary_valence_arousal', 'valence_arousal'}; emotions_category = {'Anger', 'Anxiety', 'Fear', 'Surprise', 'Guilt', 'Disgust', 'Sad', 'Regard', 'Satisfaction', 'WarmHeartedness', 'Happiness', 'Pride', 'Love'}; emotions_valence_arousal = {'Good',...
d9f7f81625182f09ffd4b030a97094bbaa8093e20d97def8388ae29d894402b6
MATLAB
2,321
68
function [t] = neuralynx_timestamp(filename, num) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % SUBFUNCTION for reading a single timestamp of a single channel Neuralynx file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright (C) 2007, Robe...
67bea45c6c81143b8190900bdec47041904563c4fa9520edadc15d0dc9090f76
MATLAB
2,322
79
function eventout = biosig2fieldtripevent(eventin) % BIOSIG2FIELDTRIPEVENT converts event information from a biosig hdr into % fieldtrip events ft_hastoolbox('BIOSIG', 1); f = which('sopen.m'); [p,f,e] = fileparts(f); if contains(p, 'external') % assume the biosig to be shipped with the fieldtrip distro, in which ...
8757b872d4a3bc8470921dbbd7425ecc346f98d7e121d386bc3ef1621378dcb1
MATLAB
2,323
68
function A = affineBuild(trans, rot, scale, skew) % % A = affineBuild(trans, rot, scale, skew) % % Builds an affine (orthogonal linear) transformation matrix from the four % componets: translations, rotations scales and skews. % % trans, rot, scale, skew should all be 1x3 vectors specifying x,y,z. % Rotations are in ra...
4208ab1d977b2e7cd026220c8580d52794957ca47e8a0978b72bba49953667e5
MATLAB
2,324
65
% Main script for separating supragranular and infragranular SANDI fraction-weighted surface intensity maps % derived from partial-volume laminar sampling % % Reference: % Lee H, ..., Huang S, Communications Biology, 2026 % % Requirements: % - FreeSurfer installed and configured % - FreeSurfer recon-all completed for e...
e86ed0744730369eea114a3998c451a6a63d65274f914436f696a64225051201
MATLAB
2,324
84
function Test_fixedrank_2factors() % function Test_LR() % Test for fixedrankLRquotientfactory geometry (low rank matrix completion) % % Paper link: http://www.icml-2011.org/papers/350_icmlpaper.pdf % % This file is part of Manopt: www.manopt.org. % Original author: Bamdev Mishra, July 11, 2013. % Contributors: % Chang...
7ad5c2fb1e2cbb79bcf41d4bf488fe8995e504a43a4099072fd624cd5071cdb0
MATLAB
2,325
81
function plot_fig1d(datadir) % Plot time to opt-out by block type for an example rat and all % rats included in fiber photometry experiment (N = 16). % % INPUTS % datadir: file path of data downloaded from Zenodo. Link to download can % be found in README. % load list of photometry rats and example rat load(fullfile(d...
bfb5c5dd82d5f7b5c32beadcbdfbec0c66aedb11418014ee1c406e85b0de02e1
MATLAB
2,327
97
function [ p, s, levp , c, mtbl, sumtxt ] = nmri_groupcompare( x , l , bf, use_nonparam) %[ p, s, levp , mtbl] = nmri_groupcompare( x , l , bf) % Does (somewhat smart) group comparisons using ANOVA and/or Kruskal % Wallis test (n case Levene is not passed)7*2*2*3 % % % p = p value % s = multiple comparisions tabe %...
cec3632f606e28ddab9a6ff074251b4d410191b2370e5c7912298ffb6561056a
MATLAB
2,327
54
% Example 02 - dual-coded map (contrast estimates and t-statistics) overlaid on an anatomical image % Define directories example_dir = fileparts(mfilename('fullpath')); data_dir = fullfile(example_dir,'data'); sd_dir = fileparts(example_dir); % Make sure directory containing slice display functions is on path...
8336941d613c19337dc78c160918249ff06ee544576548a21fa7dc4848b9b08a
MATLAB
2,328
67
function outputs = targetXTClassifier(data, config) % Fit models on 100 ms periods nonoverlapping config.tBins = config.preT:100:config.postT; nFolds = 1; nPartitions = 5; outputs = []; [outputs.tPtsTrain] = deal(NaN); [outputs.models] = deal(NaN); for train = 1:length(config.tBins)-1 % Select a subset of time bi...
07fcc50be93f758e8ebee3e934e6654928617666f477b49f65129db1ebae7caf
MATLAB
2,329
83
function [M,dsym,VoxelSize]=track_clust(TrackFile,Lthresh,J) % This script computes the distance between each pair of streamlines % Input % TrackFile: Streamlines file computed in Diffusion Toolkit % Lthresh: length threshold of streamlines % J:Number of points resampled for each streamline % Output % M: x y z coordin...
2ec034ddf40b588c211cfd83bacd70aab721c31d6682cf3f4bd31f7c28d922e4
MATLAB
2,329
75
function idxs=surfing_afni_node2voxelidxs(Info,vertw,vertp,n,orientation) % projects nodes on a surface to indices on the surface % % IDXS=SURFING_NODE2VOXELIDXS(INFO,WSURF,PSURF,N,ORIENT) takes an afni % volume with info INFO and inner and outer surfaces WSURF and PSURF in % orientation ORIENT, and returns N linear in...
6b0c53266251c2cd30857e7855ac21b7231b300ee737508312140c086ebbd27c
MATLAB
2,329
68
function shrunk = Shrink(matrix,rowBinSize,columnBinSize) %Shrink - reduce matrix resolution by shrinking it (akin to pixelating) % This returns a matrix 'shrunk' which is produced by taking the % mean of [columnBinSize rowBinSize]-sized blocks within the input matrix. % From this follows that columnBinSize needs to b...
7e4a764cc4efa7b385616b8d75e9fb9785c474102fd6d25f66428e6a7942feac
MATLAB
2,329
59
function filterTags = get_filterTags(varName) % return filter processing pipeline given the variable name % typically designed for extraction of trajectory derivatives % (c) Jiri, Apr17 %% notes % - 'zeroMean' used until 19.07.2017 (large car game tuning analysis v5) %% code varName = lower(varName); switch varName ...
c80043d958c728637ab1fc3bb18ee416a09ca2be7143bb2bff100a39071818ff
MATLAB
2,329
55
function plotTrajectories(kinematics, plotParams) % Params xshift = 20; % offset between L and R trials spoutCol = [0.5, 0.5, 0.5]; % Make figure fig; hA = gca; axis off hold on; hA.View = [-22,4]; axis equal % R spout line(hA, [plotParams.spoutPose(1,1) plotParams.spoutPose(1,1) plotParams.spoutPose(2,1) plotParams...
e47e8923bc8a9268d67eaea01e247b44ffde262631b8863c3a8ec2ae43211230
MATLAB
2,329
93
function [traj, infStates] = tapas_ph_binary(r, p, varargin) % Calculates the trajectories of v under the Pearce-Hall learning model % % This function can be called in two ways: % % (1) tapas_ph_binary(r, p) % % where r is the structure generated by tapas_fitModel and p is the parameter vector in native space; ...
39bd2e9a33bf4bb0bd53787bd969295c40c1db986a6686049af0ce5ebfa86899
MATLAB
2,330
53
% bids_geteventfiledsfromfolder() - Scan bids folders recursively to get the list of event fields % from the first events.tsv file % % Usage: % >> fields = bids_geteventfieldsfromfolder(bidsfolder); % % Inputs: % bidsfolder - a loaded epoched EEG dataset structure. % % Outputs: % ...
6ef72b5c1133986083d834e2acf49ff6886d49e59fd8e6ecad22f52028a69f0c
MATLAB
2,331
80
function [data_brain, brain_mask] = bet(varargin) % This function does a brain segmentation for diffusion data. % It uses a median filter smoothing of the b0 volumes and an automatic histogram Otsu thresholding. % Input % ---------- % data: diffusion data, (X, Y, Z, T). % bvals: b-values, (X, Y, Z, T). % median_radiu...
7e1cb2b53d11c2093b73879df6bb29ea0e12d56d1177d43c7764da57aa554e8b
MATLAB
2,331
74
function [periods,quiescence] = QuietPeriods(v,velocity,duration,brief) %QuietPeriods - Find periods of immobility. % % Find periods of immobility, i.e. periods of sufficient duration % where instantaneous linear velocity remains low. Brief movements % can be ignored. % % USAGE % % [periods,quiescence...
a937a29f598ab2b9cc3eaac804ce191005633ef39b7c56842f5a7284542cc6e0
MATLAB
2,331
82
function [msize,summary]=h5moviesize(filepath,varargin) % HELP % Find a dataset '/mov' in h5 file and reads the matrix size. % SYNTAX %[msize,summary]= h5moviesize(filepath) - use 2, etc. %[msize,summary]= h5moviesize(filepath,'optionName',optionValue,...) - passing options using a 'Name', 'Value' paradigm frequently ...
77a348822d9e4a5fceac76741957251169a5ccdf1c1d15a36c727c0d52154d2e
MATLAB
2,332
61
function corrstats=surf_sig_roi_corr(Mean_rapid_slope,indnodes,cifti_scalar,Xlabels,Ylablels,namef,Pathnew) lhgii=[Pathnew,'\Forgithub\Data\Atlas\Par_500_fslr-lh.gii']; rhgii=[Pathnew,'\Forgithub\Data\Atlas\Par_500_fslr-rh.gii']; %cifti_scalar=['D:\Documents\OneDrive - bnu.edu.cn\My_publications\0-8years\atlases_Oct...
4031dd4f7e4b80baa01b5a65b4efd57b5d2961a324bf9d77aa8ac9375349ccef
MATLAB
2,333
83
% (C) Copyright 2018 Mohamed Rezk % (C) Copyright 2020 CPP visual motion localizer developpers function [onset, duration, dots] = doDotMo(cfg, thisEvent, thisFixation, dots) % Draws the stimulation of static/moving in 4 directions dots or static % % DIRECTIONS % 0=Right; 90=Up; 180=Left; 270=down ...
f808de1f4b4edf519f61265692ba2a29206f594c8f10d7682807bc2c809bfd62
MATLAB
2,334
80
function [Data,Mask,Data_masked,ROIs,T1map, Params] = load_data(path_Data,path_Mask,Params,varargin) %load_Data(path_Data 'string', path_Mask 'string', Params 'struct', varargin) % load different niftis for further processing % if the ROI path cell is not supplied the function will fill it with the % mask % % path_Da...
d6ea74addae5e3459e1becb6fb851a8a0514f92889ede5721f9463e49380995e
MATLAB
2,335
78
function plotGraphMetricsByLag(compiledData, eMeti, eMetl, Params) %PLOTGRAPHMETRICSBYLAG Summary of this function goes here % Detailed explanation goes here AgeDiv = Params.DivNm; nDIV = length(Params.DivNm); divColorMap = flipud(viridis(nDIV)); xt = 1:length(Params.FuncConLagval); if isempty(Params.customGrpOr...
67353ede228b186849b10999a1259d79529deb3a14f93e430bb3f4deb2cd2afb
MATLAB
2,336
88
function [out] = smf_rx_detector(hsi_img,tgt_sig,mask,guard_win,bg_win) % %function [out] = smf_rx_detector(hsi_img,tgt_sig,mask) % % Spectral Matched Filter with RX style local background estimation % % inputs: % hsi_image - n_row x n_col x n_band hyperspectral image % tgt_sig - target signature (n_band x 1 - column...
8acc35051e94b5d5d9acea2b63dba029fa5a80db8066cc3e52b520839ad18a09
MATLAB
2,336
55
function [homerPruneMat, sciAvgs, pspAvgs, motionWindows, channelsRetained, snrMat, saveFlags] = initialiseMetricsStorage(statsOutLoc, cohort, task, timepoint, sub, params) % Initialises data structures for storing quality metrics, pruning results, % and SNR values across subjects. Creates empty matrices sized % ...
e122c2a142f262c29e313e68296d950302aafda2ed650e4b4b0c03f817540bce
MATLAB
2,337
58
function [PWD, F, TW]=CWT_v1(signal, time, labels, setting) % Function computes power of continuous wavelet transfor (P-CWT) in dB from trials data for % each channel. Single precision used to save memory and computational time % INPUTS: % trials_data... EEG (time X channel X trials) % trials_time... time vector in sec...
d07a165608bf694797bd5093e00bc3f7dd58d7b96b5efe5ccca96f795042605d
MATLAB
2,338
48
function plotFullDepthRaster(expInfoAll, exSubject, exProbes, paramBC, bankSelList, day2pltList, depthWinList, fullProbeScan, colAni) for pp = 1:numel(exProbes) fullProbeScanSpec = cellfun(@(x) [exSubject '__' exProbes{pp} '__' x{1}], fullProbeScan, 'uni', 0); meas = cell(1,numel(fullProbeScan...
ef68b6abf9f79edfab2ed0ae95f9723f6c633af3191046041b6be66d9457cad8
MATLAB
2,338
64
%% [chi] = Wrapper_QSM_myQSM(localField,mask,matrixSize,voxelSize,algorParam, headerAndExtraData) % % Input % -------------- % localField : local field map (tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial resolution of each dimension of the data...
58edecdb700173382c5c4994f34779c9ca96901a2261d3f4f5617e6adf41bc04
MATLAB
2,339
64
% Recipe_fMRI % this 'recipe' performs region of interest analysis on fMRI data. % Cai Wingfield 5-2010, 6-2010, 7-2010, 8-2010 %__________________________________________________________________________ % Copyright (C) 2010 Medical Research Council %%%%%%%%%%%%%%%%%%%% %% Initialisation %% %%%%%%%%%%%%%%%%%%%% toolb...
766976f696876dd98ee3f36e21e0e55cf5e7eac70320a0733d5ab7cc4f8e0a1a
MATLAB
2,340
64
% cpd2oct - Convert cycles per degree (cpd) to octaves % Finds the lowest and highest SF in cycles/degree (cpd) that produced half the maximum response. % Converts cpd to octaves. % % Syntax % [bandwidth_oct, sf_halfmax] = cpd2oct(pSFT, sf) % % Input Arguments % pSFT – pSFT curve % sf – spati...
b0b547ac67aa23623403a3bfc532b5a9251aae6c17f8a2ea48b7b8866d8b906a
MATLAB
2,340
61
function corrstats=surf_sig_roi_corr_cov(Mean_rapid_slope,indnodes,cifti_scalar,Xlabels,Ylablels,namef,Pathnew,Cov) lhgii=[Pathnew,'\Forgithub\Data\Atlas\Par_500_fslr-lh.gii']; rhgii=[Pathnew,'\Forgithub\Data\Atlas\Par_500_fslr-rh.gii']; %cifti_scalar=['D:\Documents\OneDrive - bnu.edu.cn\My_publications\0-8years\atl...
fc4829847cfe786023fda79cad992e8c4cf1b816ea14fdb0749562dc13da25a3
MATLAB
2,340
60
%FHBC_fade EEG = pop_marks_event_gap(EEG,{'-f'},3000,'in_task_fhbc_fade',[.7 .7 1], ... 'interval','off', ... 'critdir','max', ... 'exact','off', ... 'offsets',[3000 -3000], ... 'ref_point','both', ... 'invert_flags','on'); EEG = pop_marks_event_gap(EEG,{'-f'},3000,'in_leadup_fhbc_fade',[.4 .4 1...
1161a7d8f22e29edbdcda27623618951b4fb6351ec547f18b8599549554d84a6
MATLAB
2,341
84
function [OUT] = indic2classify2(indic,n,nms) % % indic is matrix of indicators, studies/contrasts are rows, 1/0 codes yes/no for % task and regional activation. integers in indic above 1 are treated as % 1. % % first n indicator vars are task codes, rest are regional activation % nms is cell array of strings, first t...
46e82ebaa0e3946e342ea801c718c01975e66e10426fb9e7bdfe69669d430826
MATLAB
2,342
76
function s = db_select(tablename, fields, sel) % DB_SELECT selects data from a database table and converts it into a % Matlab structure.Each of the fields in the database table will be % represented as field in the strucure. % % Use as % s = db_select(tablename, fields) % s = db_select(tablename, fields, num) % % ...
667b334ab7b45669ffca81e96fc6a40e4bba21929c117b461addfd6acf7858bd
MATLAB
2,342
82
classdef nnbnorm < nntest properties (TestParameter) rows = {2 8 13} cols = {2 8 17} numDims = {1 3 4} batchSize = {2 7} end methods (Test) function regression(test, rows,cols, numDims, batchSize) r = rows ; c = cols ; nd = numDims ; bs = batchSize ; x = test.rand...
22b8615d1766b710473275b39bbce5f85bf90feff2814e33a6d863090a1ed847
MATLAB
2,343
91
function phiBC = cellBoundary2D(phi, BC) % function phiBC = cellBoundary2D(MeshStructure, BC, phi) % It creates the matrix of coefficient based on the BC structure provided % by the user. It also generates the right hand side vector of the linear % system of equations % % SYNOPSIS: % phiBC = cellBoundary2D(MeshStruct...
55c9f3d86d0eaefd1c45ff3eed7f394b899ab7077abab9afe31f995e5ae80ad2
MATLAB
2,343
57
function using_gpu() % Manopt example on how to use GPU with manifold factories that allow it. % % We are still working on this feature, and so far only few factories have % been adapted to work on GPU. But the adaptations are rather easy. If % there is a manifold you'd like to use on GPU, let us know via the forum % o...
8d5f3e1acc11e5893bb5a15145b6680d900e82c5a3810112f24f7013754735cb
MATLAB
2,343
70
function [cfg] = loadAudioFiles(cfg) %% This function loads the pre-recorded audiofiles. %R=Right, L=Left, U=Up, D=Down %T=Target %% Load the sounds % static Stimuli fileName = fullfile('input', 'Static', 'one25.wav'); [soundData.S1, freq1] = audioread(fileName); soundData.S1 = soundData.S1'; ...
ad91901548a482abb64b13f582ec69a3f8f210301ae094304c4118f20b288b74
MATLAB
2,343
58
% For compilation under Windows/Octave you need to install the package % octavex.x-headers. % Under Linux/Octave, compilation works out of the box. % % There is a big variety of platforms running Matlab/Octave around and the % script is tested for: % % Linux 32bit / Matlab R2008b, 7.7 % Linux 64bit / Matlab R...
bfc3bc858cd7c6bb6e2966d3f3f00d721efa8540313292b6872d1ca30f64a814
MATLAB
2,343
83
function autoqc_nsd_grand(subjix,glmdirname) % setup nsdsetup; % get all scan directories alldirs0 = [nsdscreeningfun2(subjix) nsdallsessfun2(subjix)]; %%%%% get mean and valid from every session % init meanvols = single([]); validvols = single([]); % loop over directories for p=1:length(alldirs0) % calc ppd...
ea68275904dafb2f6759c8d1862160cc2c3a73f530426aa359707bdc038d57f8
MATLAB
2,343
56
function [Data_Filtered] = TMSIdealFilter(Data, SamplePeriod, Band) % FORMAT [Data_Filtered] = y_IdealFilter(Data, SamplePeriod, Band) % Input: % Data - 2D data matrix (nDimTimePoints * nTimeSeries) % SamplePeriod - Sample period, i.e., 1/sample frequency. E.g., TR % Band - The frequency...
38ae2de147f7587b6f5c0bec3af4b0ed35d6ec75eaa5d63f8da4ff1eb7e4f3f1
MATLAB
2,345
96
function imdb = attach_proposals(imdb,boxes,fgThresh,bgThreshHi,bgThreshLo) % % Copyright (C) 2016 Hakan Bilen. % All rights reserved. % % This file is part of the VLFeat library and is made available under % the terms of the BSD license (see the COPYING file). % gtboxes = imdb.images.gtboxes; % imdb.images = rmfield(...
51385ebaafdebc84994cc1e19ab783947bfb4d85269271ed82d17f403fc093ca
MATLAB
2,345
66
%{ # produces synchronization information between two-photon scanning and visual stimulus -> preprocess.Prepare --- -> vis.Session first_trial : int # first trial index from psy.Trial overlapping recording last_trial : int # last trial...
5ea811b8548837d102c2ac2b41564a46816b0498ac823e19d0bcd77e92405fda
MATLAB
2,345
96
function Test_MN_completion() % Test for fixedrankMNquotientfactory geometry (low rank matrix completion) % % Paper link: http://arxiv.org/abs/1209.0068 % % This file is part of Manopt: www.manopt.org. % Original author: Bamdev Mishra, July 11, 2013. % Contributors: % Change log: clear all; close all; clc; % ...
961a1b9ec1a495ea1ba1e99ed37de1b304b6ba3a24e27566bceb6ef5c75402fd
MATLAB
2,346
80
function [high, low, err_high, err_low, deltas, T, tstartbl, tendbl, tzero]... = hiloRew_stages(bstruct, pstruct, window, thirdrew_arg,... Stages) %%plot response aligned to offer cue in high versus low blocks, separated by %%input: %ratlist = which rats to run through on at a time %pstruct = align...
a4f742c86ceebc65917a79db9674b977ce0c46b7d1447b6e2faa2bd4880d1d4c
MATLAB
2,346
84
function [err,contrfile] = ContrastTest (N_runs, polort, N_basis, Task, N_tasks, N_contr, El, N_base) % % [err,] = ContrastTest () % %Purpose: % Construct the contrast test matrix used in -glt option of 3dDeconvolve. % % %Input Parameters: % % % %Output Parameters: % err : 0 No Problem % : 1 Problems % % %...
ae2e3c3b67a26ddae2f4aa27c5b7b93417a31e4831907e93b655e69d8cd2622c
MATLAB
2,346
55
function mouseHandlerHeatMap(src, evt) % function mouseHandlerHeatMap(src, evt) % % Is triggered when the mouse is clicked in the HeatMap figure. Reads % the current mouse position, translates it to a sensor ID and visualizes % (if matches unit in sta data) its neighborhood and its activity %SET PARAMETERS uni...
5744514198764731b7272cf953d4461ca3531b308e07ca6007ff966ad096b493
MATLAB
2,347
69
function outargs = hlp_resolve(x,default,context) % Look up a symbol from the current hlp_scope scope. % Data = hlp_resolve(Symbol,Default,Context) % % More precisely, perform a lookup for a symbol in the current (dynamic) scope formed by (possibly % nested) hlp_scope(s). Returns a cell array of all the values associat...
9fa9093689fdd3ad62eeebe4b663f77d8fb3527f2c352c45ba8ea410e5953362
MATLAB
2,347
69
function [distance_cos,distance_difference,pred_cond,distances] = ... mahal_func_theta_kfold(data,conditions,theta,n_folds) %% train_partitions = cvpartition(conditions,'KFold',n_folds); % split data n times using Kfold distances=nan(length(unique(conditions)),size(data,1),size(data,3)); % prepare for ou...
2801c9fb658385ef0dda4d6da52ed033943b900c75dd05f6d5f9322f4a4c6e03
MATLAB
2,348
62
function [chi2,actual,expected,colnames] = simplechi2(studycount,totalstudycount) % function [chi2,colnames] = computechi2(studycount,totalstudycount) % % 07.22.01 by Tor Wager % % computes an a vs b chi2, where #nos is total - #yesses % can generalize to other things, L/R for example, but must give L or R and total % ...
9b390e48d048371f1dbe91d4cf2cfc08089cce38d71c9ab89b34e641ea7be341
MATLAB
2,348
59
clear all %#ok<CLALL> % Clear all variables from the workspace close all % Close all open figure windows %% INSERT YOUR RECEIVER IPv4 ADDRESS HERE IPv4 = '127.0.0.1'; %% RUN THE REST % Define Image Dimensions and Preallocate Storage xpixels = 512; % Image height (number of rows) ypixels = 796; ...
c10432834aa224c9155e37b3d6184a85187bea7123874bdd2e98442ef0fd1b52
MATLAB
2,349
59
function X = filtfilt_fast(varargin) % Like filtfilt(), but faster when filter and signal are long (and A=1). % Y = filtfilt_fast(B,A,X) % % Uses FFT convolution (needs fftfilt). The function is faster than filter when approx. % length(B)>256 and size(X,Dim)>1024, otherwise slower (due size-testing overhead). % % Note:...
40f5e73c43586eedf7c27ee730c44b31821e93eefe29a8159d7e81bca9b63e21
MATLAB
2,350
79
clear clc close all tic; load input load output data=[input,output]; Particles_no=20; % Number of particles Max_iteration=100; % Maximum number of iterations % number of hidden layer, number of neuron layer1, number of neuron layer1, trasfer function 1, trasfer function 2, trasfer function 3, learning ra...
cb74628f91e413fcc745aa6848152a74a9ac522296273fac2909e83df9a930ae
MATLAB
2,351
90
function result = FuzSam(proj,result,param) %rand('seed',120) %Adapt the data P = proj.P; %P projected data or dimension d = result.data.d; %d distances f = result.data.f; %f partition matrix m = param.m; %m fuzzy exponent maxstep = param.max; alpha = param.alpha; % compute data dimens...
ff636e6ca08d04f8a6f1fc22224656da2c0ffbe79be7bfd9bda9c52f54c11d28
MATLAB
2,351
72
function [ rsq,hd,p_fit,s,y_fit,delta_fit,p,r ] = plot_fit_linear( x,y,zz,color,varargin ) n = 1; linestyle = '-'; linewidth = 1; if numel(x)>2 ci_type = 'function'; showError = 0; coor_type = 'Pearson'; for v = 1:numel(varargin) if strcmpi(varargin{v},'degree') n = varargin{v+1}; elseif strcmpi...
558a1935a0589a0093435edf3b12f2c90d919d7edc794e41705279b5cd77320f
MATLAB
2,352
90
function [traj, infStates] = tapas_kf(r, p, varargin) % The scalar Kalman filter % % This function can be called in two ways: % % (1) tapas_kf(r, p) % % where r is the structure generated by tapas_fitModel and p is the parameter vector in native space; % % (2) tapas_kf(r, ptrans, 'trans') % % where r is th...
ef2e8aad172c3495112b0f8dcb99da4c2adfb7912aecc6e8704b13ae1fad5a1c
MATLAB
2,352
71
function map = tab10(N) % Qualitative colormap from MatPlotLib, for plots using the line ColorOrder. % In MatPlotLib 2 it is named VEGA10, for MatPlotLib 3 was renamed TAB10. % % Copyright (c) 2017-2020 Stephen Cobeldick % %%% Syntax: % map = tab10 % map = tab10(N) % % For MatPlotLib 2.0 improved colormaps were creat...
df7de8dfc147e28521f15ce9935ad7676e2e916b6ddddae8c9597bb89fa0b16a
MATLAB
2,353
81
function [val, remaining] = keyval(key, varargin) % KEYVAL returns the value that corresponds to the requested key in a % key-value pair list of variable input arguments % % Use as % [val] = keyval(key, varargin) % % See also VARARGIN % Undocumented option % [val] = keyval(key, varargin, default) % Copyright (C)...
c08120c12a0c38515cdb2f08b982e64cf27c9855c28f4cff8745089f4f7e15a7
MATLAB
2,354
83
function MS = createMesh1D(varargin) % MeshStructure = createMesh1D(Nx, Width) % MeshStructure = createMesh1D(facelocationX) % builds a uniform 1D mesh: % Nx is the number of cells in x (horizontal) direction % Width is the domain length in x direction % % SYNOPSIS: % MeshStructure = createMesh1D(Nx, Width) % % PARAM...
04fed92a0144a31aff77a2c54bd083d7504a1431e2a80871bd8fad7cb0eba990
MATLAB
2,355
79
function adjM_out = limitEdgesForPlotting(adjM, Params) %LIMITEDGESFORPLOTTING Keep only top weighted edges for visualization % Support either parameter name if isfield(Params, 'maxedgestoplot') && ~isempty(Params.maxedgestoplot) maxEdges = Params.maxedgestoplot; elseif isfield(Params, 'maxNumEdge...
41f2fbdae67c15c66ac9b739a46997f98ad0d3d8f28c1c381a72bb676c07f410
MATLAB
2,355
54
function [numEvents, eventRaster, freqBinEdgeTime, freq, spikeCount] = ... YS_lzlab_eventhistogram(timeWidth, timeBinSize, eventTimes, spikeTimestampArray) numEvents = size( find( eventTimes > 0),2); % Loop over events. iLastIndex = 0; % Get bin edges. freqBinEdgeTime=[timeWidth(1...
12bd5329efc57fdf07e6f29718ae8fcd08cd560814d5d0bfdae446bbf1251ad4
MATLAB
2,357
76
function tapas_sem_prosa_llh_check_input(t, a, u, theta) %% Checks the input to the likelihood function % % aponteeduardo@gmail.com % copyright (C) 2015 % DIM_THETA = tapas_sem_prosa_ndims(); ns = size(t, 1); np = size(theta, 2); check_matrix(t, [ns, 1], 't'); check_matrix(a, [ns, 1], 'a'); check_matrix(u, [ns, 1]...
7277771feab8d99db996009532bebed959fbfb71b4453f5ad8a0805e25829425
MATLAB
2,358
65
clc clear all close all for user_num = 13:13 for session = 1:1 for pattern = 1:1 processedpath = input('Enter processed_data location(such as /home/processed_data): ', 's'); load([processedpath,'\Frame_event_pupil_track_result\update_factor_1\left\update_20_point_user',num2str(user_num),'_session_',num2str(session)...
734474e2a50daee3e7c3643bb99e9596c60c98eab3165fc2758f5075dd4e8376
MATLAB
2,359
80
function [results,rt] = UnitTest(sequence,segmentation,GUItest) %% quickUnitTest.m % This function performs a quick unit test of the command line calls of % Osprey. It is based on two Philips datasets of the Big GABA paper, which % include a complete quantification of PRESS, MEGA-PRESS and HERMES % spectra. The...
9f1f3ae9dcce5d8b2e34af1749553859a4df3555e46926329c992e94f919097a
MATLAB
2,359
62
% Script demo_affine_geometry % Exemplifies loading of affineTransformation from different data types % % demo_affine_geometry % % % See also % Author: Saskia Bollmann & Lars Kasper % Created: 2017-10-27 % Copyright (C) 2017 Institute for Biomedical Engineering % University of Zurich and ETH Z...
250063af7fb4bda21a919eb6b422285ea4c18d348181538d089a3832654426a8
MATLAB
2,361
71
function [mean_burst_amp,num_bursts,mean_burst_length] = BURST_ANALYSIS(bandpass_analysis,threshold_val) % Identify burst count and duration, as well as mean burst amplitude % Input is the hilbert transformed amplitude values, and the amplitude % threshold value for determining a burst % Output is the average a...
46266c6f229fd57c9f668299eff18f327d01d846db50f55adf2bc8c0f8d8514c
MATLAB
2,361
81
function final_dist=surfing_dijkstradist(coords,faces,center_idx,max_distance,nbrs) % Computes dijkstra distance on a surface mesh % % final_dist=surfing_dijkstradist(coords,faces,center_idx,max_distance,nbrs) % % INPUTS: % coords: 3xP coordinates for P vertices % faces: 3xQ vertex indices for Q f...
9e6d46c40195c04318efabe80f5a73c95c1c671ae87a1b1c86b3888ed4ada54f
MATLAB
2,361
89
function facenb=faceneighbors(t,opt) % % facenb=faceneighbors(t,opt) % % to find 4 face-neighboring elements of a tetrahedron % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % t: tetrahedron element list, 4 columns of integers % opt: if opt='surface', return boundary triangle list % (should ...
1badd21b5f84e2a815740abd69de69cd0ecd91f6a04a4e6a40efe289662fa0a7
MATLAB
2,363
58
function [ sig_dF_F_activity , sig_dF_F_coactivity_threshold , sig_dF_F_coactivity_peaks ] = findSignificantDF_FCoactivity(dF_F, pars) %FINDSIGNIFICANTDF_FCOACTIVITY( dF_F ) % % PARAMETERS: % \_ dF_F [TxN matrix]: dF/F-signal for N units in T time steps % % % === Jan Moelter, The University of Queensland, 2018 ======...
369df18bcb624f48a486010012c284453cdf718ef5e90b2e1ecd6b7441088afd
MATLAB
2,363
60
function [d,r] = cohens_d(data1,data2,pairedSamplesFlag) % function [d,r] = cohens_d(data1[,data2,pairedSamplesFlag]) % % Calculates a standardized measure of effect size for t-tests: % Cohen's d and r for 1-sample and 2-sample t-tests. % INPUTS: % data1: mandatory, vector for 1st data sample. % data2: if scalar,...
86c96ee108f40048627140c2397668c1a996abd1e981198599016ea1fcb51c4e
MATLAB
2,363
74
function [hdr] = read_bucn_nirshdr(filename) % READ_BUCN_NIRSHDR reads the header information of ASCII-formatted NIRS % data acquired with the UCL-BIRKBECK machine and postprocessed by the % Paris group. The first line contains the channel labels and the rest of % the file contains per line a time sample. The first co...
5723f9527a4a2f27d4880af27d336c0ea6d0a578b887271e337021c955587e0b
MATLAB
2,364
93
function [mc,stats] = maxcor_npm(X,perms,varargin); % [mc,stats] = maxcor_npm(X,perms,[c],[MCD robust outlier removal]) % % X data matrix, columns are variables, rows observations % c contrast matrix for rotation of X prior to correlation % contrasts should be rows % -----------------------------------...
bf0dad8fc2f6d1c880ff4c6106a2255211d4e2a5e5dccf408c5f46db822dc021
MATLAB
2,364
59
%% ============================= % PALM Analysis: ACQ CS×TUS×EXP % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % ensure consistent working dir % Navigate up to FEARTUS root: stats/permutation...
0c2eed667721630d988dcd2a9ed93de9b50915509c536003026d5817c325381e
MATLAB
2,366
70
% 3D scalar example % Author: Aina Frau-Pascual %% % Input image im = zeros(3,3,3); im(:,:,1) = 1; im(:,1,:) = 1; im(3,3,3) = 1; %% % Construct mesh structure Lx = size(im, 1); % domain length Nx = size(im, 1); % number of cells Ly = size(im, 2); % domain length Ny = size(im, 2); % number of cells Lz = size(im, 3); %...
2146711e7c9bc1d45dffac9ab7a79c136f850dfe4feee56f9715db3ae03db866
MATLAB
2,366
71
function update_fig(hObject, eventdata, handles, force_render_page) if nargin < 4 force_render_page = false; end % Okay, so this is pretty annoying, but the GUI is a bit slower to update % when a button is selected rather than the figure. I don't know the best % way to fix this, but disabling and enabling the butto...
3d3bcbdc8b371d140cefec4c6843cfe06558683d40a10644ba6c76b3c7e84712
MATLAB
2,366
70
function [M, Mx, My] = diffusionTermCylindrical2D(D) % This function uses the central difference scheme to discretize a 2D % diffusion term in the form \grad . (D \grad \phi) where u is a face vactor % It also returns the x and y parts of the matrix of coefficient. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % E...
987072d6bdf64188c08ae3b85a2815fb357bd6bec034f7b044d33c4c8c169688
MATLAB
2,366
59
% KURT - return kurtosis of input data distribution % % Usage: % >> k=kurt(data) % % Algorithm: % Calculates kurtosis or normalized 4th moment of an input data vector % Given a matrix, returns a row vector giving the kurtosis' of the columns % (Ref: "Numerical Recipes," p. 612) % % Author: Martin Mckeown, CNL /...
726c2470d4781edc90ab7bd3230dd17e1b52b13af538cca3cc2ad85786c891af
MATLAB
2,367
102
%% %%% SETUP % load rdata = {}; for p=1:8 file0 = sprintf('~/nsd/nsddata/ppdata/subj%02d/behav/responses.tsv',p); rdata{p} = importdata(file0); end % define prffloc = [ DATECENSORED DATECENSORED DATECENSORED DATECENSORED DATECENSORED DATECENSORED DATECENSORED DATECENSORED ]; nsdsyn = [ DATECENSORED DATECENSORED ...
840d96054f081aec003272a3cd7d410d73c75d0be2b426585859ddb2814db866
MATLAB
2,367
64
function [ahr, binvals, subj] = get_allsubs_adj_hr(binType,cellFlag) % [ahr, binvals, subj] = get_allsubs_adj_hr(binType,cellFlag) % % Produces adjusted hit rate values for all NSD subjects as a function of % different inter-item lag bins specified by binType. if cellFlag is true % (disabled by default), output is...
a9e7eaf0d036c01b086f84edc5d1d6f36bc3fa27e32f730914bb3dcbf87ca78f
MATLAB
2,367
74
function model2dot(modelPath, outPath, varargin) %MODEL2DOT Convert a model to Graphviz dot % MODEL2DOT(MODEL_PATH, OUT_PATH) Generate a graphviz dot file OUT_PATH % of MatConvNet model MODEL_PATH. % % By default, the scripts attempts to guess the input sizes based on the % network normalization options and the pa...
44e04a7b4f05e1932cdc550ee450d039e0906b0481d0bae17ba7b46e5f4894cc
MATLAB
2,368
79
function [varargout] = simulateClusteredfMRIData(simulationOptions) % simulateClusteredfMRIData % % [B_true, B_noisy[, B_noisy2[, ...]]] = simulateClusteredfMRIData(simulationOptions) % % Simulate both a 'true' beta matrix with clustered data (according to % simulationOptions) and a 'noisy' one contaminated with simula...
12edc1442429a4fca9158d031ca3ed9a2ecc547a4372cb3307f5aa14a93f179f
MATLAB
2,371
71
%% h = sepia_handle_panel_bkgRemoval_RESHARP(hParent,h,position) % % Input % -------------- % hParent : parent handle of this panel % h : global structure contains all handles % position : position of this panel % % Output % -------------- % h : global structure contains all new and o...
5c7a82457c1442f586c28164196f2cd856915f39a8dbb02a52080d79752d98b4
MATLAB
2,371
80
function [spikeRaster, spikest, fit, drift, parest]=inferSpikeTrain(trace,fs,varargin) % TO DO > estimate more accuratly the par.a parameters... some neurons have % slightly different 1-spike dff %% OPTIONS options.duration=[]; %in sec options.MLspikeParam=[]; options.plotFigure=true; options.savePath=[]; %% UPDATE ...
dcb88c625088f6fe4018cc13f321df091ae098c51be25e682114d32145108010
MATLAB
2,371
71
function samplingPointLabels = index2label(this, arrayIndices, iDims) % Returns array of index labels for specified voxel indices % % Y = MrDimInfo() % indexLabelArray = index2label(this, arrayIndices) % % For 3D data, this usually returns the voxel coordinates of the specified % voxel indices, for 4D fMRI, it addi...
de4332f00a1eb417603dbd05d650ffdf510b28b2bf5f107d274e109e3f3e15ab
MATLAB
2,371
71
function pred = knntest(Xtest,class_t,X,class,K,dist_type,pret_type) % prediction of new samples with calculated model % % pred = knnpred(Xtest,X,class,K,dist_type,pret_type) % % ------------ INPUT --------------------------------------------------- % Xtest: dataset to be predicted [n_test x p] n objects, p var...
ef424065e3f60feb555b6b206e5dfadc57b9386295547a4d7addf24eb7f7412a
MATLAB
2,371
78
% orthMID42.png taken from subj01 % generate distribution visualization n = 100000; vals = vmrand((360/40/2)/180*pi,3^6,[1 6*n]); % center in middle of first session vals2 = rand(1,4*n)*2*pi-pi; figureprep([100 100 400*.6 250*.6],1); hold on; h = histogram([vals vals2]/pi*180,5000,'Normalization','pdf'); set(h,'FaceC...
e0f91dd273f2399915801246939cd8cf25c3063992348834cb20a3a1d868dab4
MATLAB
2,372
144
% 1 x 1 % 1 x 1% plot_info % plot Free energy and other infomation a_min = 1e-5; NX = 2; NY = 2; alpha_plot = 0; FE = Info.FE; tend = length(FE); % Start and End of iteration number for plot tmode = 2; t0 = 10; t3 = 600; switch tmode case 1 t1 = t0; t2 = tend; case 2 t1 = t3; t2 = te...
0725a9b5f22c6e9c6269c197c2868041f460310e206220c41448cb96cbd4cb61
MATLAB
2,374
41
function B1Tx_GroupAverage(IndCorrMyelinAvgFile, IndCorrMyelinAsymmOutFile, IndCorrAllMyelinFile, GoodVoltagesFile, SB1TxFile, B1TxStatsFile, CSFStatsFile, RegressedMyelinOutFile, CovariatesOutFile) AvgICorrMyelinMap = cifti_read(IndCorrMyelinAvgFile); surfasymmnorm(AvgICorrMyelinMap, IndCorrMyelinAsymmOutFile,...
769a6202cddf7c2a61d01e306f38171ea492dfe1837c5d5dcb3a9aa1891d313b
MATLAB
2,374
71
function preprocessing(mri_lst) % % Input: mri_lst <list of strings> list of fullpaths to MRI images to be % preprocessed % % This function converts the MRI scan to nifti-fileformat, orients the input % MRIs to the ACPC corrdinate system and creates an average MRI image (u...
9b079bd48e04134185e1d6e0a57a99f88bc8b118055c93ae8c374abb971b8747
MATLAB
2,374
77
function plotStimDetectionChecks(filteredData, stimInfo, expSubFolder, Params) %PLOTSTIMDETECTIONCHECKS Summary of this function goes here % Detailed explanation goes here %% 1 | Overall stimulation trace figName = '1_StimsDetected'; figHandle = figure; figHandle = plotStimTimes(filteredData, stimInfo, Params, fig...
f01dec3adf6fa82f734d92ea9a2491c53c92872d4fa39135ce5e284e86acb99c
MATLAB
2,375
68
function [coef, t, n] = nancorr_amd(A, B) %NANCORR - Pearson correlation coefficient % % coef = NANCORR(A, B) is equivalent to % coef = corr(A, B, 'rows','pairwise'), % but NANCORR works much faster. % % [coef, t, n] = NANCORR(A, B) % INPUT: % A, B - input matrices, single or double, with e...
8a9b34369960f4b4515a836c383811132793b48d1f00879cd05ef9c921017a44
MATLAB
2,376
95
function obj = update_subspace(obj) N = numel(obj.data); D = prod(obj.lat); % --------- % precision % --------- % > Au = lam * E[Z*Z'] + I obj.Au = eye(obj.M) + obj.lam * (obj.ZZ + N * obj.iAz); obj.iAu = brca.utils.invPD(obj.Au); % ---------------- % variational mean %...
8d70ab83035fcdef1c6da8dcfc00c5f7e26e03ce5fc0c9b8177db1e3b7df61ff
MATLAB
2,376
82
classdef numeric < brca.format.base properties type = 'single'; end methods function obj = numeric(type) if nargin > 0 obj.type = type; end end function data = read(~,array,index,dimension) if nargin < 4 d...