sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e94da446932ca5f1e9427a6da8c10a7308d288374e5334aadb08a696d68d11f3
MATLAB
950
35
%% Plot Mixtures of 2, 2D Gaussians with 1,2, and 3 modes Respectively. % %% % This file is from pmtk3.googlecode.com mixweight = [0.5; 0.5]; model.K = 2; % M = desired num. modes for M=1:3 switch M case 3, % 3 modes mu = [0 0; 1 1]'; Sigma(:,:,1) = [1 0; 0 0.05]; ...
52850798c50e75684d59efc5a0cda7b8b576eca7e436e7853a38dc53c765ddb3
MATLAB
951
34
function map = mrfMap(mrf, varargin) %% Find the mode, (map assignment) % Optional named args are the same as for mrfInferNodes % This uses jtree. %% % This file is from pmtk3.googlecode.com [clamped, softEv, localEv] = process_options(varargin, ... 'clamped', [], ... 'softev' , [], ... 'localev', []); lo...
83fb53259e7ea58a88b89c7fd1c0e30b5f99a965f9e9971cd0cb72dd0fc72d12
MATLAB
951
35
function newsubs = irenumber(t, sz, range) %RENUMBER indices for sptensor subsasgn % % See also SPTENSOR/SUBSASGN % %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) San...
9aca9373fa4156dac57f5c23c310712e606444488e205dd47ab8f22d932de535
MATLAB
951
36
function [p,occ] = getLabelsF(s,frm,ntgtsmax) % prob rename to "getLabelsFFull" etc % get labels/occ for given frame, all tgts. "All tgts" here is % MA-style ie "all labeled tgts which often will be zero" % % p: [2npts x ntgtslbled], or [2npts x ntgtsmax] if ntgtsmax provided % occ: [npts x ntgtslbled], etc...
fc6f2b591febd3267961ff2dc42ffee228c4c5df00319530cc0fcff0707cbb66
MATLAB
951
31
function v = matrixlincomb(x, a1, d1, a2, d2) %#ok<INUSL> % Linear combination function for tangent vectors represented as matrices. % % function v = lincomb(x, a1, d1) % function v = lincomb(x, a1, d1, a2, d2) % % Given a point x, two tangent vectors d1 and d2 at x, and two real % coefficients a1 and a2, return...
0063927ddc91d789b7bdeeb97997dc268afac33526843817200543431b6d9996
MATLAB
952
24
function demos = makeRunDemos() % Generate the runDemos script % This function automatically generates the runDemos.m file, which contains % code to run all of the PMTK scripts located in the demos directory. % All of the work is done in processExamples(). % This file is from pmtk3.googlecode.com fname = 'runDemos.m...
0a28054c37f9698687ca56b4ce739f266e2e6f1d195a4ba67e18a11e94de31e7
MATLAB
952
27
%----------------------------------------------------------------------------------------- % Plot odor-identity decoding performance across regions % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 2b % Author: Marcel Kehl % License: MIT License %---------------------...
4567ee1108cbd26dc37856221ce525156f2b969452c142f3a2d0c879edc5b704
MATLAB
952
36
TRace_logic = zeros(1,size(traces.all,2)); TRace_logic(SCE.TRace) = 1; % Racesum_rows = sum(Race,1); % for i = length (Racesum_rows) % TRace_logic(SCE.TRace(i)) = Racesum_rows(i); % end r_int = zeros(size(traces.int,1),41); for cellCounter = 1:length(nCells.int) if ismember (nCells.int(cellCounter),find(SCE.R...
8758959d9c49e72229665e76ca54e91a56c8387aabfe27070ae9d919245d6895
MATLAB
952
14
%Purpose: Implement CBIG_ComputeFullSurfaceCorrelation function %Inputs: Text lists for LH and RH data %Ouputs: Full surface correlation matrices % %Written by M. Peterson, Nielsen Brain and Behavior Lab under MIT License 2022 %Arg structure: CBIG_ComputeFullSurfaceCorrelation(output_file, varargin_text1, varargin_te...
15c0823e5514e4f6e28cfcca09f0fc6c293a20d74b71e688edd3496acc5b27e1
MATLAB
953
49
% lsiCode clear all X = load('lsiMatrix.txt')'; %fid = fopen('lsiWords.txt'); %tmp = textscan(fid,'%s'); %fclose(fid); %words = tmp{1}; words = textread('lsiWords.txt', '%s'); [U,S,V] = svd(X); K = 2; UK = U(:,1:K); SK = S(1:K, 1:K); VK = V(:,1:K); [nwords ndoc] = size(X); % plot documents in latent space Xhat = ...
bf445b07ff134faf2b8890e84b8eb18c13b790c4e1bd8e65540eee9686ed44c6
MATLAB
953
47
%% PageRank by power method with no matrix operations. % x = pagerankpow(G) is the PageRank of the graph G. % [x,cnt] = pagerankpow(G) also counts the number of iterations. % There are no matrix operations. Only the link structure % of G is used with the power method. % PMTKauthor Cleve Moler % PMTKurl http://www.math...
e21c223d713b5c27337621bbd960a76d012f5666519357c5ca660bba810fe507
MATLAB
953
33
% Setup base path clear; basefolder = fileparts(fileparts(fileparts(mfilename('fullpath')))); codefolder = [basefolder,'/code']; toolsfolder = [basefolder,'/tests/tools']; addpath(genpath(codefolder)); addpath(genpath(toolsfolder)); % Load Data data_path = [basefolder, '/tests/fixtures/sub-1_rest1_schaefer400x7_ts.1...
f91b07cbefd204e53a8790f15b07f64e2aa8bb3f2e7b2cd7215f1d2eb3c334f2
MATLAB
953
34
function avgCorr = CBIG_hunMatch(beta_best, beta) % avgCorr = CBIG_hunMatch(beta_best, beta) %%% Reorder subtypes to obtain the maximal correlation coefficients % Construct the COST matrix % pos1 pos2 ... % topic1 % topic2 % ... % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/m...
32b02f9c6b112c7f82aa883afda0c660f4bfeb80a6fc599a94ffa06584294de9
MATLAB
954
46
function [p] = meg_FFTparams(data,Fs,df) % MEG_PLOTTF(data,p,selectedChannels,selectedFreq) % computes fft based on desired frequency resolution and sampling rate % % INPUT % data % structure of condition cells containing % data matrix, time x channels x trials % Fsamplex % frames per second (e.g. 1000 Hz) % df...
47be9cbd1cbe28cdcd476d0478b82d568012868e1e02a391519d95a0f548e67b
MATLAB
954
33
function Output_Image_RGB=Color_NAN_Masking(Input_Image_RGB,Mask) try Mask=logical(Mask); Input_Image_R=Input_Image_RGB(:,:,1); Input_Image_G=Input_Image_RGB(:,:,2); Input_Image_B=Input_Image_RGB(:,:,3); Input_Image_R(Mask)=NaN; Input_Image_G(Mask)=NaN;...
740f7ee170ad74c7541dd2ad9fe86d377081a83117521fddbb8721e60cefdd9c
MATLAB
954
52
function G = mkGrid(M, N, doPlot) %% Create an M by N undirected grid as an adjacency matrix in column order % i.e. mkGrid(3, 5) creates a grid that looks like this: % % 1-4-7-10-13 % | | | | | % 2-5-8-11-14 % | | | | | % 3-6-9-12-15 % % Suggested drawNetwork layout: Matrixlayout(M, N) as in % drawNetwork(G, '-und...
85d078dd724a3e902d5466e15df09524c502dff4f63f71e39af5f84577de2089
MATLAB
954
33
function output = base64encode(input) %BASE64ENCODE Encode a byte array using Base64 codec. % % output = base64encode(input) % % The function takes a char, int8, or uint8 array INPUT and returns Base64 % encoded string OUTPUT. JAVA must be running to use this function. Note % that encoding doesn't preserve input dim...
4bb2cbc1cf779abb5d389afb622b0da0fa9377d067850ef76135c05df1d7e8f0
MATLAB
955
19
function newfn=SOFAcheckFilename(fn) %SOFACHECKFILENAME % newFN = SOFAcheckFilename(FN) checks the filename FN and: % SOFA API - function SOFAcheckFilename % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or ñ as soon they will be approved b...
5a6f9a5f71c0e7a6486d490b75082e7ef969df5329c3be15f708403d5f67caee
MATLAB
955
33
% Author: Birgit Nierula (Feb, 2020) % nierula@cbs.mpg.de function zim_addFigure(txt_filename, figure_filename, figure_title, title_level, figure_width) %% input % txt_filename = file name of text file (including the path) % figure_filename = file name of the figure, should be png or (??), zim % works with relative ...
c01581ea2557b1ed68de21e31c0ebe5c16d445298a883d1c796975994d920cc8
MATLAB
955
37
function param = selparam(data) % SELPARAM(DATA) extracts the fieldnames param of the structure data containing functional % data, which have a dimensionality consistent with the dimord field in the data. Selparam % is a helper function to selectdata [dim, fn] = dimlength(data); if numel(fn)==1 && strcmp(fn{1}, 'dimo...
1e7e0862f42f34f5750a6e5d5ddc84227ebc1ea5d17eb127ae2418f7d074c951
MATLAB
956
39
function [T,Z] = mkStochastic(T) % Make a multidimensional array sum to one along its last dimension % [T,Z] = mk_stochastic(T) % % If T is a vector, it will sum to 1. % If T is a matrix, each row will sum to 1. % If T is a 3D array, then sum_k T(i,j,k) = 1 for all i,j. % This file is from pmtk3.googlecode.com % Set...
5d8328bb742a4763c69140102d3b1be89e726d6824d342ab7c4ac47ea06d8124
MATLAB
956
30
function [C,Nx,Ny,Nz] = mask2coord( T ) % MASK2COORD Get sparse coordinates vector from mask % INPUT: % I - Input tomogram (binary) % OUTPUT: % C - 3 columns vector with the three coordinates [X,Y,Z] % Ni - Tomgram sizes % % See also: dirfiltersparse % % AUTHOR: Antonio Martinez-Sanchez (...
cb80871e803d58e9995256aba2660c96214033135ab7cb8376a83763fd9f3c4d
MATLAB
956
29
function ok=CheckUmapFolder(curPath, fileName, doGrandParent) ok=true; whereIsFile=fileparts(which(fileName)); if nargin>2 && doGrandParent check1=fileparts(curPath); [check2, p]=fileparts(whereIsFile); else check1=curPath; check2=whereIsFile; end if ~isempty(whereIsFile) && ~strcmp(check1, check2) ...
10cb462d63864b067b48d11b66533436dd9ccf4fc99136feaa02e0b0f207afe8
MATLAB
957
31
function [F, J] = calcSubunitActivationAmplitudes(params, spf) %The function can deal with mulitple subunits % Detailed explanation goes here %Returns derivatives for grid spacing, xshift and yshift %========================================================================== spff = spf(:); %standardize input sigma =...
2c068e165e243f21e6c8da30bb9a19ba1177e36e8d88512384851d94e2845796
MATLAB
957
38
function out_img = loadTifSequence( directory,start_idx,end_idx ) %LOAD3DTIF: Load 3D a tif into a y,x,z stack %fname has to end in .tif files = dir(fullfile(directory,'*.tif')); num_images = length(files); A = imread(fullfile(directory,files(1).name)); sorted_names = sort_...
406293100122f6a090da357c4f3306325c02f5eb00a2893a6bfdd90bce2c5192
MATLAB
957
38
%% Precision-recall curve for two hypothetical classifications systems. % A is better than B. %% % This file is from pmtk3.googlecode.com domain = 0:0.01:1; fA = @(x)1-(x.^(3)); fB = @(x)1-(x.^(3/2)); linewidth = {'LineWidth',3}; hold all; plot(domain, fA(domain),'-r', linewidth{:}); plot(domain, fB(domain),'-b', l...
738f4d4662ed0847b22e82e91a011f755a38e7f54c8e2faf360ead01a8a38e71
MATLAB
957
56
function LAN = eeg2eeglab2lan(cfg) % <*LAN)<] % v.0.0.2 % % cfg.filename % cfg.where % cfg.delbad if nargin == 0 [file, path] = uigetfile('*.EEG;*.eeg', 'Choose a EEG Neuroscan file -- cnt2lan()'); delbad = 0; elseif ischar(cfg) %%$ compatibility with old versions file = cfg; path = '';...
c357d307c9b494cd594ab04cc45b45d83e7f6f2e5705a70c97ca2e459502859a
MATLAB
957
30
function X = tenrand(varargin) %TENRAND Uniformly distributed pseudo-random tensor. % % X = TENRAND(SZ) forms a tensor of size SZ with pseudo-random % values drawn from a uniform distribution on the unit interval. % % TENRAND(SZ) is equivalent to TENSOR(RAND(SZ(1),SZ(2),...),SZ). % % See also TENSOR, SPTENRAND,...
086386645dd112d6f376a8f92d9949e124c79eec078964cf0d2b39d00cbaa36b
MATLAB
958
29
function [ret,messages] = check_files_in_puncta_extraction() loadParameters; ret = true; messages = {}; filename_out = fullfile(params.punctaSubvolumeDir,sprintf('%s_allsummedSummedNorm_puncta.%s',params.FILE_BASENAME,params.IMAGE_EXT)); if ~exist(filename_out,'file') ret = false; ...
3b87e2470040622dbcd14ee663a6b39ed01d595511852d9b54683bcd47edede3
MATLAB
958
31
function ok = tt_valscheck(vals) %TT_VALSCHECK Checks for valid values. % % TT_VALSCHECK(S) throws an error if S is not a valid values % array, which means that S is a column array. % % X = TT_VALSCHECK(S) returns true if S is a valid and false otherwise. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation...
4094ed415c378e23cbf7f6b1bcc0bb3aef9b8decfb77ba85a624c2e97655a83d
MATLAB
958
32
function gaussian = make2DGaussianCentered(w, h, x0, y0, sigma, gaussAmp) % % function gaussian = make2DGaussianCentered(w, h, x0, y0, sigma, gaussAmp) % make sure width and height are even if mod(w, 2) w = w - 1 ; fprintf('make2DGaussianCentered: adjusting width, w, to be even ...\n') widthAdjusted = 1; ...
8665312e7a8209261de338b79d314d1ae6d287836bc54f04737d49f41cf46639
MATLAB
958
42
function [p, thres, prop_cross,out] = fit_threshold_to_acc(dv, coh, correct) v_thres = linspace(1,20,1000); for ithres=1:length(v_thres) thres = v_thres(ithres); crossed = any(dv>thres,1)'; u = unique(abs(coh)); for i=1:length(u) pc(i) = sum(coh==-u(i) & crossed)./sum(abs(coh)==u(i) & crossed)...
8c617713824a37ce1dc25de0d7b3ff25c8f801d420eb1514219fcd3056a52c93
MATLAB
958
36
function str = secsf(format, numSecs) %SECSF Yet another seconds formatting function. % Usage: % str = secsf(format, numSecs) % % Args: % format: formatted string with any of these tokens: % No leading zero: %h, %m, %s % Leading zero: %H, %M, %S % Fractional seconds: %s.ms or %S.ms % % See also: s...
bda3c10f33f41ddf08722d02b29befc818606b48d911e990903d6a408369e536
MATLAB
958
29
function images = loadMNISTImages(filename) %loadMNISTImages returns a 28x28x[number of MNIST images] matrix containing %the raw MNIST images % % http://yann.lecun.com/exdb/mnist/ fp = fopen(filename, 'rb'); assert(fp ~= -1, ['Could not open ', filename, '']); magic = fread(fp...
ddca7a10659bfb1be2bcef1b6567a139f37558dfc7658eca6f91ec4b0a0e57b8
MATLAB
958
32
function [SortedMatrix,maxIndex]=SortThisMatrix_Max(whamatrix,fromhere,tohere,SortWithThis) dbstop if error if isempty(SortWithThis) maxIndex=[]; maxValues=[]; for as=1:size(whamatrix,1) this=whamatrix(as,:); thisMax=find(this(fromhere:tohere)==max(max(this(fromhere:tohere)))); % Use this f...
3769c7af132d6e6373892bff88052aed930be8f28fc2d9d6ad3caef963ca2e11
MATLAB
959
37
function S = steer2dtvoting( Is, Io, W0, W2, W4, W6, W8 ) % STEER2DTVOTING Tensor voting for 2D image by using steerable filters. % INPUT: % Is - Input image stickness % Io - Input orientation % Wi - Basis filter i in Fourier space % OUTPUT: % S - Output saliency % % See also: dtvoting...
948fdb398a93897f0458d305627132d340c47e8c488300c14d3bc06f496f7ff5
MATLAB
959
14
function LHS = bemf4_surface_field_lhs(c, Center, Area, contrast, normals, weight, EC) % Computes the left hand side of the charge equation for surface charges % % Copyright SNM 2017-2020 % LHS is the user-defined function of c equal to c - Z_times_c which is % exactly the left-hand side of the matrix equat...
edd6aa61aa505edac6d19cffc3534adfd4c91eebd010256970d2e80c35bfef65
MATLAB
959
23
function [Intensity, Xi, Yi] = h_getLineProfileAtAPoint(Img, pos, angle, width) % Img: a 2D image, i.e. size(Img, 3) == 1. % pos: (x, y), the center position where the line profile is produced. % angle: in degrees defining the angle of the line. % width: in pixels, the length of the line profile. if ~...
a429f252e6eb6940c5a29778218a9a98fb52567e2669f0d76b09879b19ba5cb7
MATLAB
960
38
function [Y, I] = minMax(X, dim) % [Y, I] = minMax(X, dim) % return minimum and maximum values % Inputs: X = vector or matrix of values % DIM = dimension to operate along for min() and max(), can be % integer or 'all'. see 'help min' % % Outputs: Y = multidimensional array of min and max val...
5dc6c5bc7c4dbb73e2062376de8116c298170000f16f0a232fc10713d59da8b0
MATLAB
961
46
function res = grs2rgb_SINGLE(img, map) % Check the arguments if nargin<1 error('grs2rgb:missingImage','Specify the name or the matrix of the image'); end; if ~exist('map','var') || isempty(map) map = parula(1024); end; [l,w] = size(map); if w~=3 error('grs2rgb:wrongColormap','Colormap matrix must contain 3 col...
8e821d648d49d292024d3ae82a8d78141ff15227c610733c402bc549ff698c5f
MATLAB
961
28
function [ImageArray,AVI_Info,FPS]=AVI_Import(FileName) clear depVideoPlayer videoFReader warning on all warning off verbose warning off backtrace warning off AVI_Info=aviinfo(FileName); warning on FPS=AVI_Info.FramesPerSecond; videoFReader = vision.VideoFileReader(FileName)...
ceb3b0b4e55cde59e61af75b2194d0da6d5fa3f33424cd992c0b6496bf39f9a5
MATLAB
961
35
function data=data_norm(data,type) % data: Input multi-channel data matrix. Column-wise. % type: Choose the normalization method (0~5). Default value 4. % 0: L0 normalization; % 1: L1 normalization; % 2: L2 normalization; % 3: L infinity normalization; % 4: Standard normalization; % 5: Maxmin normaliz...
f2c076789b5448c1b7987a708592cb319e6b288a44714a3268612fd37af3ac52
MATLAB
961
34
function count = computeCounts(X, sz) % Count the number of times each combination of discrete assignments occurs % data is ncases-by-nvars % sz(i) : values for variable i are assumed to be in [1:sz(i)] % % Example: to compute a 2x2 contingency table on binary data % use C = computeCounts([X(:) Y(:)]+1, [2 2]); %% % T...
07b95ee34932dd6d9a6c2708e6f122dee184a3e90ecaa700446020d72b3ce77d
MATLAB
962
33
function rsaRes = summary_rsa_results(p) % % - This code is written for summarizing representational similarity analysis. % % called from emotion2020_analysis_BATCH % %% load results for sbjitr = 1:length(p.sbjID) sbjID = p.sbjID{sbjitr}; for scoritr = 1:length(p.scoreTypes) scoreType = p.scoreTyp...
2619a9662983845b5b5902748a8cdadb6c890e8c806da394ef4d1e3ca273bdb4
MATLAB
962
36
function jtree = jtreeSliceCliques(jtree, clamped, doSlice) %% Slice cliques in a jtree according to the sparse evidence vector clamped % You can optionally clamp them instead, (useful for debugging, etc) % This file is from pmtk3.googlecode.com if nargin < 3 doSlice = false; end if doSlice evidenceFn = @t...
477edfb01a94b239589b016e38c67369bd73856cc4c7a52347fc6b1a8265f6b7
MATLAB
962
45
%% Approximate joint density as a product of two marginals % i.e., fit a 2 node disconnedted MRF X1 X2 % Example From % http://en.wikipedia.org/wiki/Iterative_proportional_fitting % This file is from pmtk3.googlecode.com C = [43 9; 44 4]; %C = normalize(C); C1 = sum(C,2); C2 = sum(C, 1); nstates = size(C); p...
591695f6c6d0c4bd8d7eb1d1fe1923e4409a6740dafb6489e900620b43640cf5
MATLAB
962
38
function fn = add_extension(infn, ext) % ADD_EXTENSION Adds an extension to a file if needed (checks if the % requested extension already exists). % % [FN] = ADD_EXTENSION(INFN, EXT) Adds the extension EXT to the filename % INFN if needed (checks if the requested extension EXT already exists at % the end of the...
b9b0d0f2527d2ef8b0e3e7ca74560afdd69dff17d015472aaed85914149ef45b
MATLAB
962
32
function subs = tt_ind2sub(siz,idx) %TT_IND2SUB Multiple subscripts from linear indices. % % SUBS = TT_IND2SUB(SIZ,INDS) returns that subscripts equivalent % to the linear indices in INDS for a tensor of size SIZ. % % See also TT_SUB2IND, IND2SUB. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % ...
65b707f81c19025bf8485cbad27a59e8ccc02d9fbdd2bea3034a3d5055f91cfa
MATLAB
963
39
function colorrgb = GetShade(basecol,endcol,shadeInd,Numshades) if ischar(basecol) basecolor = ColorCode(basecol); else basecolor = basecol; end if ischar(endcol) endcolor = ColorCode(endcol); else endcolor = endcol; end r = linspace(basecolor(1,1), endcolor(1,1), Numshades); g = linspace(basecolor(1,...
78feb8a5e7c3269bb3e170e84ce7e69947c0d24e1efa623c654a8a52bd3f1183
MATLAB
963
34
function N = VBA_spm_mesh_normals(M, unit) % Compute (unit) normals of a surface mesh % FORMAT N = spm_mesh_normals(M) % M - a patch structure or a handle to a patch % unit - boolean to indicate unit normals or not [default: false] % % N - a [Nx3] array of (unit) normals on vertices %_________________...
127d1cbe4e275f702ab8db29d037d813bd16129acfff4361b4abd6455e10eba8
MATLAB
964
30
function new_X = extract(X,idx) %EXTRACT Creates a new ktensor with only the specified components. % % Y = EXTRACT(X,S) selected the subset of components in X as defined by % S. It should be the case that S is a subset of [1,...,NCOMPONENTS(X)]. % % See also KTENSOR, NCOMPONENTS. % %MATLAB Tensor Toolbox. %Copyri...
145fdefce6aa99c9c90b68248a426293710024952fe5fba48bcb9cbd3794a2ba
MATLAB
964
36
function mcrop = matcrop_withpad(m,varargin) subs = varargin; ndim = length(subs); sz = size(m); if sz(1) == 1 && ndim == 1, subs = [1,subs]; ndim = 2; elseif length(sz) ~= ndim, error('size(m) does not match number of input indices'); end mcrop = m; for dim = 1:ndim, if subs{dim}(1) > subs{dim}(2), mcro...
84f8db3511bf4e6626c93515eb3289c17c70d14cd8b09069b0af728fc05cdc85
MATLAB
964
39
function [ normdata ] = bz_NormToRange(data,range,databounds) %[ normdata ] = bz_NormToRange(data,range,databounds) normalizes some data to %fit in some range. % %INPUTS % data the data you want to normalize % range [min max] you would like to normalize it to. % use 'ylim' to normalize to...
85ccdb8fda1efbea2a016b5c12d6c58271ab1581465f60786fa19163bbaba9fd
MATLAB
964
46
%{ _ _ ___ _ __ __ _| |__ ___ ___ _ __| |_ / __| '__/ _` | '_ \/ __|/ _ \| '__| __| | (__| | | (_| | |_) \__ \ (_) | | | |_ \___|_| \__,_|_.__/|___/\___/|_| \__| # NNmakeCheckpointDirs **Syntax** ``` C.NNmakeCheckpointDirs...
de4449685916be4a64b1ce201bfd4da8ecbda5ebdfc080ea71968028bcaf584e
MATLAB
964
37
function S = steer2dtvoting( Is, Io, W0, W2, W4, W6, W8 ) % STEER2DTVOTING Tensor voting for 2D image by using steerable filters. % INPUT: % Is - Input image stickness % Io - Input orientation % Wi - Basis filter i in Fourier space % OUTPUT: % S - Output saliency % % See also: dtvoting...
b1aeae5d66660d39e6467a9ab9f94932e7073d16f2b440a1dae0369960d87435
MATLAB
965
43
function [IDXs,sCl,M,S] = kmeansopt(E,N,type) %E p parameters (cells) by N Events %N number of trials per cluster number %p p-value for cluster validation Ne = size(E,2); %% Covariance matrix if strcmp(type,'var') M = CovarM(E); end %% k-means loop parfor k = 1:N*18 NCl = floor((k-1)/N) + 2; % IDX = kmea...
ba7cd745084a6b3e16d3ccedc1153a67c4d380f33262da125202087c5b56b98b
MATLAB
965
71
clear clc global glm %%%%% SET HYPERPARAMETERS %bin width resolution=2; glm.res=resolution/100; %pulse duration duration=65; %ensure duration can be divided by resolution if(mod(duration,resolution)~=0) duration=duration+1; end glm.pulsedur=duration/100; glm.keep_regression_values=0; % only consider pulse...
da58c8689227fec5d0297f911b3db6c807ab59b48cb9546dc6416c30cc9177d7
MATLAB
965
34
function EMP_Transform_Curvelet(num_) X1 = readtable(strcat('../../Data/VCF/output_0.csv')); X1(:,1) = []; X1(1,:) = []; X = table2array(X1); C = fdct_wrapping(X,1); A = []; for i = 1:length(C) for j = 1:length(C{i}) D = reshape(C{i}{j}, 1, []); A = [A D]; ...
dc6fe181e156f6a80b66afa6fac6941f888d2b2a8cd87e14f12b222e87f1c6e9
MATLAB
965
32
%_______________________________________________________________________ % % generate fixation dot %_______________________________________________________________________ % % Input % % dotInfo | experiment configuration (struct) % screenInfo | canvas configuration (struct) %_________________________________________...
e4686cd2e1130a77798edc67290818acc451129f926eaa7ac290de56dfddcf57
MATLAB
965
26
function phi=if2phase(iflaw) %IF2PHASE Generate the phase from the instantaneous frequency % O. Lemoine - February 1996. % experimental N=length(iflaw); phi=zeros(N,1); %phi=2*pi*cumsum(iflaw); for k=1:N, t=1:k; phi(k)=2*pi*integ(iflaw(t),t); end% This program is free software; you can redistribute it and/or mo...
0f884e25e9a5a01439be15c9ee5e9315a034bec7ca9702e536c9566661e890ef
MATLAB
966
18
function test_roian_bsub_training() if ispc() warning('bsub backend is not supported on Windows, so %s always passes on Windows', mfilename()); return end linux_project_file_path = '/groups/branson/bransonlab/apt/unittest/four-points-testing-2025-04-11-with-rois-added-and-fewer-smaller-avi-movies.lb...
4e6fff540c4e10c2b7ce3294b4664da503d7a6ec20c73e7020e69497bc189ad7
MATLAB
966
44
function [Bhat, r,What,Shat,lambhat] = MakeBhat_data(histfile,Ai,Xzetai,r,b) [TP,n] = size(Xzetai); % loadvars = load(histfile); % load(histfile) %'pars','r0','n','T' if iscell(loadvars.parhist) if ~isempty(b) lambhat = loadvars.parhist{b}(1:n); shat = loadvars.parhist{b}(n+1:end); else lambhat = load...
66e79c9dfaf8b63ce2c69e6e563386c20a891bf8312c4de072aecb125e4c0d3b
MATLAB
966
30
function [imPairOLD] = createImPairOLD(imgPair) %convert imgPair (new format) into imPair (old format), including control %point and mask info, all for imgPair.sections{1,1}. %(old format does not have sections implemented) %unwrap input section = imgPair.sections{1,1}; %extract relevant data from secti...
7327c34b4610785a3876dbb77ef7afa972cad18913e3e035352f8e52848fba12
MATLAB
966
45
function LAN = lan_merge(LAN1, LAN2, ts1, ts2) % Optional : ts1 and ts2 are simultaneous time stamps in LAN1 and LAN2 % respectively (units: sample count, index-1) if nargin < 4 ts1 = 1; ts2 = 1; end LAN = []; if LAN1.srate ~= LAN2.srate disp('lan_merge requires consistent sampling rates'); return; e...
a8a48ec0b62d7b00b06a5dc5c8df04eba79093ff16aac8178c298490cc62c590
MATLAB
966
16
function test_alice_bubble_training() % Test training for alice project linux_project_file_path = '/groups/branson/bransonlab/apt/unittest/alice/multitarget_bubble_expandedbehavior_20180425_allGT_MK_MDN04182019_updated_20250306.lbl' ; [project_file_path, replace_path] = localize_test_project_path(linux_project...
3cebb8e9c55985c92288b4a1887925f24ad609ff1d4d9c8659dc0966fc73b6c6
MATLAB
967
37
function S = steer2dtvoting( Is, Io, W0, W2, W4, W6, W8 ) % STEER2DTVOTING Tensor voting for 2D image by using steerable filters. % INPUT: % Is - Input image stickness % Io - Input orientation % Wi - Basis filter i in Fourier space % OUTPUT: % S - Output saliency % % See also: dtvoting...
b6532b00a25793d37f15bd6356486cb13519d7521435e47bfc026e1930acc910
MATLAB
967
40
%% Compare speed and accuracy of different linregStudent methods %PMTKauthor Yi Huang %% % This file is from pmtk3.googlecode.com requireOptimToolbox seed = 0; setSeed(seed); x = sort(rand(10,1)); y = 1+2*x + rand(size(x))-.5; % add some outliers x = [x' 0.1 0.5 0.9]'; k = -5; y = [y' k k k]'; NUs = [1:2:9 0...
cf1209ce42a1dca8e7cd1c3191adea90880a367c7f5ba1d8fa4d56a551321e29
MATLAB
967
35
% Function that determines orientation selectivity of each neuron in the % grid according to an orientation column typical of non-human primate % visual cortex. % Chengcheng Huang's code: % https://github.com/hcc11/SpatialNeuronNet % https://github.com/hcc11/FI_SpatialNet function theta=ori_map(Nx,Kc) % Formula from ...
d4f1ba7475d6056225c2a35c40b2d5301b0a4692f66a455257808d5b88302227
MATLAB
967
22
classdef (Sealed) AdjMatrixBarabAlbGraph < adjmatrix.AdjMatrixFromNetX methods function this = AdjMatrixBarabAlbGraph(params, loadOnInit, delAfterLoad) % creates a complete graph (mean-field network) % % params {AdjMatrixParams}: params of the adjacency matrix ...
e605d993759d6ac12eb74c08e2252d9246828d4720244b7dbb1a9cb2176a40b3
MATLAB
967
25
function [gx] = g_Hampton(x,P,u,in) % Hampton's "influence learning" model: observation function % function [gx] = f_Hampton(x,P,u,in) % Let P(o=1) be the agent's prediction of the other's next move, ie the % probability that the other will pick the first alternative option. The % "influence learner" bases her decision...
1d5593a47752023dd5044b7fdaa166a853accec51752b71bd06e50e754bd1d50
MATLAB
968
57
% i'm not sure if this is exactly correct, but it is close enough function samples = samplepnoreplace(x,k,w,maxiter) if ~exist('maxiter','var'), maxiter = k; end; maxiter = min(maxiter,k); if isscalar(x), n = x; x = 1:n; else n = length(x); end; if length(w) ~= n, error('length of weights must be equivale...
20c5f89e6ae8d409c7f083aca00c63d31c5c4bf2f87e459c89cc1ca6107603a6
MATLAB
968
38
function [KSmax] = test_ks(x) % % Calculates the CDF (expcdf) %[y_expcdf,x_expcdf]=cdfcalc(x); yCDF = []; xCDF = []; x = x(~isnan(x)); n = length(x); x = sort(x(:)); % Get cumulative sums yCDF = (1:n)' / n; % Remove duplicates; only need final one with total count notdup = ([diff(x(:)); 1] > 0); x_expcd...
3baa8f8e285a599b9e88ba2dba239ba67e170fc4eb117420180df4ad46d5efbd
MATLAB
968
34
% http://en.wikipedia.org/wiki/Multivariate_adaptive_regression_splines figure; hold on; xs = 0:0.1:20; plot(xs, max(0,xs-13), '-', 'linewidth', 3); plot(xs, max(0,13-xs), 'r:', 'linewidth', 3); printPmtkFigure('splineDemoHinge') figure; xs = 0:0.1:20; %f = @(x) 25+6.1*max(0,x-13) -3.1*max(0,13-x); %f = @(x) 25 -4*m...
a9814dcb362b1797941911ed58b2187481a385b4e110c51c67cc8c59a8744236
MATLAB
968
34
function R = randint2( m, n, range ) % Faster but restricted version of randint. % % Generate matrix of uniformly distributed random integers. % R=randint2(m,n,range) generates an m-by-n matrix of random integers % between [range(1), range(2)]. Note that randint is part of the % 'Communications Toolbox' and may not be ...
53dfbdbb9236a5d66b0815572bf148d2cfe55a238289b7150c6ec3738630bfe8
MATLAB
969
38
function [ f, J, H] = rlogistic2( params, x ) %LOGISTICFUN evaluates modified logistic with params at x % Detailed explanation goes here %========================================================================== %define inputs x = x(:); gamma = params(1); beta = params(2); %====================================...
8cbdc8411a6ca9a061332ad8a7b27e8581d912827fa8cdd486ceeb549b32b127
MATLAB
969
43
%% Making Surface Plots From Scatter Data % How do you turn a collection of XYZ triplets into a surface plot? This is % the most frequently asked 3D plotting question that I got when I was in % Tech Support. %% Load the data load seamount who -file seamount %% % The problem is that the data is made up of ...
94ba5d97d1224b77322e9070d7759e3066e58ed6eecdee3e3abc2adf4c80c6d3
MATLAB
969
36
% Reformat ATLAS.mat to make variables easier to port into python. % Also condenses info from ATLAS.mat, atlasinfo.mat, and retains.mat into % same workspace for each parcellation. close all; clearvars; clc %% project repository - atlas folder cd('~/Documents/scripts_postdoc/22June_continuous_normative/continuous_abn...
d19d45cf2060540fd7fca38c85b2d3b33d8c20f945bcb7a458d546fe867ebf29
MATLAB
969
1
% TSSAVEEXPERIMENT Save an experiment from the .mat file % TSSAVEEXPERIMENT(FILENAME) saves the experiment to FILENAME % % See also TSLOADEXPERIMENT, TSEXPORTCODES % Updated: 10/7/2009 by Randy Gallistel function [result] = TSsaveexperiment(filename) result = 0; if evalin('base','isempty(who(''global'',''Experim...
e6e00f765064d0bbf89f76809b732a2153a75bfac46496f7b44c16dd52c1dbbc
MATLAB
969
29
function dragpoints(ax,currCentroid) %can change the marker size or marker type to make it more visible. %Currently is set to small points at a size of 2 so is not very visible. plot(ax,currCentroid(1),currCentroid(2),'rx','LineWidth',2,'hittest','on','buttondownfcn',@clickmarker); ax.XLim = currCentroid(1)+[-50 ...
368059a3010ec5e4700c82f0aec01b7eafcca9db688dcbd3ca6d1bbd4f75a0eb
MATLAB
970
25
function [Depths] = Extract_depth_info(imagename) Depths = zeros(1,2); fid=fopen([imagename,'_Properties.xml'],'r'); % open the file, get file ID XMLdata = fscanf(fid, '%s'); % fgetl(fid); % read the file contents (assume text file). StartDepth = '\w*Origin="(\d+[,|.]?\d*)'; matchStr1= re...
4d52be21753ad23dc56cb9017b1013f4067f23dcc4a579186f42fc2a1d7cab56
MATLAB
970
27
function [ ] = computeESSBrain( ws ) %compute effective sample size for each voxel in the brain %write message to screen sprintf('Computing voxels'' effective sample sizes. This may take a few minutes') %create ESS matrix ESS_mat = nan(size(ws.images.relevant_voxels,1),3); for voxel_num = 1:1:size(ws.images.relevan...
6c8bbacf197069d48aa6d67cc91197fbe7f23d3b6b3acb0f8d1f680764a47166
MATLAB
970
32
function p = ang2pix(ang, screen_dim, screen_res, view_dist, angle_type) % function p = ang2pix(ang, screen_dim, screen_res, view_dist, angle_type) % % ang = visual angle in degrees % p = pixel distance in pixels % angle_type = 'central' or 'radial'. defaults to central. % % view_dist = viewing distance in preferred u...
895b4d6d6d9a54145a9a1fec7ddca4ccdb8470c40ffc760f36fb9a771f971c3c
MATLAB
970
33
function sz = tsize(a,idx) %TSIZE Tensor size of tenmat. % % D = TSIZE(X) returns the size of the tensor being stored as a % matrix. % % M = TSIZE(X,DIM) returns the length of the dimension(s) specified % by DIM. For example, SIZE(X,1) returns the size of the first % dimension of the tensor. % % See also...
8e0559d1d6761c9ac8a7861a198b334d46df76b62eb5f1dbfdaa20bce09eb718
MATLAB
970
34
classdef (Abstract = true) AdjMatrix < handle % base class for every adjacency matrix properties (Access = protected) Params; Matrix; end methods function this = AdjMatrix(params, matrix) % params {AdjMatrixParams}: parameters of the required adjacency ...
ce2af02deaf1351afd3f8c044404017e0713416a4f3ab226c5fde0aaf69b661b
MATLAB
970
36
function wlPlot_plotInphaseQuadrature(cfg, times, wave_i, wave_q, ... figtitle, filelabel) % function wlPlot_plotInphaseQuadrature(cfg, times, wave_i, wave_q, ... % figtitle, filelabel) % % This function plots two time-series waveforms, labeled as the in-phase and % quadrature portions of a signal. % % "cfg" conta...
d34d368c09e47ed91baf5ff432dce918916608427f6b78b999dddd68d4c78d25
MATLAB
970
24
% classdef CBIG_MFMem_rfMRI_run_1000_simulation_testGrp_resLow_ut_test < matlab.unittest.TestCase % % Written by Peng Wang and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md % % methods (Test) % % function Test(testCase) % % % m...
024ede068a880a10d8d869c316695485b10074ce3090f49000c0b3fc709d9c8a
MATLAB
971
35
function opts = mergeOptions(opts1, opts2) % Merges two options structures with one having precedence over the other. % % function opts = mergeOptions(opts1, opts2) % % input: opts1 and opts2 are two structures. % output: opts is a structure containing all fields of opts1 and opts2. % Whenever a field is present...
0a17761a7ccb03e432c93a4414394740050c70cf8fe5a252b140bf52ef6da0e8
MATLAB
971
52
function visualizeAudio(y,name,Fs) % Syntax: visualizeAudio(y,name); % visualizeAudio(y,name,Fs); % Constants WINDOW_MS = 40; % Spectrogram window width, in ms Y_PAD = 0.05; % Ampitude (y-axis) padding % Parse inputs if ~exist('Fs','var') || isempty(Fs) % Default sampling rat...
13ae143facf7d34e62836a1274294b8084cec2ca98da2b0f939bebf89cae0638
MATLAB
971
45
function N = nunique(X, dim) % Efficiently count the unique elements of X along the specified dimension % Like length(unique(X(:, j)) or length(unique(X(i, :)) but vectorized. % Supports multidimensional arrays, e.g. nunique(X, 3). % % % Example: %X = % 5 4 3 3 2 1 4 % 2 1 1 ...
2955c7b42ffb0bc9c42ba1466712afbc43a628c37333afd0ba8cc9774b69f5ef
MATLAB
971
52
%%%%%This package written by robert wilson, freely available at % https://github.com/d-r-b-o-b/UsefulMatlabFunctions%% function [ax, hb, wb, ax2] = easy_gridOfEqualFigures(hg, wg, fignum) % gridOfEqualFigures.m % ax = gridOfEqualFigures(hg, wg, fignum) % Robert Wilson % 23-Mar-2010 hb = (ones(length(hg)-1,1)-s...
ab29484878ef0632e7ae3f2cbded439b2131fcdc4a301b88f95365c446b5cfe3
MATLAB
971
49
function [FRout,Lout,NTrials,NTimeBins,NUnits]=CollapseNeuralData(FR,L) % Collapses neural data output by Analyze.getNeuralData from NTrials x % NTimebins x Nunits -> NTimebins*NTrials x Nunits % useful for dimensionality reduction etx if~iscell(FR) FR={FR}; if nargin>1 L={L}; end ...
1a7c7207c6f55500384a47e54cb4e2da366d6651fa3c25dbfe97d206a554e92f
MATLAB
972
37
%% Get Face Divergence Operator % % Returns the divergence in either two or three dimensions. % % D = getFaceDivMatrix(h1,h2,h3); % % Where D is the divergence operator and h# = [d1 d2 ... dn]'; where d is % the size of each cell. % % % No boundary conditions are applied/needed. % % % Rowan Cockett % 04-May-2012 ...
1d3d2912ca4da63395977b2f1d7be968b90f567c997d372f78b660a8544f2f4a
MATLAB
972
45
function pcs = ezpca(X, varargin) %EZPCA PCA -- quick and easy! % Usage: % pcs = ezpca(X) % % Args: % X: N x D data % % Notes: % Project: (X - pcs.mu) * pcs.coeff % Reconstruct: (pcs.score * pcs.coeff') + pcs.mu % % See also: pca [coeff, score, latent, tsquared, explained, mu] = pca(X, varargin{:}); if ...
bc4358c47a41608b95fa943265a88b3a153ece8bc0305458ab18c88c4b722067
MATLAB
972
32
function [xlim,ylim,zlim] = h_getLimits3(handles) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); siz = currentStruct.image.data.size; dispAxes = get(handles.viewingAxisControl,'Value'); switch dispAxes case {1} viewingAxis = 3; case {2} viewing...
e5b5e2253be00ad88ad56510ba5258b673dd8f8c3ba3879ec184d215c0cc6386
MATLAB
972
30
function s = spmatrix(a) %SPMATRIX Converts a two-way sparse tensor to sparse matrix. % % SPMATRIX(X) converts a sparse tensor to a sparse matrix. The sparse % tensor must be two-dimensional. % % See also SPTENSOR, SPTENSOR/RESHAPE, SPTENMAT % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This i...
fa38c4bab08e4abec7c3e41bee6a666a45cde7347b89e33f22a481c707a545cd
MATLAB
972
27
%----------------------------------------------------------------------------------------- % Peri-stimulus time histograms for odor-modulated neurons compared to other neurons % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 5d % Author: Marcel Kehl % License: MIT Li...
179d6add45759bf3b7f850f24ca4d6e5cb5469586896bb0a7de055bee2f9b448
MATLAB
973
25
function r = VBA_spm_gamrnd(a,b,varargin) % Random arrays from gamma distribution - a compiled routine % FORMAT r = spm_gamrnd(a,b,m,n,...) % % a - shape parameter % b - scale parameter % m,n,... - dimensions of the output array [optional] % % r - array of random numbers chosen from the gamma dist...
52e8a6553f3c3336a447c3d8b91cb9ea462349d21e78bf707d1988d1a27f42cb
MATLAB
973
25
function candoit = canGetPartialGradient(problem) % Checks whether the partial gradient can be computed for a given problem. % % function candoit = canGetPartialGradient(problem) % % Returns true if the partial gradient of the cost function can be computed % given the problem description, false otherwise. % % ...
b3f65305033c5115ebb847967c453dff7f340a162049b4a640dde7716182362e
MATLAB
973
33
function t = subsasgn(t,s,b) %SUBSASGN Subscripted assignment for tenmat. % % Examples % X = tenmat(rand(3,4,2),1); % X(1:2,1:2) = ones(2,2); <-- Calls SUBSASGN % % See also TENMAT, TENMAT/SUBSREF. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kol...
0cdd9a48a249306b4b7b3dd7e789ef09f32d5c829f89ce2880711511510af442
MATLAB
974
46
function should_stop = loadNextUnsortedFile(self) if self.verbosity > 9 disp(mfilename) end self.saveData; should_stop = false; [~,~,ext] = fileparts(self.file_name); allfiles = dir([self.path_name '*' ext]); n_files = length(allfiles); this_file_seq = self.getFileSequence; allfiles = circshift(allfiles,-this_fil...