sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4d0c60ac3d719414990074b7d0d2d0a34e5412383c14ea678ee30298213705f4
MATLAB
1,238
39
function [ params ] = tapas_BLT_runIntroTrain( params ) % tapas_BLT_runIntroTrain Presents written instructions and logs the event % % About: % Coded by F.Petzschner 19. April 2017 % Last change: F.Petzschner 19. April 2017 for i = 1:params.nIntroTrain Screen('DrawTexture', params.screen.window, params.tex...
2196b6d2abdee3283cd250c1399cf0fd2e588dce07f8bbaf1c65164bbad585de
MATLAB
1,239
47
function A = op_pad(B, newSize, paddedWith) % Matlab function to pad an array to a desired new size % % By: Christopher C. Wilcox, PhD % Naval Research Laboratory % Date: Mar 14, 2011 % % Usage: A = op_pad(B, newSize, [paddedWith]); % Input: % - B is the input array % - newSize is a 2 element vector, [rows, cols...
3d69e0029908818d20ce7d8b119def31ab2514b8b00c6e9148472bd109c7c9aa
MATLAB
1,239
44
%% get_set_bfr_lbv(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid % ...
70298e2d16d914ab68d9cdce71d2838ba52e8f3e256ef56666f54ef6ac95d036
MATLAB
1,239
74
function [err,p,f] = GetPath (s, allmc) % % [err,PathString,FileString] = GetPath (s, allmc) % %Purpose: % Breaks the string s into a path and file part % % %Input Parameters: % s is a string like How/Didley/Doo % allmc : 1 --> search for path using both types of file-separators / and \ % 0 --> search...
bfe122a4b8a96bf7c9f980351ef27ed8623b4441ce3af8a9108d516e39c3fd12
MATLAB
1,239
29
%labelFileName = '/home/kannanuv/workspace/code/HeadLight//data/ORL_ARA_v2.3_bi_rotated.tif'; %matchingSting = 'layer 1'; function imLabel = extractCorticalLayers(labelImageFile, matchingString) addpath ('/usr/local/netgpu/fluoMouseBrain/scripts/utils/'); imLabel = imreadstack(labelImageFile); %% Get sub-region list ...
ddddef563d2a9a60d6f09cb83cf345c0f313406592c23c1f5917bfa32e7d5642
MATLAB
1,239
34
function [img,dims,scales,bpp,endian] = read_avw_complex(fname) % [img, dims,scales,bpp,endian] = READ_AVW_COMPLEX(fname) % % Read in a complex analyse file into either a 3D or 4D % array (depending on the header information) % Uses avwcomplex to make temporary files for reading % Ouput coordinates are in MEDx conv...
01af85e6d7f53a6fd1b8ad7b6fa0d40c4130fc2e3af20998b6706b707b968b3e
MATLAB
1,240
33
function p = compareDeltaWT_CPiCPr datpath = 'C:\Users\mld9131\Documents\GitHub\Papers\MLD\Figure1\Data'; %load data OFC-CPi CPi = load(fullfile(datpath,'CPi_opto.mat')); [highc_CPi,highe_CPi,lowc_CPi,lowe_CPi,mixc_CPi,mixe_CPi]= wt_notsided(CPi.ExpA,CPi.ConA,CPi.Raw_data); %change lowchange_CPi = lowe_CPi-lowc_CPi; ...
24b317bec50b902f9d104f84d88b1112b29ad1943f92701f3afc79f79b26e00c
MATLAB
1,240
37
function plot_gaitERSP(data, chanIdx, f_axis, clim, colorbr, cfg) FOI = ismember(cfg.f_axis, f_axis); freqs = cfg.f_axis(FOI); times = cfg.t_axis; f_ticks = 5:5:cfg.f_axis(end);%or 10? f_tickLab = {'','10','','20','','30','','40','','50','','60'}; % make dynamic! t_ticks = linspace(times(1), times(end), 21)...
4055ca94c525b479f63ed3fac30701423b2107fc4314f077a6a5e1da247cad0c
MATLAB
1,240
66
%% function output = function_name(input) % % Usage: % % Input % -------------- % % Output % -------------- % % Description: % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: % Date last modified: % % function [r2s,t2s,m0] = R2starmapping_CRSI(img,te,m0mode,sigma,m) % set range of R2* and T2* minT2s =...
6bff14ccbc708abbe3db73b9e4760ed4e5791e0c7953b0b068db4af13365527d
MATLAB
1,240
45
function percentile = prctile(this, percentile, varargin) % Computes given percentile in data (e.g. 50 for median) % % Y = MrImage() % percentile = ... % Y.prctile(percentile, 'ParameterName1', 'ParameterValue1', ...) % % This is a method of class MrImage. % % IN % percentile percent for percentile computa...
744ea76b52e35780375db0ef6154bb63454bbc381154814f3fc643340a030b6f
MATLAB
1,240
35
function plot_pc(rez,i) f=figure; channel = rez.Merge_cluster{i,5}; Nchan = length(channel); PC = rez.PC{i}; ki =0; for k=1:Nchan subplot(Nchan,3,1+ki) plot(squeeze(PC(k,1,:)),squeeze(PC(k,2,:)),'.','MarkerSize',2) title(['Cluster:', num2str(i)]); ylabel('...
a782f8df4e14830d14fb7e025cfe704eacab0b8572c34514f2e8791dc0aa00bf
MATLAB
1,240
29
function [pvec, pstruct] = tapas_hgf_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % ...
06e01abf84b2ecbe550d63fad8d6f8d6279f8753d4b4b65516958aeb3044104d
MATLAB
1,241
42
function MaskSignal = TMSextract (DataDir,MaskDir) % DataDir - folder containing nii images. e.g. D:\test % MaskDir - image dir. e.g. D:\gray.nii MaskHeader = spm_vol(MaskDir) ; [MaskVol,MaskXYZ] = spm_read_vols(MaskHeader) ; [patha b c] = fileparts(DataDir); if c=='.nii' ImgHeader = spm_vol(Dat...
3e955b8cd765fa11092e25dfe53e98566fb1d596f0d45feb066378eea89f6adb
MATLAB
1,241
37
function out = DK_crinkle(x) % DK_crinkle Computes James Theiler's crinkle statistic % % Calculates the "crinkle statistic" on a vector x % <(x_{t-1}-2*x_t+x_{t+1})^4> / < ( x_t^2 ) >^2 % as proposed by James Theiler % % ------------------------------------------------------------------------------ % Copyright (C) 19...
8d3134b68c711ff4f783bef73522bf04424aeb06037948b8e3651dbc0483bc95
MATLAB
1,241
41
function [img,dims,scales,bpp,endian] = read_avw(fname) % [img, dims,scales,bpp,endian] = READ_AVW(fname) % % Read in an Analyze or nifti file into either a 3D or 4D % array (depending on the header information) % fname is the filename (must be inside single quotes) % Note: automatically detects - unsigned char, sh...
a994843eb9de10ebe8c5479cfe6027dce35ae9299afee6dbf6b92dd6eaa1d422
MATLAB
1,241
40
function affineTransformationMatrix = get_affine_matrix(this) % Transforms geometry parameters into affine 4x4 matrix (T*R*Z*S) % with T = Translation, R = Rotation, Z = Zooming (Scaling with Resolution) % S = Shearing % i.e. performing operations in the order from right to left, in particular % rotation before tr...
2285887a39ee6c251af614b26251ad9e96a7eb148a467db40b5df96ebfca164e
MATLAB
1,242
39
function [contrasts, first_peak_in_each_con] = get_contrast_indicator_improved(DB, myfields) % [contrasts, first_peak_in_each_con] = get_contrast_indicator_improved(DB, myfields) % % [contrasts, first_peak_in_each_con] = get_contrast_indicator_improved(LTMDB, {'Memtype' 'Control'}); % % Simple funct...
2a6a285d460703dbde4637ed6fa533bd1d7cbec92070a34e695d92fd4f99a7ff
MATLAB
1,242
42
function make_contrasts_decision() % Figure 4 decision contrasts identified from SPM.xX.name. %% USER SETTINGS spmMat = 'D:\path\to\MRI_project\firstlevel_decision_public\sub-001\SPM.mat'; spmDir = 'C:\path\to\spm'; addpath(spmDir); spm('Defaults','fMRI'); spm_jobman('initcfg'); load(spmMat,'SPM'); names=SPM.xX.name...
304ae08ba6ec4514d73371e7120e0f88c39c72b6390979fd9aee03c6ee2b28df
MATLAB
1,243
42
function y = tapas_softmax_binary_sim(r, infStates, p) % Simulates observations from a Bernoulli distribution % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which...
5a435a7f507b0e0b48d07477df91a9a1d7e8b6491fcc9c7d7f385e9bbd47c678
MATLAB
1,243
35
function pCT = applyHUMapping(imageData, headMask, skullMask) %APPLYHUMAPPING Convert normalised PETRA to pseudo-CT Hounsfield units. % % DESCRIPTION: % applyHUMapping assigns Hounsfield unit values to a pseudo-CT: % - background (outside head) = -1000 % - head (soft tissue) = 42 % ...
5be514069a5097460d5581d67fcdd8e6277fa5a28d4cbcdfa8ca057649734f78
MATLAB
1,243
57
function [p,n,v,e,e2]=afni_fileparts(fn) % Returns the file parts of an AFNI volume file % % [PATH,NAME,VIEW,EXT,EXT2]=AFNI_FILEPARTS(FN) % % INPUT: % FN AFNI file name, optionally with path, of the form % PATH '/' NAME VIEW [EXT], with VIEW in '+tlrc','+acpc','+orig'. % EXT can be .HEAD or...
9d72e6460f9b6df6df59456069515b5e88a3d58f440523918b458cb4676bc0a2
MATLAB
1,243
37
function [ subject ] = nmri_regenerate_cleaning(subject_new, subject_clean, params) %[ subject ] = nmri_regenerate_cleaning(subject_new, subject_clean, params) % % This function will re-generate the cleaning, marking and vigilance % scoring from one subject struct to another subject (or the same one with % updates na...
c938c39a38064aa32ebaf29a019f05738081de3672933be754af784acfe783d3
MATLAB
1,244
68
function med = circ_median(alpha,dim) % % med = circ_median(alpha) % Computes the median direction for circular data. % % Input: % alpha sample of angles in radians % [dim compute along this dimension, default is 1, must % be either 1 or 2 for circ_median] % % Output: % mu mean direction ...
eb28ff922d5f48d00e282af7c30fd9efb10c957ec726dbce3ffd8e46e9e84292
MATLAB
1,244
59
function Test_Multinomial() % This file is part of Manopt: www.manopt.org. % Original author: Bamdev Mishra, April 06, 2015. % Contributors: % Change log: clear all; clc; close all; % Synthetic data m = 1000; n = 5; % Synthetic example A = rand(n, m); A = A./(...
3dcf34de3448bfedca1bce989adacd104b55e987b9f34b6346bbe3d00387afaf
MATLAB
1,245
43
function dt = niftiClass2DataType(matlabType) % Transform the string matlabType into a numerical codes used by NIFTI-1 % % dt = niftiClass2DataType(matlabType) % % Here is the table showing the assocation between Matlab type and NIFTI-1 % data type. % % String (Matlab) ----> NIFTI-1 % -----------------------...
64ffcaac8bdb4cb0ddf41174a4cc0c3d69d2f5e7df7d05007ed5e381f6caf18c
MATLAB
1,246
50
function [RHSdiv, RHSdivx, RHSdivy] = divergenceTerm2D(F) % This function calculates the divergence of a field using its face % average flux vector facevariable, which is a face vector % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the ...
0852d86eef4fed1596064aa2f19684b81eaaa6f14125d37de113a16d2ba1f6b9
MATLAB
1,247
18
function res = is_undefined_function(exp) % test if a given function handle has no associated code (i.e. it is neither a lambda nor a reference to a known m-file) res = false; cexp = char(exp); if cexp(1) ~= '@' && ~exist(cexp,'builtin') try % this section is a performance optimization due to the lack of a ...
46fc33459ebda66efe3ba36908c9f270d53a619af9884076f7ec58eb2c5e9362
MATLAB
1,247
38
function [logp, yhat, res] = tapas_bayes_optimal_categorical(r, infStates, ptrans) % Calculates the log-probability of the inputs given the current predictions % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ % ...
c3e6acb7a885b3da7c064f938cd1e5cd4a098c5c5a1a9fa3f69cd80909ce3d26
MATLAB
1,248
56
function [err, v] = gind2sub (sz, ndx) % % [err,] = gind2sub () % %Purpose: % This function converts a linear index to multiple subscripts based on the dimensions. % It is a further modified version from Ziad's modification based on the original Matlab % function IND2SUB. The difference from what Ziad did is th...
59fa72e661e1dc6d11c904494db2f2378fd6a0923460c787cd1bdccec2626776
MATLAB
1,249
39
function X = lyapunov_symmetric_eig(V, lambda, C, tol) % Solves AX + XA = C when A = A', as a pseudo-inverse, given eig(A). % % function X = lyapunov_symmetric_eig(V, lambda, C) % function X = lyapunov_symmetric_eig(V, lambda, C, tol) % % Same as lyapunov_symmetric(A, C, [tol]), where A is symmetric, its % eigenvalue d...
9997fafc4664a259fc7695356e2357df03aa5f843a010801c2d8030dee13bc61
MATLAB
1,249
47
function [stimInfo, stimPatterns] = getStimPatterns(stimInfo, Params) %GETSTIMPATTERNS Identify unique patterns of stimulation % Detailed explanation goes here % 1 | Get unique stimulation numbers numElectrode = length(stimInfo); numStimPerElectrode = zeros(numElectrode, 1); for elecIndex = 1:length(stimInfo) ...
bf84e122924d7967eeb36279590ba3bde7d1c07a1b976e345dd7c30667795044
MATLAB
1,250
44
%% get_set_bfr_lbv(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid % ...
e4ae5dcbc79288cfb9682bfa9c4eaf8aa372965d9c3bf51cae2ebf73674e2c9e
MATLAB
1,250
44
function cont_model(savg,ind_ins_org,roiFile,Mag,Streamlines,Prefix,Vn) % This script generates group-avearged Laplacian eigenmaps and eigenmap's % gradient magnitude as well as vector files. % Compute gradient for roi [~,roi_msk]=read(roiFile); ind_roi=find(~~roi_msk); N=size(roi_msk); % index of roi into the whole ...
57266fb091733091d07782e6e848e831373c70a2b9cd1347b82bfc9d00a3f744
MATLAB
1,251
43
% Please cite this paper if you use any component of this software: % D. Cunefare, L. Fang, R.F. Cooper, A. Dubra, J. Carroll, S. Farsiu, "Open source software for automatic detection of cone photoreceptors in adaptive optics ophthalmoscopy using convolutional neural networks," Scientific Reports, 7, 6620, 2017. % Re...
98c9fadc8b38acb4e06ecfe84135b9fe78dfe0e2bc9f60daae34efc01128a796
MATLAB
1,251
45
function outargs = hlp_resolveall(context) % Look up all symbols in the current hlp_scope scope. % Scope = hlp_resolveall(Context) % % In: % Context : Optionally the execution context (stack) at this point, if known. % Can be obtained via try/catch. % % Out: % Scope : a struct with values assigned to sy...
c8db3cef6c9a1ad43e3a86e62561ec79a7c561e876e988c945824fbe041a80bb
MATLAB
1,251
33
function [verbose, handles, labels] = tapas_physio_plot_filter_respiratory(rpulset,m, s, t, ... rpulset_out, rpulset_out_trend, trend, rpulset_out_trend_filt, verbose) % plot repiratory filtering % (C) 2023 Johanna Bayer verbose.fig_handles(end+1) = tapas_physio_get_default_fig_params(); set(gcf, 'Name', 'P...
e86923aca3b3010c0ebd931495e2be6e379c598cc0fd54ac6954a5348db6810d
MATLAB
1,251
34
function ft_destroy_buffer % FT_DESTROY_BUFFER stops the thread with the TCP server attached to % the local MATLAB instance and removes all data from memory. % % Use as % ft_destroy_buffer % % See also FT_CREATE_BUFFER % Copyright (C) 2010, Stefan Klanke % % This file is part of FieldTrip, see http://www.fieldtript...
32f85f3507f3fd40884a5b1756bddb90f87c64d64b59b3ac70aa9025426b79cf
MATLAB
1,252
40
function [fitresult, gof] = createFit(x, Y) %CREATEFIT(X,Y) % Create a fit. % % Data for 'Yfit' fit: % X Input : x % Y Output: Y % Output: % fitresult : a fit object representing the fit. % gof : structure with goodness-of fit info. % % See also FIT, CFIT, SFIT. % Auto-generated b...
74a23f49fc53e01f1489a0aaae7f157391c96386a1a13c2d4303945085591b9d
MATLAB
1,252
41
classdef nnnormalizelp < nntest properties (TestParameter) h = {1 2 3 4} w = {1 2 3 4} d = {2 3 4} p = {2 4} end methods (Test) function basicl2(test, h,w,d) x = test.randn(h,w,d,3) ; y = vl_nnnormalizelp(x) ; dzdy = test.rand(size(y))-0.5 ; dzdx = vl_nnnormalizelp(x,d...
d540c8d071f639e1221173aa140389e3ab22c9390e01c5949c6a22ac732f88ee
MATLAB
1,252
49
function db_cluster_table(clusters,fnames) % function db_cluster_table(clusters,fnames) % % tor wager % counts studies and contrasts in each cluster % % clusters is a struct in which XYZmm field has list of points % --should be output of database2clusters, which contains all fields % % Prints one row per coordinate in ...
c0157b132053f69ff6870d1b55bed11dccbf461e37bec81cad32aced62d1d62c
MATLAB
1,253
29
function [pvec, pstruct] = tapas_hgf_ar1_binary_mab_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...
3a289614071158ca93e7f1ed3796e2b8a8ec4655d1628bbe7d886711fa2d41f2
MATLAB
1,254
29
function [pvec, pstruct] = tapas_hgf_ar1_binary_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU Genera...
ac6ef49803c31b76cd115887b82b6b61da0942c5dc326493dec3287e951c6714
MATLAB
1,254
41
function [dataStructure]=alignRecording(ePhys,oPhys) % align ePhys and oPhys data acquired with different sampling rate and with % a time lag (one start after the other). Use the function alignSyncTTL % [ePhys_cal,oPhys_cal]=alignRecording(ePhys,oPhys); % % INPUT: structure as follow % ePhys.data / ePhys.ttl / ePhy...
15cf2c3dcdba1b6490a55a42cb58c53a783c7b0d46327270cd4e701a14ca9be2
MATLAB
1,255
37
function DataFixHeader( BASEdir ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Wrote by David André Barrière 09th September 2022 % This function permit to fix header of corrected data for SPM running. % Usage : set BASEdir variable with your current working directory %%%%%%%%%%%%%%%%%%...
31e42a990220725d3cda4349b64c8f3235709ae5515bc366e9d5c5c5b074944c
MATLAB
1,255
40
function [ Im ] = findBorders( I ) % FINDBORDERS Returns an binary image with the regions' boundaries of the input % image I. % % FINDBORDERS returns a binary image with the regions' boundaries of the % input image I. The input image I must be a binary image. The returned image % Im takes the value 1 i...
41cb5439a1751723f7cb35a821ed2e7f1d4c4743970da56967cc8619f4a75c79
MATLAB
1,255
35
function [D, fX] = dsqrtm(X, H) % Fréchet derivative of the matrix square root. % % function [D, fX] = dsqrtm(X, H) % % Computes the directional derivative (the Fréchet derivative) of sqrtm at % X along H (square matrices). % % Thus, D = lim_(t -> 0) (sqrtm(X + tH) - sqrtm(X)) / t. % % The second output is fX = sqrtm(X...
bbd5a25ba24a7db1ec6300cc3bce6f4128acbfeaaec051e5b012613576dbfcde
MATLAB
1,255
31
function tsv = ft_read_tsv(filename) % FT_READ_TSV reads information from a tab-separated-values file and represents it as a MATLAB table % % Use as % tsv = ft_read_tsv(filename) % % See also FT_WRITE_TSV, FT_READ_JSON, FT_WRITE_JSON, READTABLE, WRITETABLE, TDFREAD, TBLREAD % Copyright (C) 2018-2024, Robert Oostenv...
179c86e1aab38eafa0eedd4260a7385103f3e2e90d75303cba399448dac77b02
MATLAB
1,256
40
function net = vl_simplenn_move(net, destination) %VL_SIMPLENN_MOVE Move a SimpleNN network between CPU and GPU. % NET = VL_SIMPLENN_MOVE(NET, 'gpu') moves the network to the % current GPU device. NET = VL_SIMPLENN_MOVE(NET, 'cpu') moves the % network to the CPU. % % See also: VL_SIMPLENN(). % Copyright (C) 2...
2cbba6fdbbad5b58da9cb05c0e139abb8accb6c4a66581ce22dd6bd37af313bd
MATLAB
1,256
40
function affineTransformationMatrix = get_affine_matrix(this) % Transforms geometry parameters into affine 4x4 matrix (T*R*Z*S) % with T = Translation, R = Rotation, Z = Zooming (Scaling with Resolution) % S = Shearing % i.e. performing operations in the order from right to left, in particular % rotation before tr...
678f6b4e0ad6b5e8f09fc3cc100c22af2a6dd8a3241a523de1798ab7085a8b18
MATLAB
1,256
35
% Run this script for the first time to retrieve necessary data clc, clear, close all filepath = fileparts(mfilename('fullpath')); if ~exist(fullfile(filepath, 'output'), 'dir') mkdir(fullfile(filepath, 'output')); end % Add path addpath(genpath(filepath)); savepath; % Download atlas data fprintf('%s', '## Down...
f15407a83fed648c5f6c3c5d6fa8d4e4a2b5a2d2301ae0bbfd1d4d409efab7c0
MATLAB
1,256
47
function functs = tapas_get_functions_in_sub_dirs(parDir,getFullPath) % Function returning the names of matlab functions in dir and subdirs. % % IN % parDir default: pwd % Starting here. % getFullPath default: true % Return full path to file (otherwise just function name). % % OUT % functs % Function...
f93d13ad6369c78eed7ec85dfb88905fd239c5f455f37682c9b2d2bc21d66ad3
MATLAB
1,257
39
function update_from_affine_matrix(this, ... affineMatrix) % Updates properties of MrAffineTransformation from affine 4x4 transformation % matrix % % Y = MrAffineTransformation() % Y.update_from_affine_matrix(affineMatrix) % % This is a method of class MrAffineTransformation. % % IN % % OUT % % EXAMPLE % upda...
0e1138c27c273caa8d0ea2bdc062de826c4ebbd5dee8a1a40119f3bafa4fc8f5
MATLAB
1,258
45
%% get_set_r2s_NLLS(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid %...
22c62ed9c996956f2fa4e110571ca394cf13ed45bf487181d9b164bb61a483aa
MATLAB
1,258
56
% GNUPLOT % % [X,Y,Z1,Z2,Z3, Z4] = gnuplot (A) % % Create 3D mesh from program output (3 columns) gnuplot style % The first column must be x-values repeated for each different y. % The second column must be the y-values. % The third must be the corresponding z value. % It is assumed that each block is separated with a...
6f585821ffdee4902bb35b7d33a6e7f8d7249904fbfe0797e7c0684b30b08661
MATLAB
1,258
39
function [ld] = tapas_huge_logdet(A) % Numerical stable calculation of log-determinant for positive-definite % matrix. % % INPUT: % A - Positive definite matrix. % % OUTPUT: % ld - log(det(A)) % % EXAMPLE: % ld = TAPAS_HUGE_LOGDET(eye(3)) Calculate log-determinant of 3x3 % identity matrix. % % Author:...
7031d729fe52ab1b87b95e756a70bc7e32cc84e316d301bf4d684e512bfa39a0
MATLAB
1,258
37
function [neuronid,idthr] = find_core_cells(raster,nsur,p) % % [neuronid] = core_cells(raster) % % Detectes the core neurons of a given raster. A core neuron is defined as % a neuron that participates on the raster more than expected by chance. % % INPUTS % % 'raster' is a N x T binary matrix, where raster(n,t)=1 if ne...
7e16f831e4166d17211883937e5907397acb9615d916d68f1d94785348ee7f9a
MATLAB
1,258
33
function PrepareComplex(PathName, ui0) % by Julia Becker, 01/04/2020 %PREPARECOMPLEX Create necessary folders and files for complex experiments if strcmp(ui0, 'Complex') if ~exist(fullfile(PathName, 'region analysis_all')) mkdir(fullfile(PathName, 'region analysis_all')); end if ~exist(fullfile(PathN...
7e8fa477441be9e34bf65784a4a739eb64fcc45363bebf7ad43cc786ea829bc8
MATLAB
1,258
46
function res = compute_bin_correlations(D_list, cfg) % COMPUTE_BIN_CORRELATIONS Pearson correlations within myelin bins res = struct(); for li = 1:numel(D_list) D = D_list{li}; levelName = util.get_level_name(D, 'fit_models'); my = D.(cfg.col_myelin); nb = cfg.myelin_num_bins; edges = quantile(m...
73a1196b9a6fca941c04f5c5514182f07ac785f038936d113c5489772f7daeec
MATLAB
1,259
34
%{ Copyright (c) 2024 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef VoltageWaveform < Waveform methods function this = VoltageWaveform(aChannel, aStart, aData, aSource, aSubsampleFactor) this@Waveform(aChannel, aStart, aData, aSource, a...
c500d94faf5c53c52e61a30c3dc2e9cf9728c0ef5e722441b585c2e8f916383d
MATLAB
1,259
42
function [y, prob] = tapas_unitsq_sgm_sim(r, infStates, p) % Simulates observations from a Bernoulli distribution % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, w...
19c58bb4b79c109fae2e5c116722df3dbb424fe783cc10fcbc2029ca3a10f284
MATLAB
1,260
35
function addLayer(obj, name, block, inputs, outputs, params, varargin) %ADDLAYER Adds a layer to a DagNN % ADDLAYER(NAME, LAYER, INPUTS, OUTPUTS, PARAMS) adds the % specified layer to the network. NAME is a string with the layer % name, used as a unique indentifier. BLOCK is the object % implementing the layer...
17bf6ec81e359c9305604448dd2f451772e6591c515c056d7dbbf9ce0f7bb673
MATLAB
1,261
22
%{ # stacks with beads for PSF computations # stacks with beads for PSF computations$ date : date # acquisition date stack_num : smallint # stack number for that day --- who : varchar(63) # w...
a84d77039119c416f07635d7273093dcd562c35603192d78f98922f5e6ecb1cd
MATLAB
1,261
58
function [outputArg1,outputArg2] = PlotSubjectPC_All(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]; % --- means & standard deviation per azimuth for th...
fb22ef4427a8441d5ca1b554bb4ca5e83dfbfb85093e830fa9d02190ada4ebd2
MATLAB
1,261
48
function [DA_offercue, DA_sideon, DA_rewardcue, DA_reward, DA_optout] = ... get_avgFl_allevents(datadir, ratlist, sensor, region) basedir = fullfile(datadir, 'data-published/PhotometryDataAligned'); pdatadir = fullfile(basedir, strcat(sensor, '_', region)); rewards = [5, 10, 20, 40, 80]; DA_offercue = cell(1, len...
2caa8b9221f45536b0d273b7fed2ffb4831b2605742fcf5db6ae8e0a2583d860
MATLAB
1,262
35
function [NoiseSD]=getNoiseSD(data,mask_noise); % [NoiseSD]=getNoiseSD(data,mask_noise); % Calcualte the standard deviation of the noise using the noise covariance % matrix % % USAGE: % [NoiseSD]=getNoiseSD(data,mask_noise); % % INPUTS: % in = image matrix (multi TEs) % mask_noise = noise ...
37ab2d0ae81530c70188fa01a1296c146fc2da7b220fe938458a12f7f4a36d88
MATLAB
1,263
39
% logGauss - Generate neural response from log-Gaussian function % % Syntax % R = logGauss(params, x) % % Input Arguments % params – [mu, sigma] % x – time-series of spatial frequencies % % Output Arguments % R – neural response function R = logGauss(params, x) mu = params(1); si...
9976de25e5b33d1fccfdbd6d6c699d0996173fa6b196321929b400fcd395f439
MATLAB
1,263
49
function [basfun,a,c] = weber_basis(tmesh,a,c,dim,phivec,varargin) %WEBER_BASIS: log-scaled cosine basis function form. weber arxiv 2016 paper % %creates basis functions of form m_j(t) = cos( a log(t+c)-phi_j) ) % %inputs %tmesh: time vector %a: basis fun param %c: basis fun param %dim: number of basis fun...
600866d3d4fedd5fc8afe3567fc958ad5d8c3545961c2b4895785c78f0e4ee23
MATLAB
1,264
25
function [p_rms, p_amp] = getRMSAndAmp(expInfoAll, rmsBins, ampBins, altSaveDirRMS, paramBC) p_rms = nan(size(expInfoAll,1), numel(rmsBins)-1); p_amp = nan(size(expInfoAll,1), numel(ampBins)-1); for ff = 1:size(expInfoAll.subject,1) % RMS probeName = fieldnames(expInfoAll.dataSpikes{ff});...
7ca0bef48db1737b24c4b4ee03e6676d06dfd1fb268876aba470fe51a21e2593
MATLAB
1,264
28
function[xvalsgradient] = convert_to_gradient(xvalscm, yvalscm) %% convert_to_gradient transforms track data (in cm) to values of the given non-thermotaxis gradient. % Requires a gradient slope (value-per-cm), and the min/max values of the gradient. % It assumes that the alignment spots used to orient that tracks ...
f42e0b598302fc1d8edd894262ffb7710b71db3bab9d7b217868cde597609e53
MATLAB
1,264
24
% Create .nii versions of FreeSurfer's hippocampal segmentation for p=1:8 dir0 = sprintf('~/nsddata/freesurfer/subj%02d/mri',p); unix_wrapper(sprintf('mri_convert %s/lh.hippoSfLabels-T1-HST1T2.v10.FSvoxelSpace.mgz %s/lh.hippoSfLabels-T1-HST1T2.v10.FSvoxelSpace.nii.gz',dir0,dir0)); unix_wrapper(sprintf('mri_conver...
acb922a63ea956a0a5be05a32c1d438b5450ee0994da12bcc3f8f51baa4c8d19
MATLAB
1,265
30
%% Constants TIMEWINDOW_BIN = 50; SessionTime_s = 30*60; KERNEL_SIZE = 1000; KERNEL_STD = 100; REMOVE_START_SEC = 10; % remove the first 10 sec of the data REMOVE_END_SEC = 10; locPsec = 20; % location parsing sampling rate 1 : 1 loc per sec, 2 : 2 loc per sec, ... basepath = 'D:\Data\Lobster\Lobster_Recording-200319-...
d790c6ed1b1e8b2624a7779f347b97694a7d4b7e8edda03a2e9dc1f2e0748511
MATLAB
1,265
44
function tapas_physio_strip_fields(opts) % Strips fields of a structure into workspace variables of calling function % % tapas_physio_strip_fields(opts) % % IN % opts structure variable % % OUT % % SIDE EFFECTS % creates variables with field names in workspace of calling function % % EXAMPLE % opts.myString ...
0bac241f3a58209fce2da5ca77a09c2b637327dd031cb2952e8662b5f70a0108
MATLAB
1,266
35
function minMax = findMinMaxNetMetTable(outputDataDateFolder, Params) % Find the min and max values of each extracted feature in all recordings % combined spreadsheetFname = strcat('NetworkActivity_RecordingLevel', '.csv'); spreadsheetFpath = fullfile(outputDataDateFolder, spreadsheetFname); recordingLevelTable = read...
5028757181ed64a37ff06507248aa1806006f2d7f4dbf14172114cfe86871138
MATLAB
1,266
30
function [lp,dlp] = priorMix(w,priors,x) % Mixture of Univariate or Multivariate hyperparameter prior distributions. % Compute log-likelihood and its derivative or draw a random sample. % The prior distribution is parameterized as: % % p(x) = sum_i w_i p_i(x), % % w(bx1) is the mixture weight vector (nonnega...
a0574cfa81d82034da1511129bf2b1334b6b506f6020aca28767e580d2e49dee
MATLAB
1,266
37
function omega = massANOVA(y,group) %function omega = massANOVA(y,group) %efficiently calculates omega squared values for mass univariate ANOVA % %inputs: group (design matrix) should be a cell array of nTrials*1 factors % y (data) should be nTrials*nChannels*nTimepoints(*nFrequencies) % %outputs: omega ...
afb1cdfab8e60cf021c8ae854cf7375c4173901958be24b172f3cffbc95e6d46
MATLAB
1,266
52
function [fitresult, gof,output] = createFitSpline(input) %CREATEFIT(input) % Create a fit on 1D input % % Data for 'fitTest' fit: % Y Output: input % Output: % fitresult : a fit object representing the fit. % gof : structure with goodness-of fit info. % % See also FIT, CFIT, SFIT. % Auto-generated...
b9412767a9b877c73167737b9acdcd3c6d951e3f98c3f0eb3a4f9268209bb644
MATLAB
1,266
44
function R4F = decode_res4(chunk, varargin) % DECODE_RES4 is a helper function for real-time processing of CTF data. This % function is used to decode the content of the optional ctf_res4 chunck. % % See also DECODE_FIF, DECODE_NIFTI1, SAP2MATLAB coordsys = ft_getopt(varargin, 'coordsys', 'dewar'); % decode the res...
c51bcb02724601543533ac1eb61470b60f1eeaf3e050f04ee0a8cc226e4acf5f
MATLAB
1,266
55
function Pipeline_getWSData(params) % This function returns wavesurfer data from whole cell patch experiments % as a matrix file. ExpInfoFn = getFileName(params, 'ExpInfo'); analysisDir = getAnalysisDir(params); load(fullfile(analysisDir, ExpInfoFn)); if isempty(fn.ws) disp('No Wavesurfer file found.... ...
e6bc5c433cf8c19cf6833e5f2bd2f564e2aaff01f620cb404be679667ef93d11
MATLAB
1,266
28
h%-------------------------------------------------------------------------- % writeElastixPointFile.m script is used generate elastix file of sparse point lists as input for transformix % %% Developed and maintained by Kannan Umadevi Venkataraju <kannanuv@cshl.edu> %% do not distribute without permission. % % Usage %...
f502f034462cfc16d44e9b23bb9a45b89f8db746ba1a42f93f9859812348827a
MATLAB
1,266
42
function osp_updateListBox(gui) %% osp_updateListBox % This function updates the list box. % % % USAGE: % osp_updateListBox(gui); % % INPUT: % gui = gui class containing all handles and the MRSCont % % % AUTHORS: % Dr. Helge Zoellner (Johns Hopkins University, 2020-01-1...
4987628fefb71699407068999557a46de6ef6ae44b41638d8bd8a92507a76856
MATLAB
1,267
51
% ------------------------------------------------ % Crossing data in multivariate space % ------------------------------------------------ % make 2 vars with positive relationship C = [1 .7; .7 1]; x = randn(100,2); x2 = x * C; % add another group with negative relationship C2 = [1 -.7; -.7 1]; x2 = [x2; x * C2]; ...
4ce95470af6278eb899249ffdbf18f48c17b93b28bdb4025baff8d59f1e7ea77
MATLAB
1,267
48
function [y, steps] = ML_kvsteps(x) % Implements the Kalafut-Visscher step detection method, using the MEX % wrapper of the C version. % % Usage: % [y, steps] = ML_kvsteps(x) % % Inputs % x - Input signal % % Outputs % y - Estimated piecewise constant approximation to the input signal % steps - Vect...
f6192eac4fc50d289313ae525a240ec5515b750ee4300cf3fbabba05e12d1d9a
MATLAB
1,268
37
function phase_expansion = tapas_physio_get_fourier_expansion(phase, order) % does a cosine/sine expansion of a given phase up to the specified order. % % USAGE: % phase_expansion = tapas_physio_get_fourier_expansion(phase, order) % % INPUT % phase % order % % OUTPUT % phase_expansion % % One expansion term is...
326c37531c04ccb3dcf1763b6b4c7930ebee2575ceae409a657aefaeff8054f2
MATLAB
1,269
58
function [ptheta] = tapas_sem_mixed_validate_ptheta(ptheta) %% Make sute that the input is consistent. % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2017 % if ~isfield(ptheta, 'x') error('tapas:sem:mixed:ptheta', 'Design matrix ptheta.m is not specified'); end if ~isfield(ptheta,...
426f3041abc4fbce3f1173676379575ac6119272c0b074e19b5df81134a07488
MATLAB
1,269
71
% You can have as many Panels as you like in one Figure. % % (a) Create a figure with two uipanel objects. % (b) Attach a panel to one of these. % (c) Attach another - oh, wait! %% (a) % create the figure clf % create a couple of uipanels set(gcf, 'units', 'normalized'); u1 = uipanel('units', 'normalized', 'posit...
0e685a9a5a00c1bf2462aacb39acaaea1c06b33e8bb206c950099ab775df6571
MATLAB
1,270
34
% checkPTB - Check if Psychtoolbox is installed % % Syntax % checkPTB() % function checkPTB() if ~exist('PsychtoolboxVersion', 'file') error(['Psychtoolbox is not installed or not on the MATLAB path.\n' ... 'Please install it from http://psychtoolbox.org/download.']); else v = ...
43781f67e3228311420e44fcfecbdb695cb702fbe3d3210a8c5f3088eeed5560
MATLAB
1,270
58
function [outputArg1,outputArg2] = PlotSubjectPW_All(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]; % --- %-wrong per azimuth for this subject PW_lp =...
5f30a7934fd0662fcb924e28ba308882be19e55ec1a603996a4021566e5f74e0
MATLAB
1,270
43
function [ concat ] = nf_load_mats_struct( mats, target_var ) %[ concat ] = nf_load_mats_struct( mats, target_var) % Load a cell array of mat files into a struct array % will fill up missing fields with [] if ~iscell(mats) || isempty(mats) error('Need call array with at least one file') end concat=[]; for i=1:...
a06666df0b298e60fe60468b411279c863e1ff125a2046b27f2f219349984797
MATLAB
1,270
41
function data = hlp_rewrite(data,varargin) % Rewrite (replace) an input data structure into an output data structure. % Output = hlp_rewrite(Input,Rules...) % % In: % Input : some data structure to be rewritten % % Rules... : a comma-separated list of rewrite rules (oldval,newval,oldval,newval,oldval,newval, ...) %...
418a526c7bbf3ece991ebaa8fac054dbe42ad33f4cab62028191dbfe16181edf
MATLAB
1,271
57
%% images2mat.m % combines a set of images to a giant 3D matrix % function [images, full_images] = images2mat(path_name, mask, args) arguments path_name (1,1) string mask args.channel (1,1) double = 3 args.subtract_median (1,1) logical = true end % find all *JPG images allfiles = dir(fullfile(path_name,"*.JPG...
72b32d2e8e752f4debce987befe231cecac10dd6bedc23432aa48298e9b19c17
MATLAB
1,271
53
function [ output_args ] = PROMAX_MP_ASSEMBLY_DETECTION( RASTER_file ) %PROMAX_MP_ASSEMBLY_DETECTION( RASTER_file ) % % % === Jan Moelter, The University of Queensland, 2018 =================== % narginchk(1,1); fprintf( 1 , [ '\n' ] ); timerVal = tic; %% > PRINT FUNCTION-CALL if( isdeployed ) printConsoleSec...
a5b8413fcdcd08b06612ddf59369d27110d403f3aba85a01510590a0ee6af5e8
MATLAB
1,271
46
function FCMap = WMSeedFC(FunDir,SeedDir,MaskDir,OutDir) if nargin==3 OutDir=[]; end [funhead fundata] = TMSReadNii(FunDir) ; dim1 = funhead(1,1).dim(1); dim2=funhead(1,1).dim(2); dim3=funhead(1,1).dim(3); shead = spm_vol(SeedDir) ; if dim2~=shead.dim(2) sdata=TMSreslice(FunDir,SeedDir,[],0) ; s...
0dbea846cf8a0c188b92597cf7eb07986ec485e99f21e2d0fe95958dac902bc2
MATLAB
1,272
28
function [ens_seq,maxcor,tmpcor] = ens_raster_from_templates(tmplts,raster,ccthr) % ens_raster = ens_raster_from_templates(tmplts,raster,ccthr) % % Generates an ensemble raster by template mastching of tmplts on the % raster. If no template shows correlation higher than ccthr, then no % ensemble is defined on that bin...
300547e36c91f8060a8e132b46fa159216a8999fe229bbb6bad634fcf511730f
MATLAB
1,272
35
function [dip] = ft_datatype_dip(dip, varargin) % FT_DATATYPE_DIP descripts the FieldTrip MATLAB structure for dip data % % The dip structure represents a dipole model that has been fitted to % ERP or ERF data using a non-linear optimization approach. It is % usually generated by the FT_DIPOLEFITTING function. % % FIX...
7c398474bc5ce0d7a63d6078c21142a90085adb9b0ed7fb7e04e2197627f41f4
MATLAB
1,272
44
function params = parseNameValuePairs(varargin) % PARSENAMEVALUEPAIRS Parse name-value pair arguments into structure % % Syntax: % params = parseNameValuePairs('name1', value1, 'name2', value2, ...) % % Description: % Converts name-value pairs into a structure for easy access. % % Inputs: % varargin - N...
825d701269a9a6afaa07f3e5b1535d49188cff7b7e3761c63d159977094e820d
MATLAB
1,273
36
function spikeLatencies = getSpikeLatencyRelStim(allStimTimes, spikeTimesStimRemoved, searchWindowEnd) %GETSPIKELATENCYRELSTIM Calculate time-to-first-spike latency relative to stimulation % spikeLatencies = getSpikeLatencyRelStim(allStimTimes, spikeTimesStimRemoved, searchWindowEnd) % % INPUT: % allStimTimes...
b4b87d36ce30530ebc3b9221304b4fe245450570d0d5167d915759d554d83020
MATLAB
1,273
51
% op_HadamardScans.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_addScans(in1,combMatrix); % % DESCRIPTION: % Add or subtract two scans together. % % INPUTS: % in = Spectrum (in matlab structure format) % combMatrix = How to combine the spectra % % OUTPUTS: % out = Result of adding input...
334756ba98ce34ff058c0adf2d50730f9e0a743917dedd08ddd3d917142735da
MATLAB
1,274
47
function plot_fig4c(datadir) % Plot average time to opt-out in mixed blocks for rats tested with catch % probabilities of 0.15 and 0.25. N = 53 rats. % % INPUTS % datadir: file path of data downloaded from Zenodo. Link to download can % be found in README. % Load wait time data of 53 rats fpath = fullfile(datadir, 'd...
727bb90e22d14c6deef0675b5dfd1aae4d00979041beec7c708874449e3582a0
MATLAB
1,274
42
function ni = readFileNifti(fileName, volumesToLoad) % % Reads a NIFTI-1 file into a VISTASOFT nifti structure. % See http://nifti.nimh.nih.gov/nifti-1/ % % niftiImage = readFileNifti(fileName, [volumesToLoad=-1]) % % fileName - path to a .nii or nii.gz file. % VolumesToLoad - The optional second argu speci...
804584c690086b8c344041a9f16e7dd45020d9effa34b43520b8892a0201ad1f
MATLAB
1,274
54
function [osp_out] = osp_detector(hsi_img,tgt_sig,mask,n_dim_ss) % %function [osp_out] = osp_detector(hsi_img,tgt_sig,mask,n_dim_ss) % % Orthogonal Subspace Projection Detector % % inputs: % hsi_image - n_row x n_col x n_band hyperspectral image % tgt_sig - target signature (n_band x 1 - column vector) % mask - bina...