sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fc68799d19ebedf3b001e2f0fda549a3aa106f77acd7c040de341441dcb1b659
MATLAB
1,508
73
function [x_comp] = comp_distortion(x_dist,k2); % [x_comp] = comp_distortion(x_dist,k2); % % compensates the radial distortion of the camera % on the image plane. % % x_dist : the image points got without considering the % radial distortion. % k2: Radial dist...
0b293784db301979ff0c95b4edea1880ab1e8cecf8509695e740eee781208233
MATLAB
1,509
44
load('brain-region-spatial-res', 'lec_s_info', 'mec_s_info', 'ca1_s_info','ca3_s_info'); figure('position', [722 559 641 135]); tick_length = 0.015*ones(1, 2); subplot(1, 3, 1); Y = {lec_s_info, mec_s_info, ca3_s_info, ca1_s_info}; h = plotSpread(Y); hold on; for i = 1:4 plot(i, median(Y{i}), '.', 'markersi...
b62a3a1335a990ea09daa5544783e27d37108671c09a54c8b980db21997e3d61
MATLAB
1,509
60
%% cue scores % figS5 load('allFolders.mat'); thresholds = nan(1,5); for VR = 1:5 clear folders; switch VR case 1 % VAVR folders = folders_combo; clr = 'c'; case 2 % AVR1 folders = folders_audio; clr = 'm'; ...
c1322589bcb49ea2af9bf8cb2d1aa7aecf8d794a61f7f226721bf646db9984fe
MATLAB
1,509
52
function [Y,V] = TLmask(maskfilein,varargin) % provide the name of the proper file containing MNI parcels, % such as Atlas.wmparc.2.nii % Y = TLmask(maskfilein); % returns a 3d logical of in-mask voxels for the grey matter mask of % the subject associated with the call. % [Y,V]...
c4a36c7d9e201c3ba016fe342fc70e4e4e1654cd6430163af2668b0e678a3bd0
MATLAB
1,509
61
%%% Extraction of the final intrinsic and extrinsic paramaters: check_active_images; if ~exist('solution_error') solution_error = zeros(6*n_ima + 15,1); end; fc = solution(1:2);%*** cc = solution(3:4);%*** alpha_c = solution(5);%*** kc = solution(6:9);%*** fc_error = solution_error(1:2); cc_error = solution_err...
e70abcbb60f23c5f81942269b5ca8061419c4e9ed2371e27306fa10dd27fdb74
MATLAB
1,509
40
function run3dtriangulate(trkfile1,trkfile2,pptype,varargin) % Run 3d postproc and resave to trkfiles in place % % trkfile1/2: full paths trkfiles (these will be MODIFIED in-place) % pptype: see PostProcess.triangulate [crigmat,rois] = myparse(varargin,... 'crigmat',[],... % path to mat-file containing single CalRi...
f1bd3203d0017ed9d5063414f0c1453d6c05ff57fd32eabac3423537ea292914
MATLAB
1,509
43
% SIMULATE_SPIKE_TRAIN accepts a psth and generates a spike train with a given number of trials % simulateSpikeTrain.m % % Copyright 2008 Vanderbilt University. All rights reserved. % John Haitas, Jeremiah Cohen, and Jeff Schall % % This file is part of JPSTH Toolbox. % % JPSTH Toolbox is free software: you can re...
53be8f4b9fec8553ff344308136cf2eabadc107b22c90861201d618ec935fbd6
MATLAB
1,510
55
function [keys] = loadFOVKeyptsAndFeatures(FOV,round,bigparams) % Load any Fov, make it global and return % Note that all keypoints have to be warped back from the downsampled rate foldername = fullfile(bigparams.EXPERIMENT_FOLDERROOT,... sprintf('F%.3i',FOV),... '4_registration',... sprintf('%s-F%.3i-down...
4a27c14f1e16dec1acf78184501386458e4532b9ce1d6a774848de8495fa6fea
MATLAB
1,511
58
%% Demonstrate training a lattice-structured CRF % Based on http://people.cs.ubc.ca/~schmidtm/Software/UGM/trainApprox % This file is from pmtk3.googlecode.com %% Get data setSeed(0); X = loadData('Ximg'); Xclean = X; y = 1+X; X = Xclean + 0.5*randn(size(Xclean)); figure; imagesc(X); colormap(gray) [nRows,nCols] ...
75e2d8234bad329779acff194113d56a9567bcce30bd9f9509cc50dc91ad7f43
MATLAB
1,511
60
function SaveColorBar(SaveName, Limits, CTicks, Label,LoadingColorMap) % Limits=[0 20]; % CTicks=[0 20]; % Label='\DeltaF/F_0'; fig1=figure; hold on left=100; bottom=100 ; width=600 ; height=600; pos=[left bottom width height]; axis off caxis(Limits) if ~isempty(LoadingColorMap) colormap(LoadingColorMap); end hcb=col...
9f65b63788e80aa3ef612e53d431b1e2fd7dff28268b03e602295e0f9c3701cc
MATLAB
1,511
61
%%% Extraction of the final intrinsic and extrinsic paramaters: check_active_images; if ~exist('solution_error') solution_error = zeros(6*n_ima + 15,1); end; fc = solution(1:2);%*** cc = solution(3:4);%*** alpha_c = solution(5);%*** kc = solution(6:10);%*** fc_error = solution_error(1:2); cc_error = solution_er...
b9cf38a2f57f7689d85cbb43087b03be721b92d102e250e94c5b6ae4770c821a
MATLAB
1,511
55
function [options,params2update] = VBA_fillInPriors(dim,options) % fills in priors structure with default priors if necessary % function [priors,params2update] = VBA_fillInPriors(priors,dim,verbose) % IN: [see VBA_check.m] % - priors: [can be left empty] % - dim: [required] % - verbose: flag for verbose mode % OU...
be74fc185ea62f875db61e578e9e819ae044148ad3099aaf4d575db00d685097
MATLAB
1,511
69
function [] = plot_2dresp(model) unpackStruct(model.internals); %number of time steps maxt=40; facto=0.9; %model_tau = 100ms %%% pulse response in location context (wI(:,3)) clear r fixed_point1=atanh(fixed_point1'); r(:,1)=fixed_point1; for i=2:maxt if(i==2) r(:,i)=facto*r(:,i-1)+(1-facto)*(model.w...
58124e4601393de9e156162c768362b10a94d03a3502c6ed74d28331a3c5cfa5
MATLAB
1,512
47
function [bestSelectedVars, w] = larsSelectSubsetCV(X,y,varargin) % Choose amongst the subsets on the LARS regularization path % using MLE on chosen subset and CV error % w size d x 1 is the MLE for the chosen subset (offset ignored) % This file is from pmtk3.googlecode.com [lambdaRidge, CVnfolds] = process_options(...
59926d54128b6b2217028db5d134b2692a87f273bee9650e6d50ee6af1fb7ab2
MATLAB
1,512
28
function [opt] = ParameterOptions() %% %Sequence parameters opt.gamma=2*pi*42.58*10^6; % Gyromagnetic ratio opt.G=52; % Diffusion Gradient Amplitude (mT/m) opt.tau=13.56; % Diffusion Gradient Duration (ms) opt.TR=28; % Repetition Time (ms) opt.alpha=24; % F...
736279b6df098c794597b943f75c4386fea4414295570bd47c30424713ca2e63
MATLAB
1,512
59
function value = graysampler(imageHandle) %GRAYSAMPLER Returns grayscale value of pixel after a button press. % VALUE = GRAYSAMPLER(IMAGEHANDLE) returns a grayscale value from an % image with a handle of IMAGEHANDLE. The value will be the intensity of % the pixel under the cursor when a mouse button is pressed. ...
73ccc2534cc37b14b0f71dca3d7464ee8ebe56886dd5849c152e6676a9bef622
MATLAB
1,512
50
function FR = FbApply2d( I, FB, shape, show ) % Applies each of the filters in the filterbank FB to the image I. % % To apply to a stack of images: % IFS = fevalArrays( images, @FbApply2d, FB, 'valid' ); % % USAGE % FR = FbApply2d( I, FB, [shape], [show] ) % % INPUTS % I - 2D input array % FB - filterban...
b1abf846367f8592baf0752d97d6511314d9a0f09a5cbc392e4b358fc1054a97
MATLAB
1,512
101
function RT = rt_resample(RT,cfg) % v.0.0.2 % <*LAN)<| % % % % cfg.newfs = [n] or [n1 ..] % % % Pablo Billeke % Francisco Zamorano if nargin == 1 newfs =min(diff(RT.laten)); cfg.newfs = newfs; else if isnumeric(cfg) newfs = cfg; cfg = []; cfg.newfs = newfs; elseif isstruct(cfg) if isfield(...
fb0de9f2164fb3b09c9ef0772d56702f27318264cf2cc1f651ed7a011d984006
MATLAB
1,512
45
function ph = fill_between_lines_Y(ax,X,Y1,Y2,faceC,varargin) % fills between curves Y1(X) and Y2(X) % %if ischar(faceC) % faceC = get_color_from_char(faceC); %end %if isrow(faceC) && ((numel(faceC) == 3) || (numel(faceC) == 4)) % % faceC is a single color % faceC = repmat(faceC,numel(...
1dcefc049bf88fb9afc5721d98d943fe6c6740a7bc71dfe493b098544efe81a9
MATLAB
1,513
33
function eventRippleIds = getValidEventIDs(PFresultsStruct_paramPoint, resultsStruct_paramPoint, modelParam) % eventRippleIds = utils.getValidEventIDs(PFresultsStruct(ithParam1, ithParam2, ithNet), resultsStruct(ithParam1, ithParam2, ithNet), parameters); % % Criterion for preplay events are stricter than criterion for...
773769b8dcea7fc0c70a79e6c1a7542a0da85309241151184c2faee250376705
MATLAB
1,514
46
function generate_pseudo_static_PET(PET_dyn_path,time_PET,diagnostic_path,options) %generate a Pseudo STATIC PET image by averaging the frames acquired from %minute 40 (or as in options) to the end of the acquisition. % %PET_dyn_path: PET dynamic NIFTI file path %time_PET: time_grid (in seconds) %out_path: folder whe...
fa5cecb962d71f6548c1d2cd49c0e77236ddbb77497e717ecf96ea23d5ebc0b6
MATLAB
1,514
51
function tests = mex_mergesortfilesTest tests = functiontests(localfunctions); end function setup(testCase) testCase.TestData.tempDir = '/mp/nvme0/tmp/testworks'; if ~exist(testCase.TestData.tempDir) mkdir(testCase.TestData.tempDir) end n = 4000; data = {}; for i = 1:4 data...
118d6b28ae197cba1987e3bd024f031d7ca516e44c86ef8710add8e17c4f3ceb
MATLAB
1,515
44
function mdiag = kroncovdiag(BB,C,ii) % Compute diagonal of BCB^T, where C is symmetric and B is kronecker matrix % % Ldiag = krondiagBXBtrp(B,C,ii) % % Computes diagonal of B*C*B', where B = (Bn \kron ... \kron B2 \kron B1) % % INPUT % BB - cell array with basis matrices {A1, ..., An} % C - symmetric matri...
327c9952477896f0766e9fd06c5b97ffb45f25c3a602d494869bd78b839655bb
MATLAB
1,515
42
function clickWheelData = sequenceWheelData(clickArray, wheelData, params) % This function sequences wheel data into windowed-timecourses % corresponding to individual clicks. It returns a matrix where the number % of rows are the number of samples in a window (specified in params by the % preStimOffset and postStimOff...
caa86b1eed359bded2f4fc25a0dbb8131d6549f80c8ef190f7183cc96781d6f4
MATLAB
1,516
46
clear all close all addpath(genpath('/m/nbe/scratch/braindata/eglerean/narrative/isctoolbox2')) clabels={ 'movGSR6mm' 'mov' 'movGSR' 'mov6mm' } for c=0:3 % c is a number that goes from 0 to 3 to follow subjects0.m, subjects1.m, ... disp(['subjects' num2str(c) '.m']) run(['subjects' num2str(c) '.m']) for s=...
f107465697e4aee6b5c8392858b575e15c2e14a4d5172de5ef1c4ba10dbb055c
MATLAB
1,516
43
%----------------------------------------------------------------------------------------- % Plot mean respiratory track locked to odor onset % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 1d % Author: Marcel Kehl % License: MIT License %---------------------------...
60637391718dcabdb217120fe1aa7e15352566c0d0b79eb17ebadf7896b77b25
MATLAB
1,517
45
function [logZ, bels] = bruteForceInferQuery(factors, queries, clamped, localFactors) %% Run inference using brute force enumeration % factors- cell array of tabular factors % queries - cell array of vectors of integers specifying which joints to % compute; can also be just a vector for a single query % clamped - po...
aeb38772ce8c531b1e951426a281733a093ef51b394eb942ba8325f860288841
MATLAB
1,517
57
%% init clear all addpath(genpath('src')); parameters; %% % files = dir(fullfile('input', '*.tif')); % Display the names % names = {files.name}; files = dir(fullfile('input/bw_reruns_of_reruns', '*.tif')); names = {files.name}; n_files = max(size(names)); disp(['number of files: ' num2str(n_files)]); results = {'...
7b2ed740ed14877e636e2fda64f5e0a13bd9822a43b61a01653cf9bb6e4a23c6
MATLAB
1,518
42
clear clc %{ delete(gcp('nocreate')) myCluster.NumWorkers = 8; parpool('local',8) %} NineMuscleMorphParaInitial = load('NineMuscleMorphParaInitial.mat'); NineMuscleMorphParaInitial = NineMuscleMorphParaInitial.NineMuscleMorphParaInitial; MaxFunctionEvaluations_Data = 10^300; MaxIterations_Data = 100; OptimalityTole...
2d54bae3bd3b740a98c1a115507fac1b91a32fd72912650895312ca3ea975464
MATLAB
1,519
48
function hout = imhistpanel(parent,himage) %IMHISTPANEL histogram display panel % HOUT = IMHISTPANEL(PARENT,HIMAGE) creates a histogram display panel % associated with the image in specified by the handle HIMAGE, called the % target image. HPARENT is the handle to the figure or uipanel object that % will contai...
d17e0d8d36549a1e2e9f2b85d432f725bbdddf0ea1e68da9db54565af47aff96
MATLAB
1,519
39
%function calib_gui_no_read, cell_list = {}; %-------- Begin editable region -------------% %-------- Begin editable region -------------% fig_number = 1; title_figure = 'Fisheye Camera Calibration Toolbox'; cell_list{1,1} = {'Image names','data_calib_no_read;'}; cell_list{1,2} = {'Read images','ima_read_calib_...
340777437ce7802809d3823fb108d428277717206ba9d1c635deae9b37dbef99
MATLAB
1,520
56
%% Plot a Gamma Distribution % %% %as = [1 1.5 2 1 1.5 2]; bs = [1 1 1 1.5 1.5 1.5]; % This file is from pmtk3.googlecode.com as = [1 1.5 2]; b = 1; bs = b*ones(1,length(as)); figure; [styles, colors, symbols] = plotColors; legendStr = cell(1, length(as)); %styles = {'k:', 'b--', 'r-'}; for i=1:length(as) a = ...
8e3ecb413ccf63adce31e349cb5135337d798a84bdf0e2e398fde4939a5f1565
MATLAB
1,520
40
%% Getting individual connectivity values subj1 = {'POGO_11' 'POGO_13' 'POGO_23' 'POGO_25' 'POGO_29' 'POGO_31' 'POGO_32' 'POGO_34' 'ST02' 'ST03' ... 'ST05' 'ST06' 'ST08' 'ST14' 'ST20' 'ST27' 'ST36' 'ST45' ... 'ST47' 'ST48' 'ST49' 'ST50' 'ST51' 'ST56'}; subj2 = {'H_02_48' 'H_03_49' 'H_05_50' 'ST10' 'ST12...
e4ced091b7f837f13872cc79494b548297ef51efdcd637cff4ad25bd9e1a0b3f
MATLAB
1,520
56
function [clusters,imax] = RFT_clusters(X,xc,verbose) % identifies the clusters on a thresholded RF defined on a regular lattice % [out] = RFT_clusters(X,xc,verbose) % This function finds the connected clusters of points Pi on a regular % lattice, such that their value X(Pi) exceeds the threshold xc. % IN: % - X: the...
2e5dd98e12fa0a64b12a649a41653e2528c4b6a69b7e0da16de2420bee5511d2
MATLAB
1,521
47
%% SAT - app_input:: %% helper.getFiles % Name: Phone Kyaw % Date: 09/19/2024 % Description: Get the user selected file path % Parameters: None % Return Value: files - Nx1 cell containing all the files' path inside the % directory user selected %______________________________...
9e9b5dc4aef64391b04e84420636c925c48c21d0c9900cc5523fbe6ff8a6ee0a
MATLAB
1,521
44
%% Compare paired and unpaired Bayesian posteriors on contingency table differences %PMTKneedsStatsToolbox ksdensity %% % This file is from pmtk3.googlecode.com requireStatsToolbox setSeed(1); thetaX = [0.3 0.4 0.45]; thetaY = [0.5 0.5 0.5]; Nthetas = length(thetaX); N = 10; Ntrials = 9; nr = 3; nc = 3; for t=1:Nth...
f9333c8f340973413e85bdf00b07a6c5b0b3e4e265e1a428d3684d5b17a5c845
MATLAB
1,521
38
disp(' '); disp('fdct_wrapping_demo_disp.m -- Displays the curvelet coefficients of an image'); disp(' '); disp('1. The low frequency (coarse scale) coefficients are stored at'); disp(' the center of the display.') disp(['2. The Cartesian concentric coronae show the coefficients at different']); disp(' scales; t...
426ec554a92f7a45ef668c6e0973917cb650b50559100a6cf5f810c6c95eb1cf
MATLAB
1,522
42
function rois = afxConn(func,masks,rpFile,denoisingOptions,rois,firstlevelDir,conditionName,subjectName,analyses) % output directory outDir = fullfile('results',firstlevelDir,'firstlevel',['cond_' conditionName]); % load functional data (smoothed/unsmoothed) if denoisingOptions.unsmoothed ...
7c4fdde82ab1a0e686b52a73348967834a7038548ce6e321ef7523cd9ace2f3e
MATLAB
1,522
44
function spm_save_thr_SPM(SPM, con, FWE, p, k, fname) % _ % Save Thresholded Statistical Parametric Map % FORMAT spm_save_thr_SPM(SPM, con, FWE, p, k) % SPM - a structure specifying an estimated GLM % con - an integer indexing the contrast to be queried % FWE - a logical indicating family-wise error c...
801bf1e94a8efc0d8d43c0c1f32012ec1219e8c3fcc7e7de4e939e13f4e67525
MATLAB
1,522
42
function varargout = rowFcn(fcn, A, varargin) % Description: apply fcn to each row of matrix (based on cellfun) % Notice: % Inputs can be all data type valid for mat2cell() % % Input: % fcn: function handle, function to apply to each row % A: a 2-D matrix or a vector ...
a5be1c8cfac3d7711e5e6e5bd5d5d4e7b943b4d3313b8e5c157a3c8476b8565f
MATLAB
1,522
53
% Clustering demo. % % Used to test different clustering algorithms on 2D and 3D mixture of % gaussian data. Alter demo by edititing this file. % % USAGE % demoCluster % % INPUTS % % OUTPUTS % % EXAMPLE % demoCluster % % See also KMEANS2, MEANSHIFT % % Piotr's Computer Vision Matlab Toolbox Version 2.0 % Copyrig...
c6a02b7c8ef82786b346d75d7935e3af69df93fcb71d95c6575819c4b95f2a35
MATLAB
1,522
43
function [RF_weight, p_values] = statistical_test_by_stack_v10(Dnum, data_compressed, total_ROI, stimuli_start_time, dataset) load(['data_' dataset '.mat']) replicates = 10; time_point = 2*1000*2; positions = 38; color = 1; trials = replicates*positions*color; RF_weight = zeros(positions, total_ROI); p_values = zer...
df203504a1bec979606ebd12bedd2100947a00a17e49e6ff43c9edb5e9b2e865
MATLAB
1,522
54
% ReorderRegions.m % Sarah West % 1/31/22 % Starting with the LocaNMF map you want, reeorders regions into a logical % order based on ant-post location of subdivided atlas. function [] = ReorderRegions(parameters) % Load subdivided basline atlas. load(parameters.dir_subdivided_atlas); % Grab list of ...
3509a648f1a1b993aef6498f16cccfcc6ab8b825fee14ca81257e5e2a747f55a
MATLAB
1,523
74
function [res,info] = mydir(dirname,varargin) iscond = nargin > 1; if iscond, [name,daterange,isdir,recursive,maxdepth] = myparse(varargin,'name','','daterange',[],'isdir',[],'recursive',false,'maxdepth',inf); end [p,f] = myfileparts(dirname); if ~any(f == '*'), p = fullfile(p,f); end s = dir(dirname); res = {}; ...
ba61f0f50be330d7497c19c65165c02a9b7dfff7aa39a503e5aed2e5d4a9e809
MATLAB
1,523
48
function ind_regions = GetIndRegions(ele,p) % Assuming all the elements in ele are sharing one material ID (i.e. they % all belong to a certain region/material) and 'ele' defines only manifold % surfaces, this routine returns individual % closed surfaces/loops that constitute the entire 'ele' % This routine assumes tha...
c8db1d5a63fff0f2d43105a8c228e28b1a4cfd0e9c8fa7e987025599dec2455e
MATLAB
1,523
52
function out = logregPostSummary(model, varargin) % Return summaries of the posterior distribution of the regression weights % You must call logregFitBayes first % out is a structure containing % what % posterior mean % stderr % posterior standard deviation % credint(i,1:2) % 95% credible interval % % If you set dis...
018f1a7697e4384b7afbee6b0f0060f3ad6becfbcf059ddb9f77d26ba9297ffa
MATLAB
1,524
77
%load data: contact lead author %% figure; subplot(121) hold on xx1 = overlapPerc{1,1} * 100; xx2 = overlapPerc{1,2} * 100; a=xx1'; b=xx2'; c={}; c{1}='AVR';%common c{2}='VVR';%unique color=[1 0 1;0 1 0]; % color=repmat(color,2,1);%all use the same color %data All=[]; for n=1:size(a,2); All=[A...
8223ddf5de4f174f1eacbb39764590544e59fd01f236370350268afeb1251f9c
MATLAB
1,524
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 ...
3f80d7098edd7536200a776815884ad2be4e056452b0aa222808753ffb453aeb
MATLAB
1,525
63
function [model, yhat, loglikHist] = linregCensoredFitEm(X, y, censored, varargin) %% Fit a censored model by EM % X: N*D matrix % y: N*1 vector % censored(i) = true if censored % % yhat(i) = E[z(i)] computed during EM %PMTKauthor Hannes Bretschneider %PMTKmodified Matt Dunham %% % This file is from pmtk3.googlecode...
e823d4ca9b77401ebb30ba758a51c4a3ff4bf7473dd6d0d465f5774bcc1400f4
MATLAB
1,525
43
function stats = applyStatsfun(problem, x, storedb, key, options, stats) % Apply the statsfun function to a stats structure (for solvers). % % function stats = applyStatsfun(problem, x, storedb, key, options, stats) % % Applies the options.statsfun user supplied function (if it was provided) % to the stats struct...
031eed143bb5c81fd8533f27c7dd52ce4ecec9f9476929d5100fd63672cdcfde
MATLAB
1,526
58
function C = and(A,B) %AND Logical AND (&) for sptensors. % % See also SPTENSOR. % %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. Under the terms...
97ae7928ea925d0b2f24fbd44b77e147c3117ed04dfdeefbc96fe59c6a84a01b
MATLAB
1,526
51
%% Fit a rbf kernelized logistic regression model % We follow the same train/test split as linearKernelDemo % so that results are comparable % This file is from pmtk3.googlecode.com %loadData('crabs'); loadData('fglass'); % 6 classes, X is 214*9 X = [Xtrain; Xtest]; y = canonizeLabels([ytrain; ytest]); % class 4 is...
b230179aaabf729e4a0c546deae369b576eb8b9c7aa3d52f97bc9303b7146aad
MATLAB
1,526
45
function debugMsg(level, msg) % Set the debugging level % % debugMsg(level, msg) % % level 1: function names % level 2: function details % level 3: map call % msg: string containing debugging message %--------------------------------------------------------------------- % ...
b65a42bb2d975fe29aba964611615d752fe48e872bfe8f687b701f2c1d7c93c2
MATLAB
1,526
34
function h_doubleClickLoadQCaMImg3 UserData = get(gco,'UserData'); t0 = clock; if ~isfield(UserData,'timeLastClick') || ~(etime(t0,UserData.timeLastClick) < 0.4) % disp(etime(t0,UserData.timeLastClick)) UserData.timeLastClick = t0; set(gco,'UserData',UserData); return; else UserData.timeL...
cbf4118d3c2b11938707ac172141e560ab38535ebdb010770960534046304e3c
MATLAB
1,526
47
function d = check(f, X, e, P1, P2, P3, P4, P5); % checkgrad checks the derivatives in a function, by comparing them to finite % differences approximations. The partial derivatives and the approximation % are printed and the norm of the diffrence divided by the norm of the sum is % returned as an indication of accurac...
3bfad084e7e679d09b565fa71d23856922fb4eadc66cb4b561ef8f4271d74fb1
MATLAB
1,527
59
function j = CBIG_MFMem_rfMRI_diff_P1(func,para,houtput,num) %------------------------------------------------------------------------ % j = CBIG_mfm_rfMRI_diff_P1(func,para,houtput,num) % % Function for Newton-forwards first order derivative approximation % % f(x0+h)-f(x0) % diff(f(x0) = ...
b07faf6c6d551a574e436bae5f2afae19388347a8a647bd35582488f3bdc11c8
MATLAB
1,527
40
%% Getting individual connectivity values subj1 = {'POGO_11' 'POGO_13' 'POGO_23' 'POGO_25' 'POGO_29' 'POGO_31' 'POGO_32' 'POGO_34' 'ST02' 'ST03' ... 'ST05' 'ST06' 'ST08' 'ST14' 'ST20' 'ST27' 'ST36' 'ST45' ... 'ST47' 'ST48' 'ST49' 'ST50' 'ST51' 'ST56'}; subj2 = {'H_02_48' 'H_03_49' 'H_05_50' 'ST10' 'ST12...
dc9dcab4fb1e7ea446bceccd561e932d22da052525c2c818a54ff47d1d1e3afe
MATLAB
1,527
58
% Computation of the errors: fc = param(1:2); cc = param(3:4); alpha_c = param(5); kc = param(6:10); e_cam = []; for kk = 1:n_ima, omckk = param(11+(kk-1)*6:11+(kk-1)*6+2); Tckk = param(11+(kk-1)*6+3:11+(kk-1)*6+3+2); eval(['Xkk = X_' num2str(kk) ';']); eval(['xkk = x_' num2str(kk) ';']); ekk...
dfe0d70eb32b6be96329a0c56ca57761a15d8eb9768ecc2e3a1fafb3cd951508
MATLAB
1,527
80
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % shows all sorted spikes in all channels function showSpikes(self, channels) if nargin == 1 c...
74e53b7b10637335a22ecb558d95b0840321886bf145b35112443b00aad8a3b5
MATLAB
1,529
37
function flag=istfr1(method); % flag=istfr1(method) returns true is method is a % time frequency representation of type 1 (positive and negative frequencies). % See also istfr2, istfraff. % F. Auger, may 98 % Copyright (c) CNRS - France 1998. % % This program is free software; you can redistribute it and/or modify %...
af3e6a29f378914bde4be6a7fc6bcb31a5c1ca991bfd5d774ef712c529d44514
MATLAB
1,529
51
function systemcommand = GetSystemCommand(command_name) % systemcommand = GetSystemCommand(command_name) % Determines the platform that matlab is running and calls the appropriate % executable file using following convention: % command_name-mac.exe For Mac % command_name-linux.exe For Linux % command_name.exe For Win...
fc5fe942804a0c8460b7c96f543ec166910fa26d32c89f268a5cc28d74c4d20a
MATLAB
1,529
61
function [ img_3d ] = volume_filtering( img_3d, take_maximal_volume) % 3D Volume filtering operations parameters; % filtered 3d mask % imshow(cmp_z_proj(img_3d)); % find connected volumes CC = bwconncomp(img_3d); S = regionprops(CC,'Centroid', 'Area', 'PixelIdxList'); % center_xyz = floo...
13325b55a165fcb8f8754aacd18951aaf5c8d0ede85c937354aadab91356f755
MATLAB
1,531
28
function rgb = cdat2rgb(cdat, cmap, clim, highlight) % This funcxtion changes the color of pixels to white, regardless of colormap, without using opengl % It does by converting by: % 1) convert the to-be-plotted data to their respective rgb color values (determined by colormap) % 2) convert these rgb color values to h...
425fe8d1386592d6dc382b111bc982852112099d03e73a5542548e5403cea3b0
MATLAB
1,531
36
function PlotFigure1_S1(vars,varNames) % plot sRT vs velres, incentive effects % then separated by drug condition if nargin==0 load('Figure 1 - Source Data 1.mat', 'vars', 'varNames') % vars is struct with fields of [nPP, nConds, nDrug] trial means end [nPP, nConds, nDrugs] = size(vars...
453a0814e1e197047d1537f7f61e0f4a1c17721266fa0099bb1231315ebb2cd8
MATLAB
1,531
53
% Demonstrate LDA/QDA on 2d 3class iris data % From http://www.mathworks.com/products/statistics/demos.html?file=/products/demos/shipping/stats/classdemo.html requireStatsToolbox(); % "Resubstitution error" is the training set error load fisheriris if 0 figure gscatter(meas(:,1), meas(:,2), species,'r...
553978e7c3a471938067e67d8c554d7203b7dfacba1c742cf750f6fa1ef578bd
MATLAB
1,531
55
%% Linear/ quadratic discriminant analysis for Height Weight data % %% % This file is from pmtk3.googlecode.com clear all rawdata = loadData('heightWeight'); data.Y = rawdata(:,1); % 1=male, 2=female data.X = [rawdata(:,2) rawdata(:,3)]; % height, weight maleNdx = find(data.Y == 1); femaleNdx = find(data.Y == 2); cla...
17707b15f3f1d92ded5b7f78a07276c44bea7efe91db91b4a13cce474e5a1026
MATLAB
1,532
53
function W = AngularVelocity(X,smooth) %AngularVelocity - Compute instantaneous angular velocity. % % Compute angular velocity for a time-varying vector X. This is computed as % the vector product of X and its derivative DX: W(t) = X(t) ^ DX(t) % % USAGE % % omega = AngularVelocity(X,smooth) % % X ...
3e31bff2e258883c17e3193848d06f486e472624d866b298b1bc4d009c37ab05
MATLAB
1,532
54
function mask = maskSphere( d, r, show ) % Creates an 'image' of a n-dimensional hypersphere. % % Useful for testing visualization procedures. % % Create a d-dimensional matrix mask of dimensions [s x s x s x ... x s] % where s=2r+1. Each element mask(x1,x2...,xd) is 1 if (x1,...xd) falls % inside the centered hypersp...
956c1ae737326fb01b30947e1a26b7e73984cecd10a6abeb356aaef3dd9bbe1e
MATLAB
1,532
51
function h_autoSetAxesRatio3(handles) global h_img3 [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); header = currentStruct.info; dispAxes = get(handles.viewingAxisControl,'Value'); if strcmpi(header.fileType,'scanimage') && exist('calculateFieldOfView', 'file') try...
13e237ea84f176eb71c2c36a9e62c96c84ca6f793dfc354f6ef6fd9d2f65ec73
MATLAB
1,533
25
function [optScanner,optSample,optSSFP,optSE] = ParameterOptionsSNROscillating() %% %Scanner properties optScanner.MaxReadout=inf; % Maximum Readout Duration (ms) optScanner.GMax=1000; % Maximum Gradient Stength (mT/m) optScanner.gamma=2*pi*42.58*10^6; % G...
419bae54d8ea66820ca6586dd7a738f47564d153180e672a467fe4f3b869ada6
MATLAB
1,534
61
function [k,g,s,time,Ck] = vdSpiralDesign(ST, Nitlv, res, fov,radius , Gmax, Smax, T, interpType) % [k,g,s,time] = vdSpiralDesign(Nitlv, res, fov,radius , Gmax, Smax, T, interpType) % % This function designs a variable density spiral % % Input: % ST - type of solution (0 for rotationally variant, 1 for % ...
96539225ac393e21d6650b01984a548f7f069e59ea5f83c6ceda0c92d428e3d8
MATLAB
1,534
61
function [med,mad] = compute_bg_med(readframe,nframes,varargin) [bgstartframe,bgendframe,bgnframes,roi,maxmem,verbose] = ... myparse(varargin,'bgstartframe',1,'bgendframe',nframes,... 'bgnframes',200,'roi',[],... 'maxmem',2^20*50,'verbose',1); if isempty(roi), im = readframe(bgstartframe...
b9c76f0307a91b0852e9e543a620c8a14670293e1fadda6e6e361f5b778c7628
MATLAB
1,534
41
function [lat,pol]=sph2hor(azi,ele) %SPH2HOR transform spherical to horizontal-polar coordinates. % [lat,pol]=sph2hor(azi,ele) % % Input: % azi ... azimuth (in degrees) % ele ... elevation (in degrees) % % Output: % lat ... lateral angle (-90 <= lat <= 90) % pol ... polar angle (-90 <= ...
dde154a1cd0a7f710c5eb3353def64cfe8c2a658454c5127dcfa7192bb2cd094
MATLAB
1,534
73
function error = wlProc_calcWaveErrorRelative( ... bigwave, bigstart, subwave, substart) % function error = wlProc_calcWaveErrorRelative( ... % bigwave, bigstart, subwave, substart) % % This function calculates the "error" between an event waveform and a % reference waveform. % The "Relative" version computes this...
e4b2cc2bc7bba9c7398c127fc78a0d13cdad867245ffe92612b1b98d5720a68b
MATLAB
1,534
52
% Author: Birgit Nierula % nierula@cbs.mpg.de function eeg_prepro_loop7_2_allBlocks(subject, sasica_comps) %% loop 7: save ICA components % define variables subject_id = sprintf('sub-%03i', subject); analysis_path = [getenv('ANADIR') subject_id '/eeg/prepro/']; save_path = [getenv('EEGDIR') subject_id '/']; % sav...
385a235552d3724793f04d696a3a9c04e2cbbf9e3b4dd0af33b148e69c093d1a
MATLAB
1,535
45
% Author: Birgit Nierula % nierula@cbs.mpg.de function eeg_prepro_loop3(subject, condition, srmr_nr) %% loop 3: remove identified bad channels and interpolate them % set important variables subject_id = sprintf('sub-%03i', subject); analysis_path = [getenv('ANADIR') subject_id '/eeg/prepro/']; % define stimulation...
5b70b33b1ece8393a6f895b619d9c7bc379f3a1e480147a9e01a42655100a3bf
MATLAB
1,535
62
function locs_new=adjust_elecs(names,locs); [nchan ndum]=size(locs); elec_suf=zeros(nchan,1); locs_new=locs; for i=1:nchan; nloc=names{i}; n=length(nloc); if strcmp(nloc(n),'z'); locs_new(i,1)=0; %disp(nloc) %[locs(i,:),locs_new(i,:)] else kont=0; while kont==0 ...
37fe26ecd56dd95a31ab0b86c601bc3e232a193a132bc806c5e3e8102928be10
MATLAB
1,537
61
function dy = CBIG_MFMem_rfMRI_mfm_ode1(y,parameter,SC) %----------------------------------------------------------------------------- % dy = CBIG_MFMem_rfMRI_MFMem_ode1(y,parameter,SC) % % Function for dynamical mean field model diffiential equation 1st order % % Input: % - y: current neural state % -...
48dfcc047ceba48717e8d17b92eb0835f7e4a6b09430a7512f601674efa4ccff
MATLAB
1,537
49
function t = subsasgn(t,s,b) %SUBSASGN Subscripted assignement for ktensor. % % See also KTENSOR. % %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...
7e9431de4022b1c2f3d426b0b2662c4f1f1f474eef64250fa602f14179e4de97
MATLAB
1,537
52
%% convolve joint sdo % given a (recovered) joint matrix/distribution, appropriately convolve the matrix % N_STEPS. % jsdo is first scaled to px0 (colsum), and 1's are added to the matrix % diagonal to ensure the matrix functions as a transition matrix. % It is multipled N_STEP times, and then row elements are %...
d37a0d9efa70241b715c7fa62cb31b5ec3e67ffba6ccd345716dc618aeb430fc
MATLAB
1,537
40
% EQUATION3 computes the raw JPSTH of spike_1 and spike_2 % % to compile enter the following command at the MATLAB Command Window % >> mex('equation3.c') % % MATLAB equivalent to equation3.c listed below % equation3.m % % Copyright 2008 Vanderbilt University. All rights reserved. % John Haitas, Jeremiah Cohen, and J...
e40cad77889b378d956eb8f2d7cca64f851a111db2b360bb7869030bc591ec27
MATLAB
1,537
76
% [intpx,extpx] = ellipseintextpixels(im,ells,r0,r1,r2) function [intpx,extpx] = ellipseintextpixels(im,ells,r0,r1,r2,debug) if ~exist('debug','var'), debug = false; end [nr,nc,ncolors] = size(im); bw = false(nr,nc); if r0 < 0, se0 = strel('disk',-r0); end if r1 > 0, se1 = strel('disk',r1); end if r2 > 0, se...
3c6d8e3248caa66ba07ec24b16ff47f084d94294675968cb7c513a0cb8129096
MATLAB
1,538
54
function projectfun = get_project_fcn(caldata) % [XYZ,uv_re,err] = reconstructfun(uv) % reconstructfun(uv) takes input uv which is [2 x nviews x n] % and produces outputs: % XYZ: [3 x n] 3-d reconstructed points % uv_re: [2 x nviews x n] reprojections % err: [1 x n] reprojection error per view if isa(caldata,'CalRigS...
56f4e5478dc6dc47c1246e36c5d526a1a2f5d21fc9d236e8dc889d6b031639aa
MATLAB
1,538
64
%% warn_if % % Test a condition and warn if true % % <matlab:open('warn_if.m') code> % %% Syntax % % wcond = warn_if(wcond,msgstr,warnfunc) % %% Arguments % % _input_ % % wcond condition to test % msgstr string specifying warning message % warnfunc string specifying which function issued the ...
0d9af6b5fba2343cabec072d07dae267dc52e719352a8ef259972daacf892078
MATLAB
1,539
41
function [wsM] = WinMat(M, win, step) % WinMat(M, win, step); uses data from signal matrix 'M' % to construct a 3D matrix wsM using 'win' succesive rows % The sorting procedes on the columns, by taking the first 'win' rows. % Then, separated by 'step', the following 'win' rows and so on. % % Ej: M =[ 1 4 %...
725057e6094fef4eff4d90c8b2a4b3394374f439ddee36352754bc8ac4b4ff1e
MATLAB
1,539
49
function probs = Cov_comp(X,tau,isjoint) %: Compute covarance matrices from time series data X % %----------------------------------------------------------------------- % INPUTS: % X: time series data in the form (units X time) % tau: time lag between past and present states % isjoint: wh...
97ed2cf45e922610269de50c0574f4da5ee0a2451aae30e32cb7d622746708cc
MATLAB
1,539
50
% RSKELF_CHOLMV Multiply using generalized Cholesky factor from recursive % skeletonization factorization. % % Typical complexity: about half that of RSKELF_MV. % % Y = RSKELF_CHOLMV(F,X) produces the matrix Y by applying the generalized % Cholesky factor C of the factored matrix F = C*C' to th...
9a1b20ef22535a741800790018e8d5ae1a2ac473fec44bddb7a215ada00c3678
MATLAB
1,539
79
function jumpToOutlier(self,direction) arguments self (1,1) crabsort direction char end if self.verbosity > 9 disp(mfilename) end % find outliers if isempty(self.channel_to_work_with) return else channel = self.channel_to_work_with; end [spiketimes, labels] = self.getLabelledSpikes; if isempty(spiketimes) sel...
dd44d7b3ed52009bf13a3442ef8f9969162a5d237f729f44c68a871adb04e62f
MATLAB
1,539
25
%% 非线性(动力学)特征:基于时域的熵 | nonlinear features: time-domain-based entropy %% Renyi Entropy % X: single channel EEG signal (either a row vector or a column vector) % See also: % feat_ShannonEntropy, feat_LogEnergyEntropy, feat_TsallisEntropy, feat_MeanEnergy, feat_MeanTeagerEnergy %% Reference % [1] Şen, B., Pe...
41a9a91ea0785527a743f61d68a0357f0a409223da6e1d995ac7ee9534b95e83
MATLAB
1,540
61
function [DCM] = VBA_spm_sdcm_estimate(P,stochastic,augment,DisplayWin,confounds) % Estimate parameters of a stochastic DCM for fMRI data % FORMAT [DCM] = spm_sdcm_estimate(DCM,stochastic,augment) % % DCM - the DCM or its filename % stochastic - flag for s/d DCM % augment - structure for input basis ...
95314018741456e5961abc01f05415816a302fdac6af47ae33e2eb20d5c65105
MATLAB
1,540
87
function [dataKT] = meg_subjectNames_RD2KT(dataRD) % function [dataKT] = subjectNames_RD2KT(dataRD,subjectIdx) % Inputs: % - dataRD: data matrix organized in RD subject order % Rearrange data matrix from RD subject odering to KT subject ordering % dataRD must be 1 x 10? % Subject oder RD % 1. R0817 % 2. R1187 %...
9f50f37c39f1d9efc48e30264fe0ab0a302c1b78ed38364605dfe496367c263b
MATLAB
1,540
53
function res = innerprod(X,Y) %INNERPROD Efficient inner product with a ktensor. % % R = INNERPROD(X,Y) efficiently computes the inner product between % two tensors X and Y. If Y is a ktensor, the inner product is % computed using inner products of the factor matrices, X{i}'*Y{i}. % Otherwise, the inner produc...
c9a200313b2cc6fa460ce845dc899be061f03b8a083ad93c0947a4f037f4101d
MATLAB
1,540
45
function [x,mx,sx] = nanstandardise(x,dim) % X = NANSTANDARDISE(X, DIM) computes the zscore of a matrix along dimension % dim, taking nans into account % has similar functionality as the stats-toolbox's zscore function % Copyright (C) 2010, Jan-Mathijs Schoffelen % % This file is part of FieldTrip, see http://www.ru...
ecfc66be64ae2345d1b1ec026364088319bd77b7cf700169ca4372236b0f816b
MATLAB
1,540
68
% [x,npadl,npadu] = padset(x,padv,l1,u1,l2,u2,...) function [x,npadl,npadu] = padset(x,padv,varargin) % parse arguments usagestring = 'Usage: padset(x,padv,l1,u1,l2,u2,...)'; nd1 = ndims(x); if mod(numel(varargin),2) ~= 0 || isempty(varargin), error(usagestring); end isones = cellfun(@(x) x == 1, varargin(1:2:end-1)...
0ad74cd9e64ca90c183c17ba8a8e75a1963f568a55556bdc4a75355e30162697
MATLAB
1,541
62
function [numt0marker] = plotTriggers( dataset, t0marker , varargin ) %PLOTTRIGGERS Plot all the triggers in the file over time p = inputParser; addParameter(p, 'showFigure', false); addParameter(p, 'savePath', []); addParameter(p, 'xUnits', 'samples', @(x) any(strcmp(x, {'samples', 'sec', 'msec'}))); parse(p, varargi...
16c31920ea4ec459a5f8f55caaaaa7c4a9c3de60f064ad2e99dd15cfded8f9c7
MATLAB
1,541
43
basepath = pwd dat_files = dir(fullfile(basepath,'**','*amplifier.dat')); recordingnames = {dat_files.folder} names2sort = cellfun(@(X) str2num(X(end-5:end)),recordingnames,'UniformOutput',false); names2sort = cell2mat(names2sort); [~,I] = sort(names2sort); recordingnames = recordingnames(I); dat_files = dat_files(I)...
6c623e805304bc4bf56ed4a25c8f35ee646ca83b7a89e9ed3ca6cab5ad53fb16
MATLAB
1,541
55
% 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,...
891fee86dda103eaaf07b9446cd8394d291b8e11448521e9a8ac7850471235ad
MATLAB
1,541
93
function p = mahdist(x, m, S, V) % mahalanobis distance from x to m by S % mahdist([x(:)';y(:)';z(:)'],mu,[],S) % See NORMPDF for argument description. % [d, n] = size(x) % [d, 1] = size(m) % S = [] % V = cov [d, n] = size(x); if nargin == 1 dx = x; elseif isempty(m) dx = x; else % m specified sz = size(m); ...
c5079f86915b2c92d334013ee376ea563b10d3645171b22cdd1fb87ac5a761e3
MATLAB
1,541
53
function [sector_endpoints, num_sectors] = generate_sector_points_3(sector_vector, num_sector_weights, min_sector_spacing, have_min_sector_spacing) num_sectors = datasample(sector_vector, 1, 'Replace', true, 'Weights', num_sector_weights); sector_endpoints = zeros(2*num_sectors, 1); num_endpoints = length(sector_endpo...
1612b439ff844fb57277fb37f8d142720be8fee31d575c86e0e5ac9a4cab7c59
MATLAB
1,542
64
function logp = studentLogprob(arg1, arg2, arg3, arg4) % Multivariate student T distribution, log pdf % % - model is a structure containing fields mu, Sigma, dof % - logp(i) = logp(X(i, :) | model) % % For the scalar case, Sigma is the variance not the standard deviation % % logp = studentLogprob(model, X); OR logp =...