sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1d5ca0398cb0514cac58cbdce7f8f8b02304281fead4fb2f0045479ee6f98418
MATLAB
1,900
66
function disp(a,name) %DISP Command window display of a sptenmat. % % DISP(T) displays the tensor without printing its name. % % DISP(T,NAME) displays the tensor with the given name. % % See also SPTENMAT/DISPLAY. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox ...
cc103cb00535b297fd5eee14406e592774276f91eda289af70b2f73459d745b4
MATLAB
1,900
83
%% var_info % % Display VAR information as returned by |var_to_autocov| % % <matlab:open('var_info.m') code> % %% Syntax % % acerr = var_info(info,abort_on_error) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % info info structure returned by v...
07be40cc572e04c90f9463f095b49cd5889d3c6747a576d70b09fa7fa738bc6a
MATLAB
1,901
46
function [theta_AIC,phi_AIC,reg_id_AIC,cut_id_AIC,AIC_value]=AICfun_backward_constrained(Y,phi,theta,ori_reg_id) % Akaike Information Criterion Backward elimination method. % given Y, phi, theta and the regulator IDs before AIC % calculate AIC and output theta_AIC, regulator IDs after AIC, regulator IDs cutting by A...
dc0d3f2df2c43b2b6ad8fdf00f360bfa0ddf479393ae546f3060a479256c6454
MATLAB
1,901
67
classdef PathLocale < uint8 % apt.PathLocale - Enumeration for path locale contexts within APT % % This enumeration defines where paths are intended to be used. % % Enumeration values: % native - Paths for the native/host machine where APT frontend runs % wsl - Paths for Windows Subsystem for Linux...
3acc2b18dfd25c9f7c995fe836ddbc836b01a84207b36c52d88e47f4ddf8e377
MATLAB
1,902
79
function [obj] = TLrun1l(obj,varargin) %force = false; force = true; tlvl = class(obj); for i = 1:length(varargin) if ischar(varargin{i}) switch varargin{i} case 'force' force = true; case 'tlvl' tlvl = varargi...
6522f61b6f6f192390737d98e18fb77066fa29a83d11d65413c137a666ad452b
MATLAB
1,902
78
function lh = plotVerticalLines(axh,x,varargin) if isempty(axh) axh = axes; end [yMax,lineArgs] = getParamValue('ymax',varargin,true); [yMin,lineArgs] = getParamValue('ymin',lineArgs,true); yMax = repeatToComplete(yMax,numel(x)); yMin = repeatToComplete(yMin,numel(x)); yLim0 = ...
a557d09cd6b08e2a651fc68e560889c4bf156a0a9043ca2c083f7769da953d7f
MATLAB
1,902
90
%% Yeast Clustergram Demo %PMTKneedsStatsToolbox pdist, linkage, dendrogram, cluster %PMTKneedsBioToolbox clustergram, redgreencmap %% % This file is from pmtk3.googlecode.com requireStatsToolbox requireBioinfoToolbox loadData('yeastData310') % 'X', 'genes', 'times'); corrDist = pdist(X, 'corr'); clusterTree = lin...
21e3fec210fbe0833f6c0cea072e16ffd309805262f0868d7559878eb368e7b3
MATLAB
1,903
47
% Parameters of BEM-FMM solution % % Copyright SNM/WAW 2017-2024 eps0 = 8.85418782e-012; % Dielectric permittivity of vacuum(~air) mu0 = 1.25663706e-006; % Magnetic permeability of vacuum(~air) condambient = 0.0; % Air % Parameters for neighbor integrals RnumberE = 32;...
2b27880a6e7be5247d38cc3f23afb95a1dfce35d483ca2e51471189ce36c4483
MATLAB
1,903
86
theta = linspace(0, 2*pi, 100); xy = figure; hold on scatter(x(2), x(1)) title('position: X-Y') yz = figure; hold on scatter(x(2), x(3)) title('position: Y-Z') Oxy = figure; title('orientation: X-Y') hold on Oyz = figure; hold on plot(sin(theta), cos(theta)) title('orientation: Y-Z') Wxy = figure; hold on plot(sin(thet...
bc6d2ecd516427207dd5e43322d079859fe0ae35537ccc18dc898a1daa541fc4
MATLAB
1,903
1
function [im,tt] = func_toimage(A,f,t,splx,sply) % [im,tt] = TOIMAGE(A,f,t,splx,sply) transforms a spectrum made % of 1D functions (e.g., output of "spectreh") in an 2D image % % inputs : - A : amplitudes of modes (1 mode per row of A) % - f : instantaneous frequencies % - t : time ins...
de46893d55eddd5d43274b0b6ddb725ec43d0ed7899b941c047ecf0cf31d1fd1
MATLAB
1,903
76
function Y = collapse(X,dims,fun) %COLLAPSE Collapse tensor along specified dimensions. % % Y = COLLAPSE(X,DIMS) sums the entries of X along all dimensions % specified in DIMS. If DIMS is negative, then X is summed across % all dimensions *not* specified by -DIMS. % % Y = COLLAPSE(X) is shorthand for S = COLLAP...
b5cb74c6ab0d95aee686fcc02a8a70fcda089c184e0a21d7d10d145bcec848aa
MATLAB
1,904
66
%CHANGE_VALUE Change the value assigned to a unique variable in a file % % Examples: % fail = change_value(value) % fail = change_value(value, variableName) % fail = change_value(value, variableName, filePath) % % Function to change the value assigned to a variable in a text file. The % assignment must exist alr...
0fca868387d3ad8c2ac3c7f63e7d0e5cc61023919390089e79e6deb6923eec81
MATLAB
1,905
71
% Author: Birgit Nierula % nierula@cbs.mpg.de function plot_esg_isopotential(chanvalues, gridsize, chan_pos_grid, labels) %% Input arguments: % chanvalues = data values for each channel % gridsize = size of grid % chan_grid_pos = in matrix indexes % labels = channel labels %% create electrode grid chan_grid = zeros...
382fa836956fbe8db22c7ed09b5f262da6e34eb01f1e5736a5980a13f7e80f42
MATLAB
1,905
78
function lh = plotHorizontalLines(axh,y,varargin) if isempty(axh) axh = axes; end [xMax,lineArgs] = getParamValue('xmax',varargin,true); [xMin,lineArgs] = getParamValue('xmin',lineArgs,true); xMax = repeatToComplete(xMax,numel(y)); xMin = repeatToComplete(xMin,numel(y)); xLim0 ...
927a5201dfc16f9eb9377ff07ff67d8c7535d7bc5e6f8df363a8ce3e6b156085
MATLAB
1,905
53
function masks = char2img( strings, h, pad ) % Convert ascii text to a binary image using pre-computed templates. % % Input strings can only contain standard characters (ascii character % 32-126). First time char2img() is ever called with a given height h, % txt2img() is used to create a template for each ascii charact...
d115a5eca828204836647417aa37eebeccda9eea3e9a06c59767159b9f59091f
MATLAB
1,905
59
function PlotFigure4(allBetas, allPVals, xTimes2) if nargin==0 % this one plots Figure 4 load('Figure 4 - Source Data 1.mat', 'allBetas','allPVals','xTimes2') % these are for the figure supplements - see % TrioEEG_PlotAllFigures.m in the github for details % Figure 4 - Figu...
bc07a1cbc0643a0640e6247ae37bd369b6a5979faa87706de8ff74ddbc766a33
MATLAB
1,906
61
function ha = tight_subplot(Nh, Nw, gap, marg_h, marg_w) % tight_subplot creates "subplot" axes with adjustable gaps and margins % % ha = tight_subplot(Nh, Nw, gap, marg_h, marg_w) % % in: Nh number of axes in hight (vertical direction) % Nw number of axes in width (horizontaldirection) % ga...
c000298d71f51048beb682c18741954bca6a381ff9621dac4a6328aa5139d7b6
MATLAB
1,906
65
function [hf] = VBA_displayGrads(J,J2,flag,fname,flagFun) % eyeball the difference between two arbitrary matrices try; flag; catch; flag = ''; end try; fname; catch; fname = []; end try; flagFun; catch; flagFun = ''; end try; sfn = func2str(fname); catch; sfn = fname; end switch flagFun case 'f' str = [' ...
462d3a85ccfdb3d30537d5bb11272a3a70b67a6cf513fc85803988760f6505c8
MATLAB
1,908
93
function [hdr,be] = read_hdr_raw(fname) % Read a NIFTI-1 hdr file % FORMAT [hdr,be] = read_hdr_raw(fname) % fname - filename of image % hdr - a structure containing hdr info % be - whether big-endian or not % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trus...
7115a33b0e76e9e9bac5d41bf49fca68c31e4fb096f0f62270f8e61d073bf8e4
MATLAB
1,908
88
function [h, array] = display_network(A, opt_normalize, opt_graycolor, cols, opt_colmajor) warning off all if ~exist('opt_normalize', 'var') || isempty(opt_normalize) opt_normalize= true; end if ~exist('opt_graycolor', 'var') || isempty(opt_graycolor) opt_graycolor= true; end if ~exist('opt_colmajor', 'var'...
813ecf7dfab5b18257af83dc4b09c1507881aaec22f4c28dd270f22f4e912d3a
MATLAB
1,908
59
function [trl] = read_fcdc_trl(fn) % READ_FCDC_TRL reads trial definitions from a file % % Given a file which defines N trials, this function returns a Nx3 % matrix with the begin latency, end latency, and the latency offset % of the first sample of each trial. The latencies are in seconds. % % [trl] = read_fcdc_trl(f...
8e14d912d41fbfd05298d26c80494b5b9e918a428b1ab79878d8478b5a3f03a3
MATLAB
1,909
57
function [fitprms,res] = fitOutputNakaRushton(xvals, spikes, varargin) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here %========================================================================== foptim = @(p) optimizeNonlinearity(p, xvals, spikes); %====================================...
0562c3f059abb28714bfa7c22bbc5501bbdcbde55e96998501e5ae72ba570d98
MATLAB
1,910
94
%{ _ _ ___ _ __ __ _| |__ ___ ___ _ __| |_ / __| '__/ _` | '_ \/ __|/ _ \| '__| __| | (__| | | (_| | |_) \__ \ (_) | | | |_ \___|_| \__,_|_.__/|___/\___/|_| \__| # NNtrain **Syntax** ``` C.NNtrain(channel, worker) ``` **D...
3a9584fe3e21c1c87a647545a7e936c35f93fa215235b48a0dba92fab2d0949b
MATLAB
1,910
58
function [h, p, stat] = corr_clustercorr(dat1, behav) % wrapper around fieldtrip's cluster-based permutation test on a % timecourse, behaves similarly to matlab's corr % input: nsubjects x time % behavioural inputs: nsubjects x 1 addpath('~/Documents/fieldtrip'); ft_defaults; % =======================================...
41ab9376f244f8abd7f79904207474da3d51e713b267bd2740995643d10d27b2
MATLAB
1,910
83
%% Mixture of Discrete Distributions DNA Demo % t = locn % Z(t)|w ~ Discrete(w(:)), k in {1,2,3,4,k} % theta(:,t) | Z(t)=k ~ Dir(alpha(:,k)) % x(i,t) | theta(:,t) ~ Discrete(theta(:,t)) %% % This file is from pmtk3.googlecode.com %% Data generation setSeed(0); Nseq = 10; Nlocn = 15; Nletters = 4; Nmix = 4; ...
f95fd77f929fb870a63aee456a79480fe2b423aeb7f1b49d54f19bc4430716ff
MATLAB
1,910
69
function [pnt, tri] = cylinder(Naz, Nel) % CYLINDER creates a triangulated cylinder % % Use as % [pnt, tri] = cylinder(Naz, Nel) % Copyright (C) 2002, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: yo...
3d080139bc7ef02ab42ac47fe42aaa6282a0005a2e4cd3bb6bc75a7dca011b8c
MATLAB
1,911
53
% Derive a vector of edges describing the relationship between signal % amplitude and bins. %// Modular method of assigment % % % To avoid porducing 'NaN' for ranging values, signal values greater than % the defined discretization range willl be assigned to the closest defined % value (i.e. clipping). % Copyright (C...
b3b595115e0b875e53933ace825a43e38a550c884e1a6543280fe70ef4a699df
MATLAB
1,911
80
%% Robust linear regression demo % PMTKneedsOptimToolbox linprog %% % This file is from pmtk3.googlecode.com function linregRobustDemo() requireOptimToolbox seed = 0; setSeed(seed); x = sort(rand(10,1)); y = 1+2*x + rand(size(x))-.5; % add some outliers x = [x' 0.1 0.5 0.9]'; k = -5; y = [y' k k k]'; n = length(x)...
f22e84ad3f165a1a6e9b7ffaa20ab981184e84cf11b06e95700717e5c9b4acf1
MATLAB
1,911
66
function [drNduTdrNdu] = get_drNduTdrNdu(M,nt,dt,par,x) %% Created by Xinan Chen in Nov 2021 %% This function returns (d(rho(:,end))/d(u))^T * d(rho(:,end))/d(u) * a vector x % x... vector length(prod(n)*nt*dim,1) % rho(:,0) -----------> rho(:,1) --------------> rho(:,2) % u(:,1) u(:,...
2c0f8aabd3814ab9f8950f6c7807c454afd04317786cfbb2421307812f0173ee
MATLAB
1,913
73
function header = parseHeader(input) % PARSEHEADER - Read ScanImage Header String and return structure. % PARSEHEADER will output the value of the header fields as a structure. % Input is the header from ScanImage TIF File (char array). % % See also % Modified by Aleksander Sobczyk on 3/11/04 to allow pro...
64c3c89cb5e56b16923f9e78ea244fa015176b393061c91cba6847223f4cb722
MATLAB
1,913
43
function phi = phi_comp(X, Z, params, options) % Compute phi from time series data % % INPUTS: % X: time series data in the form (units X time) % Z: partition % - 1 by n matrix. Each element indicates the group number. % - Ex.1: (1:n) (atomic partition) % - Ex.2: [1, 2,2,2...
e6b3d3227e24cc3455c1972655409584db5bc73e4fe9605b9580649b11a3515c
MATLAB
1,913
71
function model = rvmFit(X, y, varargin) %% Fit a relevance vector machine using the SparseBayes 2.0 package % % model = rvmFit(X, y, 'kernelFn', kernelFn) % where kernelFn(X1,X2) computes the gram matrix. % % model = rvmFit(X, y, 'kernelFn', kernelFn, 'args', args) % args are passed directly to SparseBayes. % % y can...
f61f7bcf54db859987506bc8677a3706a49841d6b2ee0383a1343b44b65b5a5f
MATLAB
1,914
61
function [xe,ye] = get_ellipse(trk, ctr_coords, theta, fly_ind) % Input arguments % prefix = file prefix for -track.mat (usually the same prefix for both files) % ctr_f = x,y coordinates of female; typically nx2 matrix, for n frames % theta = orientation of female % fly_ind: integer corresponding to FlyT...
c54155f83fd25e19398d1fdaecdbdce3ac5081d42eac010688ba0a9e48423cd7
MATLAB
1,915
32
clear;clc;close all ROOTPATH = strcat(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 4), "Data\Processed Data\"); cd(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 2)) protStr = "Passive noise"; temp = NoveltySU.utils.dirItem(strcat(ROOTPATH, protStr), "spkData.mat"); popRes = cell2mat(cellfun(@(x) N...
e1d4a04ed3e51483ec3a7852f5c735ecb34203ddb359829d3a9f0103f985d715
MATLAB
1,915
48
function save_chunks(parentfolder,fov,chunkfoldername,CCseg,refch,name) %Saves segmented synapses as small chunks mkdir([parentfolder chunkfoldername]) %extract relevant synapse properties indexes = regionprops3(CCseg,'SubarrayIdx'); indexes = indexes.SubarrayIdx; centroids = regionprops3(CCseg,'Centroid'); ce...
2a60d8344621dcef514bb5ede1a23788de3f6b63d215c664d27d04750779cd8d
MATLAB
1,917
58
function [F] = VBA_FreeEnergy_UNL(posterior,suffStat,options) % computes free energy of generative models with unnormalized likelihoods % function [F] = VBA_FreeEnergy_UNL(posterior,suffStat,options) % IN: % - posterior: a structure containing the natural parameters of the % marginal posterior pdf of the unknown mo...
88d609a0b8ce03475c95e570af45088e73b1e0a0929fdefd7241445fa2aca4a7
MATLAB
1,917
53
function B = expand(A,S) %EXPAND Replicate and tile each element of an array, similar to repmat. % EXPAND(A,SZ), for array A and vector SZ replicates each element of A by % SZ. The results are tiled into an array in the same order as the % elements of A, so that the result is size: size(A).*SZ. Therefore the % numb...
a71e277a8a35287a6a3755d6b7907d5357fa3c1cdada21a1d7339e4aa8df468d
MATLAB
1,917
57
% Color code for each image: if ~exist('n_ima')|~exist('fc'), fprintf(1,'No calibration data available.\n'); return; end; check_active_images; if ~exist('alpha_c'), alpha_c = 0; est_alpha = 0; end; %if length(kc) == 4; % kc = [kc;0]; %end; %if ~exist('est_dist'), % est_dist = (kc~=0); %else %...
3d5dafa6a54afe846e1ce96168decb95c77f6b5fd0975eb4783bc6f796587294
MATLAB
1,918
61
function help(topic, varargin) % % % %<PRE> % This file is part of dspace-core. % % Copyright (C) 2020 University Zurich, Sepp Kollmorgen % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU Affero General Public License as p...
84744aa8650f670a2dcaeb8a5c8caf4263035a660f437226e62310110af4dc60
MATLAB
1,918
69
% Author: Javier Lopez-Calderon & Steven Luck % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2009 %b8d3721ed219e65100184c6b95db209bb8d3721ed219e65100184c6b95db209b % % ERPLAB Toolbox % Copyright © 2007 The Regents of the University of California % Created by Javier Lopez-Calderon and Stev...
ca1189c9e49998a20764567ac4bab9925d88184b3bc16205af828ecd3c0af223
MATLAB
1,918
62
filedir = 'C:\Users\chenf\Desktop\Output\Renamed\'; %filedir = '/Users/Shirin/Desktop/color/'; % File name convenction exframe7upscaled_round001_ch01 FILEROOT_NAME_INPUT = 'exseqautoframe7i' parpool(10) parfor round_num = 1:20 filepath_split1 = fullfile(fi,sprintf('%s_round%.03i',FILEROOT_NA...
ffa07b42dcb7a5a07f1366204c8f93cd650b974eea71ce1e2c1ad0538996c60c
MATLAB
1,918
58
function plot_cleaning_steps load('extracted_video_data.mat'); load('position_data'); load('extracted_position.mat'); parameters= list_of_parameters; number_of_tracks= length(position.linear); %plot pre and post processing x and y positions figure; subplot(2,1,1); plot(positions.x,positions.y,'Color',[0.5 0.5 0.5]); ...
0fbd0c746a792f7ffdc7ec53817f8f89dcfd29f5f5f153b750fb21d8b287e717
MATLAB
1,919
61
function wsd = ws_distance(u_samples, v_samples, p) % WS_DISTANCE 1- and 2- Wasserstein distance between two discrete % probability measures % % wsd = WS_DISTANCE(u_samples, v_samples) returns the 1-Wasserstein % distance between the discrete probability measures u and v % corresponding to the sample vecto...
dca308c418bc54461206e6ad4828d056b4869fba4b0eeab548bb09f2db8e9f12
MATLAB
1,919
74
function img = fdct_wrapping_dispcoef(C) % fdct_wrapping_dispcoef - returns an image containing all the curvelet coefficients % % Inputs % C Curvelet coefficients % % Outputs % img Image containing all the curvelet coefficients. The coefficents are rescaled so that % the largest coefficent...
fbf6891c05de18f33fd5fbf11c79c9fcfa19ac9f0dd1452670f80bb451c66a0d
MATLAB
1,919
76
function event = events_tsv(filename) % helper function to extract events from a BIDS events.tsv file opts = detectImportOptions(filename,'filetype','text'); % this gets the numeric stuff as doubles right away, yet might erroneously % typecast intended strings (e.g. in event_value) into doubles. tsv = readtabl...
05b9b16dc7fb34ccd13424719ca78f8d9e9bab636dab024e4f1de5015d57125d
MATLAB
1,920
57
% Color code for each image: if ~exist('n_ima')|~exist('fc'), fprintf(1,'No calibration data available.\n'); return; end; check_active_images; if ~exist('alpha_c'), alpha_c = 0; est_alpha = 0; end; if length(kc) == 4; kc = [kc;0]; end; if ~exist('est_dist'), est_dist = (kc~=0); else if ...
432af8a733d2fa52d3415a4810625405abf7a5163159b34b106bfb65a6d1f71c
MATLAB
1,920
52
function [headmodel] = ft_fetch_vol(cfg, data) % FT_FETCH_VOL mimics the behaviour of FT_READ_VOL, but for a FieldTrip % configuration instead of a file on disk. % % Use as % [headmodel] = ft_fetch_vol(cfg) % where you should specify the volume conductor model with % cfg.headmodel = structure with volume condu...
6ff26b04de0bbf52009f82efb81ee4f69e57cf86c1f312e8fdc31cd7a9ae115a
MATLAB
1,920
62
function M=matrandorth(n, tol) %MATRANDORTH Generates random n x n orthogonal real matrix. % % M = MATRANDORTH(N) generates a random N x N orthogonal real matrix. % % M = MATRANDORTH(M,TOL) explicitly specifies a threshold value, TOL, % that measures linear dependence of a newly formed column with the % existin...
bd8de4bcc93715aee8be2324b5499253a6a5f9030137a49845eece36ed3fdf15
MATLAB
1,920
73
% Demo for Fitz-Hugh-Nagumo PA propagation % Short bursts of depolarizing input current (u) are sent to a neuron that % responds according to Fitz-Hugh-Nagumo model. Note that this does not % generates 'all-or-none' spikes (as in the Hodgkin-Huxley model), but % supra-threshold input create large deviations from equili...
0791fd2d4ef5b6dc920d525a84dad37c8e2b88275d35f56028a6e0004d73a359
MATLAB
1,921
64
% This code loads Results from Connectivity Analysis and compares it to % resection and SOZ if quantative clinical data is available % Abbas Sohrabpour % 19/3/2018 clear all; close all; clc bad_chan = []; cd('../Grid Location and Defined Parameters') load('UnconstCentLFD.mat') [~, Num_Dip] = si...
fac8a621c248278cbb4a690693c29291d3a1f68447a5ff083f5320f20c9a0595
MATLAB
1,921
53
function [] = bz_plotTrials(varargin) p = inputParser; addRequired(p,'behavior',@isstruct); addParameter(p,'condition',[],@isnumeric); addParameter(p,'color',[0 0 0],@isvector); addParameter(p,'endPoints',true,@islogical); addParameter(p,'spacing',1,@isnumeric); parse(p,varargin{:}) behavior = p.Results.behavior; co...
05fa156b06966094726e7c7e0ac8945f13b4098e9e7c5674a49db310967dafbb
MATLAB
1,922
69
function [tags, lines, codeLength, text] = tagfinder(filename, tagList) % Find all of the tags in the given file % Tags begin with PMTK, contain at least one other character, no spaces, % and must reside within an m-file comment. The file must be on the Matlab % path, and the tag must be a valid variable name, i.e. can...
0fa54d6b39a6a010dbc151c8bf91d308b223f779ca44b6dd1ed50fd64902abac
MATLAB
1,922
64
function [roi,cjitter,rjitter] = cropsmart(imnc,imnr,roinc,roinr,... roiCtrCol,roiCtrRow,varargin) % Crop an roi around a given center point. Do something nondumb when the % center is close to an edge of the image. % % imnr: positive integer, number of rows in image. % imnc: " cols ". % roinr: etc, number of rows in...
45d051df85d95e95ddc3b747c5fcdb7f71efef344a75da522f03c772e0ef1c77
MATLAB
1,922
58
% Author: Birgit Nierula % nierula@cbs.mpg.de function other_preprocessing_loops(srmr_nr, loop_number, subjects, conditions, sampling_rate) switch loop_number case 1 %% separate ENG channels % load data % select ENG channels % bandpass + notch filter % save fo...
8bdfcf4ff34de2b2912685b2cf4d7dbeacf1a98af3380a21868c4f648feb34a8
MATLAB
1,922
38
% CHANNELS % See also % % Fast channel feature computation code based on the papers: % [1] P. Dollár, Z. Tu, P. Perona and S. Belongie % "Integral Channel Features", BMVC 2009. % [2] P. Dollár, S. Belongie and P. Perona % "The Fastest Pedestrian Detector in the West," BMVC 2010. % [3] P. Dollár, R. Appel and W. ...
9e8670fea4ae965537f19f60e6a9116bd14812aa292226a18f6a45a9c0e2ea9b
MATLAB
1,922
54
function [x, cost, info, options] = manoptsolve(problem, x0, options) % Gateway helper function to call a Manopt solver, chosen in the options. % % function [x, cost, info, options] = manoptsolve(problem) % function [x, cost, info, options] = manoptsolve(problem, x0) % function [x, cost, info, options] = manoptsol...
27259cfa58edee9059dd7cb75a715906f00d30b53375356c5b7a3ccc1738ae6c
MATLAB
1,923
71
%% Illustration of a conjugate function % %% % This file is from pmtk3.googlecode.com function conjugateFunction f = @(x) -log(5*x) - 5; domain = 0.01:0.01:5; offset = 0.04; t = @(x) -(1/3)*x + f(3)+1-offset; figureA; printPmtkFigure('conjugateFunctionA'); figureB; printPmtkFigure('conjugateFunctionB'); functio...
27d0b3d40ee179ef0ed2a96f2e39140ea7e85b5d784019a921f5b8cf82b96d53
MATLAB
1,923
72
function trList = TrialFilter(ts, filterStr, varargin) hemi = 'L'; laser = -1; if length(varargin) > 0 hemi = varargin{1}; if iscell(hemi) hemi = hemi{1}(1); else hemi = hemi(1); end if length(varargin) >1 laser = varargin{2}; end end segLen = length(filterStr) / 2; trL...
df1fc771d1b176ff0e31fbb386ba829f9c18d742baacc4cb4505725981f18947
MATLAB
1,923
65
function [varargout] = read_ctf_shm(varargin) % READ_CTF_SHM reads metainformation or selected blocks of data from % shared memory. This function can be used for real-time processing of % data while it is being acquired. % % Use as % [msgType msgId sampleNumber numSamples numChannels] = read_ctf_shm; % or % [data]...
fc8caa74f887207845d9db63f849f7a5c754cd38a81130cd73a9b918ee8bb3be
MATLAB
1,923
69
function sutton_demo() % do the example in Sutton and Barto (1998) p79 nrows = 5; ncols = 5; obstacle = zeros(nrows, ncols); terminal = zeros(nrows, ncols); psucc_act = 1.0; absorb = 0; wrap_around = 0; noop = 0; T = mk_grid_world(nrows, ncols, psucc_act, obstacle, terminal, absorb, wrap_around, noop); bump = mk_bump(...
9dada70e00bf11824e6b44c76986fed8a7ce4fe2d245ab93b11bee61c7c6839a
MATLAB
1,924
35
% Author: Zachary Chiang, Buenrostro Lab, Harvard University % Finds all pixels correlated to a given peak pixel over all images of an % IGS experiment and sums signal into a cycles by channels matrix % Only cosmetic modifications by Dan Goodwin, June 2021 function[mat, spot] = spot_caller(peak, all_stacks, spot_dim,...
ba08ca18811ce3b9040b4ca9cc14fdad44beaa69f91022171194c83f9c1e9868
MATLAB
1,924
63
function F=ShapeContext(Pointsc,Points) %Calaculate ShapeContext vectors around Pointsc %Points is what is calculated in the histogram for Pointsc defaultoptions=struct('r_max',3,'r_min',1e-5,'r_bins',10,'a_bins',10,'rotate',0,'method',1,'maxdist',5); options=defaultoptions; F=getHistogramFeatures(Pointsc,Points,o...
fcdbf4b24a2dc81b2c9508d47824eb8c7065a4efc3e6e0fc8222b10c8f5f119f
MATLAB
1,924
70
function [y_hat, beta] = CBIG_regress_X_from_y_train(y, X) % [y_hat, beta] = CBIG_regress_X_from_y_train(y, X) % % This function regress covariates X (e.g. head motion) from y (e.g. % behavioral scores) in the training set (for any preditive model). % % Inputs: % - y % A #TrainingSubjects x 1 vector. Each ro...
61eeee6a104e2e83b154cd1df9cad19dc64fea8bccc3c849d36561d608c630a9
MATLAB
1,926
49
%% Code Availability for Submission % Artificial Intelligence-Optimized Non-Invasive % and Treatment Response Prediction for Major Depression %---------------------------------------- % Created By Alejandro Albizu % Center for Cognitive Aging and Memory % University of Florida % 8/8/2023 %------------------------------...
862dedab36d09258b1262fff76248e97b13798969a81dfe23f5277c033628ef4
MATLAB
1,926
58
function params = fitRLogisticToSpikes(xvals, spikes) %UNTITLED Summary of this function goes here % Detailed explanation goes here %========================================================================== %unwrap and standardize variables spikes = spikes(:); xx = xvals(:); yy = spikes/max(spikes); %======...
886782747f9b20b9e484813cf49479a53aa9e30e34f6a2e4427bae34f338ddb1
MATLAB
1,926
67
classdef MovieIndexSetVariable < MovieIndexSet properties prettyString prettyCompactString id getMovieIndicesHook % fcn with sig mIdx = fcn(labeler) end methods function obj = MovieIndexSetVariable(ps,cps,fcn,id) obj.prettyString = ps; obj.prettyCompactString = cps; obj.getM...
571b2b2f00044d6696bd6bb4084684bd6b3fb5b3dc658eb57ca3d209bae099fc
MATLAB
1,927
56
function P = VBA_spm_mesh_project(M, dat, method, varargin) % Project volumetric data onto a mesh % FORMAT P = spm_mesh_project(M, dat, method) % M - a patch structure, a handle to a patch % or a [nx3] vertices array % dat - a structure array [1xm] with fields dim, mat, XYZ and t % (...
63243a0b0df6cb4dec19f7adea6ce22b40532482ce9ca62b84ee296db848c35d
MATLAB
1,927
45
function StructMap(TempStruct,StructDepth) TempStruct=ExperimentSet_PooledData.Refined_Quantifications.ExperimentSet(2).BoutonArray(1).All_QuaSOR_Data; d=1; DeconStruct(d).AllFields=fieldnames(TempStruct); DeconStruct(d).NumFields=length(TempStruct); ExperimentSet_PooledData...
9191ccf95c0b5bdc32bbccb727c65328c6b8d51bf5d17c2a62663ab41f98037b
MATLAB
1,927
62
function dat = read_deymed_dat(filename, hdr, begsample, endsample) % READ_DEYMED_DAT reads EEG data from the Deymed Truescan file format % % Use as % dat = read_deymed_dat(filename, hdr, begsample, endsample) % % See also READ_DEYMED_INI % Copyright (C) 2013, Robert Oostenveld % % This file is part of FieldTrip, s...
d9a1d17e42e92bd3c0cd27e575d55d8ac74a34bbc7f0e38738c591ff1d42010b
MATLAB
1,929
56
function params = fitRLogistic3ToSpikes(xvals, spikes) %UNTITLED Summary of this function goes here % Detailed explanation goes here %========================================================================== %unwrap and standardize variables spikes = spikes(:); xx = xvals(:); yy = spikes/max(spikes); %=====...
e751d5e6c0a68f77696eb2c01a826b0f55bd379afafe5b2122d7370c813d4d8c
MATLAB
1,929
59
% Purpose: Load FC matrices and create an average FC matrix for each participant. % Inputs: FC matrices for individual rs-fMRI runs. % Outputs: Single averaged FC matrix per individual. % % Written by M. Peterson, Nielsen Brain and Behavior Lab, under MIT License 2022 %To run: % 1. Claim computing resources using sa...
f21994aa4a41c52e5451362849bc81ac5dd57c71098fdd4ec618c344689838e8
MATLAB
1,929
65
function [varargout] = read_ctf_shm(varargin) % READ_CTF_SHM reads metainformation or selected blocks of data from % shared memory. This function can be used for real-time processing of % data while it is being acquired. % % Use as % [msgType msgId sampleNumber numSamples numChannels] = read_ctf_shm; % or % [data]...
1d933adb290869493b2c993db50ac8f9fbe71b45c56e8eeb18ed431137d28dad
MATLAB
1,931
49
function [varargout] = istable(varargin) % ISTABLE is a drop-in replacement for the same function that was % introduced in MATLAB R2013b. % % In all MATLAB versions prior to 2013b this function returns false. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
863f41e1bec0c98c6225351be35edc40a6ccc6271db4179ee00b154be79beef4
MATLAB
1,931
63
% JPSTHJETCOLORMAP produce a colormap with warm colors for positive % values and cold colors for negative values with green representing % zero % jpsthJetColormap.m % % Copyright 2008 Vanderbilt University. All rights reserved. % John Haitas, Jeremiah Cohen, and Jeff Schall % % This file is part of JPSTH Toolbox. %...
01dbcbb96c5b456aa5ae349e7fdde6fb5fd6208895ad52b4aa3eb9458ca18835
MATLAB
1,932
77
function show_window(cell_list,fig_number,title_figure,x_size,y_size,gap_x,font_name,font_size) if ~exist('cell_list'), error('No description of the functions'); end; if ~exist('fig_number'), fig_number = 1; end; if ~exist('title_figure'), title_figure = ''; end; if ~exist('x_size'), x_size = 85; end...
b7a53227cc583362a04b282c48f08588e570ed26324acb3d6b951573202b15f3
MATLAB
1,933
57
function [fitprms,res] = fitOutputNakaRushtonBase(xvals, spikes, varargin) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here %========================================================================== foptim = @(p) optimizeNonlinearity(p, xvals, spikes); %================================...
6edf6498e56433bb9bb585f491cd9188545ef4f36dca5bdf2cc8598aadd119dc
MATLAB
1,934
72
%% Baseball Batting Average Shrinkage Estimates % Reproduce example from % "Data Analysis Using Stein's Estimator and its Generalizations" % Bradley Efron; Carl Morris JASA Vol. 70, No. 350. (Jun., 1975), pp. % 311-319. %% Data % 1970 batting averages for 18 major league players. % first column = batting average for f...
d18f756a40b3ac6271c855532a34d0dcf125255b23afa4803d661d3aa054a74a
MATLAB
1,934
73
function [xn,dxdf,dxdc,dxdk,dxdalpha] = normalize2(x_kk,fc,cc,kc,alpha_c), %normalize % %[xn] = normalize(x_kk,fc,cc,kc,alpha_c) % %Computes the normalized coordinates xn given the pixel coordinates x_kk %and the intrinsic camera parameters fc, cc and kc. % %INPUT: x_kk: Feature locations on the images % fc: Cam...
182cc8dcd30a717d9f366b5336f00a7c2d277479c66886f33ec1dd9c4ae733d3
MATLAB
1,935
61
filedir = 'C:\Users\chenf\Desktop\Output\Renamed\'; %filedir = '/Users/Shirin/Desktop/color/'; % File name convenction exframe7upscaled_round001_ch01 FILEROOT_NAME_INPUT = 'exseqautoframe7i' for round_num = 1:3 filepath_split1 = fullfile(filedir,sprintf('%s_round%.03i',FILEROOT_NAME_INPUT,round...
4b939f935d6088a47e28c7209735bc3cd4c58fdbcc28c39e445db0ac3c9f0ea2
MATLAB
1,935
62
% [4D] shows R videos simultaneously as a movie. % % Plays a movie. % % USAGE % playmovies( I, [fps], [loop] ) % % INPUTS % I - MxNxTxR or MxNx1xTxR or MxNx3xTxR array (if MxNxT calls % playmovie) % fps - [100] maximum number of frames to display per second use % fps==0 to introduce n...
fe7a0964594c60d71f7f422713dbfeedc2ebaa4ac2d7c54b6f8841e37463b2db
MATLAB
1,935
75
function View_ROI_Modules(IM,Anat,ROIxyz,params) % % This function generates a plot of ROI Sortings for % various kden, scanning through the kden chosen. %% Set up paramters Modules=IM.key(:,2); Cmap=IM.cMap; ROI.Nfaces=50; Nroi=size(Modules,1); Params.Cmap=Cmap; Params.Scale=length(Cmap);Params.OL=1;Params.PD=1;Para...
4c56b70e557442e95e0b9dc3c22fbb9a40fe23e06c062ae3318d7733406ce4db
MATLAB
1,936
79
function biplotPmtk(C, varargin) %% Replacement for the stats toolbox biplot function % This file is from pmtk3.googlecode.com [S, labels, pos] = process_options(varargin, ... 'scores' , [] , ... 'varlabels' , [] , ... 'positive' , false ); [n, d] = size(C); is3D = (d == 3); ns = size(S,...
7f1957af2897ac27663e4b5ee075a14c4022fa7cb8c0b38089f730e830427107
MATLAB
1,936
73
%% Naive Bayes classifier for binary MNIST digits % PMTKslow %% %Ntrain=5000, 83 errors in 500, rate = 0.166 % This file is from pmtk3.googlecode.com loadData('mnistAll') % already randomly shuffled across classes % train_images: [28x28x60000 uint8] % test_images: [28x28x10000 uint8] % train_labels: [60000x1 uint8] ...
8cb5397e8343ef63c7028a1525e79fbbc36cfc0e3373908c603aa16797fc6337
MATLAB
1,936
75
function out = parseunits(in) % empty case if isempty(in), out.num = {'unit'}; out.den = {}; return; end % allowed unit names knownunitnames = {'mm','cm','deg','rad','frame','sec','unit','px'}; % remove white space in = strrep(in,' ',''); % find starts of unit names timesidx = strfind(in,'*'); divideidx = str...
c745fcf74a84b98a5f40ff84d3269c9940eae1ea51cac56261deac3fccc82950
MATLAB
1,936
45
function [S0,nTrans,nPathways] = S0Estimate(opt,PathwaySignalFirstOrder,PathwaySignalHigherOrder,GwaveFirstOrder,GwaveHigherOrder,TransFirstOrder,TransHigherOrder) %% %Initialise pathways S0init=0; S0HigherOrder=0; %% %Obtain indices of arrays for pathways to accellerate looping [~,idxHigherOrder] = sort(abs(PathwaySig...
ce198b9ef2ace2fa1ac90ef31fd07f9c6da2dae4d8641cc835f7982bb0b616d8
MATLAB
1,936
59
function err = SpkError(spkWaves, template, wireSD, varargin) % size(spkWaves) should be [waveLength numWires numSpikes] % size(template) should be [waveLength numWires] useMinErr = false; if isempty(wireSD) wireSD = median(std(spkWaves, 1),3); end useRelErr = false; % error measured relative to max average spike...
25fa5cfc1c6bd56196588205fea39314c3a5c6b01206c4736d10833bf03b4090
MATLAB
1,937
38
%% read deltaF/F summary excel files from Gabriella Sterne for plotting and AUC calculations Gr5a_fed = xlsread('Gr5a_fed.xlsx'); Gr5a_fed = Gr5a_fed(:,2:end); Gr66a_fed = xlsread('Gr66a_fed.xlsx'); Gr66a_fed = Gr66a_fed(:,2:end); Gr5a_starved = xlsread('Gr5a_starved.xlsx'); Gr5a_starved = Gr5a_starved(:,2:end)...
4bf249bac886d32428f7a2a357d0b658c8204dd919dc605f183cec52bdde1911
MATLAB
1,937
56
function [faceColor,erColor,sColor] = meg_manuscriptStyleCue(cueLevel) % function meg_manuscriptStyleCue(cueLevel) % returns colors for group level plots by precue % marker face color, errorbar color, subject color [style, colors] = meg_manuscriptStyle; colorMode = 'medium'; % light, medium color palette switch...
b68f439bed127533e170ef8bb9c7d6cf5709b028b64027144239714761346369
MATLAB
1,937
51
function CBIG_VK2019_plot_subjScores(Lx,Ly,names_groups,grouping,signif_LC) % % This function plots the RSFC and behavior composite scores of all % significant latent components (LCs). The diagnostic group of the subjects % is indicated. Correlations between RSFC & behavior composite scores is % displayed. % % Inputs:...
59859dfda88c32a97e06e4482e78c3c2146320636119a36204e7609daafedbc5
MATLAB
1,938
29
close all clear meter_list=ThorlabsPowerMeter; % Initiate the meter_list DeviceDescription=meter_list.listdevices; % List available device(s) test_meter_A=meter_list.connect(DeviceDescription,1); % Connect multiple devices test_meter_B=meter_list.connect(DeviceDescripti...
6beb8bad436ac182ee3e8bbd1c596851d91f70ac07b9bf0a9197c03f05adf92c
MATLAB
1,938
61
function [ wavecontext, timescontext ] = ... wlAux_getContextTrace(wave, samprate, ... minlengths, mincycles, ... evfreq, evlength, evsampstart) % function [ wavecontext, timescontext ] = ... % wlAux_getContextTrace(wave, samprate, ... % minlengths, mincycles, ... % evfreq, evlength, evsampstart) %...
d83b27072b7523371dbb6979501c6bd70c7bfd8a2694c0d753f9875aa06cba7c
MATLAB
1,938
80
% Demo for Lorenz choatic system. % This demo inverts a chaotic Lorenz system model, which is observed % through a nonlinear sigmoid observation function. clear variables close all % Choose basic settings for simulations n_t = 3e2; deltat = 2e-2; alpha = 1e0/deltat; sigma = 1e-1; theta = [28;10;8/3]; f_fname = ...
0eaaa777cf40561442a4f14c692134629f0ad44f36ce1734051e89c362be1ee1
MATLAB
1,940
66
function ss_dimen = partitionx(nx, deltax, subs_min,subs_max) % % partition the space defined by deltax(order) into a group % of sets, such that subs_max <= k <= subs_max for all sets % of size k. Where possible, pick combinations of points % which maximize a-b, where a is the norm of the new set /k and % b is the nor...
4af37edc13d87c925aa4f19c1c83d719ffcd7648ac40e438146042f15d0cd942
MATLAB
1,940
47
function [lambhat, shat,Shat,Shatblock,bhat] = Estpars_CoordAscent_lambi_S_b(lambhat0,shat0,bhat0,r,Ai,Xi,zetai,ni,xbari,Ybar,Xzetai0) P = length(r); rtot = sum(r); [T,n] = size(Ybar); TP = T*P; maxsteps = 10; stopvar = true; stopcrit = 1e-4; k=1; while stopvar % Re-calculated sufficient stats, conditioned on b0 ...
582c1ffe9e10e4483dbf52738f48ecdd202bd07d8c1130cd7cb4ebac30ac0f84
MATLAB
1,940
38
% SOFA API - demo script % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not use this work except in compliance with the ...
880bb64555836df07c6049bb79cdabb08226b26d939bb8c07463c2cb78fc4337
MATLAB
1,940
71
%% Illustration of the bias variance trade off as we vary the L2 regularizer. % %% % This file is from pmtk3.googlecode.com function biasVarModelComplexity setSeed(0); n = 25; d = 1; lambdas = [exp(6),exp(0.5),exp(-2.5)]; ndataSets = 100; showNsets = 20; f = @(x) sin(2*pi*x); domain = (0:0.0005:1)'; for lam=1:numel...
8ebd7e1f42e35f886630f7b6c103127cb1dacce9b50e87e6b1d8aefe19e4fc45
MATLAB
1,940
88
function [Y,T]=phasespace(x,dim,tau) %Syntax: [Y,T]=phasespace(x,dim,tau) %___________________________________ % % The phase space reconstruction of a time series x with the Method Of Delays % (MOD), in embedding dimension m and for time dalay tau. % % Y is the trajectory matrix in the reconstructed phase space. % ...
a8990dbed6eb3e02429a596269b9b8902043378206548d3e109187d66dd51d89
MATLAB
1,940
78
% Create Table clear all close all %% Call data and functions addpath C:\code\spm12 addpath D:\ECoG_Atlas\functions addpath C:\code\wjn_toolbox spm('defaults','eeg') %% Load info data load dataset_info_tf %% Rearrange multidimensional matrix to a 2D matrix data = info.range_values; n = 0; data_matrix = []; for b = 1...
333e79fead5db421f203edfae03183de5f85e8e06f2871d9c639ddda59ace1c2
MATLAB
1,941
92
function vrbstr = ch_verbose ( inpstr, prespace, postspace, indent ) %% About % % Name: ch_verbose % Version: 1.0 % % Christoffer Hatlestad-Hall % % % Date created: 18 Mar 2020 % Date last modified: 07 Apr 2020 % % ------------------------------------------------------------------------------------------...
4f6cb74f78a18187074271091aa6cc88b9fa3358e946a1a64d99d2de35ccd165
MATLAB
1,941
66
function [ix] = VBA_spm_fieldindices(X,varargin) % Return the indices of fields in a structure (and vice versa) % FORMAT [i] = spm_fieldindices(X,field1,field2,...) % FORMAT [field] = spm_fieldindices(X,i1,i2,...) % % X - structure % field1,.. - fields % % i - vector of indices or feildname{s} % %__...