sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
36d256e7471fe18e3955feae2cc538578c460f261d5012829c42d459756e6717
MATLAB
1,195
42
function freezeColors(varargin) %FREEZECOLORS Freeze current colormap to prevent changes % % Purpose: % Locks the current colormap so that subsequent colormap changes don't % affect the current figure or axes. % % Usage: % freezeColors() % Freeze current axes % freezeColors(h) % Freeze specific...
8a086bcef6f232a67893b7ec57d2d7f50f55208820c1301abe6d3c74109f9ee7
MATLAB
1,196
34
function getTriggers_switchEI_stimuliCondition(params) % determines trials which contained the selected keyword (in params.thisCategory) % MUST match trials 'tr' with the same keyword in trials(tr).stim_cond % saves result into respective column of 'trials_events' in each sessionCacheFile % - rows = trials % - valu...
dd00a56e9bb7d1c8644425e047fd56980d35e4188c5ac1cfc04454f4cc3fa748
MATLAB
1,198
29
function [lp,dlp] = priorTransform(g,dg,ig,prior,x) % Transformed univariate hyperparameter prior distribution. % Compute log-likelihood and its derivative or draw a random sample. % The prior distribution is parameterized as: % % prior(y), where y = g(x), % % g is the transformation function (monotonically increasin...
23205e3effb3d331c5a4093ac65b9fe9b1d0d98b020a72801006890dc8fa31c1
MATLAB
1,199
36
function test_suite = test_getDesignInput %#ok<*STOUT> % (C) Copyright 2021 CPP visual motion localizer developers try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> catch % no problem; early Matlab versions can use initTestSuite fine ...
272679e52f84f63ece9bd7ef7e49d70fdbe3b0a30f1ff2fcd9edd39f9887782c
MATLAB
1,199
22
function fieldmap = compute_fieldmap_analytical(theta, phi, sus_my, label_mask, r, r_o, r_i) % Calculate fieldmap using the analytical solution, derived from Xu thesis masksize = size(label_mask); fieldmap = zeros(masksize); % iterate over indices for i = 1:masksize(1) for j = 1:masksize(2) if label_mask(i,...
637121fc78b0026223c7416ef0b5ccdd708a4d8ff28837d4e186c6808a934bbb
MATLAB
1,199
33
% logging_fcallstack_format() - % Usage: % >> logging_fcallstack_format(formatstr) % % Inputs: % formatstr - Set the formatting for logging_fcallstack % sets CALL_STACK_FORMAT % matlog - a Matlab and Octave compatible logging library % Copyright (C) 2017 Mae Kennedy % % This program is free softw...
e8431916d38203d4778640a768f2d95d1a75d50f3c52e406d4fbc835d87dd8a9
MATLAB
1,199
45
function Y = tapas_uniqc_create_shepp_logan_4d() % Creates 4D Shepp-Logan Phantom for tapas_uniqc_slider4d demo % % output = tapas_uniqc_create_shepp_logan_4d(input) % % IN % % OUT % % EXAMPLE % tapas_uniqc_create_shepp_logan_4d % % See also % Author: Saskia Bollmann & Lars Kasper % Created: 2015-11-20 % Copy...
d65929fb15a80c20797f8b941b6caecf5f1743b8b7491954f84b731ba119b348
MATLAB
1,200
65
function custom_colormap=getCurrentColormap(varargin) % EXAMPLE USE WITH ARGUMENTS % getCurrentColormap() - use 1 % getCurrentColormap(name) - use 2, etc. % getCurrentColormap(name,options) - use 2, etc. % % HELP % Getting custom colormap and exporting it. % % HISTORY % - 20-05-09 16:13:59 - created by Radek Chrapkiewi...
e01cdda0fc15ec347a2430c13ae7d6046d099dabfc513533bdd2c65b4d5a5871
MATLAB
1,200
43
function mov = getImageData(params, fn, filesForROI, averageFiles) if averageFiles mov = getAvgMov(fn, params.Nplanes, filesForROI(1:averageFiles)); mov = mov(:,:,params.framesToDisregard:end); else mov = getMov(fn, params.Nplanes, filesForROI, params.framesToDisregard); end function im = g...
ff317fd1ce96813e7b4f9650f31b0819b10b7157478b0a328a9b2f664f21d881
MATLAB
1,200
43
function PlotExtendedData8(datadir, codedir) %PlotExtendedData8 - Plots Extended Data 4. % INPUTS: % datadir - Local directory where ProcessData_ExtendedData8.mat was saved after running ProcessData_ExtendedData8 % codedir - Local directory where code (e.g., published/EstrousRPE/) was saved %% Set up paths s = pa...
467b04a0298de5467006e2ff3169975a0ddc3a5e85c2d6872e930372182c0e13
MATLAB
1,201
30
%{ tuning.DotRFMap (computed) # receptive field from the dot stimulus -> tuning.DotRF -> preprocess.SpikesRateTrace ----- response_map : blob # average response for each location center_x : float # (fraction of x) center of receptive field on x, from Gaussian fits center_y : ...
d38be5a0f2206fb2423a5d75a90e9b2c8728a0b520f40a9b9ddcb502ec1e4ff1
MATLAB
1,201
39
function nullStats = GiveMeSimpleNullStats(groupLabels,numNulls,cfnParams,meanOverFolds) % Returns simple permutation-based null samples %------------------------------------------------------------------------------- % Check inputs and set defaults: if nargin < 4 meanOverFolds = true; end %----------------------...
2207c1fea1acb02ac8b7b3ff7f22755da244b745985245ebf50e5675da999dd1
MATLAB
1,202
42
function [o1,ovec1,ovec2,xyzo] = overlap(cla1,cla2,varargin) % function [o1,ovec1,ovec2,xyzo] = overlap(cla1,cla2,[v1,v2]) % % tor wager % o1 and o2 are overall measures of overlap % ovec1 and 2 are for each cluster % cla1 and 2 are the clusters structures % v1 and v2 are optional vectors indicating cluster memberships...
23a9e7241eecd58741673d5669ee16b5b6b7ac8d7e5b5934a8bab851695e86cf
MATLAB
1,202
34
function result = hlp_iscaller(func, level) % Test whether some function is calling this function at some level(s) of indirection. % Result = hlp_iscaller(Function, Levels) % % It can be specified what levels of nesting outside the function which runs hlp_iscaller are considered. % % In: % Function : function handle ...
44c2fa390aaabe8beb940321905c83eb34fb1c16aee267c46a57bce2f6425f84
MATLAB
1,202
39
function [XYZr] = RotateAboutAxis(XYZ, nrm, phi) %[XYZr] = RotateAboutAxis(XYZ, nrm, phi) %yet another function to perform rotations about an axis %XYZ: Matrix of XYZ coordinates, each row is an XYZ triplet %nrm: axis of rotation %phi: Clockwise rotation angle in radians %XYZr: Rotated version of XYZ %Note: %Origin of ...
7e9af53558a7092b2e4a6cc3cbff6a95119dde292d0861284eb69240c9341229
MATLAB
1,202
18
function cifti_write_sdseries(data, filename, varargin) %function cifti_write_sdseries(data, filename, ...) % Write a new sdseries cifti file from a 2D data matrix. % % The cifti extension on the filename should always be '.sdseries.nii'. % % To control the contents of the scalar and serie...
0068c6459af49e524101eaa4757773d802c7e607fcb852aa6d2850016c32e5c8
MATLAB
1,203
29
function [values] = ave_control(A) % FUNCTION: % Returns values of AVERAGE CONTROLLABILITY for each node in a % network, given the adjacency matrix for that network. Average % controllability measures the ease by which input at that node can % steer the system into many easily-reachable ...
f0f76f8c0d29bb616f8be757152bf2f94bcc302bd7eba9f89e834c0cbd427f05
MATLAB
1,203
53
% op_freqshift.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_freqshift(in,f); % % DESCRIPTION: % Apply a frequency shift to the input spectrum by 'f' Hz. % % INPUTS: % in = input data in matlab structure format. % f = frequency shift to apply (in Hz). % % OUTPUTS: % out = Output following f...
707b1054f19576536c49290911e9472e4add06ec0c31891e9cd41c2d7d7b43a7
MATLAB
1,204
37
function y = binompdf(x,n,p) % BINOPDF Binomial probability density function. % Y = BINOPDF(X,N,P) returns the binomial probability density % function with parameters N and P at the values in X. % Note that the density function is zero unless X is an integer. % % The size of Y is the common size of the input a...
747ebe4bd9e9b7c47a051516a80f2e19fd9e236227009133b966e48229e8487e
MATLAB
1,204
40
function [n_selective,p_selective] = selectiveNeuronCalc(A,mask1,mask2) %SELECTIVENEURONCALC: decides via t test which neurons are selective %for two different cases %A: main data structure %mask1/2: anonymous function handle that takes A and a neuron number to %compute boolean of trials to consider for cases 1 and 2 %...
a1d149777878cf46ef56af7e53b2791d0c19a12951e2ec681e7408d8644a34ad
MATLAB
1,204
36
%_________________________________________________________________________________ % Equilibrium Optimizer source code (Developed in MATLAB R2015a) % % programming: Afshin Faramarzi & Seyedali Mirjalili % % e-Mail: afaramar@hawk.iit.edu, afshin.faramarzi@gmail.com % % paper: % A. Faramarzi, M. Heidarinejad...
fc4f324116cfce2915a97a244957bc9941d8da0089e1daddcc561569c5cbd593
MATLAB
1,204
57
function save_avw_img(img,fname,vtype,endian); % SAVE_AVW_IMG(img,fname,vtype,endian) % % Save an array (img) as an analyse file (only the .img) % for either a 2D or 3D or 4D array (automatically determined) % % vtype is a single character string: 'b' (unsigned) byte, 's' short, % ...
0587199b73fd8bd45d0a15cb6defbcac68f2b8cd379089b5672de21f440a3a1c
MATLAB
1,205
32
function parentNode = traverseFolderAndStop(parentNode, currentFolder) % This only goes one folder (does not recurvesily go through folder) % Get all contents of the current folder contents = dir(currentFolder); % Filter out '.' and '..' directories contents = contents(~ismember({contents.name...
c299257fd89029651a4ef13c8b4829d555811cd1d87b498d89105d257d34eaea
MATLAB
1,205
39
classdef Pooling < dagnn.Filter properties method = 'max' poolSize = [1 1] opts = {'cuDNN'} end methods function outputs = forward(self, inputs, params) outputs{1} = vl_nnpool(inputs{1}, self.poolSize, ... 'pad', self.pad, ... 'strid...
c9a9acc838c08af1eb5cd1353b985df5805c05bc24c01ebc178fd924f0d0ae3c
MATLAB
1,205
38
function ss_tcs_stat = single_subject_tcs_features(ss_tcs_data) %UNTITLED5 Summary of this function goes here % Detailed explanation goes here ss_tcs_stat=zeros(1, 12); var_all=zeros(1,8); % old version of arima estimate, excluded because of extra toolbox needed % (econometric) % for j_order=1:8 % mdl=arima(j_or...
d958a17e823c3f069b7c9471cd0d5f651820f830db9351e653e849cee481d3f6
MATLAB
1,205
33
%GlobalSettings - Initialize settings for FMAToolbox. % % The global variable SETTINGS holds a number of basic settings such as the % minimum and maximum distance allowed between LEDs. Modify this variable to % customize individual values. For instance, to change the maximum distance % between LEDs, add the following t...
ddb00499d7cb021957515b877eb5136ddea3f71dc86b83ec2572b4c12b067770
MATLAB
1,206
36
% Written by Dr. Gregory Scott from Imperial College London, % Academic Clinical Lecturer, The Computational, Cognitive and Clinical % Neuroimaging Laboratory (C3NL) Faculty of Medicine, % Department of Medicine, https://www.imperial.ac.uk/people/gregory.scott99 % % 1D BDM implementation of method as described in: % A ...
409c8dfacde78867b1a3ec7f4a974c93fb070eff55f6a195ef18ed58bc34c6d6
MATLAB
1,207
59
%Encuentra los elementos con mayor y menor distancia. LC %Con ello se preserva la estructura en la proyección de LLE. %Busca los elementos F y G que tengan la mayor distancia %Despues busca el elemento mas cercano a F function [DE,Delta,T_Prop,Deltab,T_Propb]=Distancia(Dist,Y) %Elementos del triangulo, delta y propo...
7c0a2b63fc36b6ce864e636a3716e8d9859b6ae61cf35341023e6561ed992984
MATLAB
1,207
55
function [umxSignal]=runFastICAnd(input) options.savePath=[]; options.figName= '_runFastICA'; options.plotFigure=true; % Make sure M is a row matrix if iscolumn(input) M=double(input'); else M=double(input); end % run fastICA [icasig, ~, ~] = fastica(M','g','tanh','epsilon',1e-7,... 'stabilization','on',...
da13f5e87bcc42c2660a9d5b2fb0ad4652c17f4e4bf2a0a9803b40c6702442e1
MATLAB
1,207
61
function [sigma,mu,A]=mygaussfit(x,y,h,optionStab) % % [sigma,mu,A]=mygaussfit(x,y) % [sigma,mu,A]=mygaussfit(x,y,h) % % this function is doing fit to the function % y=A * exp( -(x-mu)^2 / (2*sigma^2) ) % % the fitting is been done by a polyfit % the lan of the data. % % h is the threshold which is the fra...
8e761363e4c372947f52eebb4ba593f01f14f19ba622d3690ff36cc80200daa0
MATLAB
1,208
39
classdef Pooling < dagnn_bc.Filter properties method = 'max' poolSize = [1 1] opts = {'cuDNN'} end methods function outputs = forward(self, inputs, params) outputs{1} = vl_nnpool(inputs{1}, self.poolSize, ... 'pad', self.pad, ... 'st...
df138346c7eeb053ab270434f2b3b5268f4af453282cbf4955c166ff569f5550
MATLAB
1,208
53
function indicesOut = randomPermutation(n) % generates a random vector of n integer numbers from 1 to n. The numbers % are randomly placed in the vector. % Cai Wingfield 2-2010 %__________________________________________________________________________ % Copyright (C) 2010 Medical Research Council import rsa.* import ...
4f0044ee9e5abaa6b1def0be46f612616b27a79984593715c561eaf478d46243
MATLAB
1,209
42
% Generate Model WTs by drawing from gamma or logn distribution function wt_mdl = generate_wts(wt_opt, nsims, noise_arg, params) if strcmpi(noise_arg, 'gamma') Sigma = params(1); k = wt_opt.^2./Sigma; theta = Sigma./wt_opt; wt_mdl = mean(cell2mat(arrayfun(@(x) gamrnd(k, theta), 1:nsims,... ...
52ee27d82d766c68b0ea4f09c63bb0fab650c357ca5918e3b707683000fae18e
MATLAB
1,209
85
2 37 4 GD 2 male female CN 2 C1 C2 EM 3 P U N SJ 10 S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 1 0 20 6 ../Lukas_Coarse2/m.AlvaranP051303.full.reg+tlrc.BRIK 1 ../Lukas_Coarse2/m.AstorA072903.full.reg+tlrc.BRIK 1 ../Lukas_Coarse2/m.BlumenkronF070103.full.reg+tlrc.BRIK 1 ../Lukas_Coarse2/m.CabrerraD121002.full.reg+tlrc.BRIK 1 ../Luk...
9b9d8a3170438fe51b2f5aaa111d4b36cdbd1794685cffeb88a4cd50317bb87a
MATLAB
1,209
33
function [stl_file]=Export_STL(data_file, START_TIME, END_TIME, map, column) % STL to Blender: % % This script will load LFP data from SpikeGLX bin file and export it as stl file for manual annotation % Next, blender CSV output file is loaded back into matlab % % input: % data_file: full path to ap.bin fil...
a20dfeea4d031cfc8bf495b55b0696e00b6495ed1e1ece6038f56c3e58fafc47
MATLAB
1,209
56
function [inference] = tapas_sem_multiv_prepare_inference(data, model, ... inference) %% % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2016 % % Number of chains nc = size(model.graph{2}.htheta.T, 1); % Number of subjects ns = numel(data); % Number of real parameter and input para...
cf46a46692b470f3d52b234745d92b47c3db3e5ec465c13f998639e595eee19b
MATLAB
1,209
33
function [spatial] = Setup_Storage(step_cap,C1,C2,C3,myelin) % Cell 1 spatial.C1x = cell([1 step_cap + 1]); % cell array for C1 x pos spatial.C1y = cell([1 step_cap + 1]); % cell array for C1 y pos spatial.C1x{1} = C1.x; spatial.C1y{1} = C1.y; % initialise C1 x,y pos % Cell 2 spatial.C2x = cell([1 step_cap...
fc0d6af0871181cee4c17920c24d47252f67b51f4c19a7fa770722d1e8e63fa4
MATLAB
1,209
43
function this = MrDataNd_value_operation(this, testVariantValueOperation) % Unit test for MrDataNd for arithmetic operations (perform binary % operation) % % Y = MrUnitTest() % run(Y, 'MrDataNd_value_operation') % % This is a method of class MrUnitTest. % % IN % % OUT % % EXAMPLE % MrDataNd_value_operation % % ...
0afaa3ebaa4c7d3f1c0007ff2f2a7d015571d3d8a30e87384c45a8dc3da2bc64
MATLAB
1,210
36
function proj_auc_gp = cal_proj_auc_random_gp_dist2sides(env1_data, env2_data, num_permutation) % envX_data: features X cells/voxels, gird and place cells together % num_cells should be even n_features = length(env1_data(:, 1)); num_cells = length(env1_data(1, :)); % env1 env1_data = env1_data - repmat(mean(env1_dat...
be700173abf44e910bf9c09d9380964ca64b5f42b8d92e9393da64a3b0ac1cc2
MATLAB
1,210
36
function res = DK_timerev(x,timeLag) % DK_timerev Time reversal asymmetry statistic % % Calculates a time reversal asymmetry statistic % x -- the time series % timeLag -- a time scale (in samples) default 1 % % ------------------------------------------------------------------------------ % Copyright (C) 1996, D. Kapla...
27fa184647ed580acc2c9b80765e59fa0aa8dafbd3cde7c03f9a88efd89cda70
MATLAB
1,211
37
function [shuffleTauDiff, observedTauDiff, pval] =... myTauShuffleTest(first_q, last_q, myBetas, Nshuffle) Betas = myBetas(first_q | last_q,:); nrats = size(Betas, 1); shuffleTau = nan(Nshuffle, 2); for ii = 1:Nshuffle fprintf('shuffle %d out of %d\n', ii, Nshuffle) shuffleLatency = randperm(nrats)'; ...
6650f1d3bfb7d08fe8a404e9efa0473986f0fdfda16750de32511680c30836fb
MATLAB
1,211
37
function getTriggers_emoReco_imageSound(params) % finds which stimuli inlcuded Image or Sound % concordancy paradigm stimuli: % Image + Image % Image + Sound (!!! sound is always "second" stimuli in trials structure !!!) % (c) Jiri, Nov16 display([' - finding events for: ' params.thisCategory]); %% per session: ...
c51d84fce9862c3abc0227caf81a207a6f368ff11abca286eb3b31b6c167965f
MATLAB
1,211
24
function delta = delta_from_dist_mat(dist, rho) % computed delta for the rho vs delta plot. % based on clustering by density peaks % Reference paper: Herzog et al. 2020 "Scalable and accurate automated method % for neuronal ensemble detection in spiking neural networks" % https://www.biorxiv.org/content/10.1101/2020....
ece7cc1251bfc76b4bc89a7a089fae084efa1b8327d513d529fe6be9d496f45c
MATLAB
1,211
38
function [a,b,c] = runlme(behavior , eigenvalue, toi) eigenvalue = permute(eigenvalue,[1 3 2 4]); for com = 1:2 for e = 1:2 for t = 1:size(eigenvalue, 4) C = squeeze(eigenvalue(:, com, e, t)); behavior.C = C; formula = 'C ...
f1affd8efb9a46281514e95c1786b9f2c7e5dcb27e596c9c649a3db8541564a2
MATLAB
1,213
42
function [dim] = pos2dim3d(pos,dimold) % POS2DIM3D reconstructs the volumetric dimensions from an ordered list of % positions. optionally, the original dim can be provided, and the (2:end) % elements are appended to the output. % % Use as % [dim] = pos2dim3d(pos, dimold) % where pos is an ordered list of positions ...
636d3554658fd81cefb4e007952333ac80f35a9e4acf7f1558d0a4ee70c5aba6
MATLAB
1,214
38
function VersionStruct = getCurrentVersion() %% VersionStruct = getCurrentVersion() % This function reads the current version and release date from the % version.json file in the settings folder % % USAGE: % VersionStruct = getCurrentVersion() % % INPUTS: none % % % OUTPUTS: % VersionStruct...
cffdebba5c9b086764f1007e4865f39db688cda58533b58e8c40bdce06c0e917
MATLAB
1,214
38
function exportCurrentFigAsPDF(filespec,userOptions) % exports the current figures to the file [filespec,'.pdf'] in pdf % format. % filespec is the full path (including the file name) of the file to be % saved. % userOptions can be used to modify the dots per inch (dpi) or the % tightness of the figure in the printed ...
dee9b18a7618e230ac042ebd288fcad654d9ca885f4a75050f4960b9ae5bd850
MATLAB
1,214
67
% % function to rotate a 3d object to a new orientation defined % by an eigenvalue problem. % % inputs are either: % X, Y, Z matrices defining points to rotate % n x 3 pointlist of [X Y Z] values, with 2nd and 3rd args empty % % returns: structure with X Y Z rotated, and XYZ rotated pointlist % % results = rotat...
8e35ad12e63c4f621e1db0a07c9d9aef922aa3c5084277f5e7096390091a9945
MATLAB
1,215
39
function [Mdl] = run_lda(params) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % run_lda returns Mdl structure including function handles of fit, % predict and score functions for linear discriminant analysis. % % Arguments: % params: Structure including following hyperparameters: % ...
ababd74d60cbdbda62a4985c44b2dabf70c58583ed84c0e339ffa48189f24f4e
MATLAB
1,215
36
function [LP_Signal_fix, HP_Signal_fix]=filter_signal(Fs, num_electrode, Signal) %Filtering MEA signals % INPUTS: % Fs - Sampling frequency (Hz) % num_electrode - Number of electrodes (channels) % Signal - Raw signal matrix [time x electrodes] % % OUTPUTS: % LP_Signal_fix...
be6658734a1b6555b43e03faf04fef299ef5acbd14bcc7be9e06a84b19cf3d16
MATLAB
1,215
41
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Requires: https://github.com/guorongwu/DynamicBC/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear; clc; %% --- Parameters --- ts_file = 'time_series.txt'; % input time series mu = 100; % regularisation parameter tmp_file = '/h...
cc776fc1f6d5b1f5ea942d7e09503c48981c677fb5784e42f9c5b38860df9170
MATLAB
1,215
34
% Add Manopt to the path to make all manopt components available. % This file is part of Manopt: www.manopt.org. % Original author: Nicolas Boumal, Jan. 3, 2013. % Contributors: % Change log: % Aug. 7, 2013 (NB): Changed to work without the import command % (new structure of the toolbox). % ...
f362190fb42f72740630b86666dabf1303cd276208abf380da7cd74e01a8eef1
MATLAB
1,216
39
function useCh_GW = ch2roi_assignGW(gm_wm_selection, H_channel, gm_thr) % was channel assigned to: GREY matter or WHITE matter or CSF or BONE ? % uses channel structure H_channel to find if % (1) it matches the gm_wm_selection % (2) the probablity is below threshold gm_thr % input: % H_channel = channel structur...
14c4ccb992ed85ecdeab573dd85cb6286bb76ba30d37f68172c5cafc26d64526
MATLAB
1,217
54
function Xcov = embed_cor_cov(X,D,tau,ix_act) % Partial covariance matrix in time delay embedding space % XX = embed_cor_cov(X,D,tau,ix_act) % XX = X(ix_act,:)*X' % --- Input % X : input signal : [Xdim x Tsample x Ntrial] % D : time embedding dimension (integer) % tau : delay time in sample number (integer...
2b2efc182605cdecfa5d83739a9d38bf942d9798daa4108c55c25825101ecc91
MATLAB
1,219
40
function y = tapas_condhalluc_obs_sim(r, infStates, p) % Simulates responses according to the condhalluc_obs model % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2016 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which...
694f2f2561a3322d7cf5137d41cfafc8c49e6ddbdfb37c79a07e21aba7eba29d
MATLAB
1,220
40
function numVax = freadVAXG(fid, number, method) % FREADVAXG Converts a number read in IEEE-LE format to its VAXG % floating point representation. % % Usage: % fid = fopen('file.vaxg', 'r', 'ieee-le'); % num = freadVAXG(fid, numElements, 'format') % % 'format' options are the same as FREAD. % % The fun...
0cac68744b7d2260f6bb3b9333277665cf0770c7f91cae576b33de2ab1a736d9
MATLAB
1,221
34
function zspec = cal_Z(npools, B1, concentrate, offset, T1, T2, K1, K2,M0, Exchangerate, Exchangerate_verse, w_x, T2sArr, freqArr, lineshape) zspec = [0]; % parfor ii = 1:numel(st) for j = 1:numel(B1) B = B1(j); [omega_1, ~, ~, step_size] = get_RF_pulse(B, 512); w11 = omega_1; % ...
d17c5910ef2654c03fbc2137495ffd714377068d7a6fbde20b2cb979ed81ade0
MATLAB
1,222
42
%% paths = get_sepia_toolbox_home_paths() % % Output % -------------- % paths : structure with the *_HOME directories declared in % SpecifyToolboxesDirectory.m (empty if a given toolbox is % not configured there) % % Description: Small helper to read the external toolbox directories % ...
f4b4d573b7c0a469b035802652741093f59d6267be9a1a6b4bb1f23ee0eee5ef
MATLAB
1,222
46
function G = grammatrix(M, x, vectors) % Computes the Gram matrix of tangent vectors in the Manopt framework. % % function G = grammatrix(M, x, vectors) % % M is a Manopt manifold structure obtained from a factory. % x is a point on the manifold M. % vectors is a cell containing n tangent vectors at x. % % G is an n-by...
4852a7c73cea928aca60bde75086bb563b949374c9721004bff71d65306ea7de
MATLAB
1,223
33
% logging_set_log_level() - sets the logging level of logging_log messages % to the provided level, if the level doesn't exist % the behaviour is undefined % % Usage: % >> logging_set_log_level(strlevel) % % Inputs: % strlevel - maximum level to log char type % m...
5ab6ddea39707b2de028ae817994b2345d77521d20dac99b1ae00310de923649
MATLAB
1,223
37
%% This script is an example of how to implement the functions for estimating curvature and their derivatives %Author: Itzik Ben Shabat %Last Update: July 2014 %% %Clear all variables, close all windows and clear command window clear all close all clc %% Generate the example triangle mesh example StepSize=...
aea06004810bc97b3905cb91ea8f0478b0a538a2e0f722c0187bc35c0c601948
MATLAB
1,223
32
function run_tier2() %% run_tier2() % % Description: runs the Tier-2 toolbox-dependent regression matrix % (test/tier2_matrix/) against a small, deterministically-generated % synthetic phantom (test/phantom/generate_synthetic_phantom.m) - unlike % Tier 3, no real dataset is required. Rows requiring an unavailable % too...
8f8fc11fecb60ebc7d87dc5eaf25f33ec75ef016c75ade684ab9b7f6b90e28e2
MATLAB
1,224
42
function [out,str] = anova2_repmeas_autodesign(data,factNames,printOutFlag) % function out = anova2_repmeas_autodesign(data,factNames,printOutFlag) % computes 2-way repeated measures ANOVA on data matrix: 1st dim = subjects, % 2nd dim = factor 1, 3nd dim = factor 2. % % Johannes Schultz spring 2007 if ~exist('factName...
95a8df3f953f86817ab37aa8be33406267b3db9498622ea51b60715f19ef4bad
MATLAB
1,224
33
function obj3 = binaryopp(f, obj1, obj2) if isa(obj2, 'mmo'), tmpobj = obj2; obj2 = obj1; obj1 = tmpobj; clear tmpobj; end if ~isequal(size(obj1), size(obj2)) && prod(size(obj2)) ~= 1 error('Matrix dimensions must agree.'); end data1 = memmapfile(obj1.dataFile, 'writable', obj1.writable, 'forma...
f7f538a207d81157448a9ba76f6decb50a9d8cda52861124b3f0fda745f23888
MATLAB
1,224
55
function [cem_out,w] = cem_detector(hsi_img,tgt_sigs,mask) % %function [cem_out,w] = cem_detector(hsi_img,tgt_sigs,mask) % % Constrained Energy Minimization Detector % solution to filter with minimum energy projected into background space % % inputs: % hsi_image - n_row x n_col x n_band hyperspectral image % tgt_sig...
61a7014e2c0f6f4aafb3b903ef6179b806a44960f76539c20b56f8dbab7f8975
MATLAB
1,226
53
% Panels can be any size. % % (a) Create an asymmetrical grid of panels. % (b) Create another. % (c) Use select('all') to load them all with axes % (d) Get handles to all the axes and modify them. %% (a) % create a 2x2 grid in gcf with different fractionally-sized % rows and columns. a row or column sized as "-1" ...
9e6cd0a6fd078f9097f8f54c4e4a17264a9c3035299360c5bd956f4a349e2f85
MATLAB
1,226
26
function par = sero_pulseq_defaultPars() % function par = sero_pulseq_defaultPars() par.tShot = 0.15; % step time [s] par.nShot = 1000; % number of shots/samples par.nPos = 50; % number of positions/slices par.ar = 4; % aspect ratio par.dz = 1.5e-3; % step length in z [m] pa...
389ae511b0f736c373afbda994de5a674fc7f61f9eae6af5ee3acf886066bb9c
MATLAB
1,227
29
function residuals = CorrResiduals(spikes, intervals1, intervals2) % Computes the residuals of the post vs pre pairwise spike train correlations % using the intervals provided, as described by Giri2019 JNeurosci % Pearson's correlation for each pair of neuron's spikes will be computed % within intervals1 (e.g. rippes...
e46bd05b6f44966348f94dedc713f6e0b57a63742ae07b09d45ba1e70b15e629
MATLAB
1,228
24
%----------------------------------------------------------------------- % Job saved on 31-Jan-2024 16:03:11 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- %% load libraries, I think run('set_library_paths....
15f3e7f9138b703fee1f89935fad5749ddec98e51d2277fa1521ac0fc86d3724
MATLAB
1,229
47
function [finalParams, MSE, initCond, fitParams] = my_fit_sigmoid(x, y, iters) %uses fmincon to fit sigmoidal to data specified by 'x' and 'y'. %inputs: x = vector of x values. % y = vector of y values. % iter = iterations of random initializations. 10-20 is reasonable. lb = [-5, 0, 0, -5]; ub = [5, 5, 3...
6572a496aab7c6125cc8d12c970a7d2b90e6fb84c323af61bb14da237a261243
MATLAB
1,229
39
function [ params ] = tapas_BLT_runIntroMain( params ) % tapas_BLT_runIntroMain 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.nIntroMain Screen('DrawTexture', params.screen.window, params.text.I...
9f0fd02b046c26e5dff073272fc904d5d18a27ebf94c1eb243398f11811dbbdd
MATLAB
1,229
31
function str = finish(str,unknowns) %TEMPLATE/FINISH Apply given strategy to unknown fields in a string % STR = FINISH(STR,UNKNOWNS) applies on string STR the strategy defined % in UNKNOWNS to unknowns fields '{UNKNOWNS_FIELDS}'. % UNKNOWNS may be: % * 'keep' to do nothing % * 'remove' to remove all undefined ...
a756d1bc0ad5737adb8ad9a768deaeef4ee12ec4a2de8ff415abd36d45d6c7e4
MATLAB
1,229
37
%% SpecifyToolboxesDirectory.m % % Description: Specify the toolboxes's directory % The specificed path must contain the following directories as original one: % MEDI toolbox - functions/ % STI Suite - Core_Functions_P/ % % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 24 August 2018 % Date modi...
1fa10a5c13ff4a2f7bd624799b37c86651b416867c52916d248348bdcb57b1db
MATLAB
1,230
32
function [values] = modal_control(A) % FUNCTION: % Returns values of MODAL CONTROLLABILITY for each node in a % network, given the adjacency matrix for that network. Modal % controllability indicates the ability of that node to steer the % system into difficult-to-reach states, given inp...
2eea71935fe7e4a0b57be6bce20f6f8f5f4e43a1cf3ad7449a93670adbf1c887
MATLAB
1,230
54
function [state] = tapas_sem_hier_init_state(data, model, inference) %% Generate the structure of the states of the sampler. % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2016 % nc = size(model.graph{1}.htheta.T, 2); ns = size(data, 1); mu = model.graph{4}.htheta.y.mu; nb = numel(mu);...
d96288220c1f95a87882a0886d6f2ec5b55a97f24d67749a2b797f24ce4dc6b2
MATLAB
1,230
42
%% output = get_variable_from_headerAndExtraData(headerAndExtraData, variableName) % % Input % -------------- % headerAndExtraData : structure contains any formats of the target variable % variableName : name of the variable, string % matrixSize : validating matrix size % % Output % -------------- % outpu...
eb4ebd42007e786d3945e8df9044bf370defa878d171eae9a80a4cc2e61a2c87
MATLAB
1,230
40
function plotJointAngleCorr(kinematicsAll, field) % Correlation matrices grid layout fig; hold on; axis off axis equal % Params cmap = diverging_map(linspace(0,1,20), colormapHSV([255,225,0]/255, [], [], 0.8), colormapHSV([0, 212, 220]/255, [], [], 0.8)); height = 50; width = 50; space = 15; heights = [[height 0];[he...
f69c1dc941d80a0ab732e013618a4e269a6ebcad576a67b367589c44189e8c52
MATLAB
1,230
43
function [nstate] = tapas_mh_mc3_adaptive_ti_sample_node(data, model, ... inference, state, node) %% Samples for a particular node assuming there is a function for it. % Fundamentally the temperature schedule is assumed to a state and not a % parameter. % % % This works as the conditional independency of the level...
0d0a3a54944aceb7fd48128a404219453333f512c84c7985d7b8a26cf284ab2d
MATLAB
1,231
37
function [interp_cmap]=interpolate_cbrewer(cbrew_init, interp_method, ncolors) % % INTERPOLATE_CBREWER - interpolate a colorbrewer map to ncolors levels % % INPUT: % - cbrew_init: the initial colormap with format N*3 % - interp_method: interpolation method, which can be the following: % 'nearest' - n...
92e28e52fe3c1d52c4792214357ec4744592f49fa6e8faf1940977f601ce926b
MATLAB
1,231
32
function [fact,unit_string] = ExponentToUnit(e,o) % Utility function for some nice plotting of data. % % function [fact,unit_string] = ExponentToUnit(e,o) % % Receives the exponent of the largest absolute value of the data (i.e. % log10(max(abs(data)))) and the exponent after the data is scaled by the % exponent...
a7ad695ac67229fd2a874e1b523893cf4da51b2b1ba9abe6ff89efa3729a8e81
MATLAB
1,231
48
function [pressure, flow, pass] = Run_allparam_simulator(x, file_id, nv, ntp,Qdat) %[f2,f3,fs2,fs3,alpha]%,rminScaling] % x = x'; %comment out if doing physiolgical parameters % f2_vec = x(:,1); f3_vec = x(:,1); f3p1_vec = x(:,2); f3p2_vec = x(:,3); f3p3_vec = x(:,4); fs2_vec = x(:,5); % fs...
e63eb4efc3f37113d379fa1c0b2817521dc4795de668b3497b468ff1388fb682
MATLAB
1,231
28
function outputs = loadDecodeAll(dataPath, datasets, kinematicField, neuralField, fitModels) % Wrapper over loadDecode to run all models for all datasets if nargin < 5 fitModels = [1,1,1,1,1,1]; % fit all 6 model configurations end % Loop outputs = struct('mouse', cellfun(@(x) x{1}, datasets, 'UniformOutput', fal...
334d431640ab94c3e8c06b12bd0ea8a8efa8660197687e6b924b2e87ad8e944a
MATLAB
1,232
43
function [ uint32le] = VAXF_to_uint32le(floatVAXF) %VAXF_TO_UINT32LE Converts from VAXF (single precision) to IEEE-LE (UINT32) A = 2; % VAX specific B = 128; % VAX specific C = 0.5; % VAX specific D = log(2); % VAX specific % Determine the sign bit. If -ve transform to positive. S = zeros(size(floatVAXF))...
82183756d01fa04fbb3b8b33ccc9c1cf2a01611a6c1e0c2a0a350f5e0f1b860b
MATLAB
1,232
34
function parentNode = traverseFolder(parentNode, currentFolder) % Get all contents of the current folder contents = dir(currentFolder); % Filter out '.' and '..' directories contents = contents(~ismember({contents.name}, {'.', '..'})); [~, sort_idx] = natsort({contents.name}); content...
d284ab3863b9ebd0c65b666523cc19cbd6ceb86dff8e1ce0ae4406e0a3513fe9
MATLAB
1,232
44
function [sigma,shrinkage,sample]=covdiag(x,df,varargin) % function [sigma,shrinkage]=covdiag(x,df) % Regularises the estimate of the covariance matrix accroding to the % optimal shrikage method as outline in Ledoit& Wolf (2005). % Shrinks towards diagonal matrix % INPUT: % x (t*n): t observations on p ran...
82ea09acdf3f16abc7ddfc2381ed6ddf7ceaed5fdcc860692ce8babdccf601ad
MATLAB
1,233
49
function[tl1,tl2]=rotatetl(h,rot,tb) %%%%%%%%%%%%%%%%%%%% Get current graph properties %%%%%%%%%%%%%%%%%%%%%%% a=get(h,'XTickLabel'); b=transpose(get(h,'XTick')); c=get(h,'YLim'); if strcmpi(tb,'t') || strcmpi(tb,'top'), tb=2; elseif strcmpi(tb,'b') || strcmpi(tb,'bottom'), tb=1; else disp('The third argum...
a52f8a4c31c355c6448df95916e95a73fd2a744c834bc24db4574c5d28b284d3
MATLAB
1,233
42
function f=loglike(W, S) % LOGLIKE - log likehood function to estimate dependence between components % % Usage: f = loglike(W, S); % % Computation of the log-likelihood function under the model % that the ICs are 1/cosh(s) distributed (according to the tanh % nonlinearity in ICA). It does not exactly match for the log...
a82123a8733f513324f59cf7449932e761786f751ea7d9dad0a15e8ab90dc8d7
MATLAB
1,233
47
function EquateScales(varargin) %EquateScales - Equalize the the x and y scales on all the axes of the current figure % EquateScales('x') equates the x-axes only, and EquateScales('y') - the y-axes only. % % Copyright (C) 2020 by Ralitsa Todorova % % This program is free software; you can redistribute it and/or modify...
eed055443a246dd13c6df0f310e561c9f12de9d3c70fc8db344390c97cace7d3
MATLAB
1,233
35
function varargout = covSEvlen(llen,varargin) % Wrapper for Squared Exponential covariance function covSE.m. % % Squared Exponential covariance function with spatially varying lengthscale. % The covariance function is parameterized as: % % k(x,z) = sf^2 * sqrt(a/b)^D * exp(-(x-z)'*(x-z)/b) where % a = 2*len(x...
5cc8ca98110b48b4e864a0c9ecc49fce827f1ca388152078d49e70b953d1aa92
MATLAB
1,234
57
function b = catuneven(dim, padval, varargin) %CATUNEVEN Concatenate unequally-sized arrays, padding with a value % % This function is similar to cat, except it does not require the arrays to % be equally-sized along non-concatenated dimensions. Instead, all arrays % are padded to be equally-sized using the value spec...
7ad3f8565419ca1e9cdb64dfa02299e7afa1bcb2954417e366326944bea36e86
MATLAB
1,234
36
%% addon_config % % Description: Addon script to incorporate new method to the SEPIA framework % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 27 June 2020 % Date modified: % % DO NOT change the variable names, update the variable value instead % %% main % This name will be used thorough the SEPIA f...
1855a79e5319a68fad1919610b7a86cceae29fec767b93fed5adcc76a7e54978
MATLAB
1,235
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 % ...
19915d3c1ca3fb335dfdbefb208994917f97efc6f4a3a8125d928834cdb03d87
MATLAB
1,235
55
function [model] = tapas_sem_mixed_prepare_model(data, model, inference) %% % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2016 % model.graph{1}.htheta.model = ... tapas_sem_mixed_prepare_ptheta(model.graph{1}.htheta.model); % The trick is that now njm includes also the informati...
a89180fbdd88dd84f229539a4a9277e70c3ecac1e9f2ec6836d453a45eb53bc9
MATLAB
1,235
48
function this = extract_rois(this, maskArray, keepExistingRois) % Extracts data from this image for voxels within rois given by mask images % % Y = MrImage() % Y.extract_rois(maskArray, keepExistingRois) % % This is a method of class MrImage. % % IN % maskArray (cell array of) binary MrImage % keepExi...
190bad8d6677f915d211fb766cca12637ddaa89c5860af11d2e6eac8939677ea
MATLAB
1,236
64
function [fits] = tapas_sem_generate_fits(data, samples, model, time) %% Generate the fits of the data. % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2019 % CONG = 0; INCONG = 1; n = 3; n = n + 1; if nargin < n t = data.y.t; maxt = max(t); mint = min(t); nv = 300; time = lin...
26c0b137b25b0499ff682717d66b5036c801dfdd3c25016950153e5f5cf926d7
MATLAB
1,236
56
%% Sept., 16, 2017 % Testing whether a retraction can be boosted into % a higher order retraction by integration (time stepping). % It seems yes -- there ought to be more efficient ways. clear all, close all, clc; %% n = 5; M = spherefactory(n); x = M.rand(); v = M.randvec(x); %% h = logspace(-6, 0, 101); g = ...
5122b095eb3b52b4fa3443a22a50af0a5c25498c85c27f3ef0fbea897d054df5
MATLAB
1,237
39
function brightenedColor = tapas_uniqc_get_brightened_color(baseColor, iStepArray, ... nSteps, maxBright) % brightens color for given indices by predefined number of steps % % brightenedColor = tapas_uniqc_get_brightened_color(baseColor, iStepArray, nSteps, ... % maxBright) % % IN % baseCol...
c36b223f7397f7f4f7c80ff861c771555ab2d4d924fc41c042cab775f1655b0a
MATLAB
1,237
55
function [model] = tapas_sem_multiv_prepare_model(data, model, inference) %% % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2016 % model.graph{1}.htheta.model = ... tapas_sem_multiv_prepare_ptheta(model.graph{1}.htheta.model); % The trick is that now njm includes also the informa...
e4c1838a104edf2fc6be876f1a60947c8d35efecb9ebcc40243979d8276c9397
MATLAB
1,237
29
function [pvec, pstruct] = tapas_ehgf_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2020 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public %...
e7bd17f993fb353bb2b5ffcc001a80e18209ae099e40558c1b1995afbb6d08a8
MATLAB
1,237
36
% Performs fast detrended fluctuation analysis on a nonstationary input signal to % obtain an estimate for the scaling exponent. % % Useage: % [alpha, intervals, flucts] = fastdfa(x) % [alpha, intervals, flucts] = fastdfa(x, intervals) % Inputs % x - input signal: must be a column vector % Optional inputs %...