sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2645b8c9160745a5b91115f241a37dd9edef3bf0ab215258949788c6b3c92de5
MATLAB
1,437
38
function [z,p] = SpikeSuprise(count, firingRates, binSize) %SpikeSuprise - estimate the surprise of a spike count assuming poisson spiking % Estimate probability of observing a number of spikes ('count') % counted over a window of a given duration ('binSize') % given a neuron's average firing rate ('firingRates') % ass...
6f07e42d802b1f443b9f744e9a2dd6a06da3149257d42f2b360be619646238cb
MATLAB
1,437
38
function diffLastFirst = compute_diff_last_first(this, varargin) % computes difference image between first and last volume of time series % NOTE: short-cut for compute_stat_image('diff_last_first') % % Y = MrImage() % diffLastFirst = Y.compute_diff_last_first('PropertyName', PropertyValue) % % This is a method of c...
4f57f6add52f991a0cbb324c65e29c121e7bcc676a9a1f9d49792805ee35e194
MATLAB
1,438
60
function y = DK_lagembed(x,M,lag) % DK_lagembed(x,dim,lag) constructs an embedding of a time series on a vector % DK_lagembed(x,dim) makes an m-dimensional embedding with lag 1 % DK_lagembed(x,dim,lag) uses the specified lag % % ------------------------------------------------------------------------------ % Copyright ...
4fa657fb835e623e3bfde4f95861a8bf5d61ea77b365b2bfae858bf790bcf0b0
MATLAB
1,438
73
function H=makeSignificanceBar_jiri(x,y,p,thr) %makeSignificanceBar produces the bar and defines how many asterisks we get for a %given p-value & significance threshold 'thr' % for example: % x = [0.6923, 0.8462]; % x-axis location for the sigbar % y = 0.9500; % y-axis location for the sigbar % p = 0.001; ...
df5974b14b6856535af338e25d60a931888fbef6020aaf4c319eedc3db7b2786
MATLAB
1,438
41
function c = tapas_bayes_optimal_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuraton for the estimation of Bayes optimal perceptual parameters % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
1ce409e2ca22992e9de7af685a27426c9968d549237c1a05191bff757972c1fa
MATLAB
1,439
60
function [ defaults ] = nf_request_spm( modality, spm_path ) %[ spm_defaults ] = nf_request_spm( modality ) % Makes sure that SPM is in the path and defaults are sets % modality and spm_path are optional (default, PET and ltest SPM12) % firstoff, remove any SPM8's in the path p=strsplit(path,pathsep); for i=1:length...
c5719a7b54dcb9444ff9f02474b62c08f12a51a496babdcf83e152542bf11332
MATLAB
1,439
48
function [p,praw] = ClusterCorrectionANOVA(dat, D, nSims, p_crit, p_thresh) %% Cluster Correct across any number of factors, may only work on 1D if nargin < 5 p_thresh = p_crit; end alpha = 0.05; gg = false; [efs,F,cdfs,p]=repanova2D(dat,D,[],gg,alpha); %[h,p,ci,stats] = ttest(dat); pObs = p; FObs ...
5630c914dd64f175e4baccf757229b86869d71faa0e9350608e77796d290f0d8
MATLAB
1,440
48
%% [RDF] = Wrapper_BFR_PDF(totalField,mask,matrixSize,voxelSize,algorParam, headerAndExtraData) % % Input % -------------- % totalField : total field map (background + tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial resolution of each dimension ...
8c2b54574d072f2e0b970abd13465f0b5ef973df3605c5a56986d3386019861f
MATLAB
1,440
53
clear all close all clc % plot simulated grid cells % load the simulated data: % modules: gridscale = 2, 4 gridscale = 2; file_name1 = ['simulated_grid_cells_env_1_module_s', num2str(gridscale),'.mat']; file_name2 = ['simulated_grid_cells_env_2_module_s', num2str(gridscale),'.mat']; load(file_name1) nres = length(gri...
9c43eb54054b9d83795f747f4cbda68cde5d51082a3d7d9c1c2cd91af8af347d
MATLAB
1,440
57
function preprocess_nsd_applybrainmask(subjix) % function preprocess_nsd_applybrainmask(subjix) % % <subjix> is 1-8 % % Apply brainmask to the T1s, T2s, SWIs, TOFs (at all resolutions). % We save out files named like _masked.nii.gz % setup nsdsetup; outputdir = sprintf('%s/ppdata/%s-structurals',nsddir,allnsdids{subj...
8523a55f3fb66e9232d437118ed635b79532004c98da6e5548d7ff09b03a2de6
MATLAB
1,441
57
%% [pSMWI, dSMWI] = smwi(magn,qsm,thres,m) % % Input % -------------- % magn : image that combines with QSM contrast, can be 3D/4D % qsm : QSM map (in ppm) % thres : threshold used to create para-/dia-magnetic contrast % m : power to enhance QSM contrast % % Output % -------------...
8c491e155271a0f3e618e93ba3d50535cc8ac3355fe6750748faa225864e89c1
MATLAB
1,441
53
function split = split_string(in, sep, varargin) % splits a string based on a seperator string % % P=SPLIT_STRING(S,D) splits a string S based on delimiter D, and % returns a cell P with the different parts of string S. Both S and D % should have only one row. % % If P contains N occurences of delimeter D, then P conta...
aa225e23992dd2faf969a40367c27bc4a753fd638d66927d4657ce17faf00a16
MATLAB
1,441
51
function [Mout, RHSout] = combineBC1D(MeshStructure, BC, Meq, RHSeq) %COMBINEBC This function combines the boundary condition equations with the %main physical model equations, and delivers the matrix of coefficient and %RHS to be solved for the internal cells. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMP...
b81510f80b6f825bfb319c9fc7971d1e1b065af7c436e4aa7875e443607c9ca4
MATLAB
1,441
52
function result = is_orthonormal_set(A) % % Orthonormal Sets % % is_orthonormal_set(A) determines if a set of vectors in Euclidean n-space % is orthonormal. The matrix A is formed from these vectors as its columns. % That is, the subspace spanned by the set of vectors is the column space % of A. The value 1 i...
6bbb5985a1499c57bc2e84b952341bc6565d0346343b0448864ec940071ba963
MATLAB
1,442
44
function plot_fig4f(datadir) % Plot z-scored time to opt-out during mixed blocks conditioned on reward % delay on the previous trial, averaged across rats. N = 16 rats. % Short/long delay trials are defined the bottom/top quartile of the reward % delay distribution across sessions for each rat. % % INPUTS % datadir: fi...
e8a2122fd982aaa0aef9c06797016b7a40f2855ae7646a73b44d4b4d753f0cc8
MATLAB
1,442
36
% using subset1 as an example % For multicenter fitting, using multi_center_multimodelnlm_global.m instead of multimodelnlm_global.m % For multicenter fitting, network atrriobutes should be harmonized (Adj_site_effect.m) before using multi_center_multimodelnlm_global.m % statdir=[Pathnew,'Forgithub\Code']; savedi...
fb9d05eea8361fe2075f6b9fcebf9d4517a9cd7ecf74d97795e3206b678d03dd
MATLAB
1,442
40
%% EventDecoder_AW_timing % Relationship between Event Decoder's accuracy vs Avoidance Withdrawal % timing addpath('../Behavior/'); %% BNBResult = load('D:\Data\Lobster\BNB_Result_fullshuffle.mat'); Behavior_Data_path = 'D:\Data\Lobster\BehaviorData'; output = []; for i_session = 1 : 40 i_session = 19; val = ...
c1d6b140baf4ed7f2de40f80b48fbd035f732da141b96982598260f903630363
MATLAB
1,443
52
% % example script that runs a simple simnibs TMS simulation % % G. Saturnino, A. Thielscher, 2018 % %% General information S = sim_struct('SESSION'); S.fnamehead = 'jgjtest.msh'; % head mesh, prodeced by headreco S.pathfem = 'tms_minimal'; %Folder for the simulation output %% Define TMS simulation S.p...
ceddfc165431613acfbc1262d4f1e14c7701b270c9be0868f450fbfb3a399c7c
MATLAB
1,443
49
function handle = addFigureLabel(labelText, position, varargin) % ADDFIGURELABEL Add a label to a figure at specified position % % Syntax: % h = addFigureLabel(labelText, position) % h = addFigureLabel(labelText, position, 'Name', Value, ...) % % Description: % Adds a text label to the current axes at a normalize...
3edcd9eb61dc87d2088345444b078d6b20521dca0156de0f545df076b4ddfa8d
MATLAB
1,445
34
function outputStruct = organizePairsData(inputStruct, outputStructName, outputStruct) if isstruct(inputStruct) fields = fieldnames(inputStruct); % Get all field names for iField = 1:numel(fields) currentField = fields{iField}; % Current field name fieldValue = inputStruct....
5ac09996381741dc8a98f258fb4e6e7d8cc8b8ad570030ce0f9f62b7a50c76a5
MATLAB
1,445
31
% GET ARTwarp ROOT PATH FOR REFERENCE WHILE RUNNING IN CONTINUOUS % INTEGRATION tstDir = fileparts(mfilename("fullpath")); ARTwarpRoot = fullfile(tstDir, '..'); % Add the ARTwarp root path to the MATLAB path so we can run ARTwarp's % functions addpath(genpath(ARTwarpRoot)) % CONVERT .csv FILES TO .ctr % read from the...
db8c7525732f60709c35dfee9223e8707fa9a6e0e9f7741b88af32b276adf08c
MATLAB
1,445
49
function [wSurface, pSurface, faceData] = ft_surf2mat(lh_white, rh_white, ... lh_pial, rh_pial, save_output) % Read surfaces % % [wSurface, pSurface, faceData] = ft_surf2mat(lh_white, rh_white, ... % lh_pial, rh_pial, save_output) % % Inputs: % input_white - cell containing filenames of white surface. % inpu...
5b1bd01ba96f0d56b5ffdfd3a500caf2c06814207d0fccbc4e98e3490a2b9620
MATLAB
1,446
33
function [pvec, pstruct] = tapas_hgf_binary_pu_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2015 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General...
0304dab33301360d651ef28a51d777615560fedd5490207efd1a11e4706896fd
MATLAB
1,447
41
function outputImage = ifft(this, applicationDimension) % IFFT (including IFFT-shift and normalization) using image2k % % Y = MrImage() % Y.ifft(applicationDimension) % % This is a method of class MrImage. % % IN % % OUT % % EXAMPLE % Y = MrImage(); % Y.ifft(4); % convert each voxel's time series to frequency s...
15daab86d6b2a197b81ef9691eca900f809b49b0bb125df08ce72bf1f38aa639
MATLAB
1,447
68
%% [r2s,t2s,m0] = R2star_trapezoidal_voxel(s,te,m0mode) % % Input % -------------- % img : multiecho images, time in last dimension % te : echo times % m0mode : method to compute m0, 'default','weighted','average' % % Output % -------------- % r2s : R2* % t2s : T2* % m0...
6409bc9ba564fbd79433105d96245b9368c7b9fbdbb8de463fc285f5b6a60346
MATLAB
1,447
33
function [pvec, pstruct] = tapas_ehgf_binary_pu_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2015 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU Genera...
8ba4e51f47a55f6c734cd337b6d22f692592cb44ec318de3cb44d9344e474486
MATLAB
1,447
43
function [headmodel] = ama2headmodel(ama) % AMA2HEADMODEL converts a dipoli structure with boundary geometries % and a boundary element method transfer matrix to a volume conduction % model. % % Use as % headmodel = ama2headmodel(ama) % Copyright (C) 2008, Robert Oostenveld % % This file is part of FieldTrip, see...
ff39351efb1f2f3388b83d91946027137a720c2d7c122e1ae3d718fe9c333f0e
MATLAB
1,447
41
function [s,nc]=IAAFT(t,num_surr,maxiter) %IAAFT generates # of surrogates (num_surr) from template time series (t) %credit to algorithm by victor.venema@uni-bonn.de available at website: %https://uni-bonn.viven.org//themes/surrogates/iaaft/iaaft_algorithm.html %INPUTS % t: template data (vector) % num_surr: ...
323b60e8445cd189c6837da555eb3b0fca6d50a7916316ce8ca60c4a4dc3317d
MATLAB
1,448
51
function outputImage = times(this, otherImage) % Multiplies data of other image with this one and writes output in new image % % NOTE: If voxel dimensions of 2nd image do not match - or a scalar is % given as 2nd argument - data in the 2nd argument is automatically % replicated to match this image geometry. % % % Y =...
ba5b99696ef2df64fe66a228b959b1d97d98672edeea165e74707b51b4714e8f
MATLAB
1,448
68
function [err, indx, SubLabel] = WhichSubBricks (InfoStat, Type, Label) % % [err, indx, SubLabel] = WhichSubBricks (InfoStat, Type, Label) % %Purpose: % % % %Input Parameters: % % % %Output Parameters: % err : 0 No Problem % : 1 Problems % indx: a vector containing sub-brick indices (+1 from AFNI indexing)...
0da06652cec2681ad0a028804c324abbe2334f5128fbb36eda906c2052805c6b
MATLAB
1,449
55
function map=redscale(N,B) %function map=redscale(N,B) % %PURPOSE % %Makes a colormap of shades of red from white to red. % %INPUT % %[An argument in brackets is optional. If it isn't given or it's % an empty matrix/string, the function will use a default value.] % % N (scalar) number of colors % [B] (scalar) the R...
88b067c4727a748d959a9f73fd7e066311010762f8930f0ba1d8f54eee71b16f
MATLAB
1,449
56
function plot_fig5g(datadir) % Plot firing rate of example cells aligned to Offer Cue on 3 consecutive % trials where a big positive/negative RPE on the first trial is followed % by a negligible RPE on the second trial. % % INPUTS % datadir: file path of data downloaded from Zenodo. Link to download can % be found in R...
c72ffbb3c4c65945c9158eb2db7e3857dab7c1d2ec12578076aeb770a604fbf6
MATLAB
1,449
46
function [IDX, C, sumd, D] = optimal_kmeans(clustdata, clusnum) % THe aim of this function is to find the optimal number of clusters based % on the "clusdata" and the "clusnum" range. % INPUT: % clustdata: the data matrix for the componenets. It is the same % varuable used in EEGLAB pop_clus.m % clus...
8317ce269dfa45672375ea0745a9eea02794a380eb5aefbf6ca251caa5a3149f
MATLAB
1,450
47
function [datfield, dimord] = getdatfield(data) % GETDATFIELD % % Use as % [datfield, dimord] = getdatfield(data) % where the output arguments are cell-arrays. % % See also GETDIMORD, GETDIMSIZ datfield = fieldnames(data); datfield = datfield(:)'; % it should be a row-vector throughout the subsequent code % thes...
f7c50cdb08e0d0f5ca8baec16b02a9ae37257b74084e265ffdb0088814c2bd15
MATLAB
1,450
56
function [ output_args ] = ICA_ASSEMBLY_DETECTION( CALCIUM_FLUORESCENCE_file ) %ICA_ASSEMBLY_DETECTION( CALCIUM_FLUORESCENCE_file ) % % % === Jan Moelter, The University of Queensland, 2018 =================== % narginchk(1,1); fprintf( 1 , [ '\n' ] ); timerVal = tic; %% > PRINT FUNCTION-CALL if( isdeployed ) ...
2943f65c2a24abd8ce20ff33c78d5f1d5787a8856c3e9aede00e810e2bd9c4f3
MATLAB
1,451
46
function defaultDimLabel = get_default_dim_labels(this, iDim) % returns default dim label for specified dimensions (nifti-compatible) % convention: [x y z t coil echo dL7 dL8 ...] % % defaultDimLabel = get_default_dim_labels(this,iDim) % % This is a method of class MrDimInfo. % % IN % iDim index of d...
0dc9bb89be6b47a3f06df41f5763d9fc754f3cbf2a863d40d60b356df7ae64eb
MATLAB
1,452
52
function outputImage = minus(this, otherImage) % Subtracts data of other image from this one and writes output in new image % % NOTE: If voxel dimensions of 2nd image do not match - or a scalar is % given as 2nd argument - data in the 2nd argument is automatically % replicated to match this image geometry. % % % Y = ...
1b7eb7075b47e6670442ccb9d1a80a03c6ee8a6a6c38815214283ef61b92e771
MATLAB
1,452
49
function psdmed = eeg_rpsd(EEG, nfreqs, pct_data) % clean input cutoff freq nyquist = floor(EEG.srate / 2); if ~exist('nfreqs', 'var') || isempty(nfreqs) nfreqs = nyquist; elseif nfreqs > nyquist nfreqs = nyquist; end if ~exist('pct_data', 'var') || isempty(pct_data) pct_data = 100; end % setup constants ...
31d6881299483a833e7c6289fd3f0d975244bf9d94a296ae2929a4586603e799
MATLAB
1,452
50
function S = randskew(n, N) % Generates random skew symmetric matrices with normal entries. % % function S = randskew(n) % function S = randskew(n, N) % % S is an n-by-n-by-N array where each slice S(:, :, i) for i = 1..N is a % random skew-symmetric matrix with upper triangular entries distributed % independently fol...
366a23da9a64c9829f7c4cfe338a7137683d9356f644e019581a26583fc48ecf
MATLAB
1,452
55
function output = getMeanDevPath(path_shut3, path_lob1) %% getMeanDevPath % get mean of deviation from the center row line of the Path. % When the path from the nest to the encounter zone is not straight, % then this value increases. % Main purpose of this script is to measure the change of behavior between shut 3 and...
53dd10ce5f68035c6b3c77c9a1c6b4be69f8a39729ef9cf36c9389a332475df2
MATLAB
1,452
42
function m1 = placematrix(m1,m2,pos) % function m1 = placematrix(m1,m2,pos) % % <m1> is a 2D matrix, with potentially some extra stuff in the third dimension. % <m2> is a 2D matrix, with potentially some extra stuff in the third dimension. % note that size(m1,3) must equal size(m2,3). % <pos> (optional) is [R C] wit...
79893d264ed1ffdebe7ac00061262d99793d8749ac3da30e4723db0761d0923f
MATLAB
1,452
47
function [dyn_IAC, mean_IAC] = dyn_env(data) % Computes the Instantaneous Amplitude Correlation (IAC) without % leakage correction % Tewarie et al., 2019 Tracking dynamic brain networks using high temporal % resolution MEG measures of functional connectivity % % Input: - data or time...
e697265ce2654f35f24dea65aa2d8098dfafe91ed484dd39603cae7517237a8d
MATLAB
1,452
49
function [wSurface, pSurface, faceData] = ft_surf2mat(lh_white, rh_white, ... lh_pial, rh_pial, save_output) % Read surfaces % % [wSurface, pSurface, faceData] = ft_surf2mat(lh_white, rh_white, ... % lh_pial, rh_pial, save_output) % % Inputs: % input_white - cell containing filenames of white surface. % inpu...
84cc44e4aaa0d689027071856310f8e36804e6cb973a71f305a8069fdf25cd7a
MATLAB
1,453
67
function obj = train_internal(obj) % ---------- % Initialise % ---------- obj.init_model(); obj.init_latent(); obj.init_elbo_parts(); obj.elbo_obs(); obj.elbo_latent(); obj.elbo_mean(); obj.elbo_subspace(); obj.elbo_latent_precision(); obj.elbo_residual_precision()...
a7bbd9695110afb1314f0eed65baf39e60fd0671c160867c05d2f1372121b4c6
MATLAB
1,453
33
function [cellTypeMatrix, cellTypeNames] = getCellTypeMatrix(cellTypesTable, channels) %GETCELLTYPEMATRIX Convert input cell type table to binary matrix of cell %types % Detailed explanation goes here % cellTypesTable : Info.CellTypes % this is a table (read from csv) which contains the cell type of ROIs % ...
61314dcbb451eb2dc7aadbe7a45e0682ddf6e53290de920046e7433b89c3a682
MATLAB
1,456
45
function s = saveobj(obj) %SAVEOBJ Save a DagNN to a vanilla MATLAB structure % S = OBJ.SAVEOBJ() saves the DagNN OBJ to a vanilla MATLAB % structure S. This is particularly convenient to preserve future % compatibility and to ship networks that are pure structures, % instead of embedding dependencies to code....
6d59addc57d6594d86b5b4c038b7b65419743709090b6dfad1015aea1e6b953f
MATLAB
1,456
40
function [Mdl] = run_svmR(params) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % run_svmR returns Mdl structure including function handles of fit, % predict and score functions for support vector regression. % % Arguments: % params: Structure including following hyperparameters: % ...
e1b9bdbb7db30d9509ecfd1a0eeba4cfeb320c25374557c63c89c9289f5e1fa3
MATLAB
1,457
48
%% write_bids_dataset_description(outputDir) % % Input % -------------- % outputDir : output directory of a SEPIA processing pipeline % % Description: Writes a minimal BIDS-Derivatives 'dataset_description.json' % at the root of a SEPIA output directory, if one does not % already exist. Ex...
fd0a0334290d245eb038b30216738d32382fa85b9b2af0c361c56e6777474f58
MATLAB
1,458
57
% Reproduce topoplot error with missing coordinates % 1. Create a chanlocs struct with mixed valid and empty coordinates clear chanlocs chanlocs(1).labels = 'Ch1'; chanlocs(1).X = 1; chanlocs(1).Y = 0; chanlocs(1).Z = 0; chanlocs(1).type = 'EEG'; chanlocs(2).labels = 'Ch2'; % Leave X, Y, Z empty (implicitly []) chan...
fea3f13cc2269f602ec2165c3e65573142617ba53b8d28f3c189a2674ff46755
MATLAB
1,458
42
function ProcessData_ExtendedData4(datadir, savedir, codedir) %ProcessData_ExtendedData4 - Process raw data saved under datadir such that it can be plotted by PlotExtendedData4. % INPUTS: % datadir - Local directory where 'Golden_Nature/RawData_ExtendedData4.mat' from Zenodo was saved % codedir - Local directory wh...
2460b24b03e63ab19803441cffaf2c5ad02650731bc511c74d6bd1597696cf88
MATLAB
1,459
36
% Define a global variable warpFactorLevel for testing (needed for the % warp.m function to run, but cleared at the end of this script) global warpFactorLevel; warpFactorLevel = 3; % Define an input contour and a weights matrix (containing 2 reference % contours) for testing. The first ref contour is [1,2,3,4,5]'=inpu...
3833121c4cfe24527d813603a3c0a64051836fa37d0b6e37c0db5f9dbcf495a6
MATLAB
1,459
47
function [hi, lo, mix, p] = iticurves(A) %iticurves - Average trial intiation time by block % INPUTS: % A - Rat behavioral data. Usually BestFitEarly.(RAT_ID).All.ratTrial % OUTPUTS: % hi, lo, mix - First row is average ITI in second (raw) and z-scored (z) % for each rat in high block (hi), low block (lo), o...
9d66b4b531f77535340c887fe4fdc0bdfc8f6e1f6acd612631b5b59bfae5c209
MATLAB
1,459
52
% Sophisticated Harmonic Artifact Reduction for Phase data (SHARP) % RDF = SHARP(iFreq, Mask,matrix_size,voxel_size, radius,threshold) % % output % RDF - the relative difference field, or local field % % input % iFreq - the unwrapped field map % Mask - a binary 3D matrix denoting the Region Of Interest % ...
cd4fc6fc63230aa64138bd75cbaa1633a96039e365cdfa77468600cee204c42d
MATLAB
1,459
34
function suite2pMode = appCheckSuite2pData(app) %APPCHECKSUITE2PDATA Summary of this function goes here % Detailed explanation goes here files = dir(app.MEADataFolderEditField.Value); % get a list of all files and folders dirFlags = [files.isdir]; % find all items that are directories subfolders =...
dc673845ac34ba4894242e4a33248b5fc0eb8c2b3fd30a465a9a11f3cfaba0df
MATLAB
1,459
53
%glinspace - Gamma-corrected linearly spaced vector. % % USAGE % % x = glinspace(d1,d2,gamma,n) % % d1 start value % d2 stop value % gamma gamma value % n number of values % % SEE ALSO % % See also linspace. % % Copyright (C) 2013 by Michaël Zugaro % % ...
f7803c3044fb91b9599ca310971bad13036d158b47501b3d34872c39053b4fa7
MATLAB
1,459
63
function fh = plot_gradient(G, t) % plots gradient time-course in 3 linked sub-plots, plus 2-norm of G % % output = plot_gradient(input) % % IN % G [nSamples, 3] matrix of [G_x, G_y, G_z] vectors % t [nSamples, 1] time vector corresponding to G % OUT % fh figure handle of created plot % % EXAMPLE % plot_...
30067be5d7139859dbbd85867d8e73c2248b44380f292988e35a3b52673b883e
MATLAB
1,460
43
function ops = glm_ofcOps() %commonly used forms of all options for OFC trials ops = glm_defaultOps(); %load all of the options %make the changes for ofc ops.fname = 'ofc_default'; ops.gamma = 1e-7; %L2 term ops.beta = 0; %L1 term %ops.kfoldSupplied = false; %an option to do grid search of hyperparameters. not impel...
cf413e2fc078ad303d9afc244b0d0bd3eb9ebdfb2df1bb5a429b22c861e21d3d
MATLAB
1,460
32
function varargout = spm_slice_vol(varargin) % Return a section through an image volume - a compiled routine % FORMAT X = spm_slice_vol(V,A,dim,hold) % V - spm_vol structure % A - 4 x 4 transformation matrix % dim - [i j] defining the two dimensions of the output image. % The coordinat...
2ae079f79ca0d9b276e9b855d328e337de5a843b7ebb656c369d17234442fdd8
MATLAB
1,461
69
%perm_mesh addpath("~/ER_Ca_rot/networkSpreadFVM-main/scripts/"); addpath("~/ER_Ca_rot/networkSpreadFVM-main/examples/"); dirname = "~/ER_Ca_rot/networkSpreadFVM-main/examples/inf_Perm_op"; ar = [0.0001,0.0005,0.0024,0.0111,0.0500]; ar = ar*0.3/0.0025; s_a = string(ar); l2 = length(ar); dirn = strings(1,4); filen = ce...
51d8ea3a356be6896db6fb079c9a462ed6acb4a022f9e2963e5144c8593735c2
MATLAB
1,461
44
function getTriggers_carGame_onTurns(params) % extracts discrete turns from car game paradigm % (c) Jiri, Oct16 for sess = 1:size(params.storage.sessionCacheFiles,2) % load road load(params.storage.sessionCacheFiles{sess}, 'road','time_raw'); assert(size(road,1) == size(time_raw,1)); % road deri...
627a239a7f52dfa27f82bf4ccf791d4a018628051961a96c983834670580c348
MATLAB
1,461
44
function fear_refineDelta(basename) % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; %% load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basicMetaData.AnalysesName '-deltaProperty.mat']) %% if ~exist([basicMetaData.B...
879f731e327a65055bf3a1f2a4b94a1e0b743ddcec4db61331466a12b798d37e
MATLAB
1,461
60
function [outputArg1,outputArg2] = PlotSubjectRMSError_Reliability(sn, TitleStr, lp_Color, hp_Color, bb_Color) if ~exist('TitleStr','var') % title parameter does not exist, so default it to something TitleStr = ' '; end % --- RGB vector for grey grey = 0.75*[1 1 1]; % --- "Realiability" of RMS-error per...
5888fb9162163a13a8f4d07a660121e3454eae9f730f7c9483f837bcfecdbf6e
MATLAB
1,463
47
function ft_create_buffer(port) % FT_CREATE_BUFFER starts the thread with the TCP server attached to the local % MATLAB instance. The TCP server will listen to the specified network % port, and accept incoming read and write requests. % % Use as % ft_create_buffer(port) % where port is the TCP port to which the serv...
7648588a8c5b2909fa80b315e1c077563ab6171af3b83eab8311b8cebf15a5ca
MATLAB
1,463
72
function Q = qMul( Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10 ) % qMul: quaternion multiplication % Q = qMul( Q1, Q2, Q3, ..., Q10 ); % IN: % Q1 - first quaternion % Q2 - second quaternion % Q3 - third quaternion % .... % % OUT: % Q - output quaternion, Q = Q1*Q2*Q3*Q4*.... % % REMARKS: % 1...
4117abe56b5d3d4addc9535a1f4ec491ee8e789cafab69085c977302c0b3bebd
MATLAB
1,464
46
function params = update_derived_parameters(params) % UPDATE_DERIVED_PARAMETERS - Recalculate parameters that depend on others % % H1 Line: Update parameters derived from base parameters % % Syntax: % params = update_derived_parameters(params) % % Description: % Recalculates parameters that depend on other paramete...
04382c34f39704c1535ed0e0d0e80ac3e02dee9cfb7de144282a60a4cc118dbd
MATLAB
1,465
34
function [pvec, pstruct] = tapas_hgf_whatworld_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Publ...
9c2c2d266761fa74da5f8d3b09e3736dbda6197230ab17d53d21c729dcf47364
MATLAB
1,465
51
% X : M x Tx x Nr % Y : N x T x Nr % dY : N x T x Nr % dYX : N x (M*D) % W : N x (M*D) % Xdelay(t) = [X(t+tau*(D-1)); ... ; X(t+tau); X(t)] % Error calculation in time embeded space % dY = Y - Xdelay * W [dY] = error_delay_time(X,Y,W,T,N,M,D,tau); % Correlation of dY and X in time embeded space %...
d0f1c6fab690bd1006536448755c1d1b272c71e62a7855ccfbdb1386b03280b4
MATLAB
1,465
41
function [R, verbose] = tapas_physio_load_other_multiple_regressors(... filename_other_regressors, verbose) % reads other multiple regressors from .txt-file or as variable R from .mat % % R = tapas_physio_load_other_multiple_regressors(filename_other_regressors) % % IN % filename_other_regressors filename (.m...
e10ac72f76d9187305ffc4cae6826cd3d45f2802b26d69a457a3f6e6777f7e67
MATLAB
1,465
35
function candoit = canGetGradient(problem) % Checks whether the gradient can be computed for a problem structure. % % function candoit = canGetGradient(problem) % % Returns true if the gradient of the cost function can be computed given % the problem description, false otherwise. % % See also: canGetCost canGetDirecti...
f20aab02d304f8b25c9fd7993c9b70652f8d3b86d523c8da35449fed608a8127
MATLAB
1,465
47
%% [unwrappedField] = Wrapper_Unwrap_LaplacianMEDI(wrappedField,mask,matrixSize,voxelSize,algorParam, headerAndExtraData) % % Input % -------------- % totalField : total field map (background + tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial res...
e952728d244b2a1cac1c546954a005e036f52cbab0c066dc92d1f4f58185de62
MATLAB
1,466
41
function X = sylvester_nochecks(A, B, C) % Solve Sylvester equation without input checks. % % function X = sylvester_nochecks(A, B, C) % % Solves the Sylvester equation A*X + X*B = C, where A is an m-by-m matrix, % B is an n-by-n matrix, and X and C are two m-by-n matrices. % % This is a stripped-down version of Matlab...
8821448c9ba984c05fac039ddd299b0bcb5165e491be205ba8347dc8af6c3b3a
MATLAB
1,467
41
function rename_chNames_H(params, filterName, dataTag) % renames selCh_names (selCh_names_pred or selCh_names_resp) % needed after spatial filter is applied % (c) Jiri, Nov18 %% load 'H' & selCh varName = ['selCh_H_' dataTag]; % = 'selCh_H_pred' or 'selCh_H_resp' load(params.storage.cacheFile, 'H', varNa...
897b67b51618fd8ee3cb5da0f8c465409b4b7a25dec2ac9dc05f4ffbd4d4d474
MATLAB
1,471
53
function glm_floc(subjix,ppdirname,tr,runix,stimversion,glmdirname) % approach: assume HRF, condition split, no boots % setup nsdsetup; ppdir = regexprep(nsdscreeningfun2(subjix),'rawdata','ppdata'); glmdir = regexprep(ppdir,'ppdata',glmdirname); mkdirquiet(glmdir); stimdur = 4; reps_per_run = 6; % load data data = ...
289efbe62aad8d33d9a7322e6f875a28fe0bd1234a1278bf7a7853e6a8fa75f7
MATLAB
1,472
60
function [classVector,f] = FLD_classifier_lure(respMat_novel, respMat_familiar, respMat_test) % classVector is a row vector with size equal to the number of columns of % respMat_test. Each of its column shows which class the corresponding % column in respMat_test belongs to: 0:Familiar, 1:Novel % Linear classifie...
2a1a7fbb128f34a133897e4836f088dc15fb2c8165fa0b4baf6ae1c688021d59
MATLAB
1,472
55
% reconstruct mask for a study, given indicator % v2 = meta_reconstruct_mask(indic, xyzlist, V.dim(1:3), [use values], [V], [imagename]); % % This function returns 3D mask values and optionally writes an image file % if V and imagename are entered as additional arguments % % dims are mask dimensions; V is spm_vol struc...
39ab3a7a8513a413d1903d5d485b6be0446e865a595a88b884b3d9dd7302bcad
MATLAB
1,472
32
function MM_spectrum = MM_spectrum_model(input,ppm) %ppm is the axis that defines the ppm sampling of MM_spectrum %Spectrum is based upon shifts in Giapitzakis et al. %input(1) is an amplitude and input(2) a width, etc. %input29 is a slope and input30 an offset %last input parameter input(end) is a ppm referencing sh...
4ba6d26a968409fb705784fa64b7bd983c35250eef20819334ddedd19146d747
MATLAB
1,472
44
function res = hlp_findscaling(X, scaling) % Obtain information necessary to scale the given data. Works with hlp_applyscaling. % Scale-Info = hlp_findscaling(Data, Scale-Mode) % % This is just a convenience tool to implement simple data (e.g. feature) scaling operations. % % In: % Data : data matrix of [Obser...
e4652f5331b1a1dd34ed0c0a14ace6db290c7b3119b3bc59a7cb0eb7d40d17d8
MATLAB
1,472
48
%{ aodpre.Set (imported) # Points in space and timeseries for each scan -> aodpre.Scan ----- sampling_rate : float # sampling rate reported by the acquisition computer %} classdef Set < dj.Relvar & dj.AutoPopulate properties popRel = aodpre.Scan end methods(Access=protected) function makeTuples(self, key...
ee470ecff4b21e79807e626f8d0b91ddd98c22c57fc30896fa083f92fa2c1ef9
MATLAB
1,472
52
function [fx,h,Xrange,Yrange]=KDE2(Xi,Yi,h,Xrange,Yrange) % % Kernel Density Estimate for 2 vairable % for diagonal type h and multivariate normal kernel % Each "Smoothing parameter" h is estimated from the SJ method % unless it is provided % The X and Y range is devided 30 along the min and max % of historica...
fa70ba1a361fab59975abdd275c4bfbe7794dd9fc6d9b814582e05d3303b02e6
MATLAB
1,472
37
function ImportFromMUPET_Callback(hObject, eventdata, handles) [mupetname, mupetpath] = uigetfile('*.csv','Select MUPET Log'); MUPET = readtable([mupetpath mupetname]); [audioname, audiopath] = uigetfile({ '*.wav;*.ogg;*.flac;*.UVD;*.au;*.aiff;*.aif;*.aifc;*.mp3;*.m4a;*.mp4' 'Audio File' '*.wav' 'WAVE' '*...
3dfd4ced7d46ef47c520db7be4c02200f64f8c3435cf5fa9d9e0d24b7f0586d3
MATLAB
1,473
53
function [b_wait, b_iti, dwt, diti, b_iti_rew] =... regress_trials_blocksv2(A, tback) %%Convert blocks into interpretable regressors A.block(A.block==3) = 0.5; A.block(A.block==2) = 3; A.block(A.block==1) = 2; A.block(A.block==0.5) = 1; A.wait_time(A.optout==0) = nan; %convert rewards to ordinal (log) scale [A.re...
2cb6814717415803803999b80a8d356360f750add3477d327a93afeaf2c0dacb
MATLAB
1,474
44
% Load bvecs and bvals bvecs = load('E:\Neuroimage\demo_data\TWD_AF\derivatives\qsiprep_20241128\sub-AF0237\ses-01\dwi\sub-AF0237_ses-01_acq-b4000_space-ACPC_desc-preproc_dwi.bvec'); bvals = load('E:\Neuroimage\demo_data\TWD_AF\derivatives\qsiprep_20241128\sub-AF0237\ses-01\dwi\sub-AF0237_ses-01_acq-b4000_space-ACPC_...
3eeb6d0b2b1aad82bd0772e387fa7da5a9ae66912d02c83560ad2bbf629a4ac1
MATLAB
1,475
65
function [p,pobs] = fishers_exact(tab) % % m x n generalization of Fisher's exact test % % See Agresti, 1992. Exact inference for contingency tables. Statistical % Science % % Eric W. Weisstein. "Fisher's Exact Test." From MathWorld--A Wolfram Web % Resource. http://mathworld.wolfram.com/FishersExactTest.html % % Inp...
4b67d6a596b379274a807976b047b2c05b1eb09a50c1627802875766154bbad9
MATLAB
1,475
44
function outputImage = rmse(this, varargin) % Computes root mean squared error along specified dimension, i.e. sqrt(mean(Y-mean(Y)).^2)) % % % Y = MrImage() % Y.rmse(applicationDimension) % % This is a method of class MrImage. % % IN % applicationDimension image dimension along which operation is % ...
e9325a9c32adaf50e9f171cdeb53ebb945eac66ad99715d4d3c1b9bc0a8508cf
MATLAB
1,475
41
function c = tapas_bayes_optimal_binary_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuraton for the estimation of Bayes optimal perceptual parameters % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
f4639a088277ef4a8c3f27376ec05c3b9d3e273e56ea1295cfeeaff5c0d8387f
MATLAB
1,475
43
function plot_mean_squared_errors_RNNs close all clear all clc % Plot mean squared errors (MSE) of RNN models trained using control or APP-KI mice data. % Select a folder containing data. folder_name = uigetdir; cd(folder_name) % Load data. load('RNN_mean_squared_error.mat') control_MSE = MSE.control; APP_MSE = MSE....
fe2356626c39e46bb1f3337aefe13dd37c285886a9eef9d908df76eb94051d6c
MATLAB
1,475
46
function c = tapas_condhalluc_obs3_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the response model used to analyze data from conditioned % hallucination paradigm by Powers & Corlett, AS MODIFIED FOR COUPLED PRIOR WEIGHTING...
0d3e3935e943df7427d153da32912f2ea0bf36f74cc697a5ab2bb2e33da0801f
MATLAB
1,476
42
% (C) Copyright 2019 bidspm developers clear; clc; bidspmDir=fullfile(fileparts(mfilename('fullpath')),'..', 'lib','bidspm'); addpath(fullfile(fileparts(mfilename('fullpath')),'..', 'lib','bidspm')) bidspm(); bids_dir = fullfile(fileparts(mfilename('fullpath')),'..', '..','inputs','raw'); output_dir = fullfile(filep...
945545620380eacc1f80f38d81460de0180a13556d67e1b960588a29990c74e1
MATLAB
1,477
34
function [pvec, pstruct] = tapas_hgf_whichworld_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Pub...
c9ecd2f6c7eb8d401c451a72839ce4b2fec92ace31348c3224f3e41a8d41a717
MATLAB
1,477
41
function c = tapas_bayes_optimal_whatworld_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuraton for the estimation of Bayes optimal perceptual parameters % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
ac1baa724491a80e75e7c1b9b066df95eebbdc86c532075568f474bb960c9fd3
MATLAB
1,478
48
function [K,dK] = covLINone(hyp, x, z) % Linear covariance function with a single hyperparameter. The covariance % function is parameterized as: % % k(x,z) = (x'*z + 1)/t^2; % % where the P matrix is t2 times the unit matrix. The second term plays the % role of the bias. The hyperparameter is: % % hyp = [ log(t) ] % %...
d426f1a2b6caaffa08d62c557e72ed2e6b6cb0153b5676d8836b913ded33416b
MATLAB
1,479
39
%VL_NNNORMALIZE CNN Local Response Normalization (LRN) % Y = VL_NNORMALIZE(X, PARAM) computes the so-called Local Response % Normalization (LRN) operator. This operator performs a % channel-wise sliding window normalization of each column of the % input array X. The normalized output is given by: % % Y(i,j,...
d7f377f48b978bf1d1de6be2cbcff3219c6aa1522f1b61f0411f970c4b14997e
MATLAB
1,479
50
function [effectiveRank, normEigenV] = calEffRank(spikeMatrix, method) %{ Computes Effective Rank of a matrix Parameters ------------ spikeMatrix : matrix matix of dimensions nSamples x nChannels, containing 0 = no spike, 1 = spike method : str 'covariance' : do eigendecomposition on the covariance ...
06d828003bc7207ae9ba1bff75ef9bf4fca16d6b8a47f173228c0fd8474fd942
MATLAB
1,480
53
function [eff,p,sig,pt_given_a,pt,success,yp] = nonparam_specificity(y,X,iter,varargin) % [eff,p,sig,pt_given_a,pt,success,yp] = nonparam_specificity(y,X,iter,[w]) % % weights should be mean = 1 if length(varargin) > 0, w=varargin{1};, else, w=ones(size(y));, end [n,k] = size(X); % number of obs. and tasks % weig...
5043920733a7e78b63abfcda45639a9e68343e0eccd37b923096743a18ce7f60
MATLAB
1,480
47
function defaultDimUnit = get_default_dim_units(this, iDim) % returns default dim label for specified dimensions (nifti-compatible) % convention: [x y z t coil echo dL7 dL8 ...] % % defaultDimUnit = get_default_dim_units(this,iDim) % % This is a method of class MrDimInfo. % % IN % iDim index of dimen...
884c8e7c1c2cc3fd45c07bf134613d82ad4fbe5b6091db913c0b55dc0db1322c
MATLAB
1,480
57
function [bw_out] = score_hylid_perpixel(hylid_struct,detector_img,targ_filt,title_str,varargin) % %function [bw_out] = score_hylid_perpixel(hylid_struct,detector_img,targ_filt,title_str,varargin) % % scores the detection performance of the given detector output image using Bullwinkle % optionally plots an annotated ...
ab9f5c2e3f7e3b6df893d410d83a9715b3234883fbf3a3d53881c0948863b906
MATLAB
1,480
46
%%%%%%%%%%%%%%%%%%%%%%%% % % % Write SPM mat file % % % %%%%%%%%%%%%%%%%%%%%%%%% function M = GE_createSPMmat(im_hdr, scandir) % % Put the appropriate translations and rotations to the M matrix % given the information in the image header and the direction of % acquisition % %...
e4eaf5f68d147dbbeb22100cce9a8de646b16c9bb9546f1b2920b35b64770160
MATLAB
1,480
44
function c = tapas_softmax_mu3_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the softmax observation model for multinomial responses with phasic % volatility exp(mu3) as the decision temperature % %%%%%%%%%%%%%%%%%%%%%%%%%%...
0e9cf55de37f3a77d45e512e86cc79e26501c9e24ccdfe6204afd51d244a2338
MATLAB
1,481
50
function params = validateInputsAndSetDefaults(params) % Validates required inputs for data processing, checking for correct data % types. Creates a params structure with default values for optional % parameters. % Check required fields exist requiredFields = {'dataRawLoc', 'dataOutLoc', 'statsOutLoc', 'co...
33f197b205f772e46cc1b85574e258e071605bf4e1d74c7fd8471d2a2dd16fe5
MATLAB
1,481
40
function [aPort] = align_to_ROIs(xvals, yvals, Ports, pixelpercmarray) %%align_to_ROIs aligns tracks relative to two user-provided references % Commonly used in single-camera chemosensory assays to scale and align % tracks relative to gas ports or odorant point sources. % Converts pixels to cm global tracks % Genera...