sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
85344a405909149f73b7e7ef23c26f84e27d14d75730a1f995db94454fa4f637
MATLAB
1,274
66
function [] = plotNullModelIterations(met, met2, lagval, e, FN, Params, figFolder, oneFigureHandle) %{ Parameters ---------- met : met2 : lagval : int e : FN : Params : struct Returns ------- %} p = [100 100 1000 600]; set(0, 'DefaultFigurePosition', p) if ~Params.showOneFig figur...
c5fdf61062525d2306c6738a038c067bdcc45445653979da28f8d712f685c993
MATLAB
1,274
39
% SSE - Calculate sum of squared errors (SSE) % Computes SSE between measured and estimated time series. % % Syntax % sse = SSE(measured, estimated) % % Input Arguments % measured - Measured time series [time x 1] % estimated - Estimated time series [time x 1] % % Output Arguments % sse...
dcb8d85428034d518f4ee26adacb247a9b80384181351a58f3932aeb65714642
MATLAB
1,274
58
function [harddrives,options]=getHardDrives(varargin) % EXAMPLE USE WITH ARGUMENTS %[options]= getHardDrives() - use 1 %[options]= getHardDrives(arg1) - use 2, etc. %[options]= getHardDrives(arg1,options) - use 3 with options % % HELP % Fetches information about hard drives installed on the computer. % % HISTORY % - 20...
b751edd724cc02fb57b4b95511d6abac7ec8c252908bc56619fadfd0458a1710
MATLAB
1,275
64
function [z ,t] = delay_embed(x,tau,D,T) % Make time delayed embedding vector % [z ,t] = delay_embed(x,tau,D,T) % z(:,t) = [ x(:,t); x(:,t-tau); ...; x(:,t-tau*(D-1) ] % % --- Input % x : x(:,t) , t=1:Tsample [ N x Tsample x Ntrial] % tau : Lag time % D : Number of time delay % --- Optional Input ...
fa9dd22ff7a23bc8ada4dab6e4bd1e83ff3cce2c83d992f2e8abda84ce6b7c03
MATLAB
1,275
53
function newimg = image_resize(img,p1,q1,r1) % image_resize - resize an image using bicubic interpolation % % newimg = image_resize(img,nx,ny,nz); % or % newimg = image_resize(img,newsize); % % Works for 2D, 2D 2 or 3 channels, 3D images. % % Copyright (c) 2004 Gabriel Peyré if nargin==2 % size specified ...
6e0e1c7d73ee22869f11c482aa80140674ad18cc4b0e89ad417cb2e41765f3a6
MATLAB
1,276
35
function y = vl_nnspnorm(x, param, dzdy) %VL_NNSPNORM CNN spatial normalization. % Y = VL_NNSPNORM(X, PARAM) computes the spatial normalization of % the data X with parameters PARAM = [PH PW ALPHA BETA]. Here PH and % PW define the size of the spatial neighbourhood used for % nomalization. % % For each featur...
c10700a17cdd9fdcb6932a2b15e6c09ff8123f8c34d8c460c65e0c7184b97662
MATLAB
1,276
42
classdef nnnormalize < nntest properties (TestParameter) group = {2 3 4 5 6 8 9 10 11 12 13 14 15 16 17} sgroup = {2 3 4 5 6 7} end methods (Test) function basic(test, group) param = [group, .1, .5, .75] ; x = test.randn(3,2,10,4) ; y = vl_nnnormalize(x,param) ; dzdy = test.ra...
e8ec54c15ed9f0ba2be5d64c3f33158746bb1778275d65ccba0d404f4623ce1f
MATLAB
1,276
31
%----------------------------------------------------------------------- function TMSSliceTiming(TempScan,TR,Order,Ref) % TemImg = dir([DataDir,filesep,'*.nii']) ; % for i = 1 : length(TemImg) % TempScan(i,1)= {[DataDir,filesep,TemImg(i).name ',1'] } ; % end s={} ; v1=spm_vol(TempScan) ; for i = 1 : lengt...
de7cb4e01688414e9c994c3bcab9c022f0e40a40c3c307e2e0bcd65a983b85ad
MATLAB
1,277
66
% Circular ANOVA with significance calculated from % randomization method % % p = CircAnova(Th, Gp) % or % p = CircAnova({Th1, Th2, Th3, ...}) % % computes mean angles for each group and residual sum as % sum(cos(th-pred)) % % significance is calculated by randomizing groups % % CircAnova(..., nRands) specifies numb...
71b83dc257a33a8f12d04818bad18d92282ded6ee274e313db611e626897567a
MATLAB
1,278
80
% this function is used by some of the demos to display data function demopanel_minihist(stats, show_xtick, show_ytick) % color col = histcol(stats.source); % plot b = bar(stats.bincens, stats.percfreq, 0.9); set(b, 'facecolor', palecol(col), 'edgecolor', col, 'showbaseline', 'off'); hold on % mean x = mean(stats....
d21543fb8ef51f8eee879816d7af68d9fef7efc8922ba6ff2697deb1f71b8c7f
MATLAB
1,279
32
%{ tuning.DotRFMapPop (computed) # populate receptive field from Single dot stimuli -> tuning.DotRF ----- 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 : float # (f...
93e0166d79f43df4223f2db577558049f2912a5ff28ea52faddd98651c279fd7
MATLAB
1,280
52
function vec = lincomb(M, x, vecs, coeffs) % Computes a linear combination of tangent vectors in the Manopt framework. % % vec = lincomb(M, x, vecs, coeffs) % % M is a Manopt manifold structure obtained from a factory. % x is a point on the manifold M. % vecs is a cell containing n tangent vectors at x. % coeffs is a v...
14375a9beabb850f346c7a94dab883e74a93553658ba59c1df000ef32c978a52
MATLAB
1,282
47
function [v,data] = TMSReadNii(sub_dir,filter_str) % Modified from DynamicBC 201810Version if nargin==1 filter_str = ''; end flag = 0; [fpath,name,ext] = fileparts(sub_dir); if strcmp(ext,'.nii')||strcmp(ext,'.img')||strcmp(ext,'.hdr') if strcmp(ext,'.hdr') niiname.name = [name,'.img']; else ...
089089af42448bc6319d96f832a8a0b11951e5d03747487e7365cf19fede4835
MATLAB
1,283
44
% BATCH Datos Chema clear filenames filenames{1}='6continuousPRE2_HC'; filenames{2}='6continuousPRE2_PFC'; filenames{3}='12_ContinuousPOST3min55-60_HC'; filenames{4}='12_ContinuousPOST3min55-60_PFC'; filenames{5}='19_continuousLTP30_HC'; filenames{6}='19_continuousLTP30_PFC'; clear dirnames dirnames{1}='...
e02fb76a130dfc1b4d58f713e60cc75f199f2f010b008e14ebe40df819c9a377
MATLAB
1,283
49
function [pathtorepo,options]=getPath(varargin) % EXAMPLE USE WITH ARGUMENTS %[options]= getPath() - use 1 %[options]= getPath(options) - use 2, etc. % % HELP % Outputs the path to the MicroscopesRecordings repository % % HISTORY % - 20-05-07 15:41:41 - created by Radek Chrapkiewicz (radekch@stanford.edu) % 2020-06-15 ...
5cefe2be75b7e6313aa0bac95d3a67d80bbfda34e23623fc4e18a9e655126540
MATLAB
1,285
43
%% [height,bottom,width,left] = sepia_layout_measurement(nrow,rspacing,ncol,cspacing) % % Input % -------------- % nrow : number of rows in the panel % rspacing : spacing between rows, in normalised unit % ncol : number of functional columns in the panel % cspacing : spacing between column, ...
9ba5b636fe517cac577315191f83743a1d433c4412fd0703fe885e53a1e39513
MATLAB
1,285
72
function [X,Y,Z]=cylinder1(P1,P2,R,N) % % P1 - center of the first base of cylinder % P2 - center of the second base of cylinder % R - radius of cylinder % N - number of sectors of the base of cylinder if nargin<4 N=100; end P1=P1(:); P2=P2(:); P12=P2-P1; A=[0 0 1;1 0 0;0 1 0]'; B=[]; z1=P12/norm(P1...
e48131945491776b37f1ccc590e277d76fd04ca74abbb3dfc4ded9875de5f1e7
MATLAB
1,285
39
function [ subject ] = nmri_reroot_subject( subject, new_analysis_dir ) % [ subject ] = nmri_reroot_subject( subject ) % Will fix a subject struct that was moved to a new location / analysis % dir % % subject = subject struct (input=old, output=re-rooted) % new_analysis_dir = you can provide the new analyi...
e66a9d70adb77c108b7f7b050949c6b156ecaea5d96dbfc7b1c0062e1e90ed1b
MATLAB
1,286
42
function [dims,scales,bpp,endian,datatype] = read_avw_hdr(fname) % [dims,scales,bpp,endian,datatype] = READ_AVW_HDR(fname) % % Extracts the 4 dimensions (dims), % 4 scales (scales) and bits per pixel (bpp) for voxels % contained in the Analyze or nifti header file (fname) % Also returns endian = 'l' for little-e...
1cd7237a18be4ba79b6a0ccda8ebb8a062bbe8d9ffed71aeb822609093f57b6c
MATLAB
1,287
37
function [populations] = loadPopulations() % Loads all populations that were evolved in analysis 01A and returns them % in a handy format, sorted by Ctype, environment and optimization % objective. % get file paths paths = addPaths(); analysisName = 'analysis01A'; % intermediate storage variable: cell arrays of popul...
424c8da29568169710653c8f5f7ff0f107d9cbfb5daf5c4437d44412f93a9af8
MATLAB
1,288
33
% script to convert MP2RAGE images into T1 (R1) map estimates as suggested in: % MP2RAGE, a self bias-field corrected sequence for improved segmentation and T 1-mapping at high field % JP Marques, T Kober, G Krueger, W van der Zwaag, PF Van de Moortele, R. % Gruetter, Neuroimage 49 (2), 1271-1281, 2010 % % % addpath...
90b57879dc2758056d9980969b686a5e766ffbed0edac4730a48231c69a48846
MATLAB
1,288
58
function qDemo % a demo how to rotate a point around an arbitrary axis by using % quaternions % REMARK: % 1) enless loop, hit CTRL+C to break % % VERSION: 05.03.2011 % point to be rotated P = [ 0.1, 0.4, 0.4 ]; % vector around which the rotation will be performed u = [ 0.5, 0.5, 0.5 ]; % for camera purpose azimuth...
fa14ba4780d49f54d6da433427809fa055169439be594b0a1058288496ef49d7
MATLAB
1,288
41
function [links,topology,node] = dendhier(links,topology,node) % DENDHIER: Recursive algorithm to find links and distance coordinates on a % dendrogram, given the topology matrix. % % Usage: [links,topology,node] = dendhier(links,topology,node) % % links = 4-col matrix of descendants, ances...
5dc3ab564a1b6ff37e5f28a36900d1be46bbdcfc4b5fad1da0b29180210fb7bf
MATLAB
1,289
40
function rmShockNoise(sesName,rmRange) % remove noise around shock % shock file should be ~/data/Fear/triple/[sesName]/[sesName].shocks.events.mat % kk2 files shoukd be in ~/Desktop/[sesName]/probe[n] % here n=1~3 % % usage example % rmShockNoise('hoegaarden181115',[-0.1,5]) %% if ~exist('...
5ecf29af9120975e8c4fa2255059f3c2abf18b6302953b83b20950cf8a9b1d27
MATLAB
1,289
39
function gradientColorMap = tapas_uniqc_get_colormap_gradient(rgb1, rgb2, nColors) % creates colormap as gradient from one RGB value to another % % gradientColorMap = tapas_uniqc_get_colormap_gradient(rgb1, rgb2, nColors) % % IN % rgb1 [1,3] start color % rgb2 [1,3] end color % nColors number of colors to...
b2ce33257b634188a5b1b8c8006c99e4030010a5bee89de20ac07b4ae34b20de
MATLAB
1,289
50
function glm_flocINITIALSCREENING(ppdir,runix) % this is first-pass GLM for the screening session phase. % approach: assume HRF, condition split, no boots % define stimdur = 4; tr = 1; reps_per_run = 6; % load data data = {}; for p=1:length(runix) a1 = load_untouch_nii(sprintf('%s/preprocessVER1/run%02d.nii',ppdi...
7027edc1aa31c7a1fec4a5a7acfc00cf2c77063b49e5068d72c00d93473f9728
MATLAB
1,290
42
function varargout = plotband(x,y,ey,bcolor,transparency,varargin) % function plotband - plot graph with errorband % % syntax: h = plotband(x,y,ey,bcolor,line-properties) % % draws a graph centered to a band of deviations (e.g. standard error) % x: vector points on the x-Axis, where y is provided % y: vector, the same ...
8a0d4dc9723b6dc3ecc9e488ee6801936c16acbaf038ae2f83638074bf7e9cc5
MATLAB
1,290
47
function outputImage = flip(this, iDim) % Flips all elements of a given dimension and updates dimInfo.samplingPoints % % Y = MrDataNd() % Y.flip(inputs) % % This is a method of class MrDataNd. % % IN % iDim index of dimension to be flipped; default: 1 % % OUT % % EXAMPLE % flip % % See also MrDataNd perfor...
c4503e485c00a997da00b7d13edbb062e834931ba4bafa5b9411dc4573155c03
MATLAB
1,290
82
function [t, tr, b, w, pos] = sero_srr_sero_gen1(ts, n, a, z, in_seed) %Generate first generation SERO sampling scheme with predefined positions, %TR, b, w if nargin < 1 [ts, n, z, a] = sero_srr_default_image_pars(); [t, tr, b, w] = sero_srr_sero_gen1(ts, n, a, z); clf sero_srr_plot_sampling_stats...
868d126a9d157908a54678b49a944937819112ae62c653bc0af5881e6289549c
MATLAB
1,291
50
function [hi, lo, mix] = wtcurves_SS(A, varargin) %block 1 is test block. %block 2 = high adaptation block. %block 3 = low adaptation block. A.reward = convertreward(A.reward); rvec = 1:5; hi.wt = nan(1, length(rvec)); hi.er = nan(1, length(rvec)); lo.wt = nan(1, length(rvec)); lo.er = nan(1, length(rvec)); mix.wt ...
ba59948bcd1cffea58506dee8165afdbb46658ef8a8651b31dcecebd79066daa
MATLAB
1,291
43
%% #1: Run for: general, untreated case save_spatial_data = false; intervention.active = "on"; intervention.oligo_apop = 14; intervention.oligo_stop_my = 10; intervention.restore_oligos = "off"; intervention.new_oligo_times = 5760; intervention.oligo_properties = "off"; intervention.oligo_prop_times = 5760; int...
14444e5407ebe4e60c1690c01011359d550a19ef1b4156c332e6b4dc2733fb2d
MATLAB
1,292
39
function fh = tapas_physio_plot_rvt(ons_secs, sqpar) % Plots respiratory volume per time at sampling points, and filtered time % series built from % % fh = tapas_physio_plot_rvt(ons_secs, sqpar) % % IN % % OUT % fh figure handle % EXAMPLE % tapas_physio_plot_rvt % % See also % Author: Lars Kasper % Created: ...
43f2477cd36560e510062ad554248e79f8bf96a16152f94e24e323fee0455199
MATLAB
1,292
42
function i=centrotype(S) %function i=centrotype(S) % %PURPOSE % %To compute the centrotype of objects whose relations are %defined by similarity matrix S. Centrotype means the object that %is most similar to all the others, i.e., it should be close %to the centroid of the data set. % %INPUT % % S (matrix) NxN similari...
9e5cb758bd4cfd049a9da4864085b060cd3f5811bdd6ab2e72e98a30c4b4a777
MATLAB
1,292
55
function [mtmf_out,alpha_out] = mtmf_statistic(hsi_img,tgt_sig,mask) % %function [mtmf_out,alpha_out] = mtmf_statistic(hsi_img,tgt_sig,mask) % % Mixture Tuned Matched Filter Infeasibility Statistic % % inputs: % hsi_image - n_row x n_col x n_band hyperspectral image % tgt_sig - target signature (n_band x 1 - column ...
f5d4eb14cd8eae581d29972079cf3457e380d59d302aaab0c5b53dc8ac99a403
MATLAB
1,292
40
function grouped = Group(varargin) % Provide as many vectors as you want. They will be grouped in a matrix % in the same format as spikes are grouped ([values id]) % vector1 1 % vector2 2 % ... and so on. This is useful for creating grouped events. % % Copyright (C) 2018-2024 by Ralitsa Todorova % % This program is fr...
36f2f3f521153e0d60ce46b07547bae34fa3c4439272a5fea456e5b152836263
MATLAB
1,293
43
function lengths = trk_length(tracks) %TRK_LENGTH - Calculate the lengths of tracks % % Syntax: lengths = trk_length(tracks) % % Inputs: % tracks - TrackVis track group. For tracks all of the same length (i.e. % TRK_INTERP has been run), either structure or matrix form is fine. % % Outputs: % lengths...
08ae69f7d4903cba2d787095c1d1ab5eaefdd600cd2766a95be4f294dd064598
MATLAB
1,294
49
function [high, low, T, bhi, blo] = hilo_all_events(ratList, bstruct, pstruct,... thirdrew_arg) %%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 high = cell(lengt...
6cea85347b6b6cff08cbbc48ee6b8bc9da53d304bd9cefbd54f44fc39d7efa3d
MATLAB
1,294
50
function ft_lpfilter(input, TR, cutoff_lowpass, order) % Lowpass filter % % ft_lpfilter(input, TR, cutoff_lowpass, order) % % Inputs: % input - file name of time series. % TR - repetition time in s. % cutoff_lowpass - lowpass 1/cutoff frequency in Hz. % order - order of butterworth...
752bbcba98562df94c57930ad4b8bf4be3c2834fee4a3376a62756bbbed940d9
MATLAB
1,294
41
%{ # Average filterStatistics -> stimulus.MovieClip --- kurtosis : float # mean filter kurtosis mean : float # mean filter responses std : float # mean std of filters sparseness : float # mean popsparseness of filters nmean ...
b694f86250c312e6af45a5ba5a6b9405dd10bf7f2e0bef5bb74ae60b9d51fd40
MATLAB
1,294
38
function blockFixationPosition = setFixationPosition(cfg) % % blockFixationPosition = setFixationPosition(cfg) % % Compute the fixation position (center of the stimulation) for the MT/MST localizer % in a matrix of size ``nbBlocks`` by ``nbEventsPerBlock`` % % % (C) Copyright 2022 CPP vi...
f366c78eafddbfe8c89113600b01397bb0fc8c3c57a82794ad524f0d4e1b4755
MATLAB
1,294
49
function y = tapas_physio_maxfilter(x, n) % Computes maximum over sliding window as a filtered version of the input % % y = tapas_physio_maxfilter(x, n) % % IN % x signal % n number of samples in sliding window % % OUT % y max-filtered signal % % EXAMPLE % tapas_physio_maxfilter % % See also % Author...
33d13252e22b981b00da3abe296f8fbd25eb08b8d24819a37cfb9c3a34916b7a
MATLAB
1,295
34
clear all; clc; % % Add software, add DPABI before spm if ismac addpath(genpath(fullfile('..', 'DPABI_V8.1_240101'))); addpath(genpath(fullfile('..', 'REST_V1.8_130615'))); addpath(fullfile('..', 'spm')); elseif ispc addpath(genpath(fullfile('..', 'DPABI_V8.1_240101'))); addpath(genpath(fullfile('....
42fa467d4b599bbad84ac270a0719c6bcf2a02dce492012149bc778f9f7f1f45
MATLAB
1,295
23
function Data = UpdateData(Data, used_stimval, response, anstime, condition, depthcond, gpcond, signalD, signalGP) s = condition; %staircase Data.Data.PerCondition.StimVals{s} = [Data.Data.PerCondition.StimVals{s}; used_stimval]; Data.Data.PerCondition.Responses{s} = [Data.Data.PerCondition.Responses{s}; respon...
4dc43dd5c7d1c01fbf541bc3a4d144bb01ac2e8bb3ba50c0ea268960756e6aea
MATLAB
1,295
34
clear all; clc; % % Add software, add DPABI before spm if ismac addpath(genpath(fullfile('..', 'DPABI_V8.1_240101'))); addpath(genpath(fullfile('..', 'REST_V1.8_130615'))); addpath(fullfile('..', 'spm')); elseif ispc addpath(genpath(fullfile('..', 'DPABI_V8.1_240101'))); addpath(genpath(fullfile('....
5b2c873d43a9036b593fcc011552d8ac0e9a3334679ead6c507ab418f14d26a6
MATLAB
1,295
34
clear all; clc; % % Add software, add DPABI before spm if ismac addpath(genpath(fullfile('..', 'DPABI_V8.1_240101'))); addpath(genpath(fullfile('..', 'REST_V1.8_130615'))); addpath(fullfile('..', 'spm')); elseif ispc addpath(genpath(fullfile('..', 'DPABI_V8.1_240101'))); addpath(genpath(fullfile('....
a80b6c4463eaab2d59f3e3d68a63f5ceb72d34e6c2f4c29572d8024deedb7850
MATLAB
1,295
66
clc;clear;close all hold on axis([ 0 100 0 100]) set(gca,'YLim',[0 100]); set(gca,'XLim',[0 100]); set(gcf,'MenuBar','none'); % axis off; box on; set(gcf,'color','black'); colordef black; % set(gca,'LooseInset',get(gca,'TightInset')) % set(gca, 'LooseInset', [0,0,0,0]); set(gca, 'LooseInset', [500,500,500,500]); x_...
cad9b1b689338c99de59fee390d429b8f160a814ee673a077d4dbf3de99b8ddb
MATLAB
1,295
33
function getTriggers_init(params, flag) % initializes/allocates trigger labels to each session cache file % based on the flag % these variables are needed later to select the relevant trials % (c) Jiri, Nov16 for sess = 1:size(params.storage.sessionCacheFiles,2) if strcmp(flag,'trials_events') clear pred...
ed1f8432d0b333820850ac1993257c602e039031179133062f2889fce3532011
MATLAB
1,295
50
function ft_lpfilter(input, TR, cutoff_lowpass, order) % Lowpass filter % % ft_lpfilter(input, TR, cutoff_lowpass, order) % % Inputs: % input - file name of time series. % TR - repetition time in s. % cutoff_lowpass - lowpass 1/cutoff frequency in Hz. % order - order of butterworth...
fa9fce6a3def998df040761d74fc8b83491d6a1f715237babebac3afe43ecf9b
MATLAB
1,295
38
%{ # population map -> tune.DotRF --- 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 : float # (fraction of x) center of receptive field on y, from Gaussian fits sn...
3372c7b3dc861a2955cc14faa0cb3dc8036d6bad33e270e7f3cdbd34a5c29338
MATLAB
1,296
25
%{ rf.EyeFrame (manual) # eye tracking info for each frame of a movie -> rf.Eye frame : int # frame number in movie --- ismanual = 0 : boolean # TRUE if pupil was manually detected isblink = 0 : boolean ...
5f8d737dd8dc8d60f9d7e6a790de45aaeae005c6c125f4c51ecb60d015bd8520
MATLAB
1,296
39
% For the process of DSC-MRI % Youjie Wang, 2025-07-26. wangyoujie2002@163.com % params toolbox_dir = '/this/is/for/nipype/dsc_mri_toolbox'; % path to the DSC-MRI toolbox DSC_info = niftiinfo('/this/is/for/nipype/pwi_path'); mask_path = '/this/is/for/nipype/mask_path'; % path to the mask file TE = '/this/is/for/nip...
60449c81d5efa1d714bf6b21f235c0f182c7fb84016cac50f0cb62f2f264b2ac
MATLAB
1,296
42
function [parcel_stats, all_surf_handles] = Meta_Parcel_results(parcels, parcel_stats) % [parcel_stats, all_surf_handles] = Meta_Parcel_results(parcels, parcel_stats) % % Get results and images for parcels created in Meta_Parcel nparcels = length(parcels); fprintf('There are %3.0f parcels\n', nparcels); f...
d43d38d9b6b9caa69da5fa601f85d34f5b0b57d38a45f3847def9f5c230d645c
MATLAB
1,296
44
function surf = SurfStatAvSurf( filenames, fun ); %Average, minimum or maximum of surfaces. % % Usage: surf = SurfStatAvSurf( filenames [, fun] ); % % filenames = n x k cell array of names of files. % fun = function handle to apply to two surfaces, e.g. % = @plus (default) will give the average of the...
3f3da89408c958d4797284eb0c4fe59f88c2f4dae23804c547a1e2b495f1088a
MATLAB
1,297
40
function fpFile = tapas_physio_filename2path(filename) % Converts string (also within a cell) of filename in an absolute path, % leaves it unaltered, if it is one already % % output = tapas_physio_filename2path(input) % % IN % filename (cell) string of filename, with or without absolute path % OUT % fpFile ...
0a6f2c00ead116d1f3ac65cc080aa5b20f64524abd9072264c2f1427e48e632c
MATLAB
1,300
54
%% function u = ARLO(y,x) % % Description: Fast monoexponential fitting by auto-regression % Samples have to be evenly sampled (i.e. even spacing) % At least 3 samples are needed % Assuming time series in the last dimension % ref: Pei et al. MRM 73:843-850(2015) % e.g. for function y=exp(-x/u), u can be estimated by AR...
1a22d650786e42886f565e4b9b2764abff0d3488376919693793ce3d4c376a0a
MATLAB
1,301
52
function [rocky_out,blobber_out,detector_out] = score_hylid(hylid_struct,detector_img,blob_thresh,targ_filt,title_str,blob_figh,roc_figh) if ~exist('blob_figh','var') blob_figh = figure(); end if ~exist('roc_figh','var') roc_figh = figure(); end detector_out = hylid_struct; detector_out.Data = detector_img; d...
530d92fde07b52dae0f0afe47664bae2c755e825dd8bdfb1559a26aaa1748123
MATLAB
1,301
61
function varargout = plot(varargin) % plot method for GIfTI objects %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: plot.m 3556 2009-11-11 18:20:34Z guillaume $ % if ishandle(varargin{1}) % h = figur...
c757d4c4e49e17f59bddce51a6e6ace5a400ceafd35b4b786d7de6ec39075067
MATLAB
1,301
47
function [yc,yc_weighted,w] = nnrcalcy(neighbors_y,neighbors_distance,K) % version 2.0 - June 2016 % Kamel Mansouri % NCCT US EPA % mansourikamel@gmail.com % calc response on the basis of K neighbors yc = mean(neighbors_y); % old weighted version % if sum(neighbors_distance) > 0 % w = ones(1,length(neighbors_y...
3658bd8ff445fee436b1471fde1935342799e38b771d88eb6b2d90fe8e01b2c8
MATLAB
1,302
53
function [Q A] = test08(A) % function test80() % % Finds a proper rotation matrix Q such that QA = -AQ, where A is a % skew-symmetric matrix. % % See personal notes of June 12, 2012 % % This file is part of Manopt: www.manopt.org. % Original author: Nicolas Boumal, Dec. 30, 2012. % Contributors: % Change log: ...
3f5d39fe7969f362a91c78608ec9e2110265a1a4bcc4fd492ae74d009639b260
MATLAB
1,302
52
function fear_makeIcaCoactEvtFile(basename) % clear % basename='~/data/Fear/triple/achel180320/achel180320'; % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) %% [fPath,fNa...
cacceac64babd0e8d4046e6a009c6ff44e609a6cc2f1a1059a06dbb271f135a4
MATLAB
1,302
62
function [outputArg1,outputArg2] = PlotSubjectMeans(ResponseMatrix, TitleStr) if ~exist('TitleStr','var') % title parameter does not exist, so default it to something TitleStr = ' '; end % --- means & standard deviation per azimuth for this subject s_mean = mean(ResponseMatrix); s_std = std(ResponseMa...
3bb0681a5880cac38c98081c25ba6fa7baa1b72c2f786729ffbe9113a634e115
MATLAB
1,303
34
function [inputXr, inputEr, inputIr, inputTr] = get_mean_current(rate, rateX, weight_file, param) load(weight_file, 'presynIDX','presynIDE','presynIDI'); N = size(rate,1); M = size(rate,2); inputX = zeros(N,2); inputE = zeros(N,1); inputI = zeros(N,1); inputXr = zeros(N,M,2); inputEr = zeros(N,M); inputIr = z...
8e3f125c1f391378ddf4d41596b44222e8bb9fe099d2828ed7579524de0155eb
MATLAB
1,303
41
function c = tapas_align_priors(c) % Aligns c.priormus and c.priorsas with the contents of the explicit prior % definitions. % % Example: % >> c_prc = tapas_ehgf_config; % >> c_prc.ommu(2) = -2; % >> c_prc = tapas_align_priors(c_prc) % % --------------------------------------------------------------------------...
b5a8779338fd768e884632762a8a558c3bed70e90e15ebafcbb1d4a506223ceb
MATLAB
1,303
36
function outputs = loadClassifierAll(dataPath, datasets, model) % Wrapper over load---Classifier scripts to run models for all datasets % Loop outputs = struct('mouse', cellfun(@(x) x{1}, datasets, 'UniformOutput', false)); for dataset = datasets % Requires combined M1 and S1 struct, different from regression func...
f47b6309ebef48546a2425f892ebe5b91850d24c2b0bcec491e8906300ffec9d
MATLAB
1,303
48
function fhArray = plot_rois(this, varargin) %Plots Rois (different types, e.g. boxplot, time series) for all rois % % output = plot_rois(input) % % IN % selectedRois [1,nRois] index vector of cell in MrImage.rois, % or all (Inf) % default: Inf % % varargin for MrRoi.plot (...
fe494d74f2ea0d0fa12b5462ee63da118f4ba49fc3896acb2517267a8dc83b60
MATLAB
1,303
47
function [Zscore, Pvalue] = CompCoefs(r1, r2, n1, n2, tail) %========================================================================== % This function is used to test the difference between two correlation % coefficients. % % % Syntax: function [Zscore, Pvalue] = gretna_ztest_two_corrcoef(r1, r2, n1, n2, type)...
056b6ab3d072b51d99d6daa0e6c23d766b8e59adafd8c6e78aa0ff28174daf22
MATLAB
1,304
25
function TMSRealign (DataDir) TemImg = dir([DataDir,filesep,'*.nii']) ; for i = 1 : length(TemImg) TempScan(i,1)= {[DataDir,filesep,TemImg(i).name ',1'] } ; end matlabbatch{1}.spm.spatial.realign.estimate.data = {TempScan} ; % matlabbatch{1}.spm.spatial.realign.estimate.data = % { % ...
0839bdd51ec91b2702e67f4a4baab3d916c2441872063c548046738231fb71d8
MATLAB
1,304
51
function RDMsOut = concatenateRDMs(varargin) % RDMsOut = concatenateRDMs(RDMs1[, RDMs2[, ...]]) % concatenates a number of wrapped RDMs (RDM structures). % the main difference between this function and the similar one called % 'concatRDMs' is that this function requires the input to be wrapped RDM % st % CW 5-2010, 6-...
2deb7647ac70733fccac98a7be6cf4bf163247b0ea854156822914e01e47d25e
MATLAB
1,304
50
function [p alpha] = circ_vmpdf(alpha, thetahat, kappa, period) % [p alpha] = circ_vmpdf(alpha, w, p) % Computes the circular von Mises pdf with preferred direction thetahat % and concentration kappa at each of the angles in alpha % % The vmpdf is given by f(phi) = % (1/(2pi*I0(kappa))*exp(kappa*cos(phi-theta...
4a93ca823dfcb4e75ed35259648a1b36a901d2fad72bc4cc8004ee598558ec3b
MATLAB
1,304
42
function [RPE, AUC, Kappa] =... align_pdata_and_mdl(ratname, pdata, bdata,... BestFitEarly, BestFitLate,... auc1, auc2) % align_pdata_and_mdl - aligns model fits and photometry data % INPUTS: % ratname - rat ID % pdata - photometry data % bdata - corresponding behavioral data % BestFitEarly - Early ...
504cb57cd77dba9679ff7c01e16c41dea38bb3e77377056537c979b378849092
MATLAB
1,304
52
function qq = ppdiff(pp,j) %PPDIFF Differentiate piecewise polynomial. % QQ = PPDIFF(PP,J) returns the J:th derivative of a piecewise % polynomial PP. PP must be on the form evaluated by PPVAL. QQ is a % piecewise polynomial on the same form. Default value for J is 1. % % Example: % x = linspace(-p...
8b1bfdc37e752d25b53e59988f4d34b47e9af698cf7abadcea079eead5592c7b
MATLAB
1,304
52
function [token, remainder, quotient] = strtok(string, delimiters) %Modified version of STRTOK to also return the quotient % string = [quotient token remainder] %STRTOK Find token in string. % STRTOK(S) returns the first token in the string S delimited % by "white space". Any leading white space characters are i...
f350f4dd32c4aad7430dc8961d762e2f4acd8af386cba15669693682583c65eb
MATLAB
1,304
40
function osp_onZoom( source, ~ ,gui) %% osp_onLeftX % Callback function on process click on left x voxel direction button. % % % USAGE: % osp_onLeftX( ~, ~ ,gui); % % INPUT: gui = gui class containing all handles and the MRSCont % % OUTPUT: Changes in gui parameters and MRSCont are written ...
06d3eb054c2a78f6690601712aab9979b13c3d1deac430209750308eb87cab86
MATLAB
1,305
33
function X = unwarp_precision(XX) pxperline = size(XX,2); % pixel per line xy_conversionfactor = 477/512; % empirically found through calibration for my setup pxperline_new = pxperline*xy_conversionfactor; f_res = 7.91e3; % resonant scanning frequency linetime = 1/f_res/2; linedwelltime = line...
5396019c3086c82b3d249425fb3ca8938d1412464ff3becf7c0f7192d66816a1
MATLAB
1,305
36
function V = spm_write_plane(V,dat,n) % Write transverse plane(s) of image data. % FORMAT VO = spm_write_plane(V,dat,n) % V - data structure containing image information. % - see spm_vol for a description. % dat - the two/three dimensional image to write. % n - the plane number(s) (beginning from 1). If an en...
6d998b156b2b29607d85147df1905ceca3a6a68fbebb23a8904f234da4a8c104
MATLAB
1,305
47
clearvars load(which('MLEFit.mat')); [t123idx,sRow,sCol,concT123,rspT123] = prep_ds_data(); x0Vec = cMatrixMLE(t123idx); %% perform fitting on individual curves using previously generated distributions h = waitbar(0,sprintf('Fitting odor-ORN pair %d/%d',0,size(rspT123,3))); for ii = 1:size(rspT123,3) data = rsp...
838596013bed96432a73a14c7c0b43b04397f88141f17345a9481f7be815f387
MATLAB
1,305
57
function h=textInMM(Xpos,Ypos,String,varargin) %% targetPos=[Xpos,Ypos]/10; if length(varargin)==1 && iscell(varargin) Property=varargin{1}; else Property=varargin; end unit=get(gcf,'paperunit'); if ~strcmp(unit,'centimeters') set(gcf,'paperunit','centimeters') end paperPos=get(gcf,'paperPosition'); boxP...
a571ba5726d4413932c717e948b473e41879c5abef2ec4ceac3400b0bc9cb2a8
MATLAB
1,305
50
function result = PCA(data,param,result) % %beletehetõ hogy veszi e bementnek az eigenvektoroat, if existes téma %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % the data [N,n]=size(data.X); odim = param.q; %projection to q-dimension % calculating autocorrelation matrix A = zeros(n); me = zeros(1,n);...
b79793f676988bfde9090f642d6171c1cf8f1e7261666cdcab91a71d2f5d9b78
MATLAB
1,306
42
function [R, M] = timeClus(R, M, field) % Group trials by median of the desired timing field % Get times medFieldTime_L = nanmedian([R([R.goodDLC] == 1 & [R.LR] == 1).(field)]); medFieldTime_R = nanmedian([R([R.goodDLC] == 1 & [R.LR] == 2).(field)]); % Save information M.clusField = [field 'Clus']; cmapClus_L = [[0,0...
fe5ca59fe842b3c42f2227d1d8d3d853e53a0e19b3d462a8e90e42afe6155cf6
MATLAB
1,307
46
function [mat] = vec2sqmat(vec, format) % converts vectorized matrix back into square matrix format. % INPUT: % format (str) = structure of the matrix before vectorization (e.g. triu, tril, full) % get number of edges E = length(vec); switch format case 'triu' % get number of nodes by solving: 0...
02d0c54312c677470f5001fcfde8770458825fe845d75334875fb883e442545f
MATLAB
1,308
47
function [Fval sig f A t] = ftestmovingwinc(data,movingwin,params,p,plt) % compute Thompson f-statistic for each segment within a sliding window % Fval is a [num_window x num_freqs] matrix of f-values % sig is the f-value threshold corresponding to the desired significance level of p if nargin<5 plt = 'n'; end % ...
244eddebd459d643b4d9d09f6faaac7552cb482291fbc47796254e7bad8184b8
MATLAB
1,308
26
%{ vis2p.Experiments (manual) # Root table for two-photon experiments. Populated manually. -> vis2p.Mice exp_date : date # experiment date --- operator : enum('Dimitri','Manolis','Patrick','Cathryn','Shan') # m) experimenter's name mass=null : decimal(4,1) ...
6e0fa97fa2244af0d831a3a14f977a2bd1b481102d5c6ffb5b63f000bf4dd146
MATLAB
1,308
52
function analyzebehavior_nsd_filecheck nsdsetup; % loop over subject for p=1:length(allnsdids), allnsdids{p} % find all scan directories dirs0 = matchfiles(sprintf('%s/rawdata/*-%s-nsd??',nsddir,allnsdids{p})); % for each scan session for q=1:length(dirs0), dirs0{q} % get the session number from ...
859bba586fd7cd5a5cbb1cc3bed10cdc7cd04f19608051e6b4a89592cf378ce4
MATLAB
1,308
61
%% TE = readTEfromJSON(filenames) % % Input % -------------- % filenames : json file fullname(s) % % Output % -------------- % TE : echo times % % Description: % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 6 September 2018 % Date last modified: % % % function [TE] = readTEfromJSON(fil...
88c218927c608c87ada122d2d553ca916acb8c5194cb2953ea26e31076e321d3
MATLAB
1,308
60
function [l,d,perm] = mchol(A,mu) % [l,d,perm] = mchol(A,mu) % Compute the Gill-Murray modified LDL factorization of A, if nargin < 2 mu = 1e-12; end n = size(A,1); l = eye(n); d = zeros(n,1); perm = 1:n; for i = 1:n c(i,i) = A(i,i); end % Compute modification parameters gamma = max(abs(di...
fe67fb7fb4f1b18811b55235d0b0b4ee486f4bcac84207ac054837316787a423
MATLAB
1,308
47
function [yc,yc_weighted,w] = nnrcalcy2(neighbors_y,neighbors_distance,K) % version 2.0 - June 2016 % Kamel Mansouri % NCCT US EPA % mansourikamel@gmail.com % calc response on the basis of K neighbors yc = mean(neighbors_y); % old weighted version % if sum(neighbors_distance) > 0 % w = ones(1,length(neighbors_...
6f4b8d58d85657f08338fc4dfb55950591bacb462a28c2ec60253e32a906eb41
MATLAB
1,309
63
function BC = createBC3D(meshvar) % Creates a boundary condition structure from a mesh structure % for a 3D structured mesh. The default boundary conditions on % all boundaries are Neumann; % The values of each boundary condition are defined as: % BC.<position>. : % a, b, c, where % a*grad(phi).n + b*phi ...
7eae344b12beeb8e404ba54b98b25799fed9f361337fad9156e031b0d740e5e0
MATLAB
1,309
40
function osp_onLB( source, ~ ,gui) %% osp_onLB % Callback function on process click on left x voxel direction button. % % % USAGE: % osp_onLeftX( ~, ~ ,gui); % % INPUT: gui = gui class containing all handles and the MRSCont % % OUTPUT: Changes in gui parameters and MRSCont are written into ...
b815a0ea3ffdb3f3d21655f2609301c3e1fca0137b8b82d8a4a1d7160008212a
MATLAB
1,310
30
function[xvalsgradient] = convert_to_thermo(xvals, yvals, ppcm) %% convert_to_thermo transforms track data in pixels to cm data then to values of the given thermotaxis gradient. % Requires a gradient slope (value-per-cm), and the min/max values of the gradient. % Assumes a linear gradient across the x-axis of the ...
15bad6b80fe3dd527eccc0ae1bcc1c4d79dcabe7491f8cb7f258c15170a8e846
MATLAB
1,311
47
function [stats, cfg] = plot1Dcluster(data,cfg) % cluster correct and plot significance cfgfields = fieldnames(cfg); if ~ismember(cfgfields,'nperm') cfg.nperm = 1000; end if ~ismember(cfgfields,'minp') cfg.minp = 1/cfg.nperm; end if ~ismember(cfgfields,'pthresh') cfg.pthresh = 0.05; end if ~ismember(cfgfiel...
84248d9b16e44150b4acc7e17cac1a15bf8b7743027c14693458fb9ec282a33a
MATLAB
1,311
41
function plot( obj ) n = length( obj ); nCols = ceil(sqrt(n)*1.2); nRows = ceil( n/nCols ); if nRows==1 nCols = n; end count = 0; for key=enumerate( obj ) count = count+1; subplot(nRows,nCols,count); [r,g] = take( Movies(key), 'red', 'green' ); %r = r - 0.1*polyfitImage( r, 3, 25, 25 ); % equ...
9344abffb3d081593de84c73a24d1574610c32105f09aaef9412c20512400dd5
MATLAB
1,311
38
function rgbColors = valuesToColormap(values, cmapName, vmin, vmax) % valuesToColormap: Map numeric values to RGB colors using a colormap. % Written by chatgpt with the following prompt: % In matlab, can you write me code to convert a set of values to color % values specified by a colormap, % I will provide the min an...
87ff1a97851e60b6d8751f9cdfbcd4c5e0bb65d04753fb42a7e80e01e80c563d
MATLAB
1,312
61
function tapas_linear_validate_data(y, u) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % if ~iscell(y) error('tapas:linear:validate_data', 'y should be a cell array'); end if ~iscell(u) error('tapas:linear:validate_data', 'y should be a cell array'); end if ~ (size(y, 2) == 1) error('tapas:linea...
41fe4ae2c37752478cbaf050f6df0a837991563f5cb072c4d4f29c451d2c8bb6
MATLAB
1,313
39
function ehess = essential_ehessE2ehess(X, egradE, ehessE, S) % Converts the Hessian in essential matrix E to the Hessian in X. % % function ehess = essential_ehessE2ehess(X, egradE, ehessE, S) % % egradE is the function handle for the gradient in E. % ehessE is the function handle for the Hessian in E. % S is the sear...
5fc65bd9454e5c92895b481120bb09aafead6453a8801bfd3ccfab3712fb7006
MATLAB
1,313
40
function this = redo(this) % restores next processing step status of MrSeries, after previous undo (or % restore) % % Y = MrSeries() % Y.redo() % % This is a method of class MrSeries. % % IN % doDeleteLastStep false - last step is kept for possible restore % true - last step is removed f...
8eb0af6644a5d0fb5405d8898dd7ab707e0bc7dcb583e9c082e6ecfbc179e234
MATLAB
1,313
36
function cnn_vgg_faces() %CNN_VGG_FACES Demonstrates how to use VGG-Face % Setup MatConvNet. run(fullfile(fileparts(mfilename('fullpath')), ... '..', '..', 'matlab', 'vl_setupnn.m')) ; % Load the VGG-Face model. modelPath = fullfile(vl_rootnn,'data','models','vgg-face.mat') ; if ~exist(modelPath) fprintf('Downlo...
a880e66d25a1968f712682595a24f6931d9c8376b4ed15f7303c27e8ca9dbcd7
MATLAB
1,314
57
function [err, Info] = Info_1D(v, fname) % % [err, Info] = Info_1D(M, name); % an Info structure for a 1D file. To use with WriteBrik % % Specify name if you want Info.RootName and Info.Extension_1D to be filled out % otherwise, you can do that on your own later. % % see also Read_1D, BrikLoad, and BrikInfo % Ziad ...
092df56e1829272a640f8816dd024ed97446f1f51740ccec0b408e89a4706109
MATLAB
1,315
38
function b = multihconj(a, dim) %MULTIHCONJ Hermitian conjugating arrays of matrices. % B = MULTIHCONJ(A) is equivalent to B = MULTIHCONJ(A, DIM), where % DIM = 1. % % B = MULTIHCONJ(A, DIM) is equivalent to % B = PERMUTE(A, [1:DIM-1, DIM+1, DIM, DIM+2:NDIMS(A)]), where A is an % array containing N P-by...
dba8719e1470358bdc165557b36920ee26c21a7462281890a0fe621400383570
MATLAB
1,315
41
function faceGrad = gradientTermCylindrical3D(phi) % this function calculates the gradient of a variable in x and y 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 = gradientTermCylindrical3D...
e0e0b06bd2f0f2e1810eee7d0b251f7f1fb5a2b58d3d3b467010e5174ee827c4
MATLAB
1,315
49
classdef Loss < dagnn.ElementWise properties loss = 'softmaxlog' opts = {} end properties (Transient) average = 0 numAveraged = 0 end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnloss(inputs{1}, inputs{2}, [], 'loss', obj.loss, obj.opts{:}) ; n = ...