sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e6da9dc0b7a4967834fbdf03fa699691c03a975a3d4f05e4fb5a1269447905b2
MATLAB
1,230
36
function hs = adaBoostApply( X, model, maxDepth, minWeight, nThreads ) % Apply learned boosted decision tree classifier. % % USAGE % hs = adaBoostApply( X, model, [maxDepth], [minWeight], [nThreads] ) % % INPUTS % X - [NxF] N length F feature vectors % model - learned boosted tree classifier % maxDept...
7b0cbf6d9d843ff5be4edd39c0cc184f02ccf0253f585256c880d083e1f0e9e3
MATLAB
1,231
40
%% addpath('../engines/bem_fmm_engine/'); FileName = fullfile(patient_path,'mesh_data', strcat(patno,'_wm.stl')); TR = stlread(FileName); P = TR.Points; t = TR.ConnectivityList; normals = meshnormals(P, t); % % If you also want to display normal vectors, uncomment this block % Ce...
836909d7a37a70b5e6298887d85edc1b1f05d010d7f5a722370bbfe66a5ad963
MATLAB
1,231
51
function LAN = resample_lan(LAN,newsrate) % <*LAN)<] % v.0.0.02 % RESAMPLE_LAN change the sample rate. % see also RESAMPLE % % Pablo Billeke % % 11.07.2011 fix double/single and n+1 temporal points % 24.06.2011 %%% cell if iscell(LAN) for lan = 1:length(LAN) LAN{lan} = resample_lan(LAN...
cffa012cad3efa38af9ae0e43fb93b6d8d8f0226c9b2583c684757f351852293
MATLAB
1,231
25
for iArea = 1: 2 switch iArea case 1 txt = 'lip'; case 2 txt = 'fef'; end meanweights = [mean(all_accuracies{iArea,1}), mean(all_accuracies{iArea,2}), mean(all_accuracies{iArea,3}), mean(all_accuracies{iArea,4})]; figure('color',[1 1 1]); % req...
3d4191054ab9b02151708a33d4ef819b4f8a1dad7ae10291bedc1b2505241d4e
MATLAB
1,232
37
function t = permute(t,order) %PERMUTE Rearrange the dimensions of a sparse tensor. % % 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 elem...
6b8d6c9cc7dc1cfe41e7c5d223f7ce3f77d811eba61ed07b37e380302581af25
MATLAB
1,232
40
function [d] = dist(x) % DIST computes the euclidian distance between the columns of the input matrix % % Use as % [d] = dist(x) % where x is for example Nx3 for points in 3D space. % % This function serves as a replacement for the dist function in the Neural % Networks toolbox. % Copyright (C) 2005, Robert Oostenv...
9386936a141e3f7ab1a2c0737ae8ff762147d51e70a3f6976e88a7f48584dcdd
MATLAB
1,232
41
function makeFigureMenubarAndToolbarAPTAppropriateBang(fig) % Delete buttons from the figure toolbar that are not wanted in APT, etc % Want the zoom/pan buttons in the figure toolbar addToolbarExplorationButtons(fig) ; % N.B.: this sets fig.MenuBar to 'figure' % Make sure the menubar and toolbar are showing fig.M...
bb2b62fc1184cce848960a5f4f73016d712f8a9eeefdbb538e558b25e3f108e0
MATLAB
1,232
46
function G = grammatrix(M, x, vectors) % Computes the Gram matrix of tangent vectors in the Manopt framework. % % function G = grammatrix(M, x, vectors) % % M is a Manopt manifold structure obtained from a factory. % x is a point on the manifold M. % vectors is a cell containing n tangent vectors at x. % % G i...
bbf9408f87ae898d864321583efa30fbc2005e0ff3eaf26506a5eeb5b9240576
MATLAB
1,232
63
clear clc %%% This script determines the total number of sessions %%% and the total number of trials available per rat %%% create a list of all rat with behavioral data d=dir('data/Sessions_trials/*sessions.mat'); %%% total number of rats nrats=length(d); for iii=1:nrats [iii nrats] %%% rat name...
08b5b545cdf9d96908b4d9bade6b090244befe120df3a20fc0f1709ca7d6b735
MATLAB
1,233
37
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% s0_patient_selection.m %%% %%% Select a patient and record relevant information %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% clear all re...
0fab15fba306099a10eadcc643cd0591d4778d666fca74c112e32a12525b6f0e
MATLAB
1,233
40
%H7: SDO Proper % Sort-of-redundant; Just rips from the sdoStruct %_______________________________________ % 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 publ...
421a4a2b4d399daa64d3d19ad968d44d4b6f3347b9c68406a6816e784dc1cff5
MATLAB
1,233
41
function [tf,diffs] = issymmetric(X) %ISSYMMETRIC Verify that a ktensor X is symmetric in all modes. % % TF = ISSYMMETRIC(X) returns true if X is exactly symmetric for every % permutation. % % [TF,DIFFS] = ISSYMMETRIC(X) also returns the matrix of the norm of the % differences between the normalized factor matr...
6edc0ec4c174c67af0cf6bc30b149efaa5f013a851a6aca284b6b79f996cc57f
MATLAB
1,233
27
load('/Volumes/LNDG/Julian/Projects/StateSwitch/C_Paradigm/StateSwitch/stimuli_corrJQK.mat') info.combs = allcomb([1,2],[1,2],[1,2],[1,2]); info.WordCategories = {'NoAnimal', 'animal'; 'twoSyllable', 'oneSyllable'; 'uneven', 'even'; 'noH', 'H'}; % yes option is always right, no option left rng(170821, 'twister'); inf...
a1b32c207f3c1514d74cb8f5192ee710c3dc447cfd9ded614a3e7b1cbbf86db8
MATLAB
1,233
59
function hh = logbar(edges,vals,width,colors,hax) if nargin < 3, width = .8; end edges = edges(:)'; nbins = numel(edges)-1; sz = size(vals); if ~any(sz==nbins), error('vals should be ndata x nbins'); end if ~ismatrix(vals), error('vals must be 1- or 2-dimensional'); end if sz(2) ~= nbins && sz(1) == nbins, v...
3e3a2131db25aa38de54149c7ea6b5c6a5462afe2bf4ebe6f3c46b9f21dfb7b1
MATLAB
1,234
54
% Entropy: Returns entropy (in bits) of each column of 'X' % by Will Dwinnell % % H = Entropy(X) % % H = row vector of calculated entropies (in bits) % X = data to be analyzed % % Example: Measure sample entropy of observations of variables with % 1, 2, 3 and 4 bits of entropy. % % Note: Estimated entropy ...
4bb6b2999327c6ebc2319c22443f8efc1e216e01c5b31bcf3a55b1a0cdfc3c4e
MATLAB
1,234
57
function sigmoidBounds() x = [-6:(1/10):6]; function sigupper = sigupper(eta,x) sigupper = exp(eta * x - fstar(eta)); end function fstar = fstar(eta) fstar = -eta * log(eta) - (1-eta) * log(1-eta); end function sig = sigmoid(x) sig = exp(x) ./ (1 + exp(x)); end function siglower = siglower(xi,x) siglower ...
63713f4ef22ff783d1b96a009059e269dfe9e48cfab5e2fc71e8c9c2492da3c3
MATLAB
1,234
52
%% Student T Plot Demo % %% %[X1,X2] = meshgrid(linspace(-5,5,100)',linspace(-5,5,100)'); % This file is from pmtk3.googlecode.com [X1,X2] = meshgrid(linspace(-2,2,30)',linspace(-2,2,30)'); n = size(X1,1); X = [X1(:) X2(:)]; %C = [1 .4; .4 1]; C = 0.5*eye(2); df = 0.1; figure; model.mu = [0 0]; model.Sigma = C; mod...
78fc592a258110a63fa8924452275318fdbeb505c0d16ed3cfb8e9ce9401a3e7
MATLAB
1,234
43
function [input, output] = funargname(fname) % FUNARGNAME returns the input and output arguments of the function % by parsing the m-file % % Use as % [input, output] = funargname(fname) % where the input and output function arguments will be returned % as cell-arrays containing strings. fid = fopen(which(fname), '...
0969a269d065f1e695a47cdb9f64ba83b729d4a488ae90aba29f141b250b8c03
MATLAB
1,235
29
function [pointsline] = targetctr(P, t, Target) % Outputs centerline for Target vs P, t in mm %% Load shell center = meshtricenter(P, t); %% Find nearest faces Rnumber = 8; % number of neighbor triangles ineighborS = knnsearch(center, Target, 'k', Rnumber); ...
bd0d6704d7c415596a64eb76c6fe5c192ff7dd9ebeb03160acd6d08f4f6572fe
MATLAB
1,235
44
% Copyright Christopher Fricke, University Leipzig Medical Center, % Neurology 2024 close all; clear; datafolder = '\results\HCP\datscan_learning\firstlevel'; d = dir(fullfile(datafolder,'learning','*.nii')); for i = 1:length(d) fprintf('.'); nii1 = single(niftiread(fullfile(datafolder,'learning',...
fc6346fb277fa4b21b779c4acfdabf675055b0b2de7a0ab19497e2fd93fffb0e
MATLAB
1,235
30
classdef (Abstract) ShellToken % apt.ShellToken - Abstract base class for shell command tokens % % This abstract class defines the interface for all types of tokens that % can appear in shell commands. Concrete subclasses include: % - apt.ShellLiteral: Plain string literals that need no translation % - apt....
7c2b8603068e972dd3fa93f53ccded097f826a074108b2cd8065109aff227d0e
MATLAB
1,236
43
function [X, y] = mixGaussSample(varargin) % Sample n samples from a mixture of multivariate gaussians % all with the same dimensionality. % [X,z] = mixGaussSample(model, N) % or % [X,z] = mixGaussSample(mu, Sigma, mixWeight, N) % where % mu(:,c) - a d-by-C matrix, with mu(:, c) = the mean of component c. % Sig...
91b33e7712d280f2b259299d5c3404c9b5544b9a970b33ae61622ce7b54ca89f
MATLAB
1,236
49
%% NVR baseline removal % 2017 (edited 2018) by Felix Klotzsche % 2024 update by Antonin Fourcade function NVR_10_rmbase(cropstyle, mov_cond, path_data, baseline) %% 1.Set Variables %clc %clear all %1.1 Set different paths: % input paths: path_data_eeg = [path_data 'EEG/']; path_in_eeg = [path_data_eeg '09_LPF/' mov_...
9e7db3c7bd11f12128ec11ba9a2477aabeccf03a8eab4943993e61f92d47475f
MATLAB
1,236
22
function [FoundCurrentParentDir]=FindCurrentParentDir(CurrentParentDir) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% warning('I currently only have the default parent directories set up for a few folks, but you can add more options here when re-generating fixing lists') FoundCurrentParentDir=[]; ...
cd5894a05c05ac7435d90fb5f66d3872db765f2df69546dca2a21230cbfb472c
MATLAB
1,236
31
function [rt] = isFeature(in) % % % %<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 pu...
d19bfe2f07f6eec056348fd6aa4e0921baef4d7db4810e4686def04f32e6796f
MATLAB
1,236
41
function h = plotBarStackGroups(stackData, groupLabels, fignum) %% Plot a set of stacked bars, but group them according to labels provided. %% %% Params: %% stackData is a 3D matrix (i.e., stackData(i, j, k) => (Group, Stack, StackElement)) %% groupLabels is a CELL type (i.e., { 'a', 1 , 20, 'because' };) %...
49d188c49acae4c324885e28e9b5cd77d4456450309b31f3fb6c717c684375c3
MATLAB
1,237
52
%% fnc_SelectInput: select the input indexes from a generic list % % Usage: % index = fnc_SelectInput(pro, iset) % % Inputs: % pro project structure % iset cell array or array of inputs of the considered set, they can be selected % by index (1,2,3 ...) or by na...
843bf3f986ccc606e17a2a7d5a1713163e7144c20bad5e52304badee6237d5aa
MATLAB
1,237
44
function newdata = wlProc_calcPaddedBandpass(olddata, band, samprate) % function newdata = wlProc_calcPaddedBandpass(olddata, band, samprate) % % This function wraps Matlab's "bandpass" function. % Zero-padding is added on both sides of the data to give Matlab's filters % time to stabilize. This is removed when the tr...
d13fac66cdf305fdb2ad679810c72041b470644eb769a5061171b23bda9bb7da
MATLAB
1,237
33
function featureNamesNew=featureNamesNewFromOld(featureNamesOld, ... scoreFeaturesOld, ... scoreFeaturesNew) % Figures out the feature names in the new feature lexicon, given the old % feature names, the old scoreFeatures, a...
39f25da009e0740b46a20ba71c0649db120395b567bd20ff8d7c8840b45b4718
MATLAB
1,238
38
function rowNumber = selectMuscle_from9() % Define the list of muscles muscles = { 'Shoulder Protractor' 'Elbow Extensor' 'Biceps Brachii' 'Elbow Flexor' 'Elbow Flexor-Wrist Dorsiflexor' 'Wrist Dorsiflexor' 'Wrist Plantarflexor' 'Shoulder Retractor' 'Triceps Brach...
3dba1028e2f616f8812624fffbf38b267c69216441df298a12325d7a2821c545
MATLAB
1,238
29
% this script can be used to send yourself an email upon code completion % WPI email will send it to trash, but gmail works just fine function [] = misc3_send_email(toEmail, job_id) % Your Gmail account information yourEmail = 'guillermo.matlab@gmail.com'; % Your Gmail email address yourPassword = 'zpfj zhjl mx...
51bf1b4e7f433a56b8f4a78f7f76e6755eac684e26d705edf52bb16a88d3ab88
MATLAB
1,238
48
function [x] = comp_distortion_oulu(xd,k); %comp_distortion_oulu.m % %[x] = comp_distortion_oulu(xd,k) % %Compensates for radial and tangential distortion. Model From Oulu university. %For more informatino about the distortion model, check the forward projection mapping function: %project_points.m % %INPUT: xd: distor...
781983bfdf25597da0f1bfd1bbc698b4ed758f21702d44365c562b3ff2d2baed
MATLAB
1,238
39
clc clear addpath('/home/lcao/software/NIfTI_20140122'); path='/media/lcao/DATA/T1_structure/cpp/T1data/noiseeval/'; subj=textread(strcat(path,'sub.txt'),'%s'); filetype='.nii.gz'; SNR_index=zeros(5,4); % the sequence of SNR_index is CJV, CNR, SNR_GM, SNR_WM for i = 1:length(subj) bg=load_untouch_nii(strcat(pat...
8203c767466aaade697baf41da9ce561f1601ab45c97d37a2cda4e5bd0613b6c
MATLAB
1,238
49
%% %Plot the basic elements of a linear model that accounts for neural firing %as a function of the subject's choice and the cued action. From this %dataset it appears that there is no significant tuning prior to the action %cue suggesting some type of heirarchical neural architecture where the %high-level de...
985cd388ee12cd0e3d62f9e14c761e6daece1da733ed774c2dda706066f81edd
MATLAB
1,238
53
%% plot_pw % % Plot pairwise quantities on a colourmapped grid % % <matlab:open('plot_pw.m') code> % %% Syntax % % plot_pw(P,cm) % %% Arguments % % _input_ % % P square matrix of pairwise quantities % cm colour map (default: something soothing) % %% Description % % Plot pairwise quantities ...
c45df3d47e305575b5ba92a164d03de2fde9839a829b0b678420118c4a884e48
MATLAB
1,238
41
%H4: (Normalized) Background SDO; Normalize from struct; %_______________________________________ % 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 published ...
edb62d3ce1bd456836bd44bc2472cdab1d7eb865e9dcf406ea379cc1081963b8
MATLAB
1,238
45
function WriteImageAndROIs(Image,FileNameAndDir,ROIs) OS=computer; if strcmp(OS,'MACI64') dc='/'; else dc='\'; end if length(FileNameAndDir)>260 error('Shorten Name and or dir...') end [FileDir,FileName]=fileparts(FileNameAndDir); FileExte...
22a3957f213d2d23ebcb93a53fb9c9add742546823375a031e2fd859f38bddae
MATLAB
1,239
45
function [D] = diff3d( T, k ) % DIFF3D Calculates partial derivative along any dimension in a tomogram. % INPUT: % Is - Input tomogram % k - 1: x-dimension, 2: y-dimension and otherwise: z-dimension % OUTPUT: % D - Output tomgram % % See also: angauss, eig3dkmex, diff2d % % AUTHOR: Anton...
33d50eac3e6ebe0ba852a2f2d7e81f62f293e73f56b6f23ce6c4ae3aa2391aeb
MATLAB
1,239
31
function Val_all = optical_mask_crosstalk(led,pd,ds,net) %% mag = sum(ds)/ds(1); [shifts_x,shifts_y] = led_positions_to_pd_positions(led.y,led.x,pd.y,pd.x,mag); % calculate ideal shifts max_shift = (mag-1)*led.sz/2+mag*net.sz/2; min_shift = (1-mag)*led.sz/2+mag*net.sz/2; %% % calculate_convrect_overlap p...
7c2cd299c284261ecd165a24a08843853490b97c819d7d13b5fcec1c1833dea3
MATLAB
1,239
35
function P2 = readpdf2(P0,xg0,yg0,xg1,yg1,xc,yc,th) % Like the inverse of readpdf. Readpdf is "I have a PDF, let's place it % somewhere in a new coord sys and read off the PDF in the new coord sys." % This is "I have a PDF, let's place a new coord sys somewhere and read the % existing PDF in the new coords." % % Mayb...
93a587b6ba4783887d46cd07d7737ffde440ba8a33e868564a021fe579415da3
MATLAB
1,239
36
function A=imresize3d(V,scale,tsize,ntype,npad) % This function resizes a 3D image volume to new dimensions % Vnew = imresize3d(V,scale,nsize,ntype,npad); % % inputs, % V: The input image volume % scale: scaling factor, when used set tsize to []; % nsize: new dimensions, when used set scale to []; % nty...
1a75d2ca10e5910b3c69e1092a2fbc20e75ad924dec5c17f2649b5e33ed10b34
MATLAB
1,240
35
function neu_boxes = load_neuron_posiNidx_to_neuron_box(neu_posi,neu_idx,neu_box_template) %LOAD_NEURON_POSINIDX_TO_NEURON_BOX Summary of this function goes here % neu_box_template is the one row of typical neuron_boxes, which contains % the bounding box of target neuron. nb=XBoxes(neu_box_template); nb.total_vol=h...
4c0eb41a7d1cea245a960e13c42a464cc132a541c40cb3581361a7508a6b0def
MATLAB
1,240
31
function PathList = y_GetRecursivePath(InPath,PathList) % function OutPath = y_GetRecursivePath(InPath) % Get Recursive Path List % Input: % InPath - The input path % PathList - The previous Path List % Output: % PathList - The output Path List which has added the files in InPath %------------...
9ba1d20c38cbbd65203c5f888f38a2f02fc2a3a494e78354e505d01ddf897b6f
MATLAB
1,240
41
function wlPlot_plotReconParams(cfg, realtimes, realwave, ... exttimes, extmag, extphase, figtitle, filelabel) % function wlPlot_plotReconParams(cfg, realtimes, realwave, ... % exttimes, extmag, extphase, figtitle, filelabel) % % This function plots a reconstructed time-series burst waveform against % the real dat...
1b1df148dd6b041204483fb0da8b086dc30c2262aca4dada3ce0608095b92d24
MATLAB
1,241
35
rgb = [0.1 0.4 0.5; 0.7, 0.4, 0.7]; areatxt{1} = 'lip'; areatxt{2} = 'fef'; vx=-1:0.02:1; figure('color',[1 1 1]) for iArea = 1: 2 switch iArea case 1 areatoplot = 2; % plot FEF on top graph otherwise areatoplot = 1; end iCond = 1; subplot(2,1,areatopl...
f8c0f20252d6f7df48f46e9c9b6c74062739cb5e15abb475a67ade41438ec8d1
MATLAB
1,241
46
function results = ReadYaml(filePath) % Lloyd Russell 2017 % Simple little function to read simple little YAML format parameter files % read file line by line fid = fopen(filePath, 'r'); data = textscan(fid, '%s', 'delimiter', '\n', 'whitespace', ''); fclose(fid); % remove empty lines data = deblank(data{1}...
3b16b7f23d8e596cd6f9cc4deae1030d0c4318c8ec0d619f831d8c584f36c6f7
MATLAB
1,242
43
function [R,ti] = bigSbigT(H,dt,tstep,twin,conditions,filter,min_num_bins) % AZ % function [R,ti] = bigSbigT(H,dt,tstep,twin,conditions,filter,min_msec) % % Inputs % H: spike counts [trials x time steps] % dt: bin duration % tstep: time step for calculation of the rates % twin: time window fo...
5169698628034d7f72e7451c6ee521b761c5c32a65c44e8688160528cd4f15b9
MATLAB
1,242
45
function y = mean_nonan(x,dim) %MEAN Average or mean value. % For vectors, MEAN(X) is the mean value of the elements in X. For % matrices, MEAN(X) is a row vector containing the mean value of % each column. For N-D arrays, MEAN(X) is the mean value of the % elements along the first non-singleton dimension of...
55a20e844d8137f4a6e740bc86f77a1e0df5f84049c97fdcf9ce9c1f56aeb85e
MATLAB
1,242
45
function [D] = diff3d( T, k ) % DIFF3D Calculates partial derivative along any dimension in a tomogram. % INPUT: % Is - Input tomogram % k - 1: x-dimension, 2: y-dimension and otherwise: z-dimension % OUTPUT: % D - Output tomgram % % See also: angauss, eig3dkmex, diff2d % % AUTHOR: Anton...
f8bb13e1581e4977ab3d9ea95ce91aacd265cc53215934ebee71932b476c5fd6
MATLAB
1,242
39
function [fixDot, fixFrame] = makeFixations(display) % Generates new dot fixation; called in 'showScanStimulus' %7 = green; 6 = red; % pixelsPerDegree = 1/d.pixelSize; pixelsPerCm = 1/display.pixelSize; degPerCm = atan(1/display.distance)*180/pi; pixelsPerDegree = pixelsPerCm/degPerCm; % FIXATION % make frame rect r...
0e58c033b824d88785fdaf5177e7cfbc1acef48f6d359571339a00734c14a5a2
MATLAB
1,243
37
function [Iall,Icombo] = load_and_combine_multiplexed_channels(parentfolder,fov,fnames,refch) %Loads multiple channels of the same image, e.g. from multiplexed data. %Assumes all are the same width, height, and z-stack length %fnames = list of filenames to load %Iref = name of reference channel. If provided, will s...
0f830631ec583a38299e78afee02f6e8799653e1fab0fa1567807f43387b5f38
MATLAB
1,243
37
% Make something similar to figure 3.5 of Rasmussen and Williams book % based on demo_laplace_2d from the GPML toolkit %PMTKauthor Carl Rasmussen %PMTKmodified Kevin Murphy % make data n1=80; n2=40; S1 = eye(2); S2 = [1 0.95; 0.95 1]; m1 = [0.75; 0]; m2 = [-0.75; 0]; randn('seed',17); x1 = ...
27d13f2a87090461f681d9d4beeedaabde296eb4f5b60f1ffb44a0ef5c9e030a
MATLAB
1,243
29
function res = changeCellRowNum(cellData) % Decription: convert a*1 cell with elements of b*n matrix to b*1 cell with elements of a*n matrix % Notice: cellData will be reshape into column vector before converting. % Input: % cellData: a A*1 or 1*A cell vector with elements of an B*N numeric matr...
6b126c3ed03accca2fa2dc3c254f09f563db3488b964109e1e0f44e9e20e40d7
MATLAB
1,243
38
function [CenterOfMass] = y_CenterOfMass(AtlasFile) % Extract Center of mass. % Input: % AtlasFile - the Atlas File % Output: % CenterOfMass - the Altals region table %___________________________________________________________________________ % Written by YAN Chao-Gan 120917. % The Nathan Kline Institute for Psyc...
86f59d955330847e26b9bfe41f82901a178c9d097bb9531ce7eb7cb70946a3b4
MATLAB
1,243
25
function [azi,ele]=nav2sph(azi,ele) %NAV2SPH Coordinate Transform. % [azi,ele] = nav2sph(azi,ele) vonverts navigational coordinates to % spherical coordinates. % % Input: % azi ... azimuth (-180 <= azi <= 180) % ele ... elevation (-90 <= ele <= 90) % % Output: % azi ... azimuth (0 <= azi < 360) % ...
a36de5fa4ba61bc80c83d201c6430ddd31c3b2348ef9f243687455728c6dc78e
MATLAB
1,243
49
function [g,N] = GPA(f, sigmar, W, eps, flag) % Gaussian Bilateral filter: % [g,Ng] = GPA(f, sigmar, sigmas, eps, 'Gauss') % f : input image % sigmar : width of range Gaussian % sigmas : width of spatial Gaussian % eps : kernel approximation accuracy % g : output image %...
1deaa5ad9b865ce7e843ce88ebec621fd861a47c58e4f1092377fbab2a3b2d53
MATLAB
1,244
56
function fatal = checkSortedSerial(allfiles, neurons, early_exit) fatal = false; load([allfiles.folder filesep allfiles.name],'-mat','crabsort_obj') self = crabsort_obj; % check if the entire file is ignored if ~isempty(self.ignore_section) && ~isempty(self.ignore_section.ons) if self.ignore_section.ons(1) == 1 & ...
795b7cce3306b5637c3fa8b47c3a6ddc125daef67893153c9885078889c7547b
MATLAB
1,244
57
function stre = ls_lan(e,e2) % v0.3 % P Billeke % TAREA: HACERLO GEENRUICO PARA WINDOWS TAMBIEN try if nargin == 0 || isempty(e) stre = ls; else stre = ls(e); if nargin<2 e2=[]; end end catch stre = []; return end stre(isspace(stre)) = ' '; nss=1; while ~isempty(stre) ...
61efa7ae0d6dc71f3be8f68e0f8ece9841643633065ec26c792a4eeb8871a768
MATLAB
1,245
31
function [rt] = isDataCollection(src) % % % %<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 Licen...
d9a72f0361dbb9ae32f999ed19a26c496800b1a9a524e2031c09cebb27d1afd2
MATLAB
1,245
25
%% Hjorth parameters % Hjorth Activity 活动性:衡量信号波幅的偏离程度,是时间函数的方差var % Hjorth Mobility 移动性:衡量坡度的变化,为信号一阶导数方差的平方根 除以 信号方差的平方根 % Hjorth Complexity 复杂性:衡量一个振幅上有多少个标准的坡 % X: single channel EEG signal (either a row vector or a column vector) % See also: % feat_HjorthActivity, feat_HjorthMobility %% Reference % [1...
32bb26cde0133381bbd87c38e2ffc4dbbab92e9890b26b08cf3f1b9fbe69d682
MATLAB
1,246
34
% SPIKE_COUNTS converts timeStamps into logical time-indexed spikes % returns makes matrix of ones and zeros % rows are trials % columns are times % spikeCounts.m % % Copyright 2008 Vanderbilt University. All rights reserved. % John Haitas, Jeremiah Cohen, and Jeff Schall % % This file is part of JPSTH Toolbox. % ...
dba7558fcedcc1699cf30ce30bd062eaa5f28bc5e839fc4d428a553c84de5341
MATLAB
1,246
18
function [x,fval,exitflag,output,lambda,grad,hessian] = IPGenerateCode(x0,lb,ub,MaxFunctionEvaluations_Data,MaxIterations_Data,OptimalityTolerance_Data,StepTolerance_Data,ObjectiveLimit_Data,ConstraintTolerance_Data) %% This is an auto generated MATLAB file from Optimization Tool. %% Start with the default options opt...
08e80d21bc6e85f994f92f4150521f6a77ab0b767422686027274db2c2a8283f
MATLAB
1,247
43
function p = plotCVgrid(params, mu, bestParams, params1, params2) % Plot Cross validation results in 2D % This file is from pmtk3.googlecode.com if nargin < 4 || isempty(params1) params1 = unique(params(:,1)); params2 = unique(params(:,2)); end sz = nunique(params); nrows = sz(1); ncols = sz(2); X = reshape(pa...
17a7bb042e30663bd36e5c37213eac0d70ad0ebd63e8e1947c0fe36e930e636f
MATLAB
1,247
40
function structcheckfldspresent(s0,s1,varargin) % Check for equality among fields present in (possibly-nested) structs % % Every field is compared (recursively on structs) with isequaln. [pathstr,pathexceptions,assertmsg] = myparse(varargin,... 'pathstr','',... % structure 'path' to s0,s1 'pathexceptions',cell(0,...
35692cf773a3d1f2b6a9a757ec0f05b3e575d90ede2f28e5b220da3a1da8a102
MATLAB
1,247
39
function [ptchs,ptchGrp] = createPatches(x,y,offset,c,FaceAlpha, base) %createPatches.m % This file will create a bar plot with the option for changing the % FaceAlpha property. It is meant to be able to recreate the functionality % of bar plots in versions prior to 2014b. It will create the rectangular % patches with ...
81a010c53f1f46643e93bae8aeed2451f1e82410fb28221ffb8166c524817c8c
MATLAB
1,247
56
function [XQ, params] = discretizePMTK(X, K, params) % Quantize scalar continuous variables % This is similat to quantizePMTK, except we always % use uniform quantization. Also, we store the values % used at 'training' time, and use the same values at 'test' time % So a typical usage is % % [XQtrain, params] = discreti...
c048ba844239dbdc755f547e0071754c50b91f07039b55d1162e8a643876012d
MATLAB
1,247
46
function affine_tform = findAffineModel(key1, key2,doFullAffine) if nargin==2 loadParameters; doFullAffine=params.AFFINE_FULL; end num_samples = size(key1,1); %Put the coordinates into homogenous coords (appending the 1) x1 = [key1, ones(num_samples,1)]; %Format the data into a matrix that we will take the ...
c58f6d1946770deff95f5cafe6cfc172993220f03a8566d2ff16089d89a1672c
MATLAB
1,247
45
function [thresh, CC] = my_threshold_PET(vessels_PET,voxs_thresh) % VESSELS ENANCHMENT PET %load(fullfile(output_path, 'Temp', 'vessels_PET.mat')) thresh = 0.99; mask = vessels_PET > thresh; CC = bwconncomp(mask, 26); % while CC.NumObjects < 2 % thresh = thresh - 0.01; % mask = vessels_PET > thres...
20639cafe4088e53a0a0434ee1a45812c80c5322cd8646a9e2496dc79ad71df8
MATLAB
1,248
54
function RR = lan_tfmatrix(LAN, RT, chan, lag) % args % * lag in miliseconds if nargin < 2 RR = []; return; end if nargin < 3 chan = 1:LAN.nbchan; end if nargin < 4 lag = 200; end lag = ceil(lag*LAN.srate/1000); % lag ms -> points if iscell(RT) len = length(RT); else len = 1; end RR = cell(len,...
495b52c0e2ed89a72d47b8e52e4d1c16f96c5aff7ad055f02f2370e4d3531e13
MATLAB
1,248
68
function [T tipo v ] = is_lan(LAN,base) % <*LAN)<] % v.0.0.4 % 22.10.2012 % 16.05.2012 % 20.03.2012 % 29.07.2011 T = false; tipo = ''; v = ''; if nargin==1 base = true; end if ischar(LAN)&&base try LAN = evalin('base',LAN); catch ret...
bb753cdb0f272a65fb7d531653e9b26ab90f391067f29491310a9a8da3c06434
MATLAB
1,248
51
% HIFDE_SPDIAG_SV_H Dispatch for HIFDE_SPDIAG with DINV = 1 and F.SYMM = 'H'. function D = hifde_spdiag_sv_h(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find act...
f249cafcaf9b85ef3912867f8d50a6bad12a1d1eaea35313ae24c6d5243a606e
MATLAB
1,248
46
function data = h5readgroup(filepath, group) %H5READGROUP Reads a group into a structure containing all the data in the group. % Usage: % data = h5readgroup(filepath, group) % % Args: % filepath: path to the HDF5 file % group: name or path to the group % % % % See also: h5read, h5save, h5att2struct if nargin ...
9048a95edaec1f0999e821d0dbd5525f04e1bedfc36de4566ec49e916a0d6273
MATLAB
1,249
39
function V = mttkrp(X,U,n) %MTTKRP Matricized tensor times Khatri-Rao product for ttensor. % % V = MTTKRP(X,U,n) efficiently calculates the matrix product of the % n-mode matricization of X with the Khatri-Rao product of all % entries in U, a cell array of matrices, except the nth. How to % most efficiently do...
df4abb8f91369f4f07824e9274dc361e1e3c8cf5fa7c5ba943bd0942800caabd
MATLAB
1,249
51
% HIFDE_SPDIAG_MV_H Dispatch for HIFDE_SPDIAG with DINV = 0 and F.SYMM = 'H'. function D = hifde_spdiag_mv_h(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find act...
f6072f93e99832210338d1f7cc547f51026c526f35d6654055ceca1f7e1c5078
MATLAB
1,249
53
if ~exist('color'), color = lines(1); end if max(im(:)) > 1, color = color*255; end npts = length(xline); if ndims(im) < 3, im = repmat(im,[1,1,3]); end [nr,nc,three] = size(im); im = mat2cell(im,nr,nc,ones(1,3)); for i = 1:npts-1, dxline = xline(i+1) - xline(i); dyline = yline(i+1) - yline(i); m = d...
005a58c102a346fcb6671c4c2885d5fb45c61853b83de9e07086abf086d55976
MATLAB
1,250
44
function [pZ, ll] = mixModelInferLatent(model, X) %% Compute pZ(i, k) = p( Z = k | X(i, :), model) % ll(i) = log p(X(i, :) | model) %% % This file is from pmtk3.googlecode.com nmix = model.nmix; [n, d] = size(X); logMix = log(rowvec(model.mixWeight)); logPz = zeros(n, nmix); switch lower(model.type) cas...
9a5b535df239a91866a2ba352b055bd64817c9bd722fd50096052490e1ec8a47
MATLAB
1,250
38
function [edims, sdims] = ttm_me_partition(U, esz, n) %TTM_ME_PARTITION Finds best order for ttm_me. % % [EDIMS, SDIMS] = TTM_ME_PARTITION(U, ESZ, N) finds the best order for % memory efficient ttm. ESZ specifies the number of dimensions that % are to be handled elementwise. U is the cell array of matrices. % ...
d03143520306a1fbfdb5785cace8b9b00bf86b9c5418af447c6a6058ab42bdee
MATLAB
1,250
31
function dspace_main_folder = getDspaceRootFolder() % % % %<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 Genera...
0795ab5300c0ae445347857a4c77acca6e703d64c06886c0c1989b5ff9e3cd2f
MATLAB
1,252
51
function pmlCopyAndRenameFigsByNumber %% Copy every pdf figure in the book naming it e.g. fig11.8b.pdf % % Requirements: % % (1) The correct path to the book must be in config-local.txt % (2) All chapters must be included directly in pml.tex, (just % copy pmlcore.tex right into pml.tex) % (3) The figure index must ...
0bb0ffa518fb8a7a0ed236a3bf4188db5f84d51cf32697eefeff8d0828261718
MATLAB
1,252
13
function Auto_ScaleBar(ImageHeight,ImageWidth,PixelSize,ScaleBar_Size,ScaleBar_Location,ScaleBar_LineWitdh,ScaleBar_LineColor,BufferRatio_X,BufferRatio_Y) if strcmp(ScaleBar_Location,'BL') plot([ImageWidth*BufferRatio_X,ImageWidth*BufferRatio_X+ScaleBar_Size/PixelSize], [ImageHeight-BufferRatio_Y*ImageHeig...
c9194e4a38710336723395480fb4c93a5f3e51886ed31ba9d7c706f2fb7845d4
MATLAB
1,252
39
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef Annotation < EventTag %ANNOTATION tag that correspond to events listed in AxIS's play bar properties(GetAccess = public, SetAccess = private) NoteText; end methods ...
fb5d46a4d129fbf86da2bf9f22e891a30cfbd9e53c44fbbcc224ac2616d2ab17
MATLAB
1,252
45
% test_kroncovdiag % % Short script for illustrating kroncovdiag, which computes the diagonal of % a matrix after left and right multiplying by a kronecker matrix B % % In practice, the function kroncovdiag.m is useful computing marginal % variance of regression coefficients by computing the diagonal of the % matrix B*...
0ccf09e5bf8e36f8d878c2126f40e176255bc0ea50a9477696e0bd5c5512956b
MATLAB
1,253
36
function [cope,varcope,tstats] = run_glm( data, design_matrix, contrasts ) %%function [tstat, thresh] = run_glm( data, contrasts ) % % % Preallocate arrays cope = zeros(size(contrasts,1),size(data,2)); varcope = zeros(size(contrasts,1),size(data,2)); tstats = zeros(size(contrasts,1),size(data,2)); % reject bad_trials...
35ad5290276c1d0308578350cbc5b436619e85adbaf5d98a2f85e6ae4073c34f
MATLAB
1,253
49
function t = parseConfigYaml(filename) % t = parseConfigYaml(filename) % Parse a configuration yaml. s = yaml.ReadYaml(filename); t = lclParse(s); function tagg = lclParse(s,prefix) if nargin < 2, prefix = ''; end vallen = 9; fns = fieldnames(s); tagg = []; for f=fns(:)',f=f{1}; %#ok<FXSET> val = s.(f); isLe...
4a960e1cc4d94c74738e1c010850338237e0ef0bc47d114446e0a48701748b66
MATLAB
1,253
31
function [F, J] = calcGaussianSurrActivationAmplitude(params, spftheta) %UNTITLED6 Summary of this function goes here % Detailed explanation goes here %========================================================================== spff = spftheta(:, 1); %standardize input thori = spftheta(:, 2); %standardize input g...
6969398c80267bc10dd7bf1e778496c32a238770d131d8b6a1fbe4bb1ec81f0c
MATLAB
1,253
38
%% Temporal Consistency Analysis % the script follows the anaylsis steps as described in % []... %% 1. Load files and flatten images to 2d matrices % accepted formats are nii and nii.gz % normally, preprocessing should include motion correction, % temporal highpass filtering and possibly spatial smoothin...
956e9687eb22b8d2f4e6dc1553b5272640745cd7175967ad7cb58bc172a17dc8
MATLAB
1,253
39
function X = tendiag(v,sz) %TENDIAG Creates a tensor with v on the diagonal. % % TENDIAG(V) creates a tensor with N dimensions, each of size N, where N % is the number of elements of V. The elements of V are placed on the % superdiagonal. % % TENDIAG(V,SZ) is the same as above but creates a tensor of size SZ. I...
a792dacaea1c160f302b96703486d9bd011639b0e66050b5c2908d73caf18511
MATLAB
1,253
51
function logp = gaussLogprobMissingData(arg1, arg2, arg3) % Same as gaussLogprob, but supports missing data, represented as NaN % X is N*D % L = gaussLogprobMissingData(mu, Sigma, X) % L = gaussLogprobMissingData(model, X) % Test example %{ N = 5; D = 3; X = randn(N,D); M = rand(N,D)>0.5; X(M) = NaN; mu = zeros(D,1); ...
0e2e9d84a6a8737d7e5291efe0017a5e9670730034f52d08bb267270d869b423
MATLAB
1,254
44
function B = nonmaxsup( I, M, Vx, Vy, Vz ) % NONMAXSUP Ridge centreline detection by non-maximum suppresion criteria % INPUT: % I: Input tomogram, input data must be single or double % M: Binary (logical format) mask for improve the speed % Vi: The i coordinate of the major eigenvector % OUTP...
4aeca70402726e9865b68a210ecdf5abedce6b9dac7a5ba392fa35a18b83e6b3
MATLAB
1,254
54
%% Demonstrate inference in undirected markov chain % Based on http://www.cs.ubc.ca/~schmidtm/Software/UGM/chain.html % This file is from pmtk3.googlecode.com %% Setup model nNodes = 60; adj = chainAdjMatrix(nNodes); nStates = 7*ones(1,nNodes); initial = [.3 .6 .1 0 0 0 0]; nodePot = zeros(nNodes,nStates); nodePot(...
df1f5c918c211c69658bbba77354333fb702fcf6a78d949c140b2c8b71b5a983
MATLAB
1,254
43
function h = WattsStrogatz(N, K, beta, varargin) % H = WattsStrogatz(N,K,beta) returns a Watts-Strogatz model graph with N % nodes, N*K edges, mean node degree 2*K, and rewiring probability beta. % % beta = 0 is a ring lattice, and beta = 1 is a random graph. % % Adapated from % https://www.mathworks.com/help/matlab/ma...
512becd8ffbb4422b1e08ea3933098be2497215a7d6a4e1f3aff955abdf39015
MATLAB
1,255
41
function a = elemfun(a,fun) %ELEMFUN Manipulate the nonzero elements of a sparse tensor. % % X = ELEMFUN(X,@FUN) modifies the elements of X according to the % function @FUN which should take and array and output an equally % sized array. % % Examples % X = sptenrand([10,10,10],10); % X = elemfun(X,@sqrt) %<...
0f43e6fdd9348570afbc1e734bba5b9c18cab02a435d6b6068fe8af82bf7259c
MATLAB
1,256
43
function [pr_process, act_contribution] = CBIG_ComputePrProcessGivenAct(act, beta, threshold) % [pr_process, act_contribution] = CBIG_ComputePrProcessGivenAct(act, beta, threshold) % % act = 1 x 18715 % beta = # processes (K) x 18715 % % Written by B.T.Thomas Yeo and CBIG under MIT license: https://github.com/Thomas...
16ba709cb9357aedd823c29045d40ec79b9a314b5bc0f3f0334d6726536c8b4f
MATLAB
1,256
37
function [TFmega, stateMap] = tabularFactorToMegaNode(TF, newId) %% Construct a mega node from a tabularFactor % by taking the cartesian product of the state spaces of the participating % variables. The new domain of TFmega is the single value newId. % % The new states correspond to the linear indexing of TF.T. % % Y...
6148ee1c791e2e293cdb04d58a06df226a7fc89f49bdf59f0601ed8eb0ba175d
MATLAB
1,256
37
%% pxTools_getSdoFromJointArr; %// Resampling Method to quickly convert p(x1|x0) into p([x1-x0]|x0) * p(x0); % % NOTE: Due to differences in sampling smoothing, the extracted 'sdoMat' % will not exactly resemble the spike-triggered sdo extracted with % 'computeSDO.m', but will grossly approximate it. % Copyr...
a8bc4b4a35ef3024b35fd0e17679ef280578ea74894dc6cdc398670b9a62f45a
MATLAB
1,256
53
clear all close all addpath(genpath('/scratch/work/eglerean/isctest/external')) iscfolder={ 'ISCout1' 'ISCout2' }; option={ 'decoder_24HMP-8Phys-Spike_HPF_TRw25_step-' %2_subjects-1.nii' 'decoder_24HMP-8Phys-Spike-4GSR_HPF_TRw25_step-' %2_subjects-1.nii' }; steps=[1 2 4]; perc=[1]; for c=1:2 iscdata=iscfolder{...
a8f29b424fd485252e918a8cbdc117fef6a4d65dd32146d97436f7ae383bb9a9
MATLAB
1,256
42
function [ handlers ] = define_shared_key_handlers() % % % %<PRE> % This file is part of dspace-GUI. % % Copyright (C) 2020 University Zurich, Sepp Kollmorgen % % dspace-GUI is licenced under a custom license (see LICENSE file). % % This program is distributed in the ho...
b08789cf06a8a8dfcffeb88a2338d55b975814293683b605e0b88fffe2106356
MATLAB
1,256
36
function [ax,rh,ph] = plot_arena_circle(ax,simParam,plotArgs,arena_outside_patch_args) if (nargin < 1) || isempty(ax) figure; ax = axes; end if (nargin < 3) || isempty(plotArgs) plotArgs = {}; end if (nargin < 4) || isempty(arena_outside_patch_args) arena_outside_patc...
ce459c4c2a6fb957d8c4ad73050f6a0e6b403dff34bdb2d2bef12adce303006a
MATLAB
1,256
33
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Function description to go here %%%%%%%%%%%%%%%%%%%% function [affine_tform,keyM_total_transformed] = getGlobalAffineFromCorrespondences(keyM_total,keyF_total) %First we do do a global affine transform on the data and keypoints before %doing the fine-resolution non-rigid wa...
d27ddda7a0e57981132d65b15d55a763dd8b987683053ab9fc0b9fd1d78cf509
MATLAB
1,256
37
function [v,th]=get_adaptive_threshold(data,frame,overlap,h_frame,h_overlap,type,param,input) % data: single channel raw data. % frame: window length for rectangular window, or pre-defined window. % overlap: overlaping samples when calculating the variance. % h_frame: Number of adaptive frames when...