sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9a1a623016e05f29f9d5bc8c3e35f9a1bddce3009a5296145e0315661fd7b2c8
MATLAB
1,080
26
%% FindResponsiveCell % Go though all neurons and find the responsive cells % Prerequisite % - All Session files must gone through AlignEvent.m script and have aligned data basepath = 'F:\LobsterData'; filelist = dir(basepath); workingfile = regexp({filelist.name},'^#\S*','match'); workingfile = workingfile(~cellfu...
d0a4f08f505bf593aa96ff05b67bbefd525868ee87a926a631a8eff47f39e174
MATLAB
1,080
61
function [CnoHelp] = SkipMatlabHelp (C) % % [CnoHelp] = SkipMatlabHelp (C) % %Purpose: % removes the first set of comments from a character array % that would normally consiture matlab's help text (see example) % % %Input Parameters: % C : a character array % % %Output Parameters: % CnoHelp : C without the he...
40573137e6bded5141ad7f76d9e392d757fc6bc6e795b8174619273e9073b869
MATLAB
1,081
37
function [smf_data,mu,siginv] = smf_detector_array(hsi_data,tgt_sig,mu,siginv) % %function [smf_data,mu,siginv] = smf_detector_array(hsi_data,tgt_sig,mu,siginv) % % Spectral Matched Filter for array (not image) data % % inputs: % hsi_data - n_spectra x n_band array of hyperspectral data % tgt_sig - target signature (...
40ecac8fdda2ed9995dc9ec30d263f9b4ba1a4ad30358bdafa12fedd729b2b84
MATLAB
1,083
37
function this = realign(this) % Realigns all 3D images in 4D data to each other, then to the mean % Uses SPM's realign: estimate+rewrite functionality % % MrSeries = realign(MrSeries) % % This is a method of class MrSeries. % % IN % MrImage.data % MrImage.parameters.realign.quality % % OUT % % EXAMPLE % realign...
61df78ffd942d4d82307d169e89e63c614447cb85bf6e1c37027e962212c0235
MATLAB
1,083
35
function plot_sens_spec(obj) % plot_sens_spec(obj) % % Barplots of sensitivity and specificity for meta_nbc object. % You should have tested the nbc already: e.g., obj = test(obj); nterms = length(obj.terms); colors = {'y' 'b' 'r' 'g' [1 .5 0] [1 0 .5] [0 1 .5] [.5 1 0] [0 .5 1] [.5 0 1]}; while length(colors) < nt...
7db8cfce49f9ac276de23ab15d20d42ca4d409324993bbd5297cf32daaee90f0
MATLAB
1,083
41
%% Perceptually Uniform Colormaps from MatPlotLib % The <www.mathworks.com/matlabcentral/fileexchange/62729 % MatPlotLib Perceptually Uniform Colormaps> submission includes the % default colormap family and default line colororder family from % MatPlotLib 2 and 3. This document shows examples of their usage. %% Overvie...
8fb2bd8e5ec42b20e7b18a53dcf2df34eea442f3856116d1408da4cb117e4f9f
MATLAB
1,083
38
function []=CoeffofVariationofConcentration(op,file,model,ds,M,S0,U) % Load Data and scale from SI units to desired ones scaleC=convertFromSIunit(U); C=load(file); Y=C.Data.*scaleC; COV=zeros(16,6); % Get Measuring Points at each radius 0.5, 1, 2,5, 10 um radius=[0.2,0.5,1,2,3,5...
771fe9565ce0b93d25548ce9d45a33e8c0cfbc601e59dae6d0a306185bd2eb11
MATLAB
1,084
25
function [verbose] = tapas_physio_plot_get_cardiac_phase(scannert,cardiac_phase, pulset, ... svolpulse, verbose) % 1. plot chosen slice start event % 2. plot chosen c_sample phase on top of chosen slice scan start, (as a stem % and line of phases) % 3. plot all detected cardiac r-wave peaks % 4...
a3e1a571ba7c79511fa4b210c4bf7daf9441c115e90a8174b3da6f02e4b704ad
MATLAB
1,084
54
% Expects hh and ii (sorted unique indices) to be defined. % Creates <somedata> in the workspace. iimax = max(ii); somedata = []; end0 = -Inf; tic; for iii=1:length(ii) if ii(iii) <= end0 continue; end start0 = ii(iii); end0 = min(ii(iii)+100,iimax); while any(ismember(end0+1:end0+100,ii)) end0 = m...
6e758c83b2d828567cb6fdc05c2f31bc8307979ec87e0739d98055bf5e31cd63
MATLAB
1,085
35
function verbose = tapas_physio_close_figs(verbose) % Close figures given argument 'verbose' with a list of figure handles % % verbose = tapas_physio_close_figs(verbose) % % IN % verbose.fig_handles % % OUT % % EXAMPLE % verbose = tapas_physio_close_figs(verbose) % % Author: Lars Kasper, Stephan Heunis % % Create...
93e1c9ace4113f1f36d8fea5b1fc6d9af6673d68865780c8586098212831533d
MATLAB
1,085
42
function analysis_surfacevoxels(subjix) % function analysis_surfacevoxels(subjix) % % <subjix> is 1-8 % % Save .mgz files with surface voxels at 1, 2, and 3 mm resolution % onto each of the following surfaces: white, pial, layerB1-B3. % define hemis = {'lh' 'rh'}; surfs = {'white' 'pial' 'layerB1' 'layerB2' 'layerB3'...
d828f919f2e6a76a68d47e7b301d61d50b2a0abeb1f7a28e193a7c19d9406df7
MATLAB
1,085
46
function [y] = filtfast(x,dim,i,ftype,fsize) %[y] = filtfast(x,dim,i,ftype,fsize) if nargin < 5 error('Missing input arguments!'); end if dim > ndims(x) error('Filter dimension exceeds input dimensionality!'); end if isempty(i) i = 1:size(x,dim); end fungaussian = @(x,m,s)exp(-0.5*((x-m)./s...
28473a9f5c75c48dfb69906ba64a6b14dc50a7b5f3171f3f6a457eb7ff1bb057
MATLAB
1,086
53
function [LZComplexity] = compute_LZC(sequence) % Computes the Lempel Ziv complexity of a symbolic sequence % % Input: % - sequence: array with a symbolic sequence % % Output: % - LZComplexity: Lempel-Ziv complexity of the symbolic % sequence % %%%%%%%%%%%...
4e3faf3d8694c1f071bcbae126f2fd9971bd807123cc6252057571f701f8f742
MATLAB
1,086
36
function [node,elem,face]=s2m(v,f,keepratio,maxvol,method,regions,holes) % % [node,elem,face]=s2m(v,f,keepratio,maxvol,method) % [node,elem,face]=s2m(v,f,keepratio,maxvol,'tetgen',regions,holes) % % volumetric mesh generation from a closed surface, shortcut for surf2mesh % % author: Qianqian Fang (fangq <at> nmr.mgh.ha...
528821090e8fee005d8887315b4bd7eba0e3908510b384ed4186ce34b604d91d
MATLAB
1,087
27
%{ # all slices of each stack after corrections. -> stack.StitchingVolume --- x : float # (px) center of volume in a volume-wise coordinate system y : float # (px) center of volume in a volume-wise coordinate system z ...
553b6d6c3deab734dcae6c827515641fd595b3b9e4fa30d55beef87c14fb1f0d
MATLAB
1,087
26
function [pval, realrho, realpval, nullrho] = cs_pvalvsNull_spearman(data1,data2,permno,wsname) %% This script was build based on the original script by Aaron Alexander-Bloch & Siyuan Liu, pvalvsNull.m, 2018-04-22 % written and edited by Christina Stier, 2022 % Calculate the p-value of correlation between two surface ...
6a9f512bf3688e072e4ac50e031434febe704c3029e9b6da9d954891d213de5b
MATLAB
1,087
30
function [verbose] = tapas_physio_plot_create_hrv_regressors(sample_points, hrOut,... hr, t, crf, convHRV, delays,samplePointsOut, convHRVOut, verbose) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here verbose.fig_handles(end+1) = tapas_physio_get_default_fig_params(); set(g...
6ccd4f82c12597e907fd6f7839d25fb399162f494bb4ce153af6f73f5a5bf2cb
MATLAB
1,087
37
function this = analyze_rois(this, maskArray, keepExistingRois) % Extracts roi data for given (cell of) masks and compute its statistics % % Y = MrImage() % Y.analyze_rois(inputs) % % This is a method of class MrImage. % % IN % maskArray (cell array of) binary MrImage % keepExistingRois if true, ne...
1ac948d11e3a4849c0b34a4bf7bc2b99fea1f0c9526e615ea8ed3e9af00f2dad
MATLAB
1,088
40
% http://matlaboratory.blogspot.co.uk/2015/04/introduction-to-psychometric-curves-and.html function [coeffs, stats, curve, threshold] = ... FitPsycheCurveLogit(xAxis, yData, weights, targets) % Transpose if necessary if size(xAxis,1)<size(xAxis,2) xAxis=xAxis'; end if size(yData,1)<size(yData,2) ...
90d502ca347da39bcc73b05f0c23e1cc45ecf1780e6ad1594f4787cde8ee23b1
MATLAB
1,089
36
% listStandardBasisFunctionNames.m % Georg Oeltzschner, Johns Hopkins University 2022 % % USAGE: % allMets = listStandardBasisFunctionNames % % DESCRIPTION: % This function returns a cell array of standard metabolite and % macromolecular basis function names. It will look up the list of VALID % names via 'listValidBasi...
94cfe8f52af38793ff1d5feb6057d6646a70b9cab8decaba4c609d55620e2264
MATLAB
1,090
44
function [high, low, high_err, low_err, T] = hilo_one_event(bstruct, ... pstruct, thirdrew_arg, event) %%plot response aligned to event in high versus low blocks %%input: %ratlist = which rats to run through on at a time %pstruct = aligned photometry data by rat %bstruct = aligned behavioral data by rat sem = @(xx...
1a1dce027fe7b0cdf91035a4a3911eb1dcbf568f5aaf0239d79d1afd4d0d7771
MATLAB
1,091
49
classdef MrPlots < MrCopyData %Abstract class to create fancy plots from multiple other class objects % (e.g. boxplots of rois) % % % EXAMPLE % MrPlots % % See also % Author: Saskia Klein & Lars Kasper % Created: 2014-07-01 % Copyright (C) 2014 Institute for Biomedical Engineering % Universit...
308e1f0b6fa0cb54e96217d3da375420737a22a8d16a49e9879846a8088cb9af
MATLAB
1,091
36
function w = tapas_physio_gausswin(L, a) % vector of discrete Gaussian window % % w = tapas_physio_gausswin(L, a) % % IN % L number of sampling points of gaussian window % a alpha parameter: 1/std of gaussian, measures width of % fourier transform of gausswin % Th...
b8822be4571bd36a4a396c67887dcc0ebff745dd8adb0ddde8a3c2afa31ee0eb
MATLAB
1,091
39
function [R,D] = breadthdist(CIJ) %BREADTHDIST Reachability and distance matrices % % [R,D] = breadthdist(CIJ); % % The binary reachability matrix describes reachability between all pairs % of nodes. An entry (u,v)=1 means that there exists a path from node u % to node v; alternatively (u,v)=0. % ...
e39f3dd803048f1fab60dddd70ce589a49848bc7f2372a39e69c2c0d02f239cc
MATLAB
1,091
43
function [all_SU,all_S,all_index] = reduce_index(index,S, SU, goods) % reduces the size of the SU struct to only include a subset of cells. all_SU = {}; all_S = {}; %all_pt = {}; %all_behEvents = {}; all_index = []; for i = 1:length(goods) S_goods(i) = index{goods(i),4}; end these= unique(S_goods); Snum = 1; count...
10e43151a39bbf2d07d59ed591591b3dd38cab16e6a90555a8ebd58ea46ac3ab
MATLAB
1,092
53
clear,clc fn_seq = 'SERO_example_sequence.seq'; % Basic settings dz = 1.75e-3; nPos = 50; ar = 4; % Hardware limits lims = sero_pulseq_sysLims_prisma(); % Sequence options opt = sero_pulseq_SERO_opt(); opt.bMax = 1.4e9; opt.nShot = 1000; opt.TE = 70e-3; opt.Nx = 120; opt.Ny = 120; opt.FOV = opt....
34b7d6884ecfc0faf5b250e95188a09f8913941f9828942cb0c24906391e0106
MATLAB
1,092
35
function test_permuanova1 %TEST_PERMUANOVA1 Unit tests for permuanova1.m. % © 2018-2023 Mick Crosse <crossemj@tcd.ie> % CNL, Albert Einstein College of Medicine, NY. % TCBE, Trinity College Dublin, Ireland. % Generate test data rng(42); x = randn(30,5); group = 1:5; % Perform one-way ANOVA [p1,Table1,stats1] ...
9389ea642c7e47628c6cfb418740927eee183b6d100c2c730a2bcf7bf3783572
MATLAB
1,092
36
%{ vis.MovieClip (lookup) # clips from movies -> vis.Movie clip_number : int # clip index --- file_name : varchar(255) # full file name clip : longblob # %} classdef MovieClip < dj.Relvar methods ...
ba75498ffa4b8e86f23fba0428a11dbb8c2748dae6b17f2a5baace150614683a
MATLAB
1,092
31
% load all sessions in spread sheet session_name = []; % either provide a .isxd file name, or leave blank to read from excel file crop_x_offset = 100; % in pixels, from the left of the raw image crop_y_offset = 100; % in pixels, from the top of the raw image dcrop = 600; % image size after cropping and before down...
3e426119484a9438a434b5810e170e03a444c17edb9f4a2ce032b2cb423f7b42
MATLAB
1,093
39
%% get_set_qsm_myQSM(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 ...
dc3d55823ff2e3ec5a41b6a4660bb0700f095f8346fc2aaed382250ab007821a
MATLAB
1,093
37
function yOut = getBinCenters(y, doLinear) % returns centers of the bin boundaries 'y' % if doLinear = true, then it finds the first and last bin center values % 'yOut' based on linear extrapolation of the inner bins % (c) Jiri, Jan12, Jan13 if nargin < 2 doLinear = false; end yC = nan(1,length(y)-1); for n = 1:...
41251d0f0980efc2bc1b3254ae4145951e16179ab26899c828a539ee4527a23d
MATLAB
1,094
56
function BC = createBC2D(meshvar) % function BC = createBC2D(meshvar) % Creates a boundary condition structure from a mesh structure % for a 2D mesh. The boundary conditions on all boundaries are Neumann; % The index of each boundary condition is defined as: % 1: Dirichlet % 2: Neumann % 3: Mixed % % SYNOPSIS: % % % PA...
4f5c64fa8f3366e0a391784be3cdff69691529b419dc80642d4caece4f1ec50e
MATLAB
1,094
23
function writeTransformixToElastixFile (inputFileName, zSpacing, labelFileName) if (~isdeployed) addpath ('../cellCounting/'); else zSpacing = str2double(zSpacing); end elastixScalingFactor = [0.05 0.05 1]; visualizationSpacingFactor = [1 1 zSpacing] * 1e-3; %millimeter units in mha fp = fopen (inputFileName...
5cf9d17dfc9f99f3db00f3da762c6a7fe9293dbb63e6fc62be6fb6ddad688f86
MATLAB
1,094
30
function [activationPattern] = transform_toActivationPattern(X,beta) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Transform weights derived from linear models to activation patterns using % algorithm shown by Haufe et.al., 2014. % % Arguments: % X: Feature matrix (sample x featu...
7d511e1e101459a4c45d70532ed3455870174127a7191010d8d2742363047181
MATLAB
1,094
39
function [results] = analysis01A(config) % Runs analysis01A: Evolving populations of reservoirs by selecting for % minimum prediction loss, or maximum psi to examine the relationship % between emergence and prediction performance. % set a unique random number generator seed! rng(config.seed) % turn struct input into...
acb2f2fb064f589b44a1fee79f46f076041eec14396d588452c13b8a0110568e
MATLAB
1,094
31
% Demo simulation clear all; close all; clc; %%Randomly generated parameters % tsteps = 1800; %4 per day, 7 days for 40 weeks = 1120 tsteps = 300; Pm = rand(); %Between 0 and 1 Pp = rand()*0.015; %Between 0 and 0.015 bv_str = 1-sqrt(rand()); %Between 0 and 1 wm_str = (1-bv_str)*...
711486289690d016cc93da449c8b39358a253148cf587cf085a8d037404d35b1
MATLAB
1,095
69
function [S, D, T, V] = sero_srr_generate_structure(z, iters) %generate line phantom if nargin < 1 z = 50; iters = 1; end S = zeros(z,iters); D = zeros(z,iters); V = zeros(z,iters); T = zeros(z,iters); n_obj = randi(7,[iters,1])+3; for i = 1:iters w = zeros(z, n_obj(i)); p = randi(z, [n_obj(i)...
246c816dacf55e9122a477f6ffd2c4d83d5823b4f282b904e7a1707e120ab1d2
MATLAB
1,096
36
function namesPhysContrasts = tapas_physio_get_contrast_names_default() % Returns cell of defaults names for phys contrasts used e.g. in reporting % % namesPhysContrasts = tapas_physio_get_contrast_names_default() % % IN % % OUT % % EXAMPLE % tapas_physio_get_contrast_names_default % % See also tapas_physio_repor...
26614743846db3b4a44ee25bf631f5123ca8d72b2d14a11cb1cbac9e487f044d
MATLAB
1,096
39
function iLastDimension = ndims(this) % Returns Number of last non-singleton data dimension of image % % NOTE: For a [nX,nY,1,nVolumes], this would return 4, and is thus % different from Matlab ndims % % Y = MrImage() % iLastDimension = Y.ndims() % % This is a method of class MrImage. % % IN % % OUT % % EXAMPLE % ...
d4e8a7594948e025e3a248d074e310c0b64af3b5944beebc58841a7cff7f71dd
MATLAB
1,096
31
function output = decode(kinematics, neurons, tBins, ROIs, kinematicField, neuralField) % Fit instantaneous regression % Format kinematics outcomes = kinematics([kinematics.locked]); % Subselect to desired time period for tr = 1:length(outcomes) outcomes(tr).data = cat(2, outcomes(tr).(kinematicField)(tBins, :)); ...
0323aa0d3c9a0647ae7d7ede856ee43304a8776a1859439ae6bcef2f0e59fe59
MATLAB
1,097
50
function [ptheta] = tapas_sem_prepare_gaussian_ptheta(ptheta) %% Precomputes things that might be needed afterwards. % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2016 % np = ptheta.ndims; dtheta = size(ptheta.jm, 1)/np; LN2PI = log(2 * pi); njm = tapas_zeromat(ptheta.jm); % Comput...
46dcb13a3d62381e13d809d23bda2046d633f875d40584344ad8cbb169bb0a9b
MATLAB
1,097
28
function pstruct = tapas_ehgf_binary_pu_tbt_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2024 Anna Yurova, Irene Sophia Plank, LMU University Hospital; % ehgf adaptation based on the function tapas_hgf_binary_pu_tbt_namep by Rebecca La...
067c5844e56ec159d63c9cc2ad83a7116e240782bc2bfc8154d46126beeceae2
MATLAB
1,098
30
function pathName = tapas_physio_simplify_path(pathName) % Simplifies path name string by replacing all relative paths in it, i.e. ..\, .\ % NEW version, used Matlab's dir functionality % pathName = tapas_uniqc_simplify_path(pathName) % % IN % pathName string with relative path symbols, e.g. % 'C:\b...
48c382d1f7a7bc98527328e35e27cf7530ba889f2e2cdb340053d6b44343fbfe
MATLAB
1,098
43
function GetRotateLabel(SphereSurf, Label, OutFile) L_SpSurf=gifti(SphereSurf{1}); R_SpSurf=gifti(SphereSurf{2}); NumV=size(L_SpSurf.vertices, 1); P=zeros(12, 1); %P(7:9)=1; P(4:6, 1)=2*pi*rand(3, 1); LM=spm_matrix(P, 'R'); P(4:6, 1)=2*pi*rand(3, 1); RM=spm_matrix(P, 'R'); LOldCoord=L_SpSurf.vertices; ROldCoord=R_SpS...
8bde4324cb97cfc8052412faae8c44d23992780509c27cc2a6cc19017cedfda5
MATLAB
1,098
36
function format = auto(object) switch class(object) case 'nifti' format = brca.format.nifti(); case 'char' % get extension (and remove leading period) [~,~,ext] = fileparts(object); ext = ext(2:end); % build list of extensions that work ...
ac67959addd6afb374d3a8968d8fb6060e499617e9eee296a7505d39d84b4c7c
MATLAB
1,098
30
%% addon_config % % Description: Addon script to incorporate new method to the SEPIA framework % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 12 June 2021 % Date modified: % % DO NOT change the variable names, update the variable value instead % %% main % This name will be used thorough the SEPIA f...
bec503c900f999e98a2ce4173eefb4fe543d857252a73394b952a3b241092e48
MATLAB
1,098
35
function pValue=pValueSynch(raster,repetitions) rasterShuffle=raster; x=0:1:size(raster,2); histTotal=zeros(1,size(x,2)); for j=1:repetitions for i=1:size(raster,2) % This is for permutations of spike times, preserving only spike count % threshShuffle(:,i)=datos(randperm...
c4ffb06db11dd3248969013e36adee2fc26c7eccd83f4686f0e44612a7a65a00
MATLAB
1,099
37
function [ntheta, ratio] = tapas_ti_propose_gaussian(otheta, ptheta, htheta) %% Makes a new proposal using a purely Gaussian kernel. % % Input % otheta -- Array with old parameters. % ptheta -- Priors. % htheta -- Parameters of the proposal distribution. The field % ...
d0959b80a00de6e5c125ea550f022e139554ee37458bff662417890771cc5163
MATLAB
1,099
27
function change_spectogram_contrast_Callback(hObject, eventdata, handles) clim_change = [0,0]; if ~isempty(eventdata) switch eventdata.Source.Tag case 'high_clim_plus' clim_change = [0, .1]; case 'high_clim_minus' clim_change = [0, -.1]; case 'low_clim_plus' ...
488e22bedf45507a5c5f9b69b8bf5df86e27ca3c24efb24d07d4ccfb6111dd20
MATLAB
1,100
29
function [dip, p_value, xlow,xup]=HartigansDipSignifTest(xpdf,nboot) % function [dip,p_value,xlow,xup]=HartigansDipSignifTest(xpdf,nboot) % % calculates Hartigan's DIP statistic and its significance for the empirical p.d.f XPDF (vector of sample values) % This routine calls the matlab routine 'HartigansDipTest' t...
ba76573f35aa9ae279b72c8212e9ca3e51a911eac458267663835706339592b8
MATLAB
1,100
45
classdef DropOut < dagnn.ElementWise properties rate = 0.5 frozen = false end properties (Transient) mask end methods function outputs = forward(obj, inputs, params) if strcmp(obj.net.mode, 'test') outputs = inputs ; return ; end if obj.frozen & ~isempty(obj...
3da58e0aa2491b8569a864b9c5b4ac8b144d5fca48e9db64d1c530f0c3cf564e
MATLAB
1,101
31
function CI = ci_t(data,percentile) % function CI = ci_t(data[,percentile]) % % Returns confidence intervals for the t-distribution for normally distributed data. % % Formula: CI = m +/- t_crit * (std / sqrt(N)) % where m is the mean of the data sample, t_crit is the critical value of % the t distribution, std is the s...
58f14a4fef1bc8218a314fdc78fac0b907ac365c7f2b585ce42301c8a9a8e4d3
MATLAB
1,101
22
%----------------------------------------------------------------------- function TMSRealignEW (TempScan) s={} ; v1=spm_vol(TempScan) ; for i = 1 : length(v1) s{i,1} = [TempScan, ',', num2str(i)] ; end matlabbatch{1}.spm.spatial.realign.estwrite.data = {s} ; matlabbatch{1}.spm.spatial.realign.estwrite.eop...
6e6d5d06740d49ff8ff68c62a602cfd03e97e33f17f0347b55970c341aae691a
MATLAB
1,101
54
%% Colormaps that are pretty awesome: DEMO2 % In this demo we will show how to supereasily use the new colormaps % % % this is an exampe of 4 colormaps that are being considered as the default % colormap in python's matplotlib lybrary. % % All of them look quite good and they dont have any official name, so at ...
93309f35243bd6525a1aba0e8e831b260d8d9591dadc4eaa8343ba65957fc1b9
MATLAB
1,101
33
function [frAlignedToStim, rasterBins] = getFrAlignedToStim(spikeData, allStimTimes, Params) %GETFRALIGNEDTOSTIM Summary of this function goes here % Detailed explanation goes here % Returns % ------- % frAlignedToStim : matrix % double of shape (numChannel, numTrials, numTimeBins) numChannels = length...
b23d76281f3698b9968e582c95a48f8d3b801d89e68ee4ba011c363f7ec5160e
MATLAB
1,101
38
function f = l1unitlength(m,dim,wantcaution) % function f = l1unitlength(m,dim,wantcaution) % % <m> is a matrix % <dim> (optional) is the dimension of interest. % if supplied, normalize each case oriented along <dim> to have L1 unit length. % if [] or not supplied, normalize L1 length globally. % <wantcaution> (op...
ff8beeb6866988df956ad607bfec45e15c8f551f044f52041bdffca91bc9ea8c
MATLAB
1,102
42
function [titl,tm,volinfo] = titlemarker(s) % % given cells with citation info (from citation_mca.m), gives title string % and title marker index % % title must begin with (year) volinfo = 'None.'; for i = 1:length(s) tmp = findstr(s{i},'('); if length(tmp) > 1, tmp = tmp(1); end tmp2 = findstr(s{i},')');if l...
2cd5bc177c8103c9cf0e2127e5b25dbe3d7abc7b2a533ca60f29821dbbbc5be3
MATLAB
1,103
45
classdef DropOut < dagnn_bc.ElementWise properties rate = 0.5 frozen = false end properties (Transient) mask end methods function outputs = forward(obj, inputs, params) if strcmp(obj.net.mode, 'test') outputs = inputs ; return ; end if obj.frozen & ~isempty(...
4e1681b1f81206d2834da957f1d6d43261017e4a8d228537fb7d3dbb97c10efa
MATLAB
1,103
39
function ox = ARFIT_adjph(x) % ADJPH Normalization of columns of a complex matrix. % % Given a complex matrix X, OX=ADJPH(X) returns the complex matrix OX % that is obtained from X by multiplying column vectors of X with % phase factors exp(i*phi) such that the real part and the imaginary % part of each column vect...
5e2d8e918c4cbe64089f43ddc5a18772f9dcc4557eb2ccb477a07e5a914262fc
MATLAB
1,103
45
function vl_test_imreadjpeg % VL_TEST_IMREADJPEG % Test basic file reading capability for t=1:6 files{t} = which(sprintf('office_%d.jpg', t)) ; end ims = vl_imreadjpeg(files) ; % Test reading a CMYK image ims_cmyk = vl_imreadjpeg({which('cmyk.jpg')}) ; ims = vl_imreadjpeg(files) ; assert(all(~cellfun(@isempty, ims...
8a34eb28b347fc91e5c856762841e832a37284cc25b9b104106c4ff2cb8b1e22
MATLAB
1,105
24
%% Computign core-cells for each stimulus and for full recording load('/home/octodon/Documents/MATLAB/FastEnsDet/4exps/4_exps_6_conds_concatenated.mat') load('/home/octodon/Documents/MATLAB/raster2Ens/Analyzing4Exp_FullRecording/v4_4_exps_ens_seq.mat') %% raster and ensemble sequence for stimuli ras_ind = cumsum(cat(2...
96ce122bf0151304a4b6e8002abb318f4b5a743d29c67ef2fb94bdbb343bc956
MATLAB
1,105
34
function offsetAxes(ax, offset) % this function 'despines' the x- and y-axes, letting them begin at the % first tick mark % thanks to Pierre Morel & undocumented Matlab % and https://stackoverflow.com/questions/38255048/separating-axes-from-plot-area-in-matlab % % by Anne Urai, 2016 if ~exist('ax', 'var'), ax = gca; e...
cd1c8192405e742874658a330838b1aaab78459f2aa2e0f6676054ecb9127973
MATLAB
1,105
38
function [modelITI, modelValue, ratTrial, modelRPE] = ... vanillaTD_perRat(A, modeltype, alpha, scalingfactor) % Simulate trial initiation time by block using a vanilla-alpha TD % algorithm. if nargin<4 scalingfactor = 0.48; fprintf('Using default scaling factor %.2f\n', scalingfactor) if nargin<3 ...
b1e0b31b50c6a0a9e17fade68daa89deaa74ea73450677966e9576a66714cee0
MATLAB
1,106
38
%Support function for essential_distMinAnglePair implementing Newton's search function [tMin,fMin]=essential_distMinAnglePair_dfNewton(m1,p1,c1,m2,p2,c2,tMin,tLow,tHigh) tolDist=1e-8; for i=1:100 % d=dfi(m1,p1,c1,tMin)+dfi(m2,p2,c2,tMin); % dd=ddfi(m1,p1,c1,tMin)+ddfi(m2,p2,c2,tMin); %The code below unrolls...
c3c7862ba0a5788bb51ed2ab78a9cfc14ea0dbaa48bf046ed7ecd20cb3fdc4b5
MATLAB
1,106
18
%----------------------------------------------------------------------- % Job saved on 08-Jul-2014 10:20:34 by cfg_util (rev $Rev$) % spm SPM - SPM12b (5672) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{1}.spm.spatial.realign.estwrite.data = {}; m...
1021f2afc5892bd057a2a923a1570ec9d8e6d7b4012e4d2117509c8bc89b8a0f
MATLAB
1,108
21
function pval_vec = fixed_paretotails_cdf(orig_paretotails, x) % WARNING: this function is used due to potential bug in MATLAB paretotails. % The lowest value produced by paretotails.cdf is ~ 1E-17 (regardless whether lower or % upper tail is taken). All lower values are truncated to 0. Directly usin...
11112115e7f062748e759fb2929240cf1bbe05b6d2805bab31758a303a4ef068
MATLAB
1,108
40
function [fitresult, gof] = createSpikeFitSimpleExp(tsFit, toFit) %CREATEFIT(TSFIT,TOFIT) % Create a fit. % % Data for 'untitled fit 1' fit: % X Input : tsFit % Y Output: toFit % Output: % fitresult : a fit object representing the fit. % gof : structure with goodness-of fit info. % % See also FI...
2455058a7e7f2f3b65f73b79d9d737ef727f8f53c44da71c803565576bdca95e
MATLAB
1,108
31
%% load libraries run('set_library_paths.m'); addpath(genpath(GBVS_PATH)); %% read in video, extract framewise activations vid = VideoReader(video_path); % could set this to 227^2, aka alexnet % but since the saliency map returns a value for every pixel, that's still HUGE % smaller could be 132^2, aka flynet resize_p...
32091c7d02d3ff909f375eeebe43ef99e14fb619e5825dda45fdd62acb584ba9
MATLAB
1,108
37
function plot2axes_signif_filled(xVals, hVals, pVals) % plots grey transparent bands of significant values % xVals = x-axis (e.g. time) % hVals = 0 (n.s.) or 1 (was significant) % pVals = p-values % (c) Jiri, Oct22 hVals = hVals(:); % column vector N x 1 pVals = pVals(:); % column vector N x 1 % xVals = trialsDa...
b2ebed43a7ef95ac966dbb3c40615548e13469272b381c5af01f6b3ec1b4d8c8
MATLAB
1,108
49
function cmap = fireice(m) % FIREICE LightCyan-Cyan-Blue-Black-Red-Yellow-LightYellow Colormap % % FIREICE(M) Creates a colormap with M colors % % Inputs: % M - (optional) an integer between 1 and 256 specifying the number % of colors in the colormap. Default is 64. % % Outputs: % C...
c120a763456f632127dab81ab45986d250f9c9cb36cd9df0bc8b48ace2f9f90c
MATLAB
1,108
56
function [x, y] = tapas_sem_predicted_delta_plot(time, congruent, ... incongruent, quants) %% Plot the predicted delta plots % % Input % time -- Vector of time. % congruent -- Vector of likelihood of congruent responses % incongruen -- Vector of likelihood of incongruent responses % % O...
cafbb6a8697d720f763145941926146ec40cfd3d0447dea8bb2bf1cef3a2e17a
MATLAB
1,108
41
function [waic, lppd] = tapas_waic(llh) %% Computes the Watanabe-Akaike Information criterion % % Input % llh -- An NxS array containing the samples of the % likelihood where N is the number of subjects and S % the number of samples. % % Output % waic ...
d2c7bcaf505192269ffbe103a76dc5ddb4f1c8f14235d8219d322f3a0a6ea3ea
MATLAB
1,108
36
function varargout=getChamberTime(basename) load([basename '.basicMetaData.mat']); load([basicMetaData.Basename '.sessions.events.mat']) load([basicMetaData.Basename '.cues.events.mat']) %% sesTime=sessions.timestamps; extIdx=find(strcmpi({basicMetaData.chamber.name},'CueAndExtinction')); FirstPip=min(cues.timestam...
f6adf174b62047034972d7b4876edf92d70716c914b5bbf1dcb8874da80fbc4e
MATLAB
1,108
61
function [err, snl, Nlines, strt, stp] = GetNextLine (s,n) % % [err, snl, Nlines, strt, stp] = GetNextLine (s,n) % %Purpose: % reads the nth line of a string % lines are separated by a new line character, of course % %Input Parameters: % s % % %Output Parameters: % err : 0 No Problem % : 1 Mucho Problem...
5994ecea62f8b8ecc37c568250b49dcd93b6b69159e070ab54ca743759fe894c
MATLAB
1,109
33
function residual = ComputeResidualGivenR2sFieldmap(te,r2s,fieldmap,s_cplx) magn = abs(s_cplx); phase = angle(s_cplx); % estimated T1w signal S0 % s0 = s_cplx(:,:,:,1).*exp(r2s*te(1)); s0 = magn(:,:,:,1).*exp(r2s*te(1)); % bug fix 20220920 % compute simulated signal shat = zeros(size(magn)); for kt=1:length(te) ...
770cf07a5ae65354e5205ea6f7c7012002bd8ffa8a165f54bdba7e05e0a65629
MATLAB
1,109
37
function x = gpml_randn(seed,varargin) % Generate pseudo-random numbers in a quick and dirty way. % The function makes sure, we obtain the same random numbers using Octave and % Matlab for the demo scripts. % % Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch 2010-07-07. if nargin==2 sz = varargin{1}; els...
799d57f7a71984a54e1868232a0f9acc15b613f8e6bae96c01baf789b35bd502
MATLAB
1,109
54
function y = matches_filter(filt,type,sz,vis,occ) %function y = matches_filter(filt,type,sz,vis,occ) % % test if a Hylid ground truth entry matches a scoring filter % % 8/14/2012 - Taylor C. Glenn - tcg@cise.ufl.edu if isempty(filt) y = true; return end y = false; for i=1:numel(filt) ...
d18369bff787435d48c706c336c7680eaf7688ca62e52f60df2ada9d5efece43
MATLAB
1,109
35
%% function [resnorm, residual] = ResidualGradientGivenQSM(chi,matrixSize) % % Description: compute residual adn residual norm of gradient given QSM % % Input % ----- % chi : QSM % matrixSize : image matrix size % % Output % ______ % resnorm : residual norm % residual : residual map...
ddc5f4925e952106f7a837252546b8e3ad6f6a4c0f53bfa333ebeac3fc42915f
MATLAB
1,109
31
function run_tier1() %% run_tier1() % % Description: runs the Tier-1 toolbox-free smoke test suite % (test/tier1_smoke/) and errors (non-zero exit under `matlab -batch`) if % any test fails. Used both locally and by % .github/workflows/tier1-smoke.yml. % import matlab.unittest.TestSuite import matlab.unittest.TestRunne...
21c0c70d14c41176f1b56c938926ffa0a48f2073c84f9c0684422deeb59b2a07
MATLAB
1,110
48
function beh=relabel_ma2sleep(beh, varargin) % function relabel_ma2sleep(beh,...) % relabel wake < minWakeDur (ma) to nrem/rem % ma adjacent to nrem will be nrem % ma interleaved to rem will be rem % remaining will be unchanged % % beh is n x 3 array % [startTime endTime stateID] % % default values % ...
c5abdd4103fe0a7e541d07138ff5a90a524a1fa207601712f24d56e7a467e2c7
MATLAB
1,110
29
function timestamps = Unshift(timestamps,intervals) %Unshift - The opposite of option 'shift' in <a href="matlab:help Restrict">Restrict</a>. % % USAGE % % timestamps = Unshift(timestamps,intervals) % % timestamps time stamps to unshift, must be provided in the first column % intervals each row is [...
b61eefaf23d0991dd787a8ff077a26d443d6d9d07f78a5dfbb852e6f52770c16
MATLAB
1,111
20
clear; close all; clc; % Get the metadata for a dataset from the HDF5 file h5disp('data_motor_unit.h5','/') % We can see that the dataframe is organized in 8 'groups' (muscle, hip position % and force level). Muscle = VM or VL, hip position = 90 or 180 degrees and % force level = 10% or 30% MVC. Each member'...
e8a5387fa9b6d5d2f374d89886e81965b473216719cbcc196487867130ffacab
MATLAB
1,111
46
function [u] = generateInput(T, n, system, checkInputs, varargin) % generates inputs from a number of random initial conditions and plots % them in the lorenz space. % Parameters % ---------- % T (int): length of the input samples % n (int): number of input samples % system (str): ...
513020096240f03d638196682573e14cfc073dca95b1bd08b843541a6dac4680
MATLAB
1,112
39
function [delaybins, delays_rats] = get_delays(ratlist, Bstruct, numbins) %run to find delay bins delays_rats = cell(length(ratlist), 1); for rat = 1:length(ratlist) ratname = ratlist{rat}; bdata = Bstruct.(ratname).SideOff; thesestages = cellfun(@(x) logical(sum(strcmp(x,... {'Proestrus',...
5a579e21d4af83dae10d647720ee540c0f6f794b13dab01ec34732c765feb556
MATLAB
1,112
37
function [K,dK] = covOne(hyp, x, z) % Constant (degenerate) covariance function, with unit variance. % The covariance function is specified as: % % k(x,z) = 1 % % hyp = [ ] % % For more help on design of covariance functions, try "help covFunctions". % % Copyright (c) by Hannes Nickisch, 2016-04-17. % % See also covFu...
f7978bcde14aefb60e4176562ee497fba85b7de440bff61af0867571f7a2d9f7
MATLAB
1,112
34
function brainSlices_prep2plot(params, channels, plotInfo) % brain slices plotting: prepares necessary data % channels = H.channels(i_sel) % (c) Jiri, Nov21 % based on plot_ieegChnlsInBrain.m %% plot brain slices? if ~isfield(params, 'plot_brainSlices') params_default; end if ~params.plot_brainSlices.plot_slices ...
50a42117ed58bff64c4779c85da8af1ef361adec3bd02b6ced542a91f5fe9299
MATLAB
1,113
43
function [cst X A B C] = test05(m, n) % function [cst X A B C] = test05(m, n) % All intputs are optional. % % Test case for the Euclidean space (classical nonlinear optimization). % We generate three matrices A, B and C and try to solve the Sylvester % equation AX + XB = C by minimizing the residual ||AX+XB-C||^2. % %...
5d4d32f9ad77e2297153d639f906343406c5a4edfb380c1049beb5e3e3ab9a8a
MATLAB
1,113
30
function saveResponsesAndTriggers(responseEvents, cfg, logFile, triggerString) % % saveResponsesAndTriggers(responseEvents, cfg, logFile, triggerString) % % % (C) Copyright 2020 CPP visual motion localizer developers if isfield(responseEvents(1), 'onset') && ~isempty(responseEvents(1).onset) ...
7775bb7c07a26a6a36beb29d0d8412c1120ecb2fe7e61055f3f8e7d27a023715
MATLAB
1,113
50
% One panel can manage multiple axes/graphics objects. % % 19/07/12 This example, and the multi-object functionality, % was added with release 2.5, and was suggested by user % "Brendan" on Matlab Central. % % (a) Create a layout. % (b) Create two user axes. % (c) Have them both managed by a panel. %% (a) % create ...
8edeea1dd89201f05419722f3f50a65c06c354c24fd1c0f68909e7a46fe6c6bb
MATLAB
1,113
37
function Change1D2Carray(f1d, decplaces, fc) % take a 1D file and write it out as a C arrary % f1d : 1D file name % decplaces: -1 use all precision % 0 ints % > 0 number of decimal places [err,v] = Read_1D(f1d); if (decplaces >= 0), v = round(v .* 10.^decplaces)/10.^decplaces; end fcid =...
96337e8601934b349fa52ca55238b86a65387b9da7210a83b5ebc99873630855
MATLAB
1,114
32
function [potentials,mask_index0] = computePotentials3D(D, meshstruct, M, RHSbc) % Compute potentials 3D % Define mask Nx = D.domain.dims(1); Ny = D.domain.dims(2); Nz = D.domain.dims(3); G=reshape((1:(Nx+2)*(Ny+2)*(Nz+2)), Nx+2, Ny+2, Nz+2); mnx = Nx*Ny*Nz; rowx_index = reshape(G(2:Nx+1,2:Ny+1,2:Nz+1),mnx,1); % main ...
f04a7249bd62384e107f4e4b413130ff36247159c1369d131c215ba4308be021
MATLAB
1,114
49
% modelRDMs is a user-editable function which specifies the models which % brain-region RDMs should be compared to, and which specifies which kinds of % analysis should be performed. % % Models should be stored in the "Models" struct as a single field labeled % with the model's name (use underscores in stead of sp...
0f290337180cd998ce325224803c6f186359ce2da2214150281ad5c4d638de79
MATLAB
1,115
42
clc; clear; % load analysis results res_dir = '/cbica/home/lihon/comp_space_recover/ABCD_comp/dl_prediction/pred_res_cog_abcc_bl_cv/non_dl_pnc_res'; dat_dir = '/cbica/home/lihon/comp_space_recover/ABCD_comp/dl_prediction/data_cog_pnc_cv'; num_r = 400; st_type = 'regional'; num_K = 3; ro_covars = 1; out_dir = [res_...
2e4cf5a7f3e45a027352aa574d0908753f7c06ca9bf252e87c0a2c1d67a5a0d5
MATLAB
1,115
45
function [chouts choutc] = dotdelay_frames(gs, scw, in) %function out = dotdelay(kernel, in) % % calculate linear responses of a system kernel to an input % % INPUT: % [kernel] = kernel N x D matrix where N is number of channels and % D is number of delay lines. % [in] = input N x S matrix where S is the...
6fcec078586ee0699f918990fea330a21238cfaa2c65e844464a6fedab34c391
MATLAB
1,115
33
% 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...
72efaa4e4850aa18d9534eeae1c77c6fb03680fe332d0be3f56490d2f9bbd920
MATLAB
1,115
40
function opt=varargin2struct(varargin) % % opt=varargin2struct('param1',value1,'param2',value2,...) % or % opt=varargin2struct(...,optstruct,...) % % convert a series of input parameters into a structure % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2012/12/22 % % input: % 'param', value: the input para...
f39c373e35f9664fbfda39f670cdb75584cf8cc95bff06b0d60e4e65c2852861
MATLAB
1,115
44
function [W ,Ydim, Xdim, Dtau] = get_estimated_weight(Model,parm,wmode); % return Weight matrix from 'Model' % [W ,Ydim, Xdim, Dtau] = get_estimated_weight(Model,parm,wmode); % W : Weight matrix : 2D-matrix [Ydim x (Xdim * Dtau)] % Dtau : time embedding dim % Ydim : Output space dim % Xdim : Input space dim % ...
f73470b2b68c44155a17f520c87df78dd76fb55508516dbd5b01a880142b81ac
MATLAB
1,115
28
function RGBim=mat2RGBimage(mat,cols,clims) % Given a matrix mat, a colormap cols, and colorscale-limiting values % clims, this function returns an RGB image RGBim in which the mat is % displayed using the colormap, such that the first color in cols maps onto % matrix value clims(1) and the last color in cols maps ont...
92b81f8fec36e595b1ded92d832318c08f1c5a5dc3d93a7130283fd8604f8b2e
MATLAB
1,116
28
function r = RandomIntervals(n, sumDuration) %RandomIntervals - generates n random intervals from 0 to 1, covering a total of 'sumDuration' % % EXAMPLE % % Generate random surrogate ripple events % nRipples = size(ripples.timestamps,1); % totalRippleDuration = sum(diff(ripples.timestamps,[],2)); % totalRecordingDurat...
c3e769918294617028b6863955f3ab891448d99079552fc8bc912d6a52080c13
MATLAB
1,116
37
function [K,dK] = covZero(hyp, x, z) % Constant (degenerate) covariance function, with zero variance. % The covariance function is specified as: % % k(x,z) = 0 % % hyp = [ ] % % For more help on design of covariance functions, try "help covFunctions". % % Copyright (c) by Hannes Nickisch, 2016-04-17. % % See also covF...