sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
30df48eee59bc5797be7b0f13f317f28e74e004c99d4a9495e9e98f336af8e6a
MATLAB
1,542
36
clear all %% %Define default parameters [opt] = ParameterOptions(); %% %Generate Pathway Amplitude & Gradient Waveform Dictionaries %First Dictionary [PathwaySignalFirstOrder,GwaveFirstOrder,TransFirstOrder] = PathwayOperatorOrder(opt,'First'); %Second Dictionary [PathwaySignalHigherOrder,GwaveHigherOrder,TransHigherOr...
34097c379da18ca181193cd9f85f7a4abe85539860848d3f5a1b4e084be7c522
MATLAB
1,542
48
function IC = arrayToDims( I, dims, padEl ) % Pads or crops I appropriately so that size(IC)==dims. % % For each dimension d, if size(I,d) is larger then dims(d) then % symmetrically crops along d (if cropping amount is odd crops one more % unit from the start of the dimension). If size(I,d) is smaller then % dims(d) ...
f0ed651319cf2499bc3675077119ecba3fa6eaddf881f389803950086eb7ce6a
MATLAB
1,542
44
function avgs = getAvgByClass(A, classIDs) % this function averages an array by 'type'. For example, class could be % seizure, in which case the array elements will correspond to certain % seizures and all elements corresponding to one seizure will be averaged. % Same thing if the class was animal. % Inputs: % - A: a...
594e37789d4baec3b5fda5cf30134acb7bb619048b2cd7ffd29b6b2c0594a5fc
MATLAB
1,543
43
function C = xcorrn( A, T, shape ) % n-dimensional cross-correlation. Generalized version of xcorr2. % % For 2 dimensional inputs this function is exactly the same as xcorr2, but % also works in higher dimensions. Can also be more efficient because it % performs convolution using convnFast. Note that xcorr2 is part o...
89ee4f47012ec01d8b548d46baa619b5a1b6b3f41d43e3ce442895a49f97c39c
MATLAB
1,543
29
% Create coordinates of intersection contours and intersection edges tissues = length(tissue); PofYZ = cell(tissues, 1); % intersection nodes for a tissue EofYZ = cell(tissues, 1); % edges formed by intersection nodes for a tissue TofYZ = cell(tissues, 1); % intersected triangles NofYZ = cell(tissues, 1);...
9250ddb5f9555400deafd63e84612d0e2f04c99e6799a4b98b7c5a8307b28069
MATLAB
1,543
29
% Create coordinates of intersection contours and intersection edges tissues = length(tissue); PofXZ = cell(tissues, 1); % intersection nodes for a tissue EofXZ = cell(tissues, 1); % edges formed by intersection nodes for a tissue TofXZ = cell(tissues, 1); % intersected triangles NofXZ = cell(tissues, 1);...
e85be58ae6a2668369312a1e4296171ca416e2b49b5d5888639ba8569a81c9ca
MATLAB
1,543
52
function varargout = plot_avSel5(vcf, avsd, summaryInfoTable, selSmltId, pcof1_act, pcof2_act, plRefSlop_act, id4col) % similar to plot_avSel4, but with plot_avDis...2 % nsmlt = height(summaryInfoTable); % for ksai = selSmltId % ksai = k av id % ksa = k av for ksa = 1 : numel(selSmltId) ksai = selSmltId(...
81430860931f9eb986aa1dec35cf481779dfdd9319d0124b4ddcbb1e7b781f0a
MATLAB
1,544
68
function [meantheta,R,sigma,confangle,kappa]=anglemean(theta); % calculates the mean of angles % % [meantheta,anglestrength,sigma,confangle,kappa]=anglemean(theta); % % anglestrength: can be thought of as the inverse variance. [varies between 0 and one] % sigma: circular standard deviation % confangle: a 95% co...
83cc3556a310b9b32faa1bd1b9b8da626f5d8304efe75c9f18630750f4356fe5
MATLAB
1,544
43
function opts = getGlobalDefaults() % Returns a structure with default option values for Manopt. % % function opts = getGlobalDefaults() % % Returns a structure opts containing the global default options such as % verbosity level etc. Typically, global defaults are overwritten by solver % defaults, which are in ...
a75a50b0080a700533bd414cee792dff0eb835dbbe43a0bbe8eb7a33ee2b52c8
MATLAB
1,544
49
function fp = fmf_write_header( filename, header_size, version, ... f_height, f_width, bytes_per_chunk, ... max_n_frames, data_format) % fp = fmf_write_header( filename, header_size, version, % f_height, f_width, bytes_per_chunk, %...
7bb850c827697735f512d6284c9d4651d26e1cd9e0b8198f02cc01fbc1df3b48
MATLAB
1,545
72
function synchrot = plot_syncro(synchro, chanlocs,cha,title,power) % head plot, sincronia entre electrodos % synchro = matriz de sincronia % chanlocs = loacalizacionde electrodos % chan = electrodos para plotear % xxx = 1%5; yyy = 1%12; if iscell(synchro) meansyn = zeros(size(synchro{1})); for i = 1:lengt...
9f60cc4c7fe39d9fd668560bfe740ebdee3aad8fba193c3b7b73c6ef65d6751d
MATLAB
1,545
47
function [FM, xf] = ft_preproc_online_filter_apply(FM, x) % function [FM, xf] = ft_preproc_online_filter_apply(FM, x) % % Passes signal x (channels times samples) through the filter, % returns updated filter model (delay states) and filtered signal. % % See also FT_PREPROC_ONLINE_FILTER_INIT % Copyright (C) 2010, Ste...
a1538e6cd6b49b11e48268614a83ce583c04ae5dffb65c36dbe058a0f9d0bc3b
MATLAB
1,545
55
function [prep_data, data] = meg_getData(sqdfile,p) % function [prep_data, data] = MEG_GETDATA(filename,parameters) % % INPUT % filename: string path to sqd file % p: structure of expt parameters % OUTPUT % data: time x channels x trials matrix % % Karen Tian % January 2020 % dat = ft_read_data(sqdfile); ...
f330d1fe5bd503733e4bfb601083d13f920c2ade28cd38b633dbb4eaaf333d72
MATLAB
1,545
44
function CBIG_ASDf_checkJobStatus(progress_file, num_jobs, lag_time) % CBIG_ASDf_checkJobStatus(progress_file, num_jobs, lag_time) % % This is a helper function that holds off the next jobs until submitted jobs % are finished. Useful when the next job is dependent on the submitted % jobs. % % Input: % - progress_f...
1251af74c20ce9db284ba8a9cff9746b2defed65702e3079e854252d151340bc
MATLAB
1,546
43
function IndividualROI = y_CheckIndividualROI(ROIDef, iSub, Flags) % function IndividualROI = y_CheckIndividualROI(ROIDef, iSub, Flags) % Check and get Individual ROI % Input: % ROIDef - ROIDef, any .txt definition would be checked % Flags - can be: 'Seed_Time_Course_List:'; 'Seed_ROI_List:'; 'Covariable...
3d7a7b05bdd6a4879c5273f4a385d015225604486b21dd4bb6c5f9f5e4f24175
MATLAB
1,546
53
function [el, lab] = read_elec(fn) % READ_ELEC reads "la/mu" electrode parameters from a MBF electrode file % which are used to position them on a triangulated surface % % [el, lab] = read_elec(filename) % % where el = [tri, la, mu] % and lab contains the electrode labels (if present) % % See also READ_TRI, TRANSFER_E...
645aff9bca8d574fb7f6804bb77a4d5b58c66b2bf95cf4275f7c292b01ff9903
MATLAB
1,546
57
function [pnt, tri] = read_off(fn) % READ_OFF reads vertices and triangles from a OFF format triangulation file % % [pnt, tri] = read_off(filename) % % See also READ_TRI, READ_BND % Copyright (C) 1998, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation an...
95628c95b56a90dfb6328b0a720b657cbcbd0167c295a14f728019a6e793a2e8
MATLAB
1,546
71
function [counts,bin,centers] = histn(x,varargin) % parse inputs if length(varargin) < 1, error('usage: [counts,bin] = histn(x,centers), [counts,bin] = histn(x,''edges'',edges)'); end if ischar(varargin{1}), if strcmpi(varargin{1},'edges') && length(varargin) >= 2, edges = varargin{2}; nd = length(edges);...
6dffb4aaa814bec97f0cdaf1d8c78fd96a7120af0b542cd2b22ea4a0ca16bce1
MATLAB
1,547
52
%% trimdatacell % Small utility to trim a dataCell to a given set of trials or channel row % indices. % % INPUTS: % dc % - dataCell structure; either xtDataCell or ppDataCell % TRIAL_LIST % - Vector/Integer % - Trial indices (dataCell columns) to include in trimmed dataCell % CHANNEL_LIST % ...
725bac60a72a973b868d935fee4ce0f2d3dd6ee75c43e963d32a48c633aaf20c
MATLAB
1,547
39
function h_genericSettingCallback3(hObject, handles) % this function try to setting the state variable for various fields so % that coding is simplified. % At some places, FV_settingQuality or FV_updateStateVar is used instead for enhanced % functionalities. global h_img3; [currentInd, handles, currentStr...
a9bbb78d8a78adc74c20aad8689a53ea99277de1956073c840939e2d6b5e976d
MATLAB
1,547
43
function [Stublinked, BlinkTimes] = Stublinks60(inputMat, SAMPLE_RATE) % This code is a wrapper for stublinks.m, written by Sharif Kronemer %SAMPLE_RATE = 1000; DURATION = size(inputMat,2)./SAMPLE_RATE; %12000/1000 = 12 %Stublinked = zeros(size(inputMat)); %size 2 x 12000 %BlinkTimes = zeros(size(inputMat...
abc958aa24c1d4cecba923310717c40ba80851c68f7f85cb39bd7e61627248e5
MATLAB
1,547
73
% Visualize difference between KL(p,q) and KL(q,p) where p is a mix of two % 2d Gaussians, and q is a single 2d Gaussian % This is Figure bishop-5-4 %PMTKauthor Cody Severinski clear all mu = [-1,-1; 1,1]; Sigma = zeros(2,2,2); Sigma(:,:,1) = [1/2,1/4;1/4,1]; Sigma(:,:,2) = [1/2,-1/4;-1/4,1]; SigmaKL = [3,2;2,3]; ...
27c4847ad1f5e1a76914fe6ccf1c3ffcfecf390252a4ffb7aa1293ff92889608
MATLAB
1,548
55
function [dat_out,clindx,keepit] = iimg_cluster_prune(dat,datsig,volInfo) % Prunes an image data vector (dat) assumed to contain suprathreshold % contiguous clusters ("blobs") by saving only those blobs that have one or % more significant (nonzero) elements in another image, datsig % % :Usage: % :: % % [dat_out,cli...
f8ac1c247c0ae66ddff84d01711584f5aab269152a3de38b45d16d7b05126487
MATLAB
1,548
45
function extract_dropped_samples(varargin) %extracts timestamps of samples dropped from Neuralynx file during the recording %note that these samples must be removed at a later step in the pipeline, %as during "drops" samples are drawn from the existing samples in the buffer and do not %reflect real data. if isempty(va...
54a6d15a79b0df16097494a6875fec67ba4b18a70aff68873fab136397f18fd4
MATLAB
1,549
41
function kout = breakup_seg(seg,th) % splits up a segmentation into new unique disconnected labels % % Alexandru V. Avram, Ph.D. % NIH 2022 % if nargin<2 th = 100; end ct = 1; kout = seg*0; CC = regionprops3(seg,'Centroid','VoxelIdxList','Volume'); for k = 1:length(CC.VoxelIdxList) tmp = s...
55d28d0f0b892f7a88280a35a76c087e69c748c59e0ce6ede2215499ef5f78ce
MATLAB
1,549
40
function C = conv2fft(varargin) % C = conv2fft(A, B) % C = conv2fft(H1, H2, A) % % C = CONV2FFT(A, B) performs the 2-D convolution of matrices A and B. % If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then % mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]). % % C = CONV2FFT(H1, H...
999c531f9ff15fa2b6fb7ac18bd955a4a0dd3dad4278eafc3c9e378424bebd3e
MATLAB
1,549
53
function [yhat, py] = naiveBayesPredict(model, Xtest) % Apply a Naive Bayes classifier % We currently assume binary features % For Gaussian features, use discrimAnalysis. % yhat(i) = argmax_c p(y=c|Xtest(i,:), theta(c,:)), in 1:C % py(i,c) = p(y=c|xi, params) % This file is from pmtk3.googlecode.com vectorized = tr...
b1e4a21b7e831c8a2ed9640180d12801af3e5a23bf19c76678b3717d154f7ad9
MATLAB
1,549
48
function t = subsasgn(t,s,b) %SUBSASGN Subscripted reference for a ttensor. % % See also TTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation...
c320c91caec19ef98a313d2a686381cae1f6ac3630f2bbda1a6ca6f9a0d33189
MATLAB
1,549
36
function [trl, event] = ft_trialfun_edf(cfg) % FT_TRIALFUN_EDF is an example trial function. It searches for events of type "up" % in an analog data channel, as indentified by thresholding. This threshold can be a % hard threshold, i.e. a numeric, or flexibly defined by an executable string (e.g., % calculating the 'm...
cde2d02743753498b86e3edf4f68bd287a7dfee79ed072dd39d099b52f982162
MATLAB
1,549
64
clear;close all;clc;FS=22; %pkg load image % Co-ordinates and dispersions for the kernel y=-81:80; x=-86:85; [X,Y]=meshgrid(x,y); D=2; t=1:30; sigma2=4*D*t; for j=1:length(t); P{j}=exp(-(X.^2+Y.^2)/(4*D*t(j)))/(pi*4*D*t(j)); end %% % Затравочные иозображения с локализацией в 1 пиксель (разреше...
744d1bc633d7165a72539952d598a5078643d81981450fd211da32f133c79829
MATLAB
1,550
32
% 1) Separation strategy % Marker-Controlled Watershed Segmentation % http://se.mathworks.com/help/images/examples/marker-controlled-watershed-segmentation.html function [ nuclei_seg ] = segment_nuclei( nuclei_chnl ) % function: Short description % Watershed segmentation % https://blogs.mathworks.com/steve/2013/11...
14ffd23ab9486afc580188cde1ff813267062e6c9e5d39e5aae3ad026ead788d
MATLAB
1,551
50
% RSKELF_CHOLSV Solve using generalized Cholesky factor from recursive % skeletonization factorization. % % Typical complexity: about half that of RSKELF_SV. % % Y = RSKELF_CHOLSV(F,X) produces the matrix Y by applying the inverse of the % generalized Cholesky factor C of the factored matrix F ...
254885f8cff8822b2e6a903c4f6d518af33a29343491261be4a15fcf15458308
MATLAB
1,551
39
function [config] = get_studydetails() config = []; % The location of the downloaded data % eg: config.datadir = '/home/disk3/ajquinn/ds000117/'; config.datadir = ''; % <- edit this line % The location of the downloaded scripts directory % config.scriptdir = '/home/disk3/ajquinn/HMM_frontiers...
60a85ad780ad26344ab1f34ba6d367f399fc88215c4ff5469887cc116630f861
MATLAB
1,551
43
function [Nx, Ny, Nz] = GaussNormal(X,Y,Z,sigma) %GaussNormal computes smoothened normal using Gaussian derivative % % GaussNormal(X,Y,Z,sigma) %--------------------------------------------------------------------- % license %-----------------------------------------------------------------...
9ac036e6a86e7003728821447a320a338374d14aa82fa1569750ed06176cf78a
MATLAB
1,551
62
function C = mtimes(A,B) %MTIMES Multiplies two tenmat objects. % % C = MTIMES(A,B) computes the product of A and B. The result is a % TENMAT object and can be transformed into a tensor. % % C = MTIMES(A,B) is called for the syntax 'A * B' when A or B is a % TENMAT object. % % See also TENMAT. % %MATLAB Tensor ...
277fd9e617c8ff06a7b9187cb7ee22c1679a56ac22fbaba8a4ce68793d7e9339
MATLAB
1,552
64
% assignSignal % Assign signal from sigSL and sigRL clear sl rl ylims switch dim case 'TinC' sl = sigSL.TinC*1000; rl = sigRL.TinC*1000; ylims = [0 30]; if sub0 == 1 ylims = [0 20]; end case 'TinI' sl = sigSL.TinI*1000; rl = sigR...
86af6ac258e9e689957884ffbd39427d141245c25d13c75172080fc7d4a95b80
MATLAB
1,552
51
% This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
a307d939ec13d31a4f11c50bd3b2fa3c0939e9d23c05c60e42a576e44d249e39
MATLAB
1,552
60
function result = deflateimports(r) import yaml.*; result = recurse(r, 0, []); end function result = recurse(data, level, addit) import yaml.*; if iscell(data) && ~ismymatrix(data) result = iter_cell(data, level, addit); elseif isstruct(data) result = iter_struct(data, level, addit); else ...
72460c435930c3d9d90f6b47164a38f5cbd4cd6f49f91edc120eadb0d41a27bd
MATLAB
1,553
38
function params = prepare_system_limits(params) if params.gen.field_strength == 7 % 7T, SC72 gradient lims = mr.opts('MaxGrad',65,'GradUnit','mT/m',... 'MaxSlew',200,'SlewUnit','T/m/s',... 'rfRingdownTime', 20e-6,'rfDeadtime', 100e-6,'adcDeadTime', 10e-6, 'B0',6.98); % To read it in VM I need ...
eee3df2ed21ddffe05b09396fad980411cc23ad1da5bd0a7f39f4650f7f39b01
MATLAB
1,553
58
CStr = textread('../filtered_transcripts.txt', '%s', 'delimiter', '\n'); %Load a sample file data = load3DTif('/Users/Goody/Neuro/ExSeq/culture/input/sa0916dncv_round1_summed.tif'); gene_idx = 0; gene_names = {}; gene_space = {}; transcript_locs= []; trans_idx =1; %% Load all for row_idx = 1:length(CS...
0e334842536e6e9b41a4f5b4fc9aee901cd406af22ec9a4610e7577ae5e01121
MATLAB
1,554
27
figure('Name', 'PEV Scatter', 'NumberTitle', 'off', 'color', [1, 1, 1], 'position', [360 50 600 400]); hold on; clear h rgb = [0.3 0.6 0.3; 0.1 0.4 0.5; 0.8 0.8 0; 0.5 0.2 0.2;]; % 1-way, z-score, 0.05 sign val: 1.645 signval = 1.645; % non-significant idx1 = avg_omega(:,1)<signval & avg_omega(:,2)<signval; n(1...
53f5de3a78d77ad5db4539229752d1d810cde7fd870076e99079f614aa998e4e
MATLAB
1,554
55
% Function that computes the average subpopulation activity % INPUTS: % s0: spike times and indices of neurons which spike % t_start: beginning of the timewindow we are interested in (ms) % t_end: end of the timewindow we are interested in (ms) % idxSelNeur: linear indices of the selected neurons % bool_plot: 1 to plo...
63bbec2a972b149f753468d6487d4c1cd532458fb8574fd0a4d4bb7e24115630
MATLAB
1,554
59
%% Bootstrap demo for the MLE for a Bernoulli % %% % This file is from pmtk3.googlecode.com fs = 12; setSeed(1); theta = 0.7; Ns = [10 100]; for Ni=1:length(Ns) N = Ns(Ni); B = 10000; X = rand(1,N) < theta; estimator = @(X) mean(X); bmle = estimator(X); mleBoot = zeros(1,B); for b=1:B...
6fcc43ed15fdf99acbd01877faf4908bd11060168f62a54ef39238cfbdcb5ae3
MATLAB
1,554
27
figure('Name', 'PEV Scatter', 'NumberTitle', 'off', 'color', [1, 1, 1], 'position', [360 50 600 400]); hold on; clear h rgb = [0.3 0.6 0.3; 0.1 0.4 0.5; 0.8 0.8 0; 0.5 0.2 0.2;]; % 1-way, z-score, 0.05 sign val: 1.645 signval = 1.645; % non-significant idx1 = avg_omega(:,1)<signval & avg_omega(:,2)<signval; n(1...
c0a0542033bdcf4d7f724d588fac58047f674bff19488741c651853aeaebae02
MATLAB
1,554
66
function dy = CBIG_MFMem_rfMRI_mfm_ode1_4p(y,parameter,SC) % dy = CBIG_MFMem_rfMRI_mfm_ode1_4p(y,parameter,SC) % dy = CBIG_mfm_rfMRI_mfm_ode1_4p(y,parameter,SC) %----------------------------------------------------------------------------- % dy = CBIG_mfm_rfMRI_mfm_ode1(y,parameter,SC) % % Function for dynamica...
e5cb8cb662391490105e4837e257d51263134671974f849f9b931db1c402faee
MATLAB
1,554
45
%% Generating the leading mode-n vectors % The leading mode-n vectors are those vectors that span the subspace of % the mode-n fibers. In other words, the left singular vectors of the % n-mode matricization of X. %% Using nvecs to calculate the leading mode-n vectors % The |nvecs| command efficient computes the leadin...
58a76eb8b67e061ba98675f3607b20c4956983033109ad555ba485458b53ced6
MATLAB
1,555
46
function T = permute(T,order) %PERMUTE Permute tensor dimensions. % % B = PERMUTE(A,ORDER) rearranges the dimensions of A so that they % are in the order specified by the vector ORDER. The result has the % same values of A, but the order of the subscripts needed to access % any particular element are rearranged...
49f562ad9f0a8581edcd1bd06dda4699c0e2d4142c88b88feed8f32e66e160cb
MATLAB
1,556
50
% Compare to Fasano & Franceschini simulations n = [5 7 10 15 20 30 50 100 200 500 1000 2000 5000]; samples = 100; Z = zeros(length(n),samples); pval = zeros(length(n),samples); for i = 1:length(n) n(i) tic; for j = 1:samples r1 = rand(n(i),2); r2 = rand(n(i),2); [p,D] = kste...
defa39384a8f454d0d385b8b521c71f7a53d97c9297c1714f1b9b7144bacd629
MATLAB
1,556
43
function [infos, status] = VBA_version() % infos = VBA_version() % return infos about the current version of the toolbox. It requires the % toolbox to be installed using git (not by downlading the zip) to work properly: % git clone git@github.com:MBB-team/VBA-toolbox.git % OUT: % - infos.path: path of the tool...
1ef221b1845021d24c72b9593eec7073809a8906d8bac86f602072735709200b
MATLAB
1,557
34
function [max_run_jobs,max_run_jobs_downsampled] = concurrency_size_in_normalization_cuda(cond) loadParameters; if ~isfield(params,'NORM_MAX_RUN_JOBS') main_mem_usage = params.MATLAB_PROC_CONTEXT; job_worker_mem_usage = 4 * cond.imgsize_dbl + params.MATLAB_PROC_CONTEXT; max_run_jobs = ...
659b7311bfff5b64b352e2dd4e4735bf3c2ef48dd1f692f57752bb25aa0c556f
MATLAB
1,558
40
function [hs,ps] = forestApply( data, forest, maxDepth, minCount, best ) % Apply learned forest classifier. % % USAGE % [hs,ps] = forestApply( data, forest, [maxDepth], [minCount], [best] ) % % INPUTS % data - [NxF] N length F feature vectors % forest - learned forest classification model % maxDepth - [] maxi...
b8df9d4a799dfca7e672ee915accb171ccdc87868950090f96203ca0290f6902
MATLAB
1,558
59
function paf = graph2paf(nodes, edges, sz, channelsOnly, sigma) %GRAPH2PAF Converts a set of edges into part affinity fields. % Usage: % graph2paf(nodes, edges, sz, sigma) % % Args: % nodes: set of points (N x 2) % edges: indices into nodes defining directed edges (E x 2) % sz: grid/image size (1 x 2) % chan...
9d6e87fe87ebf0229a647ec48abbe40593ade596add6cd91b06d79595f74d4fc
MATLAB
1,559
33
function [circle_centers, circle_radii] = generate_colony_centers_and_radii(num_circles, circle_size, circle_size_var, padding, inner_plate_radius, outer_plate_radius, min_border_distance) circle_centers = zeros(num_circles, 2); circle_radii = zeros(num_circles, 1); pick_center = 1; while pick_center <= num_circles ...
d098114392c4c60f12c1ec5f8c52a873b497dd5d4dbd5fe70e0d1c3452c53431
MATLAB
1,559
52
function filtsign = lan_fir2(LAN, min_freq, max_freq, chan) % lan_fir2 realiza de forma intuitiva un filtro FIR sobre todos los canales % especificados 'chan' en un entorno LAN, para uno o multiples trials, con % un rollover constante de 0.5 % Los parametros min_xfreq y max_freq pueden ser [] o un número real: % - Ban...
d3af9102fa6ca5fa2b49e3923ed535ac94002c45cbe3330a6784f064309c3aee
MATLAB
1,559
47
%// temporary method for explicitly defining ppData components for OOP %_______________________________________ % Copyright (C) 2024 Trevor S. Smith % Drexel University College of Medicine % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as...
456e7dd59daa6f03581ebb7a01a97dfd1aea21fdafd4a955a045b1ccd993e541
MATLAB
1,560
50
function y = pinknoise(m, n) % function: y = pinknoise(m, n) % m - number of matrix rows % n - number of matrix columns % y - matrix with pink (flicker) noise samples % with mu = 0 and sigma = 1 (columnwise) % The function generates a matrix of pink (flicker) noise samples % (columnwise). In terms of power at a co...
56fe9a642a35d4697b4e79bd2cb02862b5294b3a0b471719890a8d8abcaf9d7e
MATLAB
1,560
71
function convertFile2crabFormat(filename, file_ext) % first check if it has already been converted [~,a] = fileparts(filename.name); if exist([filename.folder filesep a '.crab'],'file') == 2 disp('Already converted, skipping...') return end self = crabsort(false); self.path_name = filename.folder; self.file_nam...
a5a31cee9485eea1ce22346737f14bf4f0c8e9fcdef63d4dec869b0fb84dd581
MATLAB
1,560
58
%% RosenBrock Demo % %% %PMTKinteractive %PMTKneedsOptimToolbox % This file is from pmtk3.googlecode.com % "A note on the extended rosenbrock function" Evol. Comp. 2006 % claims that for d=4 to 30 dims there are 2 local minima, at [1,1,...1] and % and near [-1,1,...,1]. % Let us verify this for d=4 and d=5 %xstart =...
c45ce928a9edc00b5bfad43332864c317a7d4219370060044d5344d5ae9e996e
MATLAB
1,560
34
function [max_run_jobs,max_run_jobs_downsampled] = concurrency_size_in_normalization(cond) loadParameters; if ~isfield(params,'NORM_MAX_RUN_JOBS') main_mem_usage = params.MATLAB_PROC_CONTEXT; job_worker_mem_usage = 6 * 4 * cond.imgsize_dbl + params.MATLAB_PROC_CONTEXT; max_run_jobs = m...
4277310c65b832017d6b767d1c62ba86cb047a4bfb8bbef29389abab9cb5596b
MATLAB
1,561
41
function [rf_phase_offset,adc_phase_offset] = rf_adc_phase(params) %% 3D RF and ADC phase % This part is coming from ./Emily/RF_design/calcRFphase_3D.m % I don't know how this works for 3D; I kinda know now delta_x = 0; Gslice = 9.5571; Tpulse = 2560; Asym = 0.5; InitPhase = 90; ...
8317a29b71192ed514ea4ccb299e2606ff165bccc057c28f2c10fb282cf14a7f
MATLAB
1,561
66
% demo GLM under multiple covariance components % This demo exemplifies how to wrap the VBA model inversion scheme to make % it estimate multipe covariance components within the context of a GLM % analysis. % function demo_covComp Qy{1} = kron(diag([1;0;0]),eye(8)); Qy{2} = kron(diag([0;1;0]),eye(8)); Qy{3} = kron(di...
b932ff199374819e1152cb25e19854e9b05508a5811a807139de4e1095808695
MATLAB
1,561
48
function figName = createFigureName(toolName,targetFigureHandle) % CREATEFIGURENAME(TOOLNAME, TARGETFIGUREHANDLE) creates a name for the figure % created by the tool, TOOLNAME. The figure name, FIGNAME, will include % TOOLNAME and the name of the figure on which the tool depends. TOOLNAME must % be a string, and TARGE...
c709c0c64c8ae7df96316d600d55a4a8870284b28d0551e49aea417c9bb51df2
MATLAB
1,561
72
x = h5read('02_b3_000_000.hdf5','/estimates/F_dff'); x=xx; b=size(x) %x1=posTrials02 peak_num = []; Prom = []; peak_num = []; Prom = []; for l=1:b(2) w=x(:,l); figure plot (w) end % ampD = [ampD Damp]; % Dcoord = [Dcoord DX] % hold off % end %Damp=mean(w(DX-shag/2:DX+shag/2)) x1=[1:b(2)]; x2 = [];%%% tr...
2000e26c89e42e8768de38253f3016b0da0efffd2cd0df74bc925320ceb9cb97
MATLAB
1,562
68
% This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
38d9ab3662cc5aa18559211b46911e9b6a324743be41caeb4918c076b05e3adb
MATLAB
1,562
39
function generateAuthorLocReport() %% Generate the html contributing author LOC report % Create a table of authors and the total lines of code contributed % PMTKneedsMatlab % This file is from pmtk3.googlecode.com dest = fullfile(pmtk3Root(), 'docs', 'authors'); pmtkRed = getConfigValue('PMTKred'); R = pmtkTagRep...
7063bff46ee1468288bfafce2d9914f78947ed75fb68e3b0ede4fadb5d7e5ad8
MATLAB
1,562
53
function ndx = sub2indv(siz,v,varargin) %SUB2INDV Linear index from multiple subscripts. % SUB2INDV is used to determine the equivalent single index % corresponding to a given set of subscript values. % % IND = SUB2IND(SIZ,V) returns the linear index % equivalent to the N subscripts in the arrays V = [I1,I2,......
074e8f00ac0ccfe186a46910d4396d1f4fec7fdbfd61d5bbe8790b58e1b3ada3
MATLAB
1,563
57
%% Bayesian inference of the mean of a 2D Gaussian with fixed Sigma % %% Sample Data % This file is from pmtk3.googlecode.com setSeed(0); muTrue = [0.5 0.5]'; Ctrue = 0.1*[2 1; 1 1]; mtrue.mu = muTrue; mtrue.Sigma = Ctrue; xyrange = [-1 1 -1 1]; ns = [10]; X = gaussSample(mtrue, ns(end)); ...
0f9de5bcb5a267a260086eaef7254af46b081005a85dee40e3b97b239b4547a8
MATLAB
1,563
42
% PercentvarPerVariable % Sarah West % 8/4/22 % Calculates the percent variance of brain data (explanatory or "X" data) % explained by each behavior variable (response or "Y" data) in a PLSR % regression. Is run with RunAnalysis. % Inputs: % parameters.XL -- the loadings of each component/latent variable for the ex...
3861a5e02a4bd82184a7c9d4f7d580f819dda257510a4cd3b6b1dee9f4bccb36
MATLAB
1,564
48
function [impreds, stagauss] = predictGaussModel(mdlparams, imEnsemble, nrx, nry) %UNTITLED Summary of this function goes here % Detailed explanation goes here [ypix, xpix, Nims] = size(imEnsemble); imenuse = reshape(imEnsemble(nry, nrx, :), [numel(nry)*numel(nrx), Nims]); rfparams = [mdlparams.gaussparams 1];...
df153068df1d4f940d4259af0f3db40b6a7140c9c48ed96074171a59edefd9ae
MATLAB
1,564
47
function [newCond, newCondinds] = ConditionIndexes(unique_cond,reginds) % function [newCond, newCondinds] = ConditionIndexes(unique_cond,reginds) % a function to return the conditions and the global conditions indices by % a specified set of variable indices % INPUT: % unique_cond - C x P array listing all C possible...
362030c8609668077dec7d30746f926d1047034b547206883f9b585c8190fce0
MATLAB
1,566
37
function [BOUT_ENDS_AND_BEGINNINGS_indices,BOUT_ENDS_AND_BEGINNINGS]=GET_FEEDING_BURSTS(Onsets,... diff_Onsets__or___IFI,Criterion_for_defining_regular_feeding,MINIMAL_NUMBER_OF_TOUCHES_IN_THE_BURSTS,Plot_raster_for_check_or_not) %Onsets=ons1{ThisFly,Condition}; %IFI=IFIs1{ThisFly,Condition}; VARIABLE_TO_US...
6afef7e50826487863ec5ac64ed8c1892348ff49e51dccef608bff62d56c6be8
MATLAB
1,566
66
close all; clear all; clc; F = csvread('filename.csv'); N=831; %number of cells t=306; %number of frames in the moviedFoF_new=zeros(t,N); dFoF=zeros(t,N); x=linspace(2,t,t-1); %To find fitting curve figure(1); plot(F); t=1:t; for i=1:N fitting=fit(t.',F(:,i),'exp2'); F_corrected(:,i)=(F(:,i)-fit...
014fddae01e488a3534b9313561fe82e84b14170c5d8ed4bcad2de1501a585bb
MATLAB
1,567
54
%% Example of parameter updating in a Beta-Binomial model % %% % This file is from pmtk3.googlecode.com data(1).a = 2; data(2).a = 2; data(1).b = 2; data(2).b = 2; data(1).N1 = 4; data(2).N1 = 40; data(1).N0 = 1; data(2).N0 = 10; data(3).a = 1; data(4).a = 1; data(3).b = 1; data(4).b =...
6ef9cf26d14acd63e40e9db8737dcd5edbf61ebc306eb124689835860ffdc612
MATLAB
1,567
63
%% Bernoulli mixture model for mnist digits % %% Setup data % This file is from pmtk3.googlecode.com setSeed(0); binary = true; keepSparse = false; Ntest = 1000; Ntrain = 1000; % Kvalues = [2, 10]; Kvalues = 2:15; Kvalues = [20]; [Xtrain, ytrain, Xtest, ytest] = setupMnist('binary', binary, 'ntrain'...
7a66fde5ec2bc48c1a1c92cf4697950d6e341a084e940dc858204b5ee22e80c9
MATLAB
1,567
51
function [G,r] = calc_prob_gradient_with_positions(sites,L,invert_y,normalize,sites_jackknife,show_jk_avg,calc_significant_path_args) if (nargin < 3) || isempty(invert_y) invert_y = false; end if (nargin < 4) || isempty(normalize) normalize = false; end if (nargin < 5) || isempty(sit...
8de8b5a3c62940091f3f5dbf6c3f99fd2d4a1e737c0493dc74d1f493c5028e46
MATLAB
1,567
49
function D = build_KLdiv(datadir, hmmdir, kerneldir, HMM_name, only_1st) % D = build_KLdiv(datadir, hmmdir, kerneldir, HMM_name, only_1st) % % build symmetrised KL divergence matrix based on time-varying model (HMM) % This requires that the group-level HMM has been fitted to the % timecourses. % The divergence matrix w...
961ad6ca71ed80c45b32442138d829636f6ae5413aa3737d27750bebae4f27ae
MATLAB
1,567
48
function y = modefilt1( x, s ) % One-dimensional mode filtering. % % Applies a width s one-dimensional mode filter to vector x. That is each % element of the output y(j) corresponds to the mode of x(j-r:j+r), where % r~s/2. At boundary regions, y is calculated on smaller windows, for % example y(1) is calculated over x...
5945ee58a02dc96bca845027f16fa066b265f16e4160bf3a560a48211f7279a2
MATLAB
1,568
58
function [indices minBoundBox numNonZero] = findZeros(mat); % %----------------------------------------- % [indices minBoundBox numNonZero] = findZeros(mat) % % finds a square that is a power of 2 in size % and includes the non-zero portions of % the input matrix % % mat: input matrix % % indices: indices into the squ...
92be97b8eaa4070ad37391b1a2e4d20b309a782d285e8000346d59e31ae21a4d
MATLAB
1,568
47
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% topological_kmeans_init.m %%% %%% Author: GN Ponasso (2024) %%% %%% Calculate a well-spaced initial set of cluster centers for k-means %%% %%%%%%%%%%%%%%%%...
1911f3d38f0ba052186e25143d7b425cf903da25f5b89ad4759c8d20dd3d01d1
MATLAB
1,569
50
Contents: Main ----------------------------------------- metamerTest.m - test script showing basic functionality metamerOpts.m - create structure with options metamerAnalysis.m - compute model parameters on an image metamerSynthesis.m - synthesize a new image Analysis ----------------------------------------- wmean2....
6f653003cc7195f7fd519c6481b78089476bf2d950eec16fc2a344cb68e25cb2
MATLAB
1,569
23
function StateSwitch_addSurroundingCues_visual(expInfo, screenInfo, indRun, indBlock, indTrial) % adds the surrounding cues for the next flip for indAtt = 1:4 CueImg = ['img_vis',filesep, expInfo.attNames{indAtt},'Q.png']; [cueLoad,~,~] = imread(CueImg); cue2Disp = Screen('MakeTexture',scree...
510771a75fc906850bf4c34d8588e5e0a269edea42bceaaa9f62252af701dce8
MATLAB
1,570
50
% Author: Birgit Nierula (Feb, 2020) % nierula@cbs.mpg.de %% SRMR1: Manual R-peak detection % --> to use after automatic detection steps (SRMR1_01_prepro_1_automatic_Rpeakdetection.m) % Adapted from Ulrike % Usage of manual r-peak selection tool: % Input: some eeglab data (set file) with peaks as additional events % ...
52869fbda62c933949218ec1e12465771937daa3a619cd960682068dfb97c5fd
MATLAB
1,570
51
function varargout = angle_between_vectors(v1,v2,in_deg,return_only_cos_theta) % v1 is a row vector or a collection of 1 vector per row % v2 is a row vector or a collection of 1 vector per row % return % theta: angle between v1 and v2 (or each row of v1 and the corresponding row of v2) % CCW angles relative to v...
2704bff0b71066a7271c08205b97dbbbb5bdd4c738426fa294d052c4e852d344
MATLAB
1,571
50
function [pnt, tri] = ksphere(N) % KSPHERE returns a triangulated sphere with K vertices that are % approximately evenly distributed over the sphere. % % Use as % [pnt, tri] = ksphere(K); % % This implements the recommended algorithm in spherical coordinates % (theta, phi) according to "Distributing many points on ...
470e89348a2f79086823e5bd1054e97cef80ca894da34d2b63de28e040f5412d
MATLAB
1,571
50
function [hist12, hist1, hist2]=mutual_histogram_double(I1,I2,Imin,Imax,nbins) % This function makes a 2D joint histogram of 1D,2D...ND images % and also calculates the seperate histograms of both images. % % Note! : For a value of 4.3, the histogram function will put 0.7 in bin 4 % and 0.3 in bin 5. This makes t...
02520150f45524b30f4383fbf0b8b41cb15dec5c056da6a30c938d5685b5103f
MATLAB
1,572
59
%% Relative MSE plot %PMTKneedsStatsToolbox ksdensity %% % This file is from pmtk3.googlecode.com requireStatsToolbox n = 1:50; k0 = 0:3; sigmaTrue = 13; mu0 = 100; thetaTrue = 112; theta0 = 100; mseThetaE = zeros(length(n), length(k0)); mseThetaB = zeros(length(n), length(k0)); for k=k0 w = (n./(n + k)); mseThet...
54d115222546a62b0c2c8f9834beed4b81326c7e1310070fcc0dff739821fbea
MATLAB
1,572
78
function V = downsample(U) % Try the 5x5 filter for building the pyramid: % Now works with color images! U = double(U); [r,c,k] = size(U); p = floor((r+1)/2); % row q = floor((c+1)/2); % col U2 = zeros(r+2,c+2,k); for i=1:k U2(:,:,i) = [U(:,:,i) U(:,end,i)*ones(1,2); ones(2,1)*U(end,:,i) U(end,end,i)*ones(2,2)...
613a6e90d27ba62e3d526ba5fc2d1015d911e19958a30cdd4d8e8a9603af2b57
MATLAB
1,572
45
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef EventTag < Tag %EVENTTAG Base class for tagged events in the file.Indicates %time stamps for particular events properties(SetAccess = private) % SamplingFrequency: Sampling...
6adee034d841811390d2e7f05f3fbbba32bac88dceef9759299056e9bfac89a0
MATLAB
1,572
1
% TSLOADRAW Load a MEDPC file onto the Experiment structure % TSLOADRAW(FILENAME) loads in the data from FILENAME into TSData. This % function is the one to use in the fully automated regime, where the % data are grabbed from the Backup folder in MedPC-IV rather than from % the Data folder function [ SUCCESS...
906c740ae1cc3578cd47fc11c6d56c163f3d56171e5fdc0fb16207b6267f365b
MATLAB
1,572
50
function [feven,fodd] = filterGabor1d( r, sig, omega, show ) % Creates an even/odd pair of 1D Gabor filters. % % USAGE % [feven,fodd] = filterGabor1d( r, sig, omega, [show] ) % % INPUTS % r - final filter will be 2r+1 (good choice for r is r=2*sig) % sig - standard deviation of Gaussian mask % omega - f...
ac116915d391f40f56dfbbd8a081fe16d2e05edd92bfc481d32dcd0665f5120a
MATLAB
1,572
48
% Example of 3D affine registration using the fminunc optimizer. % clean clear all; close all; clc; % Add all function paths addpaths % Get the volume data [I1,I2]=get_example_data; % Convert all volumes from single to double I1=double(I1); I2=double(I2); % First resize volume I1 to match size of vol...
af174b3b3089f30a9246326678672cd06d57c2593f039adbb71d370096905bbd
MATLAB
1,572
29
function [ScaleBarLine,ScaleBarLabel]=Auto_ScaleBar_wText(ImageHeight,ImageWidth,PixelSize,ScaleBar_Size,ScaleBar_Unit,ScaleBar_FontSize,ScaleBar_Location,ScaleBar_LineWitdh,ScaleBar_LineColor,BufferRatio_X,BufferRatio_Y) ScaleBar_Length=ScaleBar_Size/PixelSize; if strcmp(ScaleBar_Location,'BL') ScaleBa...
85d1c2e5b045b7143b131dc2935a2ced194e6f7a26bede7b4e04d15b2d8b48a4
MATLAB
1,573
50
function cspec = lan_cspec_load(LAN,chan,trial) % IMPORTANT % this script's purpose is to provide a single smoothed and normalized % spectrogram, regardless of the output format (LAN.freq.powspctrm) % % chan : a SINGLE channel indicator % trial : a SINGLE trial indicator % cspec : smoothed and normalized SINGLE spectro...
ac470e6832659b28553220d907344c213e6df4f875eec1191b9edce74748e3a3
MATLAB
1,573
53
function compute_dwpli(params,bidsID,freqBand) % Load EEG data and check that there are more than 10 epochs data = load_preprocessed_data(params,bidsID); assert(size(data.trial,2)>=10, 'Recording with less than 10 epochs'); % Band-pass filter the data in the relevant frequency band cfg = []; cfg.bpfilter = 'yes'; cfg....
2a8b62879fd6b10e644ff3f19ea828b24b575654ab753784fccdb0a5f5243327
MATLAB
1,574
81
clear all; %% Manually specify ROI names in 0_raw folder ROInames = { % 'S1ROI1'; % 'S1ROI2'; % 'S1ROI3'; % 'S1ROI4'; % % 'S1ROI5'; % % 'S2ROI1'; % 'S2ROI2'; % 'S2ROI3'; % 'S2ROI4'; % % 'S3ROI1'; % 'S3ROI2'; % 'S3ROI3'; % 'S3ROI4'; % % % 'S4ROI1...
74da588dfa4a22e3da11d3f5d86e78cef3b1135aebca606cd9308faed461c89f
MATLAB
1,574
37
function ROIoverlaps % This script will combine all the individual ROIs, and using mricron to % show color-code clusters depending on the amount of overlaps. written by % Jin Wang 5/3/2019 addpath(genpath('/dors/gpc/JamesBooth/JBooth-Lab/BDL/LabTools/nifti')); % addpath the nifti function tools, for this script it is ...
8f4a3858d2999b083b4e41e680142e505a6bbb26323abf7ec1c394f0ec9781d4
MATLAB
1,574
67
function [table, M] = parsePMLtypoFile(fname) % Parse the PML typos file and generate an html table % listing the unique e-mail addresses and the number of each type of error % found. % % **** Download the file as a csv **** % %% Example % parsePMLtypoFile('C:\users\matt\Desktop\typos.csv'); % This file is from pmtk...
de74d171938b95ea09707ca8338bc705886e2b37f9dd267b89617d5e2b196971
MATLAB
1,574
47
function h = mysigstar_absolutepval(ax, xpos, ypos, pval, color, whichWay) % replaces sigstar, which doesnt work anymore in matlab 2014b if ~exist('ax', 'var'); ax = gca; end if ~exist('color', 'var'); color = [ 0 0 0 ]; end if ~exist('whichWay', 'var'), whichWay = 'down'; end if numel(ypos) > 1, assert(ypos(1) =...
09ebeabf81f9d1023c193593840ea6aeed8ac1645be81934311d5e780dc45151
MATLAB
1,575
65
% Same as logregMultinomKernelDemo, except uses KNN % This produces plots of the decision boundaries in 2d. % It uses the same data as knnClassifyDemo, but the plots look nicer. % This file is from pmtk3.googlecode.com function knnClassifyDemo2() %% Setup Data loadData('knnClassify3c'); % 500 samples from 2 classes ...
5622184cd19612aa700689d2f977abeb2d769de26de6b5cc49303437797972c6
MATLAB
1,575
46
% $$C\frac{dV}{dt}=-g_L(V-V_L)+g_L\Delta_T\exp\left(\frac{V-V_T}{\Delta_T}\right)+I$$ % Input defined at Line 30 clear; %clear all variables % close all; %close all open figures %DEFINE PARAMETERS dt = 1/1000; %time step [ms] t_end = 1200; %total time of run [ms] t_StimStart = 100; %time to start injecting current [ms...