sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
22dd5c5974134b3fde565c3bdb415ccd30b0925ada5595b2d1006090ef25f8fc
MATLAB
746
31
function test_permuztest %TEST_PERMUZTEST Unit tests for permuztest.m. % © 2018-2026 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,20); m = 0; sigma = 1; tail = {'both','right','left'}; for i = ...
57a47359c4727d953dedbe9c67915c269dedcbfdb33fbc4f08d2a352c664215d
MATLAB
746
31
function test_permuztest %TEST_PERMUZTEST Unit tests for permuztest.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,20); m = 0; sigma = 1; tail = {'both','right','left'}; for i = ...
e2d4606a7dcbe3e414e8ed5eb3c401b86cb457c3a3b3929406ad56d5ecdbc5bf
MATLAB
747
43
function [num, num3, ax1Pos, x, y, x2, y2, yNew, y2New] = setThirdAxis(refAxes, av, md) ax1Pos = get(refAxes,'position'); set(gcf, 'currentAxes', refAxes); % Get the normalized x-y coordinates of the means [x,y] = dsxy2figxy(gca, 1, av(1)); [x2, y2] = dsxy2figxy(gca, 2, av(2)); refLims = get(refAxes, 'YLim'); n...
0ad6b07f6e08e90dca2aa60a7b76df121ed41d065de627c7011faa318b25c911
MATLAB
748
31
function hnew = outlinebounds(hl, hp) %OUTLINEBOUNDS Outline the patch of a boundedline % % hnew = outlinebounds(hl, hp) % % This function adds an outline to the patch objects created by % boundedline, matching the color of the central line associated with each % patch. % % Input variables: % % hl: handles to lin...
7f318d288b7181a61a92707d0a5e5e6c308fd20c5db8b24a4cbd26c792e062f1
MATLAB
748
25
function [ratname,session,tetrode,unit] = cellid2tags(cellid) %CELLID2TAGS Convert cell IDs to separate tags. % [RATNAME,SESSION,TETRODE,UNIT] = CELLID2TAGS(CELLID) parses CELLID % string to RATNAME, SESSION, TETRODE and UNIT strings. % % See also CELLID2FNAMES. % Edit log: BH 6/23/11 % Convert cell ID if...
08320d50727bd315635c289a79159f7178eda148abee9e50b4e74e361ced5510
MATLAB
749
26
%% Fig5 % set working paths statdir=[Pathnew,'Forgithub\Code']; savedir=[Pathnew,'Forgithub']; Pathnewplot=[Pathnew,'Forgithub']; cd(Pathnewplot) load([Pathnew,'Forgithub\Data\Gretna_results\Subset1\gretna_results_subset1.mat']); load([Pathnew,'Forgithub\Data\Network\Subset1\Matrixallpar500FN_subset1.mat']); ...
8f6d6d0c55bb4503b6e6636ba296e8ad2a08639f0946b48f25bdcf7a669a9ed5
MATLAB
749
33
function faceGrad = gradientTerm1D(phi) % this function calculates the gradient of a variable in x direction % it checks for the availability of the ghost variables and use them, otherwise % estimate them, assuming a zero gradient on the boundaries % % SYNOPSIS: % faceGrad = gradientTerm1D(phi) % % PARAMETERS: % % % ...
bee98c51ef1d44167e9c7093f3e637d477deb9102e9e41961a4d6cfd31c4695f
MATLAB
749
33
function str_out = str_splitSortDelWM(str_in, delimiter) % splits string to cell array based on delimiter '/' % sorts alphabetically % removes any occurances of 'wm' % cats again to string % (c) Jiri, Aug22 if nargin < 2 delimiter = '/'; % default end if isempty(strfind(str_in, '/')) str_out = str_in; %...
7579bf9197cc095d8641df630564e1e5d5c8df27c6a1a0ae019e6505dc420bff
MATLAB
750
26
% plotSettings % Returns a structure of plot settings for the pSFT toolbox function plot_settings = plotSettings() %% Font settings plot_settings.font_type = 'Helvetica'; plot_settings.axes_label_font_size = 14; plot_settings.axes_tick_font_size = 13; plot_settings.tick_length = 0.020; plot_settings.line_width = 1...
7684b381b1d75fd4331ad66d42e1bbf609c4f079e726377bf9fad22b8c77b53a
MATLAB
750
27
% Wrapper for BilinearSampler block: % (c) 2016 Ankush Gupta classdef BilinearSampler < dagnn.Layer methods function outputs = forward(obj, inputs, params) outputs = vl_nnbilinearsampler(inputs{1}, inputs{2}); outputs = {outputs}; end function [derInputs, derParams] = backward(obj, inputs, p...
f821c4bc187d6310fb4e268fe73490dbc2ed9d97bece92d1156970267e17dd1f
MATLAB
750
28
function xyz = getSelChnlsMNI(params, dataTag) % loads header H and finds the used channels and returns their MNI coors % in case of bipolar reference, returns mean of the 2 bipolar channels MNI % (c) Jiri, Feb17, Nov18 if nargin < 2 dataTag = 'resp'; end %% load header structure 'H' load(params.storage.cacheFil...
0d81970d7af629272c1850d87fec7121496c4e6f62aba2e2fed8317f75d1707f
MATLAB
751
25
function varargout = covGaboriso(varargin) % Wrapper for Gabor covariance function covGabor.m. % % Gabor covariance function with length scale ell and period p. The % covariance function is parameterized as: % % k(x,z) = h(x-z) with h(t) = exp(-t'*t/(2*ell^2))*cos(2*pi*sum(t)/p). % % The hyperparameters are: % % hyp ...
2e23a3525a0caf44996c07de4b07d1c9bea331f9219469cc9b0f02b5d78fb0b2
MATLAB
751
32
function S = sero_srr_fit2data(T, tr, b, do_t1, do_v, W, te) % function S = sero_srr_fit2data(T, tr, b, do_t1, W, te) if nargin < 7 te = []; end if ~do_v T(:,4) = 0; end switch do_t1 case 0 % No T1 effects T1W = double(tr>0); case 1 % Simplistic T1 effect T1W = 1-exp(-tr./T(:,3)'); ...
594681cd336b0ca2270493203e5d4e3ce4450f7f4ed23645e4b34e1a949d6678
MATLAB
751
28
%% % Load the MRI data, correct the transformation matrix, and save as NIfTI files %% addpath '/fieldtrip-20240110/' %add fieldtrip to the MATLAB path ft_defaults mri_files = dir([main_path '/Dataset/*mri_anon.mat']); subids={}; for j=1:148 subids{j} = sprintf('RSID%04d',j); end for k = 1:length(mri_files) m...
9b203a62996d0ef676dd5667871d1357165329b10306d6b122a51e5a6404637a
MATLAB
751
19
function [pvec, pstruct] = tapas_condhalluc_obs2_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2016 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Pu...
e1053be0220b9e6cb13e917561ba9ec1c0106f455a48937dfabab4dbff4a1eb4
MATLAB
751
22
function [sigma, baseline] = findsigma(trace, blperiod, blfraction) % Find the standard deviation sigma of the baseline from a calcium % recording in vivo. Assume that the trace contains at least %blfraction of % baseline segments of length 'blperiod' that contain no transients and % therefore accurately represent ...
fff2486a8dcfdf1ff0f990fe6e6312c81f80cf878fabb4aafe56c05766624f5c
MATLAB
751
29
function tapas_BLT_runITI(params, iTrial) % tapas_BLT_runITI shows the Fixation Cross % % About: % Coded by F.Petzschner 19. April 2017 % Last change: F.Petzschner 19. April 2017 % Show Cue Screen('DrawTexture', params.screen.window, params.text.imgiti, [], params.screen.fit, 0); Screen('Flip', params.screen.window...
07fde86e0f65ff6e7e871ca41af98d181e05b93d5e1dcd6bcae1aaa5096f8df2
MATLAB
752
28
function [complete]=colorvarmap(mphase,mvar,filtopt) % plot a phase colromap modulated by variance of phase nmvar=zeros(size(mvar,1),size(mvar,2)); complete=0; clsc=load('smooth-cool-warm-table-float-1024-zn.txt'); clscale=clsc(:,2:4); c=clscale; % normalize variance between 0 and 1 nmvar=1-(mvar-min(min((mvar))))./r...
e182d58b6aadd4042c4699c4f00e5c70691e39b4fb492ea03743d10e34c9d481
MATLAB
753
27
% Wrapper for BilinearSampler block: % (c) 2016 Ankush Gupta classdef BilinearSampler < dagnn_bc.Layer methods function outputs = forward(obj, inputs, params) outputs = vl_nnbilinearsampler(inputs{1}, inputs{2}); outputs = {outputs}; end function [derInputs, derParams] = backward(obj, inputs...
f302c5e96f06f247aa87ea6a2fe0b539f279451f05d6c09ff9669d21405d933c
MATLAB
753
34
% function e = MS_rms(y); % % e is the l2-norm of row vector y, for a n-by-m matrix e is the n-by-1 column % vector which is the l2-norm of the n rows of y.; % % Michael Small % michael.small@uwa.edu.au, http://school.maths.uwa.edu.au/~small/ % 3/3/2005 % For further details, please see M. Small. Applied Nonlinear Tim...
38b23db2d6c9f75264adfc3260b71103ebd944b79c217b81c18f650534b36ea6
MATLAB
754
18
function [pvec, pstruct] = tapas_gaussian_obs_offset_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2018 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU Genera...
65321f5a784fa7b9d1e6b5abdfb5e4a7f58342c4c059eb24f822335e9744698b
MATLAB
754
35
function plot_confusion_matrix(C,last_is_unlabeled,class_labels) %function plot_confusion_matrix(C,last_is_unlabeled,class_labels) % % plot a confusion matrix with overlayed numbers % % 10/31/2012 - Taylor C. Glenn - tcg@cise.ufl.edu if last_is_unlabeled class_labels = [class_labels 'Unlabeled']; normC =...
4a5150bf4380de3da8f607e1a3e8d61644f12f09102c4a4d665f0c4480717d00
MATLAB
755
24
%{ # clips from movies animal_id : int # id number session : smallint # session index for the mouse area : enum('A','POR','P','PM','AM','RL','AL','LI','LM','V1') # area name scan_idx : smallint...
f303e8606268181b059ebc63310f431d576a8a5441ccc25e399cb3c54572e455
MATLAB
756
34
function [z,pint] = segcircintersect(p1,p2,cent,R) % intersection of line segment between p0 and p1, with circle % with center cent and radius R % p0 and p1 should be row vectors for the segment endpoint % returns z = fraction along segment where intersection occurs % and pint = intersection coords %% dx = p2-p1; p0...
a7ae2da08d197bfed268aca8b8c8c75dfc258c20ffa2270f15c175c966aa9c6e
MATLAB
757
37
function [llh] = tapas_sem_prosa_llh(y, u, theta, ptheta) %% Computes the likelihood of the data. % % Input % % y -- Observed behavioral data. A structure with fields 't' times and 'a' % action % u -- Experimental input. A structure with fields: 'tt' trial type, either % prosaccade or antisaccade % ...
ffaf40515bd9439df5b2dab862397c99b5f0c5b3aefbc806e23305de490a2a4b
MATLAB
757
26
function versionPhysio = tapas_physio_version() % returns version number of this copy of PhysIO % % versionPhysio = tapas_physio_version() % % IN % % OUT % % EXAMPLE % tapas_physio_version % % See also % Author: Lars Kasper % Created: 2018-10-19 % Copyright (C) 2018 TNU, Institute for Biomedical Engineering, % ...
032807af67ade3aaeb8e2a5546894cb9c894d2686390df3fc03625e67680f68c
MATLAB
758
46
function [f,g] = NetVis_Jtilda2d(x,y,n) % does estimation of the repulsion forces % using RANK and ROTATE algorithm % Code provided by David Smith N = length(x); if nargin < 3 n = 10; end multfactor = pi/(n*4); % Initialization: xrank = zeros(N,1); yrank = zeros(N,1); p = pi/(2*n); [~, xind] = sort(x); xrank(xin...
16247fb9d34a1593ab27a5909ff4a6675db7bf965c9c998ba9ab2c1e6441276f
MATLAB
758
26
function [filter] = tapas_uniqc_raised_cosine(f, T, beta) % creates a raised cosine window for frequency domain filtering % % USE % [filter] = tapas_uniqc_raised_cosine(f, T, beta) % % IN % f [nr_samples x 1]; frequency vector % T [scalar]; 1/BW at FWHM of the window % beta [scalar]; roll-off fact...
278f981f5ba4b9c2007f3d4766aad1795604c8fdacd5fb0145c930ddb55a3934
MATLAB
758
25
% eeg_icalabelstat - show some stats about IC label % % Input: % EEG - EEGLAB dataset % threshold - threshold for belonging to a category (default 0.9 % corresponding to 90% % % Author: A. Delorme function eeg_icalabelstat(EEG, threshold) if nargin < 1 help eeg_icalabelstat; return; end ...
3ca06e9ca32766a237531b5bbe8fd6a4f4f7b5c5a34a3160edf2d43a89aa010b
MATLAB
758
26
function [ d_sec,times_sec ] = d_assemblies( Pks_Frame,sec_Pk_edos ) %LCFeb14 %Genera un arreglo de primitivos y un arreglo de tiempos para cada par %d_sec [edoa,edob] %time_sec [frame edoa] d_p=find(sec_Pk_edos>0); d_n=size(d_p,2)-1; d_sec=zeros(d_n,2); times_sec=zeros(d_n,1); for dai=1:d_n if sec_Pk_edos(d_p(dai...
eff170a318bc7031392ed6ee0532245a21c1fa7f3fbef0b128dd2d536044c173
MATLAB
758
18
function [pvec, pstruct] = tapas_softmax_mu3_wld_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2018 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Pu...
8561287dcdee09632432d1dacec1a14d3946cfbb54b83b5e94d6784f87cd913f
MATLAB
759
31
function fn = tapas_physio_get_filename_from_id_philips(fileID, dirRaw, ext) %searches for matching filename with fileID in dirRaw % % output = get_filename_from_id(input) % % IN % fileID e.g. 8 % dirRaw folder with raw files % ext {'.nii'} file extension % OUT % % EXAMPLE % get_filename_from_id % % S...
48fcc025f5b0cc86b4322cd4a1494f19ebb54649f94b69240a25ab978f0882a8
MATLAB
761
22
% M2HTML Toolbox - A Documentation Generator for Matlab in HTML % Version 1.5 01-May-2005 % % M2HTML main functions. % m2html - Documentation System for Matlab M-files in HTML. % mdot - Wrapper to GraphViz's <mdot> for dependency graphs. % mwizard - Graphical user interface for m2html. % private - Inte...
d84536f69e41386c24b817560f2b5777001ffec5290ffd98ccb9cd3ecd50e17b
MATLAB
761
25
function sqnorm = multisqnorm(A) % Returns the squared Frobenius norms of the slices of a 3D matrix. % % function sqnorm = multisqnorm(A) % % Given a 3-dimensional matrix A of size n-by-m-by-N, returns a column % vector of length N such that sqnorm(i) = norm(A(:, :, i), 'fro')^2. % % See also: multiprod multitransp mul...
43b3d9ba4a7dc36ddb50938bf5f7004597c604b3ecaa8c5ff4a930a1bc0bce06
MATLAB
762
25
%{ # quantal size in images -> reso.Quality -> shared.Field -> shared.Channel --- min_intensity : int # min value in movie max_intensity : int # max value in movie quantal_size : float # variance slope...
de233c009b362ff04e11d85ae6e3b0bd2ffd3a9c8e339641240c18734a00a3de
MATLAB
762
25
%{ # quantal size in images -> meso.Quality -> shared.Field -> shared.Channel --- min_intensity : int # min value in movie max_intensity : int # max value in movie quantal_size : float # variance slope...
ed89c6a4d53af6f31d81c38063cc00f950215aeec852f3abc460f9814c0c69d8
MATLAB
762
37
function cb = colorbar_range( clim ); %Sets the colour limits for SurfStatView. % % Usage: cb = colorbar_range( clim ); % % clim = [min, max] values of data for colour limits. % % cb = handle to new colorbar. a=get(gcf,'Children'); k=0; for i=1:length(a) tag=get(a(i),'Tag'); if strcmp(tag,'Colorbar') ...
22e6b779aad7ca7f9ade226d8f0070c178706c96c7f8ee94c1e7ccaf8da6e7c7
MATLAB
763
22
function initParams(obj) % INITPARAM Initialize the paramers of the DagNN % OBJ.INITPARAM() uses the INIT() method of each layer to initialize % the corresponding parameters (usually randomly). % Copyright (C) 2015 Karel Lenc and Andrea Vedaldi. % All rights reserved. % % This file is part of the VLFeat library a...
d4a5887a1b66a7704dab8fd3948e2299a9c23287ac3bd79c7e1d6be1c804f6a1
MATLAB
763
31
function osp_onGit( ~, ~) %% osp_onGit % Callback function on git button click. Visits GitHub Schorschinho. % % % USAGE: % osp_onGit( ~, ~ ); % % % % % AUTHORS: % Dr. Helge Zoellner (Johns Hopkins University, 2020-01-16) % hzoelln2@jhmi.edu % % CREDITS: % This code is based on numerous f...
ea0a2f30907f38689e4fc70df6dbc9776c1b1fac535c3a5e76f3e13e7f57a016
MATLAB
763
25
function exel = sero_pulseq_posandb2excutionlist(posi, sthi, bval, dz) % function exel = sero_pulseq_posandb2excutionlist(posi, sthi, bval, dz) % posi = position indices % sthi = slice thickness in number of voxel indices % bval = shot-wise b-values in s/m2 with arbitrary scale % dz = step distance in meters % Numbe...
898d8a772fc471dcf39b053d04e90711fb42c39ecd8c19cbd21277505c41e7ab
MATLAB
764
18
function [pvec, pstruct] = tapas_rw_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 General Pub...
a0d6aec0cffce4d63135a0ed34abdd0710aae113c304e2391649744618dd8e88
MATLAB
764
20
function gen_ssvkernel_reference() % Ground truth for the ssvkernel port. Reads fixed PSTH-sample inputs % (ssvkernel_inputs.mat: tin + x_big/x_mid/x_small, pooled from real analyzed % channels) and runs MEA-NAP's ssvkernel.m on each, saving y/optw. % Regenerate with: matlab -batch gen_ssvkernel_reference addpath(genpa...
b56f135bed9ef9e66f4efdd882032085f4412986e5963208647cdd701e872bb1
MATLAB
764
44
function simpleExamples % % clf % % subplot(2,2,1) % notBoxPlot(randn(20,5)); % % subplot(2,2,2) % notBoxPlot(randn(20,5),[1:4,7]); % % subplot(2,2,3) % h=notBoxPlot(randn(10,20)); % d=[h.data]; % set(d(1:4:end),'markerfacecolor',[0.4,1,0.4],'color',[0,0.4,0]) % % subplot(2,2,4) % x=[1,2,3,4,5,5]; % y=randn(20,len...
a2a10bad048a68a2f6673965f026149fb10f5738cf7abc7c976dda0ee293e182
MATLAB
765
21
function lambda = resolve_default_lambda(lambda, X) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % resolve_default_lambda returns the default 1/nTrain lambda when the % model parameter does not specify an explicit value. % % Arguments: % lambda: User-specified lambda. Empty means use th...
af4d1aeb5d1a6b6010a8686c72d0d679656306951b953d72dfb95b4e04e7c077
MATLAB
765
28
function renameLayer(obj, oldName, newName, varargin) %RENAMELAYER Rename a layer % RENAMELAYER(OLDNAME, NEWNAME) changes the name of the layer % OLDNAME into NEWNAME. NEWNAME should not be the name of an % existing layer. opts.quiet = false ; opts = vl_argparse(opts, varargin) ; % Find the layer to rename v = ...
c17b3515926e2024e92b75b4a74cbe7ddc9a5abf0d7c94cd22359400697b3163
MATLAB
765
21
% Figure 3 (Saccades in social hierarchy) % The two scripts generate the components of Fig. 3 in the paper % separately for the BLA and CMA nuclei of the amygdala, respectively. clear all;close all grand_average_SACC6z_BLA close all;clear all grand_average_SACC6z_CMA % Figure 4 (Joint Attention and Gaze-Follow...
d1bcc7541b01e530d9c5da6d247a914c4ab61271583f1ac81f4bb40115a2238d
MATLAB
765
33
function measure = radius2measure(radius, dim) %RADIUS2MEASURE Compute the measure from the radius. % % DESCRIPTION: % radius2measure computes the area or volume (collectively called the % measure) from the radius. % % USAGE: % measure = radius2measure(radius, dim) % % INPUTS: % radius - Radius [...
30a954af8bfa194c5538d5afc80287761025a34e3cfb63247fd37b5673b2b395
MATLAB
766
23
function [cfg, isDefault] = checkParameter(cfg, fieldname, default) % Helper function to set default parameters if necessary % % function [cfg, isDefault] = checkParameter(cfg, fieldname, default) % % Checks if a field with name fieldname exists in structure cfg. If not, or % if it is empty, sets it to default, o...
49be0a9db4594d0af1eb588d5e9b44b2c82b1b5d5f131fa3acd1e142375286ad
MATLAB
766
20
% (C) Copyright 2020 CPP visual motion localizer developpers function [conditionNamesVector, CONDITON1_INDEX, CONDITON2_INDEX] = assignConditions(cfg) [~, nbRepet] = getDesignInput(cfg); conditionNamesVector = repmat(cfg.design.names, nbRepet, 1); conditionNamesVector = conditionNamesVector(cfg.design.bl...
545c87d02b5163b73f56d61ca65cf89d2d72f243a8b6aa5ea42cdc22ac1cb2d9
MATLAB
766
33
function RHS = constantSourceTerm3D(phi) % RHS vector for a Explicit source term % % SYNOPSIS: % RHS = constantSourceTerm3D(phi) % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file % extract data from the mesh structure Nxyz = phi.domain...
844a2eb9310c704a3a316321bb2cc2a9249c9cebf1b732bcbb99665ab8631f9e
MATLAB
767
37
%% MOTIMUS fNIRS DATA PROCESSING %% % Ségolène M. R. Guérin % June 26, 2023 %% ----- PREAMBLE % Clear workspace and commmand window clear clc % Empty lib paths restoredefaultpath; % Load project lib and function paths addpath(genpath('lib')); addpath(genpath('matlab_functions')); % Get parameters params = motimus_g...
aa2521562a39f56f7b529c3d8089a98137a2a0a953617cac3b232c033fcfeca1
MATLAB
768
43
function [Sd] = zdeblank (S) % % [Sd] = zdeblank (s) % %Purpose: % removes blanks surrounding a word in S % % %Input Parameters: % S : a string % % %Output Parameters: % Sd : S without the surrounding blanks % % %Key Terms: % %More Info : % deblank, zdeblankall % % % % Author : Ziad Saad % Date : Tue S...
ecffe779ef4b9e1ef6b10cb621b01f02cd9c40230d92ff81804a9d3aa271c6c2
MATLAB
768
28
function [output_struct] = concat_cell_struct(event_frames) % concatenate data fields in the structures in a cell array into one structure if numel(event_frames) == 1 output_struct = event_frames{:}; return end fds = cellfun(@(x)fields(x)',event_frames,'UniformOutput',0); fds = [fds{:}]; fds = unique...
34432d5cd0ece9b5fabd4d76abbad2a307709a3d5b3f37bae580153f42c11427
MATLAB
769
30
function out = checkForCell(in,variable_type) if nargin<2 variable_type = 'numeric'; else if islogical(variable_type) %backward compatibility if variable_type==true variable_type = 'logical'; else variable_type = 'numeric'; end end end if iscell(in) ...
45869f6281808970e9bfbe269043c9ceb97ca8d3f6839d00a9420f235f43813d
MATLAB
769
24
function write_param_txt(param_map,ROI,txtfilename,transformscale) % % author EML % write parameter values in txt file for use in COMSOL if nargin < 4 || isempty(transformscale) transformscale = 1; end idx = find(ROI); if size(param_map,3) > 1 [Vx,Vy,Vz] = ind2sub(size(param_map),idx); % forma...
57f27c2c553caa7664bb342539e3ec6f734c9f79df4d89ff454e8b554542339b
MATLAB
769
31
function csd = CSD(lfp) %CSD - Compute current source density. % % USAGE % % csd = CSD(lfp) % % lfp local field potential <a href="matlab:help samples">samples</a> % % SEE % % See also PlotCSD. % Copyright (C) 2008-2011 by Michaël Zugaro % % This program is free software; you can redistribute it...
64307ffc407f5bc4b7bc4225533f1af4a691410ecb9606929d0612fbae272b7f
MATLAB
770
27
% [Generalized Eigenvalue De-Artifacting Intrument (GEDAI)] % PolyForm Noncommercial License 1.0.0 % https://polyformproject.org/licenses/noncommercial/1.0.0 % % Copyright (C) [2025] Tomas Ros & Abele Michela % NeuroTuning Lab [ https://github.com/neurotuning ] % Center for Biomedical Imaging %...
74db3609934fde5ea01254d960ba049570bce8f552ce866229fe510702ba9517
MATLAB
770
27
% [Generalized Eigenvalue De-Artifacting Intrument (GEDAI)] % PolyForm Noncommercial License 1.0.0 % https://polyformproject.org/licenses/noncommercial/1.0.0 % % Copyright (C) [2025] Tomas Ros & Abele Michela % NeuroTuning Lab [ https://github.com/neurotuning ] % Center for Biomedical Imaging %...
93a65cc17e44979dc506eb09c4397cfc2e2781b19d9648a1a35bc45fbd0a4c65
MATLAB
771
44
function BC = createBC1D(meshvar) % function BC = createBC1D(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...
d1971a1c093966aa71da6b3629dc768d2b37748394c1db0d4ef907a64feb1d7f
MATLAB
771
28
function ringRemoval(niinames) for k = 1:length(niinames), [pa na ext] = fileparts(niinames{k}); if strcmp(ext,'.nii'), im = nifti(niinames{k}); for i = 1:size(im.dat,4), v = double(im.dat(:,:,:,i)); v = ringRm(v,[1 3 10]); im.dat(:,:,:,i) = v; ...
e3a1a04fe696728e053e76bafc5f87df9735faebc482e6d5450c7f3e9482b6e6
MATLAB
771
21
function candoit = canGetPrecon(problem) % Checks whether a preconditioner was specified in the problem description. % % function candoit = canGetPrecon(problem) % % Returns true if a preconditioner was specified, false otherwise. Notice % that even if this function returns false, it is still possible to call % getPrec...
043a80f37d65ac165a74cba8195785b3e9979162fdce89ed950a94b3cf4b8914
MATLAB
772
29
%% sepia_read_edit_string(config_txt, str_pattern, action_handle) % % Input % -------------- % config_txt : variable contains config text % str_pattern : string pattern to be printed after algorParam parameter % action_handle : handle of the GUI popup % % Output % -------------- % val : (optional) value...
d40ddf425fb92e4a23b4a51c69e7521f74a5cf774c2372f5f49af3c989767f5f
MATLAB
772
22
function [m,dm] = meanWarp(mean, g, dg, hyp, x) % meanWarp - compose a mean function by warping another mean function m0. % % m(x) = g( m_0(x) ). % % The hyperparameter is: % % hyp = [ hyp_m0 ] % % This function doesn't actually compute very much on its own, it merely does % some bookkeeping, and calls other mean func...
f80dc16e01611961a8d5ec6ae34cf3cea3d3fadff299828e0b60a66f16b2cd74
MATLAB
773
19
%----------------------------------------------------------------------- function TMSsmooth (imgdir,kernal) s={} ; v1=spm_vol(imgdir) ; for i = 1 : length(v1) s{i,1} = [imgdir, ',' num2str(i)] ; end matlabbatch{1}.spm.spatial.smooth.data = s; % { % 'E:\test\Fun...
22147cb090c6d7dd933d5548d9cfb4809fc0cc9863affd72e1a5a32b1b36b788
MATLAB
774
27
function timecp() % Copy time stamp to a clipboard, for pasting comments inside functions. % SYNTAX %[output_arg1,summary]= timmecp() - use 1 if no arguments are allowed % % HISTORY % - 27-Jun-2020 00:33:34 - created by Radek Chrapkiewicz (radekch@stanford.edu) % - 2020-06-27 00:41:18 Radek - adapted for VIA ADD_init...
69642a77095a625bcb6de69dbfb1b9a36aabf90fe2dd4303280d9bb53178d291
MATLAB
775
27
function [da_rats, AUC_rats, yint_rats, slp_rats] =... DelayEffectAcrossRats_stages(ratlist, block, delaybins,... window, Pstruct, Bstruct, event, Stages) %Sorts response to SideOff by delay length %input %block = behavior block to use %numbins = number of delay bins da_rats = cell(length(ratlist), 1);...
9445589fd433df835a8729ac6f60e0abee12883803a5cfeee89e4fadc5981867
MATLAB
775
26
function TMSimgcomp(imgdir,type) img = dir ([imgdir,filesep,'*.nii']) ; Header = spm_vol([imgdir,filesep,img(1).name]) ; [jVol,jXYZ] = spm_read_vols(Header) ; if type==1 %%represent sum for i = 2 : length(img) Header = spm_vol([imgdir,filesep,img(i).name]) ; [jVol2,jXYZ] = spm_rea...
ad41babe7d51d6e0e79169db3bc69d36b80a1289351d657e8a2a2f41e7669313
MATLAB
775
35
function [sam_out] = sam_detector(hsi_img,tgt_sig,mask) % %function [sam_out] = sam_detector(hsi_img,tgt_sig,mask) % % Spectral Angle Mapper % % inputs: % hsi_image - n_row x n_col x n_band hyperspectral image % tgt_sig - target signature (n_band x 1 - column vector) % mask - binary image limiting detector operation...
25fdd076d897b12d5b30e2e8df6a66448cb9c3f01c36282ffd0c3362ee3d5532
MATLAB
776
37
function [] = test11() % function test11() % % Try out centroid function in Nelder-Mead solver. % % This file is part of Manopt: www.manopt.org. % Original author: Nicolas Boumal, Dec. 30, 2012. % Contributors: % Change log: % Pick the manifold n = 10; k = 2; % M = euclideanfactory(n); M = o...
7e62130e4d35b648f684bb17602764c949d5d5dd24b391dc46d6a826440b6b58
MATLAB
776
38
function overlaps = bbox_overlap(boxes1,boxes2) % Copyright (C) 2016 Hakan Bilen. % All rights reserved. % % This file is part of the VLFeat library and is made available under % the terms of the BSD license (see the COPYING file). x11 = boxes1(:,1); y11 = boxes1(:,2); x12 = boxes1(:,3); y12 = boxes1(:,4); x21 = boxes...
7ff5bf35c83d42c956a33e254029ff77be77fc51dd201f89453d392f68bf6851
MATLAB
776
26
function [SCc] = get_consensusSC(SC) % computes the group-level connectome across multiple structural % connectivity matrices by setting all edges that are non-zero in more than % half of the matrices to the average edge across subjects and all other % edges to zero. % INPUT % SC = numSub x 1 cell with NxN struct...
b470c8b9a8a7dc236ab22f5458f9862b9af759c38ee684c102b08f1c568935f1
MATLAB
776
20
function ts = ts2sec(ts) % convert 10 MHz counts from the patching program (ts) to seconds % return: timestamps converted to seconds for each sample in the ts % remove wraparound and convert to seconds starting at time zero rate = 1e7; % Hz ts = [0; cumsum(mod(diff(double(ts(:))), 2^32))] / rate; % Interpolate excl...
d67e9de5cf985facf47ff7ba35af59ec6c539236cf2ca875953136c0d8aae56c
MATLAB
776
38
function E = sero_pulseq_trb2pos(tr, b, dz) % function E = pulseq_trb2pos(tr, b, dz) % tr = position-wise repetition times in seconds % b = shot-wise b-values in s/m2 with arbitrary scale % dz = step distance in meters if nargin < 1 [~, tr, b] = sero_srr_conventional(0.15,1000,1,50); dz = 1.5e-3; spacing ...
ef8b96d68ca9e684325af037d73740e2a8a213aaea9632c6faf6c0cf98e4e2e6
MATLAB
777
18
function n = nspikespertrials(spiketimes, handles, wndw) %NSPIKESPERTRIALS Counts number or spikes on each trial in a session % used to determine if neuron is active enough to use for analysis % returns (n x 1) array with number of spikes, where n = number trials n = nan(length(handles.start), 1); %find trial spi...
0e8ee567f7813b6bcc6de331bdba6f074701b83acb288f57e3b20eadd032566b
MATLAB
778
26
%% Experiment with the cnn_mnist_fc_bnorm [net_bn, info_bn] = cnn_mnist(... 'expDir', 'data/mnist-bnorm', 'batchNormalization', true); [net_fc, info_fc] = cnn_mnist(... 'expDir', 'data/mnist-baseline', 'batchNormalization', false); figure(1) ; clf ; subplot(1,2,1) ; semilogy(info_fc.val.objective', 'o-') ; hold ...
ddb51bc52a32465243a2352e153e3a4d46c373125452eb5c1dd59e43098fb178
MATLAB
778
33
function lineExamples % % Mixing lines and areas and using different number of points % % in each group [note that the way notBoxPlot sets the x axis % % limits can cause problems when combining plots this way] % % clf % % subplot(1,2,1) % h=notBoxPlot(randn(10,1)+4,5,'style','line'); % set(h.data,'color','m') % h=no...
a5ad00ac930f3718bac82abe924104629fd95e416c7dbb9abf42498a7621ea17
MATLAB
779
20
function [hyperstack,metadata] = load_scanimage_data(fullFileNameDir) % Import the ScanImage Tiff Reader API import ScanImageTiffReader.ScanImageTiffReader; % Create the "reader" object reader = ScanImageTiffReader(fullFileNameDir); metadata = reader.metadata; % Get the number of channels numChannels = numel(get_SI_...
e25073018d7beca474c33825e8f9287f2b858f53120fabf1270ebb1f32ddbbf0
MATLAB
779
36
%% getCiclo(Enunciado) % % Regresa los ciclos del Enunciado. % % Enunciado = "string" % % %% function c=getCiclo(e) if ~ischar(e) error('MATALAB:getCiclo:InvalidArgument','Se requiere sólo una cadena.') end n_c=0; % número de ciclos v_e=fndVer(e); % vértices del enunciado for i=1:length(v_e) %-1 % busca...
29dbfbc539d26e85b9d98644145bb93f6ae3e14d9b01b0714c9b3df814d317c8
MATLAB
780
30
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % As implemented in: https://github.com/brain-networks/edge-ts/blob/master/main.m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear; clc; ROI_sig = readmatrix('time_series.txt'); ROI_sig = ROI_sig(:...
35ec8802e3768c838380b46db05a61a2b8453b1fbf724cf16100db3389bc32e6
MATLAB
780
31
% A special function to read Siemens' spectroscopy FIDs. function complex_fid = dicom_get_spectrum_siemens(fd) % advance the field to the appropriate place % in the file field_length = dicom_move(fd, '7FE1', '1010'); field_size = field_length / 4; % we can use fread to read data in as floats [fid, fid_size] = fread...
5e75b07ccff82c9c817b8fbd7aef27ae4b6261c96527fb55ba2f837502239bf3
MATLAB
780
33
function [err, Indx] = AfniXYZ2AfniIndex (XYZ, Nxx, Nyy) % % [err, Indx] = AfniXYZ2AfniIndex (XYZ, Nxx, Nyy) % % Returns the AFNI index of an AFNI voxel with coordinates XYZ % % XYZ : is the XYZ triplets matrix Nx3 % If the data in XYZ is not integers, it will % be rounded to the nearest integer. % % Nxx, Nyy : ...
b53453ab93216886c1f281ca51224f2e0c8681215598c23ffc06882cc6412126
MATLAB
780
28
function plotEC_plotband_2NN(FC, EC_info) % plotband of effective coinnectivity (e.g. DTF) for different classes % mean fover subj % FC = 3D: [t, clz, subj], may inlcude NaNs % (c) Jiri, Oct23 % plotband subj mean for clz = 1:size(FC,2) plotband(EC_info.time, nanmean(FC(:,clz,:),3), sem(FC(:,clz,:),3), EC_info.in...
f71217b64778db1e34139983bd37575693396561f94ae692b383c492b50dc7db
MATLAB
781
23
function intpos = interpolateMeshPos(MSH,NT) % get mesh cell positions interpolating over network edge paths intpos = zeros(MSH.ncell,NT.dim); for mc = 1:MSH.ncell %% ec = MSH.edgeind(mc,1); nc = MSH.nodeind(mc); if (nc>0) % nodal mesh cell intpos(mc,:) = NT.nodepos(MSH.nodeind(mc),:); ...
2c2b223149df6202649f04d55427be10e68032306de93bcd307c9cb28dad8fa9
MATLAB
782
12
%----------------------------------------------------------------------- % Job saved on 25-Jul-2014 15:21:23 by cfg_util (rev $Rev: 4972 $) % spm SPM - SPM12b (5556) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{1}.spm.spatial.coreg.estimate.ref = '...
7fd4ad1557e764e5db40ed641746a2bbbb70afc6b36a1afa9ac37951e526dfa2
MATLAB
782
36
function [realchi2,chi2p,sig,df,tab,yp] = nonparam_chi2(y,condf,nperms,varargin) % [realchi2,chi2p,sig,df,tab,yp] = nonparam_chi2(y,condf,nperms,[w]) % % weights should be mean = 1 if length(varargin) > 0, w=varargin{1}; else w=ones(size(y)); end [realchi2,df,tmp,tmp,warn,tab,e] = chi2test([y condf],'obs',w); n = s...
b5acad13d1ece2cc66a2231a389d872306e54f962f6e089951988e174ae8705d
MATLAB
782
40
function y = gammpdf(x,a,b) if nargin < 3, b = 1; end if nargin < 2, error('Requires at least two input arguments'); end [errorcode x a b] = distchk(3,x,a,b); if errorcode > 0 error('Requires non-scalar arguments to match in size.'); end % Initialize Y to zero. y = zeros(size(x)); % Return NaN if...
b79d4be9e2903d6b95b091aae34665467fdfc0cb91c381e9e3a102a1fd628d28
MATLAB
782
25
function y=surfing_afni_conjunction(x,dim) % Computes the conjunction along a dimension % % Y=SURFING_AFNI_CONJUNCTION(X,DIM) % INPUTS: % X P1xP2x...xPn array % DIM Dimension along which conjunction is computed % OUTPUT % Y Q1xQ2x...xQn array, where Qi=1 if i==DIM and Qi=Pi otherwise % A non...
d03b569bbaccd8f9bb6c8839b5b1cec477ebbe6bd2124724dd5ce9ac326e5c1b
MATLAB
782
32
function [ mff_reader ] = nmri_check_mff_reader( mff ) % [ mff_reader ] = nmri_check_mff_reader( mff ) % Will auto-determine the MFF reader to use if ~exist(mff,'file') error('Could not find mff=%s',mff) end xmlfile=fullfile(mff,'info.xml'); if ~exist(xmlfile,'file') error('Could not find info.xml=%s',xmlfile) en...
fbf114c4242921c1fc68d8700c55205d2c8012702ded98754c7d11e879b12c59
MATLAB
782
27
function value = getfieldi(S,fieldName) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % getfieldi is a case-insensitive version of MATLAB's getfield function. % It returns value from field from a structure. % % Arguments: % S = Structure from which value of field are requested. % f...
3957f63d2ae1ae7f485af7edbe079193b45e0f0240bfa7f006ad8c08ff4fc8d1
MATLAB
783
57
function [res, int_part, dec_part] = isint (v) % % [res, int_part, dec_part] = isint (v) % %Purpose: % obvious % % %Input Parameters: % % % %Output Parameters: % res : 0 it's not an integer % : 1 % % % %Key Terms: % %More Info : % % [res, int_part, dec_part] = isint (4.07) % [res, int_part, dec_part] = ...
c050621203d964a48d9bb6c445b7ac15c7f4ff626b4074ddf074dda645644536
MATLAB
783
15
%{ tune.DotRFMethod (lookup) # options for dot maping. rf_method : tinyint # method number --- onset_delay : float # response onset delay in msec response_duration : float # response window in msec rf_filter ...
6391a8d576f3e31c4a527bd144133601d368ef8971697687decf263d261d9900
MATLAB
784
23
function fear_relabel_pfcGamma(basename) load([basename '.basicMetaData.mat']) fprintf('%s start %s with date of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basename '.pfcGamma.events.mat']) load([basename '.pfclowGamma.events.mat']) pfcRipple=pfcGamma(4); pfcFastGamma=pfcGamma(1); pfcSlowGamma=pfcL...
180e3d66925269ac1818208c52c4c0391d01840cf5a16eb7f7d2eec9080eb500
MATLAB
785
23
%% Figure 5 S1 YOURDATAPATH = '/Users/hank/Documents/MATLAB/kaufmanlab/data/P1/'; savePath = [YOURDATAPATH '/' 'models' '/']; %% Load model outputs % sdeconv load(sprintf('%sall_regression,M1,angles,sdeconv', savePath), 'outputsM1_sd') load(sprintf('%sall_regression,S1,angles,sdeconv', savePath), 'outputsS1_sd') % rad...
c86530ed50fdc6a06f3c85dd03b87518758065bdd85e23e73c24ca355848db91
MATLAB
785
23
% 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...
f4d701fe321d773ab617c011414f0591b1ecade9cf7002d7eae3f766f20ddd03
MATLAB
785
33
function s=mergestruct(s1,s2) % % s=mergestruct(s1,s2) % % merge two struct objects into one % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2012/12/22 % % input: % s1,s2: a struct object, s1 and s2 can not be arrays % % output: % s: the merged struct object. fields in s1 and s2 will be combined in s. ...
204e35a7e5937df6690f265bf8f1ae11fbf686a14a257463089124afa110aa21
MATLAB
787
26
function [m,dm] = meanZero(hyp, x) %MEANZERO Zero mean function. % % Report number of hyperparameters % s = MEANZERO () % s = MEANZERO (hyp) % % Evaluation of m(x) % m = MEANZERO (hyp, x) % % Evaluation of function derivatives dm (w.r.t. hyp) % [m, dm] = MEANZERO (hyp, x) % % Call meanFunctions to ge...
6e7e9edbc52cf9759cc630163141848a54bcd10bfe69952fc73708ff585ccf21
MATLAB
787
14
function [ head_degree ] = getHeadDegree( x1, y1, x2, y2 ) %ÀÌÀüÁÂÇ¥¿Í ÀÌÈÄ ÁÂÇ¥¸¦ ±â¹ÝÀ¸·Î ¿òÁ÷ÀÎ ¹æÇâÀÇ °¢µµ¸¦ ±¸ÇÕ´Ï´Ù. head_radian = atan(... (y2 - y1)/... (x2 - x1)); % vector(1,0) À» 0 µµ·Î ±âÁØÀ¸·Î 90µµ±îÁö´Â Á÷°üÀûÀΠǥ½Ã°¡ µÇÁö¸¸ 270~360µµ »çÀÌ´Â ¸¶À̳ʽº °ªÀ¸·Î Ç¥½Ã°¡ µÇ°í % 90~270±îÁö´Â °ªÀÌ -90~90 »...
968f33df7d37544db77189f67a67ce4dac090145eec0a91d7f3e5242218a9d4d
MATLAB
787
12
%% This file specifies the Python environment and Checkpoint of QSMnet+ % qsmnet_dir = '/project/3015069.05/bids/code/QSMnet/'; % dir_net = fullfile(qsmnet_dir,'Checkpoints/'); % Specify LPCNN_HOME corresponding to the code from Github LPCNN_HOME = '/autofs/space/linen_001/users/kwokshing...
ab8cb361b1d769f5b1cdc7c6da16f336b86eb925ee7b0170293310a1e300d42b
MATLAB
787
34
function cellvar = reshapeInternalCell(MS, phi) % cellvar = reshapeInternalCell(MS, phi) % this function reshapes a vetorized cell variable to its domain shape % matrix based on the mesh structure data; it is assumed that the phi % does NOT include the ghost cell data as well. % % SYNOPSIS: % cellvar = reshapeInterna...
02f606f71fe2d53972a7f942447e4577d57ab4777f6102903423b7b7d1015d4a
MATLAB
788
21
function spikes_pertrial = spiketimes_pertrial(spiketimes, handles, wndw) %SPIKETIMES_PERTRIAL parses spike timings into different trials % %output: %spikes_pertrial: nt = length(handles.start); spikes_pertrial = cell(nt,1); %find trial spikes by searchign range between trial start and end/violation for j = 1:nt ...