sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c8f0ac9eab5760640846da1d32fc4da10ff7552cee6f49dd5d4b8cfec96942d4
MATLAB
1,167
47
% mglIsFile.m % % usage: mglIsFile(filename) % by: justin gardner % date: 08/20/03 % e.g.: mglIsFile('filename') % purpose: function to check whether file exists % Note meta characters like "?", "*", or "~user" are not recognized but "~/" can be used for filename. % function [is...
489a9ce0859fc9266edfbe5478eed2838698699e1c59e82649b5697c3958e508
MATLAB
1,168
38
function confMat = confMatGet(desiredOutput, computedOutput) %confMatGet: Get confusion matrix from recognition results % % Usage: % confMat = confMatGet(desiredOutput, computedOutput) % % Description: % confMatGet(desiredOutput, computedOutput) returns the confusion matrix of a given classifier based on % its desir...
da53aad60407c26b48ecacaa11823502edb5a3efb6fd01d79d757bdfc0729867
MATLAB
1,168
44
function [slope,intercept] = find_slopeintercept_phasevstime_fast(dataPhase,TEs) % [slope,intercept] = find_slopeintercept_phasevstime_fast(dataPhase,TEs) %% Author: Xu Li % Affiliation: Radiology @ JHU % Email address: xuli@mri.jhu.edu % updated 2015-04, X.L. % updated 2017-02, X.L. % updated 2021, X.L. dim = ndims(d...
a1244ef4bceac5967569b2a4c6dd468bb4bbc2de279e67906f75638ee2bd6c17
MATLAB
1,169
44
% Create unit test data for comparison between matlab and Python addpath('./matlab') fprintf('MATLAB version\n') [stauts, data_path] = system('python -c "import mne; print(mne.datasets.testing.data_path(), end=str())"') fname = strcat(data_path, '/MEG', '/sample', '/sample_audvis_trunc_raw.fif'); raw = fiff_setup...
f253840bd3c1ffa4a4d675a84b3619499277abc063b9b46a3412f29ff806e700
MATLAB
1,172
43
function gabor = gaborArrayParametrized(sigma, wavelength, orient_chosen) % Bounding box halfLength = 17; xmax = halfLength; xmin = -halfLength; ymax = halfLength; ymin = -halfLength; [x,y] = meshgrid(xmin:xmax,ymin:ymax); %init gabor(numel(orient_chosen)).filter = []; %loop on angles %for oriIndex = 1 : divTheta...
62b4eaa7dbb0e69feba3a76ca8381d98597193e69e73392499761fa2d76942ca
MATLAB
1,173
48
%% Circular Graph Examples % Copyright 2016 The MathWorks, Inc. %% 1. Adjacency matrix of 1s and 0s % Create an example adjacency matrix made up of ones and zeros. rng(0); x = rand(50); thresh = 0.93; x(x > thresh) = 1; x(x <= thresh) = 0; %% % Call CIRCULARGRAPH with only the adjacency matrix as an argu...
63f13deaf39e594a3d2c2848366ede6fe607debf6990b175036ebfc13af1cd0e
MATLAB
1,174
40
function node = gennode(num,root,conn,pos,type,misc) % node = gennode(num,root,conn,pos,type,misc) % % Function to create a node struct (branch point of blood vessels). Nodes % are arranged as a structure array with fields: % % node.num - identifying number % node.root - root node, if it exists (0 is n...
2951a5be7c320ef9b76eb83d9f5fbe1bfcb0c03385692b52e2d18fdac12aff7e
MATLAB
1,175
47
function c = InvProbV2Cons(x,Imat_t,tn,ni,nh,no,msteam_st_t,mfg_st_t,Tsteam_in_st_t,Tfg_in_st_t,cpfg_st_t,cpsteam_st_t,delta,data) wh = reshape(x(1:ni*nh),[ni,nh]); wo = reshape(x(ni*nh+1:ni*nh+nh*no),[nh,no]); bh = (x(ni*nh+nh*no+1:ni*nh+nh*no+nh))'; bo = (x(ni*nh+nh*no+nh+1:ni*nh+nh*no+nh+no))'; y_r = reshape(...
a72493daabe2a05529cd5171a0d6b73e506dbbcaa61eedd352f7882508f0aaac
MATLAB
1,175
39
function [L,dL,ddL] = neglogpost_GLM(wts,hprs,mstruct) % [L,dL,ddL] = neglogpost_GLM(wts,hprs,mstruct) % % Compute negative log-posterior of data under GLM regression model, % plus gradient and Hessian % % INPUTS: % wts [m x 1] - regression weights % hprs [p x 1] - hyper-parameters for prior % mstruct - model ...
19b32f4e0ad6dcf54f7f0fd550647d1b7bc10193669be3ce534e18cb987bf9db
MATLAB
1,176
1
function Dif = CalcDif(Data, StepSize) % StepSize MUST be > 0 % This function calculates the (approx.) derivative of the vector *Data*. % % Alignment issues: % The function returns a vector (Dif) that is aligned with the input vector (Data). % This means that the i-th index of Dif is the value of the derivative %...
1b20b3eb60e8ff83feb9531af9aaf89023b49f2804f3b3e975cf36cb88bc69b0
MATLAB
1,176
17
% Helper functions for FMAToolbox. % % Parameter testing. % % isstring - Test if parameter is an (admissible) character string. % isdscalar - Test if parameter is a scalar (double) satisfying an optional list of tests. % isdvector - Test if parameter is a vector of doubles sat...
69bca3b3c29ad67f580efacc67d09a621cfcf50f3951d0b433a6937481ac3324
MATLAB
1,176
41
% ITERATIVE_OUTLIER_REMOVAL - Removal of outliers in a vector based on an iterative sigma threshold approach. Only finds % the number of removals and the threshold. % % Usage: % >> [n_remove, threshold] = iterative_outlier_removal(data_vector,sd_level,sd_level_increase); % % Required Inputs: % data_vector ...
a801807599b1612c92cd97f1b92b777fa011f8a287b948a6a1328328356f2251
MATLAB
1,176
34
function C=clustering_coef_wd(W) %CLUSTERING_COEF_WD Clustering coefficient % % C = clustering_coef_wd(W); % % The weighted clustering coefficient is the average "intensity" of % triangles around a node. % % Input: W, weighted directed connection matrix % % Output: C, clustering coeffi...
c3baa39cdc1fb045fe6c3f3dfb2592a172003bd565660e48a03c87117a2e91c8
MATLAB
1,176
12
ops.target = ''; % target .smr file to use ops.method = 'mountainSort'; % ['plexon' or 'mountainSort'] What method did you use to sort spikes? ops.chanNum = 8 ; % What chan # were the waveforms extracted from? ops.chanName = {'epthys', 'e...
f7ac9f4b3f67b48ff64b96b27eeaa81aa545c2747ade366b395fa3aa7148f4e7
MATLAB
1,176
51
function typeName = TDMS_getDataTypeName(dataType) %TDMS_getDataTypeName Returns a string indicating dataType % % Given a Labview numeric datatype value, this returns a string % % typeName = TDMS_getDataTypeName(dataType) switch dataType case 0 typeName = 'void'; case 1 typeName...
219d72ae9291e63bad3c105503e4aea71bab4859a655ea01e37070f3f316e955
MATLAB
1,177
41
function[output]=shuffled_event_classifier(starts,bin,param,ds_events,nshuf) %% SET UP ends=zeros(1,length(starts))+bin; timepoints=[starts;ends]; %% sp_shuffled=nan(length(ds_events),size(timepoints,2),nshuf); spm_shuffled=nan(length(ds_events),size(timepoints,2),nshuf); for d = 1:length(ds_events) for t = 1...
abc7a2558768ee4842201902322453b997c61c6074026938eae455c1cd085367
MATLAB
1,177
27
clear file=dir('ACC*reverse*.mat'); for jj=1:5 load(file(jj).name) n=length(outcome);n1=fix(n*0.15);n2=fix(n*0.50); go{1}=[find(outcome(1:n1,1)==1);find(outcome(1:n1,1)==2);]; go{2}=[find(outcome(n1+1:n2,1)==1);find(outcome(n1+1:n2,1)==2)]+n1; go{3}=[find(outcome(n2+1:end,1)==1);find(outcome(...
4530f5fdccad55b833239dace89d1b523e578ebe9d7050f42af5218d8c763078
MATLAB
1,178
49
% % Compute a network statistic using Matlab. % % PARAMETERS % $network % $statistic % % INPUT % dat/data.$NETWORK.mat % dat/info.$NETWORK % dat/meansi.$NETWORK.mat % % OUTPUT % dat/statistic.$STATISTIC.$NETWORK % Text file with one number per line, the first being the statistic % itself and the other lines bei...
99a765c3658a0a1b0cd8ca2148cff41db61efe442aabf6c88c604d4615daa704
MATLAB
1,178
37
% VL_SVMPEGASOS [deprecated] % VL_SVMPEGASOS is deprecated. Please use VL_SVMTRAIN() instead. function [w b info] = vl_svmpegasos(DATA,LAMBDA, varargin) % Verbose not supported if (sum(strcmpi('Verbose',varargin))) varargin(find(strcmpi('Verbose',varargin),1))=[]; fprintf('Option VERBOSE is no longer suppor...
9fec02a9b1ec5863962a305c87a77f58224dd75561ae6d23e2ae79801dc45e57
MATLAB
1,178
45
% mglTestMetalDots: an automated and/or interactive test for rendering. % % usage: mglTestMetalDots(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test rendering various sizes and shapes of vectorized do...
bccb79fe16f5c85806cb3be146d0eeed74f9ad7c6c9773b5733a35c68c467587
MATLAB
1,178
35
function [strings, perm] = vl_alphanum(strings) % VL_ALPHANUM Sort strings using the Alphanum algorithm % STRINGS = VL_ALPHANUM(STRINGS) sorts the cell array of strings % STRINGS by using the Alphanum algorithm [1]. [STRINGS,PERM] = % VL_ALPHANUM(...) returns the corresponding permutation PERM as % well. % % ...
34be9a4905ed5c660c457f7311b6f4e56f1b822f26d895d6c2d9a4c2357e1479
MATLAB
1,179
38
% Author: Zachary Chiang, Buenrostro Lab, Harvard University % Given an in situ signal matrix, finds the closest matching ex situ UMI % using a probablistic approach function[match_ind match_val hamming_dist close_umis] = match_spot(curr_umi,umis,intensity_mat,hamming_thresh) % fill out Hamming distance matrix ...
8549bcd474288eb5c4d2bf1ea36a7d81eb7ef5e195cc9bcd5478a27d3b3857b4
MATLAB
1,179
33
function projected_test = test_classification(TestBatch,G_prime) % projects the test set and to the discriminant space using projection % matrix, and returns the projected test data. % % PROJECTED_TEST = TEST_CLASSIFICATION(TESTBATCH,G_PRIME) gets the test set % TESTBATCH and projection matrices G_PRIME and return...
aa43ba06ca9652ccafcb5fec00a24fd3116d50e77ff2711772e4a92c2ceb9861
MATLAB
1,179
41
% mglTestMetalRepeatingFlicker: an automated and/or interactive test for rendering. % % usage: mglTestMetalRepeatingFlicker(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test random clear colors repeate...
cbc80837387004c45ff3c793792318697116d00a5556d10b20225251545637ea
MATLAB
1,179
20
%% construct the JS-based individual morphological WM networks based on the preprocessed structural images %% required toolbox: SPM12 path = pwd; % extract the voxel-vise signal within the roi gretna_Vol_ROI_signal('Z:\Data\HCP1200_T1\path_anat_mri.txt', 'mwp2',... [path '\Template.txt'], 'JHU-WhiteMatter-labels_...
cc1e3ac49245dd1994e379396ee67888669ae0991dfd48550d00fc1a19a35cbe
MATLAB
1,180
46
function [A xy] = cycle_graph(n,varargin) % CYCLE_GRAPH Generate the cycle graph of order n % % The cycle graph is a simple cycle with n vertices. % % [A xy] = cycle_graph(n) generates a cycle graph with n vertices and % returns the adjacency matrix in A. The matrix xy stores two-dimensional % coordinates for each ve...
d180006d21bdede10d402512ae1b4b1cb79b4ad1dadc7867361e8832ed62f6b3
MATLAB
1,182
65
<<<<<<< HEAD function [EER, EERlow, EERhigh] = computeEER_classic(FAR,FRR) % calcolo le posizioni di confine t1 = min(find(FRR<=FAR)); t2 = max(find(FRR>=FAR)); % Controllo la combinazioni che da errore complessivo inferiore if (FRR(t1) + FAR(t1)) <= (FRR(t2) + FAR(t2)) EERlow = FRR(t1); EERhigh = FAR(t1); el...
f354d4651a8766231bcb34f74ef11a3a4a70daf31b39b960ba9e211f54165d5c
MATLAB
1,182
44
function handle = ternary_outlines(handle, varargin) %ternary_outlines creates a standard triangle-plot to add to an axes % % Accepts VARARGIN as forward to customized plot settings. This function % uses the convention of 0->1 plotting range %% Check Inputs % Check if handle is given if (na...
1286f66b10de6d1ff6af3f4b61ad0269c31d77306a88421fec179ece4ea37705
MATLAB
1,183
72
function x=my_resize(x, map_size) % x=do_resize_cpu_only(x, map_size); x=do_resize_with_gpu(x, map_size); end function x=do_resize_cpu_only(x, map_size) map_size=double(map_size); assert(length(map_size)==2); x_size=[size(x,1) size(x,2)]; if all(x_size==map_size) return; end if isa(x, 'gpuArray') x=gpuAr...
1ee0274041b037c662d1677ea8f6d38ca536628fdd57c5e32f931ff9de997f2a
MATLAB
1,183
43
function [scanner_ss,count_scanner,count_processed] = sweetspot(scanner,processed,th_index) %load(name) %Define range,number of FD thresholds FD = [0.01:0.01:0.5]; nth = length(FD); th = FD(th_index); %threshold for FD_processed to determine remaining time n_vol = length(scanner);%Determine paramters of input varible...
87f99cf0ea99cf30fda107f541724f0da328f5754ded8ea4644a75e80e5481c5
MATLAB
1,183
23
function lim = serverLimits() % Limits and rules the client checks before sending, mirroring the server % % function lim = webupload.serverLimits() % % Purpose % maxZipBytes is max_zip_size from the shared contract (tests/web/upload_contract.json, copied % here as upload_core/tests/upload_co...
a621adbad6642dce9af2ad2c2bd776b8892ce7e8367c8880d8c796dc59d85b1e
MATLAB
1,183
47
function squareIdx = getIndividualSquareROIIndices(pths, prfParams, roiType, hemi) squareLoc = []; useStimFlag = true; offset = 0.41; % deg tmp = strsplit(roiType,'_'); nrSquares = str2double(tmp{1}(regexp(tmp{1},'[0-9]'))); sqArea = tmp{2}(regexp(tmp{2},'[0-9]')); if strcmp(sqArea,'2') relativeSize = 'sma...
0379423f6d39e50e5e0a7a1a801601f0dfe684e6a7ff663081279f70be3a5b68
MATLAB
1,184
36
function uid = root(tree) % XMLTREE/ROOT Root Method % FORMAT uid = root(tree) % % tree - XMLTree object % uid - UID of the root element of tree %__________________________________________________________________________ % % Return the uid of the root element of the tree. %________________________________________...
40c08adb99b3e87033614198a91f43ac9b24b1b2432db0bc6a7fd5fe07d69700
MATLAB
1,185
47
function [CIJ] = makeringlatticeCIJ(N,K) %MAKERINGLATTICECIJ Synthetic lattice network % % CIJ = makeringlatticeCIJ(N,K); % % This function generates a directed lattice network with toroidal % boundary counditions (i.e. with ring-like "wrapping around"). % % Inputs: N, number of vertices % ...
5419c24c8b42a2fa727151c5e4dad5ae1d47b859a2101e92810976bb2452d46f
MATLAB
1,185
29
function [folders, folder_count] = getfolders() %get the experimental folders one by one as the user selects them folders = {}; folder_count = 0; start_path = ''; while true folder_name = uigetdir(start_path, 'Select Experiment Folder') if folder_name == 0 break else ...
bfabff67b53bda414835cb755e4ae6aa1314f61726e80d8983dfdb896cd69df0
MATLAB
1,185
43
% getInterpPad.m % % Function that returns padding at the beginning or end of a vector. % Padding is generated by cubic spline interpolation % % INPUTS: % vec - vector to pad % padLen - length of padding, in samples % padSide - which side to pad, 'start' or 'end' % % OUTPUTS: % pad - vector for calculated paddi...
a5818699356b00324bb7593a3c23ec18c387297b0517af18d71f4b6a4e86b9c6
MATLAB
1,186
36
function tree = delete(tree,uid) % XMLTREE/DELETE Delete (delete a subtree given its UID) % % tree - XMLTree object % uid - array of UID's of subtrees to be deleted %__________________________________________________________________________ % % Delete a subtree given its UID % The tree parameter must be in ...
d329ca59f89c4d5e1b32bb1022d13058b91d4a968e1c63d5de87ec2065f05fa7
MATLAB
1,186
34
function T=transitivity_wd(W) %TRANSITIVITY_WD Transitivity % % T = transitivity_wd(W); % % Transitivity is the ratio of 'triangles to triplets' in the network. % (A classical version of the clustering coefficient). % % Input: W weighted directed connection matrix % % Output: T transit...
d33b85358d96f8a445d43546c5de0f974b600d56e628a8df85044afcb8cc6437
MATLAB
1,186
42
clear addpath(genpath('.')) addpath(genpath(fullfile('..','ANE'))) global result; global resultString; global resultSpikes; %% dir_parent=fullfile('..','data','data_TENASPIS','added_refined_masks'); list_Exp_ID={'Mouse_1K', 'Mouse_2K', 'Mouse_3K', 'Mouse_4K', ... 'Mouse_1M', 'Mouse_2M', 'Mouse_3M', 'Mo...
3fb361e96305feca80984358c0e28503ab885e2bd1c4c5466669fe666f3d19cb
MATLAB
1,187
44
function [ftest_all, numFeatures] = ... featExtrGaborAdapt(imagesCellTest, PalmNet, bestWavelets, param, numImagesTest, stepPrint, numCoresFeatExtr) %one iteration to get size and init ftest = Gabor_FeaExt(imagesCellTest(1), PalmNet, bestWavelets, param); numFeatures = size(ftest,1); %init feature matrix ftest_all...
340d1f6ac6d0e30b8c214b5f226bd071d27bb7931e376f0659beb0ca0e115194
MATLAB
1,188
34
function [params, s_new] = denoise_fica_tanh(params, s, state) % FastICA tanh nonlinearity as DSS denoising function % [params, s_new] = denoise_fica_tanh(params, s, state) % params Function specific modifiable parameters % a Scaling constant (default: 1) % state DSS algorithm state % s ...
292a9861b9e56be91387ae44affe450042bb885f0aab819eb2f2175f0c892ebe
MATLAB
1,189
27
function [I_ramp,tRamp] = makeRampInput(timeStep,tRise,tFall,tsRise,tsFall,maxRamp) % MAKERAMPINPUT make a scalar exponential rising ramp and fall % [I,T] = MAKERAMPINPUT(timeSTEP,tRISE,tFALL,tsRISE,tsFALL,MAX) % computes an exponentially rising and falling ramp I, on time-base T, % defined by: % timeSTEP: duration...
b4863b41973bdee60f9c32d8a381097cef454baeaa86e87c838358ea46552dc3
MATLAB
1,189
43
function f = vl_lbpfliplr(f) % VL_LBPFLIPLR Flip LBP features left-right % F = VL_LBPFLIPLR(F) flips the LBP features F from left to % right. % % Example:: % The following instructions return results almost identical % assuming that the width of I is exactly divisible by the cell % size: % F = ...
f41be806b084d8e0feede65b901af93bd929a05d5179e6757f7d40e1b6334acc
MATLAB
1,189
31
function [new_t_mus, new_y] = ml_alg_ds_bandpassed_signal(t_mus, y, bandpass_freqs) % Resample to have equal sampling intervals dt_mus = median(diff(t_mus)); interp_slice_t_mus = t_mus(1):dt_mus:t_mus(end); interp_slice_csc = interp1(t_mus, y, interp_slice_t_mus); % New sampling rate in Hz ...
6d8edcab337b227b6eec5b0964879226232815f30585bedf859efd6c401ff57a
MATLAB
1,190
27
%% From wrapper parc_folder=['/group_shares/FAIR_LAB2/Projects/ADHD_HCP_biomarkers/experiments/model_based/' parcellation]; addpath(genpath('/group_shares/FAIR_LAB/Staff/Oscar/matlab_code/')); %% Connectotyping settings options.params.cutoff=1; options.params.lags=0; options.params.autocorrelation=0; options.params.c...
85d479d69f3a4e4670054f5cf5741af030fa49f01fa5945914e15f302726e149
MATLAB
1,191
39
function P=participation_coef(W,Ci) %PARTICIPATION_COEF Participation coefficient % % P = participation_coef(W,Ci); % % Participation coefficient is a measure of diversity of intermodular % connections of individual nodes. % % Inputs: W, binary/weighted, directed/undirected connection matrix % ...
01e272d2be57eee2b54e755ee01abe2a658de9d6e465ffee0a6fb719cf375eaa
MATLAB
1,192
34
function [dat] = ft_preproc_rectify(dat) % FT_PREPROC_RECTIFY rectifies the data, i.e. converts all samples with a % negative value into the similar magnitude positive value % % Use as % [dat] = ft_preproc_rectify(dat) % where % dat data matrix (Nchans X Ntime) % % See also PREPROC % Copyright (C) 2008, Ro...
3c91709b7a44998744fce892eb8cb4a14df827eee3894137cd7aeb8aa17005d6
MATLAB
1,192
45
function [amplitude, phase, freq, fitTrace, r2] = fit_sineWave(data, samplerate, freq) % set up thing to fit segLength = length(data); segTime = (1:segLength)/samplerate; % if no frequency given, estimate if ~exist('freq', 'var') Y = fft(data(~isnan(data))); P2 = abs(Y/segLength); powerTrace = P2(1...
3f72f6a7d87f295c0d8ac3651bcd2c40ac49c1570a22a1499be0f85e5d86f24a
MATLAB
1,192
28
% efficient color labeling algrithm, the imput image should be in the range % of [0,1] function [im_lbl, nColorHist] = colorLabeling(im, tBins) nColorHist = tBins * tBins * tBins; % total number of bins in a color channel % % split three channels from a color image % c1 = im(:,:,1); % c2 = im(:,:,2); % c3 = im(...
49d135eb55b0db4479c54d0ef59257612215e93a1115edb7df5d3044215c0818
MATLAB
1,193
27
clear file=dir('ACC*uncertain*.mat'); for jj=1:6 load(file(jj).name) n=length(outcome);n1=fix(n*0.33);n2=fix(n*0.67); go{1}=[find(outcome(1:n1,1)==1);find(outcome(1:n1,1)==2);find(outcome(1:n1,1)==5)]; go{2}=[find(outcome(n1+1:n2,1)==1);find(outcome(n1+1:n2,1)==2);find(outcome(n1+1:n2,1)==5)]+n1; ...
53ca279c9dabe38d8114f9807bd9786adf1ea8ca411ffd28a0176e3b4aa0859b
MATLAB
1,193
33
function val = littleendian; % LITTLEENDIAN returns 1 (true) on a little endian machine, e.g. with an % Intel or AMD, or 0 (false) otherwise % % Example % if (littleendian) % % do something, e.g. swap some bytes % end % % See also BIGENDIAN, SWAPBYTES, TYPECAST % Copyrigth (C) 2007, Robert Oostenveld % % Thi...
49f507f545639f88ebc89d9ac427149718ad6f19fe1bcdc2eeea1364b3762966
MATLAB
1,194
43
% getLinProj.m % % Helper function to get linear projection of multiple variables onto % defined axis. Like PCA, but specify coefficients % Mean subtracts each variable but does not otherwise normalize values % across different variables % % INPUTS: % varVals - matrix of size numSamps x numVars for sample values ...
0188e4998552a24359927b378a1a8e2e14199df8a12e110a39ecf79306da9ff2
MATLAB
1,196
40
function [] = layoutConverter (phase) w = waitbar(1,'Converting format - Please wait...'); % waitbar for i = 3:length(phase) waitbar((i-2)/(length(phase)-2)) cd(phase(i).name); d = dir; if length(d)-2 == 120 m = MEA120_lookuptable; elseif length(d)-2 == 152...
bbb66a8172fe1a7f89ae05d0c6efe7e85bf0e5423889445f477bc0bd786074cd
MATLAB
1,196
37
function trk = fix_GetPartOfTrack(trk,f0,f1,trajfns) % returns a subset of the input trx structure, from frame f0 to f1 % does not copy all fields -- convert_units must be re-run on the output track % splintered from fixerrorsgui 6/21/12 JAB if nargin < 4, trajfns = {'x','y','a','b','theta'}; end i0 = trk.off+(f0);...
83cd54f5c23e3b13adcdefe72163ca4e71514b2df0aaf85eb777631863bfad7c
MATLAB
1,197
39
function imdb = setupFMD(datasetDir, varargin) % SETUPSCENE67 Setup Flickr Material Dataset % This is similar to SETUPCALTECH101(), with modifications to setup % the Flickr Material Dataset accroding to the standard % evaluation protocols. % % See: SETUPCALTECH101(). % Author: Andrea Vedaldi % Copyrigh...
8445a9d09aec43189058337f6bca0e209699a944725d6a4cdc75a07cb7987ee9
MATLAB
1,197
33
function val = bigendian; % BIGENDIAN returns 1 (true) on a big endian machine, e.g. with a SUN Sparc % or Apple G4 processor, or 0 (false) otherwise % % Example % if (bigendian) % % do something, e.g. swap some bytes % end % % See also LITTLEENDIAN, SWAPBYTES, TYPECAST % Copyrigth (C) 2007, Robert Oostenvel...
97c0012a3fd520bd95ed32877f40c8be07405f68023bbc9cd5b6b4c0a5343463
MATLAB
1,197
69
function [P1_xx,P1_xy,P1_xo,P2_xx,P2_xy,P2_xo,PE1_xx,PE1_xy,PE1_xo,PE2_xx,PE2_xy,PE2_xo]= predictive_coding_local_global(n, SP, s0, s1, s2); % Input: % n: number of tones in a squence % SP: [SPxx, SPxy, SPxo] e.q. [4/6 1/6 1/6] % Output: % P1_xx= P1 in xx sequence %% Check if sum(SP) ~=1 disp('The s...
3eb8565300713fd416da9b7b363f36aa7950c8634f7b43f1b4f9469780b7f954
MATLAB
1,198
35
function vid = setupvideo_new2019(pos) % make sure that there are no other connection to other video input imaqreset; % Videoinput makes sure that the connection between PC and camera exists. vid(1) = videoinput('winvideo',1,'MJPG_1280x1024'); vid(2) = videoinput('winvideo',2,'MJPG_1280x1024'); % Set up t...
82a0d92ad506b1ba65d476712fbde68d4c7c4a37e6637400f73ae5d296dd815e
MATLAB
1,198
22
% This make.m is for MATLAB and OCTAVE under Windows, Mac, and Unix function make() try % This part is for OCTAVE if(exist('OCTAVE_VERSION', 'builtin')) mex libsvmread.c mex libsvmwrite.c mex -I.. train.c linear_model_matlab.c ../linear.cpp ../tron.cpp ../blas/daxpy.c ../blas/ddot.c ../blas/dnrm2.c ../blas/dsca...
ffe352a271f38bf00495f7b73a2c5be424d5e622c6dfcce86a7dfe63277389c3
MATLAB
1,198
28
function chi_res = MEDI_sweep(deltaB, Params, DPWeight, maskErode, lambda, merit, edgePer, outputFile) % Do lambda sweep search for MEDI % Calculate curverture and save intemedia results % Using maximum curverture to determine the best lambda lambda = sort(lambda); % change to assending order Nlambda = l...
9764f3d428512461f17bd914df452f037c5d77557940c85d9d9ebba91e2502db
MATLAB
1,199
43
function hs = HaltonSequence(n,b) % Function to generates the first n numbers in Halton's low % discrepancy sequence with base b % % hs = HaltonSequence(n,b) % % Inputs: n - the length of the vector to generate % b - the base of the sequence % % Notes: This code focuses on details of the implementation of the %...
c2e1d513da498de894bceaa0df6f2640db0e1f0ceea068dc7207d601e4186673
MATLAB
1,200
64
function vl_demo % VL_DEMO Run VLFeat demos % VL_DEMO runs all VLFeat demos in a row, exporting figures for % the documentation. Edit this file to see a list of the vailable % demos, or look into the toolbox/demo directory. % Author: Andrea Vedaldi % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % A...
e5d9087da7c85a8cab0ed45e88bdd08324bd01fad7f867e16fd41333f4fe9bf6
MATLAB
1,200
51
function dt = mapType(dtype) %MAPTYPE % converts dtype name to type name. If struct, then returns a struct of mapped types % all this does is narrow the possible range of names per type. if isempty(dtype) || (ischar(dtype) && any(strcmpi({'None', 'any'}, dtype))) dt = 'any'; return; end if iscell(dtype) ...
fc276935b177d18541497e0d75e2127cd1635f62c43e8f734d1e984f080c1e00
MATLAB
1,200
47
% mglTestPoints3: an automated and/or interactive test for rendering. % % usage: mglTestPoints3(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test rendering some points. % usage: % % Yo...
980fde833e8386bfc9f6d6fdcb9f419027b8722a3178364c62fd7b5ca28b3963
MATLAB
1,201
38
% Author: Zachary Chiang, Buenrostro Lab, Harvard University % Apply an offset in x, y, and z calculated using simple_offset_xyz.m function[stackCr] = simple_offset_xyz_applied(stackC,offsets) % pre-set output stackCr = uint16(zeros(size(stackC))); % get offsets xoffset = offsets(1); yof...
cb7300c842ff2640b9240e3ff54f6993f4a72f2675bce41e0a843b0a8fbf2042
MATLAB
1,201
28
function [generated_image, linear_bresenham_image] = generate_binary_image_from_centerline(K, image_size, dilation_size) % given the centerline and the image size, this function creates a % image that looks like the original worm linear_bresenham_image = false(image_size(1)*image_size(2),1); f...
f27921493aa13d1e78a9e690b5b13dab48eaba2eb9c2b460e5305d0bb95df6e4
MATLAB
1,201
49
function Boris_spikeAnalysis(ephysdata, struct, thresh) %temp %thresh = 120; % Prep & params window = [20 40]; % manual spike time extraction putitive_spikes = ephysdata > thresh; rc = size(putitive_spikes); RC = rc(1) * rc(2); spikeVec = reshape(putitive_spikes', 1,RC); % create spike window for j = 1:length(spike...
06d951a7e2c2187a045a28145b1977ca9c2b265faf18459b5dcec94598d51a94
MATLAB
1,202
44
function handles = LoadDataList_cluster(DataListFile, handles) % %% Author: Xu Li % Affiliation: Radiology @ JHU - Kirby Center % Contact via xuli@mri.jhu.edu % cluster version % Open file [PathName, FileName,FileExt] = fileparts(DataListFile); % Something? if(FileName ~= 0) S = load(fullfile(PathName, [FileName...
fa17025921bac42c7ce56975cd2409d604fd4ac8faace1508ebb5982c71cc6c0
MATLAB
1,202
30
% VL_UBCMATCH Match SIFT features % MATCHES = VL_UBCMATCH(DESCR1, DESCR2) matches the two sets of SIFT % descriptors DESCR1 and DESCR2. % % [MATCHES,SCORES] = VL_UBCMATCH(DESCR1, DESCR2) retuns the matches and % also the squared Euclidean distance between the matches. % % The function uses the algorithm sugg...
7edea12c73c57028fe7d93e894414abc5d8daf70786193231dc5841916f3c257
MATLAB
1,204
49
function plot_profile(DATA,ROI,AddInfo) % PLOT_PROFILE - Plot profile % (this is an Aedes plugin) % % Synopsis: % % Description: % % Examples: % % See also: % % This function is a part of Aedes - A graphical tool for analyzing % medical images % % Copyright (C) 2006 Juha-Pekka Niskanen <Juha-Pekka.Niskanen@uku.fi>...
2033e0661e2220280d3373a6b0704246af785ae6087ecf5c0ca1e22509835ff4
MATLAB
1,205
42
function output = TDMS_initData(dataType,nSamples) %TDMS_initData Initializes raw data arrays % % output = TDMS_initData(dataType,nSamples) % % dataType - Labview datatype % nSamples - # of samples to initialize to % % See Also: TDMS_getDataTypeName switch dataType case 1 output = zeros(1,nSampl...
a423893615721cfd6f6fc4949cbc9b08487b1987abe88ba8ecb65b94bdc478ab
MATLAB
1,205
39
function crc = neuralynx_crc(dat, dim) % NEURALYNX_CRC computes a cyclic redundancy check % % Use as % crc = neuralynx_crc(dat) % % Note that the CRC is computed along the first dimension. % Copyright (C) 2007, Robert Oostenveld % % This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip % for t...
91dcb8f7b95024949617481fa2d7eab9653a740c786c1edda71d2589699cbc8b
MATLAB
1,206
40
% mglFlushAndWait.m % % $Id:$ % usage: mglFlushAndWait() % by: justin gardner % date: 10/13/11 % purpose: Normally mglFlush waits till the vertical blank and so you will only refresh once % every video frame. But with some video cards, notably ATI Radeon HD 5xxx series, % ...
9fda8371d0f57ab6756f5e8aa3aee0db5ab87d90f301a39bfb8fa64d6ea4abd8
MATLAB
1,206
39
%% Create labels labels{1,1} = 'Ant_Commissure'; labels{1,2} = 'Ant_Thalamic_Projections'; labels{1,3} = 'Ant_Segment_Arcuate'; labels{1,4} = 'Long_Segment_Arcuate'; labels{1,5} = 'Post_Segment_Arcuate'; labels{1,6} = 'Cingulum'; labels{1,7} = 'Cingulum_Ant'; labels{1,8} = 'Cingulum_Post'; labels{1,9} = 'C...
2711a561b4ad91adbe51d0cc1a2d0b44c222588b1e3e8f9c43aace266b4f4440
MATLAB
1,207
41
function BX = temporalBases_dense(X, bases, indices, addDC) % Computes the convolution of X with the selected bases functions. % It cannot do partial time indices. Use it for trial-based computation. % % Each row of X marks events, and with corresponding bases selected by indices, % it is convolved to the feature matri...
8b94bc660ad19acdd68a5c1d5bac104852624ff2656e90665ceb6dca68839b8a
MATLAB
1,207
38
function exportWorkspace( obj ) % EXPORTWORKSPACE Saves workspace % % Syntax: % EXPORTWORKSPACE( obj ); % % Input parameters: % * obj - object containg data % % Example: % EXPORTWORKSPACE( ); % % Available at: https://github.com/NCN-Lab/DBScope % For referencing, please use: Andreia M. Oliveira, Eduardo Carvalho...
b9c59ebe09df020dca295344f2f1855df0e0053cfc1f7d3aeaca856e8cfd8e96
MATLAB
1,208
35
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ // // mglSecs.m // mglMetal // // Created by justin gardner on 1/5/20. // Copyright © 2020 GRU. All rights reserved. // //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ #import "mglSecs.h" #include <mach/mach.h> #include <mach/mach_time.h> @impl...
e80f3bdb85f47435bbffe4413843a945675208ada4eb4471c07eb89083d9237f
MATLAB
1,208
43
function [C,Grad]=iRSHARP_SpaWeight(data,Params, Wrapcount) % [C,Grad]=iRSHARP_SpaWeight(data,Params, Wrapcount) % Author: Xu Li % Affiliation: Radiology @ JHU % Email address: xuli@mri.jhu.edu % % Calculating the iRSHARP spatial weight % Gaussian kernel Kwin = 5; % window size, cubic khsize = floor(...
7911e36fd87ffb05398ca540e6e58ac8667400d53a89cc4459c9886d6f99c663
MATLAB
1,209
31
addpath('../funcs'); Delta_e_start = 0; % cannot equal to 0 Delta_e_end = 0.5; % can equal to 0.5 Delta_e_steps = 200; Delta_i_start = 0; % cannot equal to 0 Delta_i_end = 0.05; % can equal to 0.05 Delta_i_steps = 200; Iattn = 0.02; alltime = 4000; % container psdPeaksSheet = zeros(Delta_e_steps, Delta_i_steps, 16...
79c4cca5fe13fac2a359ddb9724f24a416a9f2bf64adc37a0bf756108aedca57
MATLAB
1,209
37
function [params, s_new] = denoise_fica_gauss(params, s, state) % FastICA gauss nonlinearity as DSS denoising function % [params, s_new] = denoise_fica_gauss(params, s, state) % params Function specific modifiable parameters % params.a Scale constant (default: 1) % state DSS algorithm state % s ...
8830f9312809be147509b3532ccbf74c66abb48e61b6c3a05407a820b0a44b63
MATLAB
1,209
26
% Semi-automatically label neurons from the Tenaspis dataset. %% Initial manual drawing % Use an initial drawing GUI to draw masks by looking at % either the frame-by-frame video or the summary images. Manual_Labeling_data_TENASPIS % Merge repeated drawings belonging to the same neuron. merge_masks_after_manual_data_T...
5db453c689c0526350ade1dfefecfa939aa90ddf2454720ed231df0fa784488d
MATLAB
1,210
44
% VL_DEMO_QUICKSHIFT Demo: Quick shift: basic functionality pfx = fullfile(vl_root,'figures','demo') ; randn('state',0) ; rand('state',0) ; figure(1) ; clf ; % -------------------------------------------------------------------- % Load a figure % ---------------...
77ab5abcde98d503570b2892c1b852be29a91b40e36ec4f3e3bf09de03382255
MATLAB
1,210
40
function [RandWatson] = randWatson(N, mu, k) % This function generates the random samples from Watson distribution. The % formula and algorithm of the generation process is descrbed in % SphereDistributionRand.pdf. % % Usage: % [RandWatson] = randWatson(N, mu, k); % % Inputs: % N: The number of samples one wants to...
8bec93378ce7ea6552f7de7199c55a6145ababdc5034212b3c46aa060d61adfc
MATLAB
1,210
43
% % Generate an assortativity plot. % % PARAMETERS % d (n*1) Degree vector % A (n*m) Unweighted adjacency / biadjacency matrix; does % not contain edge weights, but may contain other % values than 0/1 when there are multiple edges % letter Determines the color % text (string) The word "degree" or similar in lower c...
e4afa84abbd35dc2d5c3958cf2c6cc44741a3c87ff1d383236e89f98b8ba0e8a
MATLAB
1,210
41
function [aAngle, ax, ay] = ml_alg_placemap_center_out_angle(mapA, PLACEFIELD_PERCENTILE_THRESHOLD) if isempty(PLACEFIELD_PERCENTILE_THRESHOLD) PLACEFIELD_PERCENTILE_THRESHOLD = 95; end ax = nan; ay = nan; % Some maps can be all zeros or all nan or empty, so check if all(mapA =...
72ec45ff677da73d28c0992d88db4065ae3235d0a2fc6ce31bc23195a5e38ba1
MATLAB
1,211
28
function [sptitle]=make_title(param,bin_size) if strcmp(param.stat,'avg') if strcmp(param.type,'before') b=num2str(100-param.be(1)); bsize=num2str(param.be(2)); exthresh=param.exthresh; sptitle={[bsize,' frame bins, ',b,' frames before onset'],['bin size = ',num2str(bin_size),' ...
76965fa6fe516bd498fa1488836448b9eede82065650074df2c6edaeddbcde0a
MATLAB
1,211
30
function W = threshold_proportional(W, p) %THRESHOLD_PROPORTIONAL Proportional thresholding % % W_thr = threshold_proportional(W, p); % % This function "thresholds" the connectivity matrix by preserving a % proportion p (0<p<1) of the strongest weights. All other weights, and % all weights on the main diago...
9f1090e1a6628da2ae53396e82ed5f5c0b5bcce3c9d7406f5bba404a701bc7e6
MATLAB
1,211
40
% produce MePD output calculation on beta2 x Kp space clearvars; clc; addpath("C:/Users/kn356/OneDrive - University of Exeter/Desktop/StandardMATLAB") load("colour.mat") addpath("C:/Users/kn356/OneDrive - University of Exeter/Desktop/StandardMATLAB/MePD") load("par.mat") par.d=0.05; p1 = [0 , 7]; p2 = [0, 1]...
a1bf4dc2970cf5cfa08955277d5d5a9b55a05f1a4e38068cf28cb8767ed2b6d9
MATLAB
1,211
41
function ROIStruct = nifti2roi(fname) %Converts a nifti file to a .roi -file for aedes % Assumes areas of same value = roi colorarray = [1 0 0; 0 1 0; 0 0 1; 1 1 0; 1 0 1; 0 1 1; 1 0.5 0; 1 0 0.5; 1 0.5 0.5; 0 0.5 1; 0.5 0.5 1]; colorarray = round(255*[colorarray; colororder]); fig = aedes_read_nifti(fname); roi_v...
b94680e4536664422f2509c749db240b00f88601e7bd6d75e59dfed75dd64f8e
MATLAB
1,211
42
%% TEMPORAL RECONSTRUCTION for 36 maps GICA3 clearvars -except results pcadata % Define paths maskPath = '/boundarymask.mat'; indPCAMusPath = fullfile(pcadata, 'boundarymask_Mus_indPCA.mat'); indPCANonMusPath = fullfile(pcadata, 'boundarymask_NonMus_indPCA.mat'); groupPCAPath = fullfile(pcadata, 'segmentBoundary_combi...
dcfba0fe9759c8ecf289ada56fc57652277fbfa0a2705bc203b47f432460a46f
MATLAB
1,211
68
% % For one network, scatter plot of degree vs local clustering coefficient. % % PARAMETERS % $network % % INPUT FILES % dat/cluscod.$network.mat % uni/out.$network % % OUTPUT FILES % plot/degcc.{a}.$network.eps % network = getenv('network'); consts = konect_consts(); weights = read_statistic('weights', network...
6aecc7125341732043a23e820073082d33dcd8c97d1fbaf81164297a094f7d92
MATLAB
1,212
32
function DM = ft_preproc_online_downsample_init(factor) % function DM = ft_preproc_online_downsample_init(factor) % % Initialize an downsampling model with the given factor. % Copyright (C) 2010, Stefan Klanke % % This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip % for the documentation and ...
6c95e9e978e8609db57c8a3f5c18c2e241e33634c2e9d10a21404ee2f4e10369
MATLAB
1,213
56
function Q = qGetQ( R ) % qGetQ: converts 3x3 rotation matrix into equivalent quaternion % Q = qGetQ( R ); [r,c] = size( R ); if( r ~= 3 | c ~= 3 ) fprintf( 'R must be a 3x3 matrix\n\r' ); return; end % [ Rxx, Rxy, Rxz ] = R(1,1:3); % [ Ryx, Ryy, Ryz ] = R(2,1:3); % [ Rzx, Rzy, Rzz ] = R(3,1:3); ...
9cf10a5336069ae02c1d8d5ee7c5dc55dddc605ac8ae49ec20a3dbd416c435f8
MATLAB
1,214
52
function [t] = randVMFMeanDir(N, k, p) % This function generate random samples from the tangent direction of von % Mises-Fisher distribution using rejection sampling. The density of is % described in VMFMeanDirDensity function. See the % SphereDistributionsRand.pdf file for detail description and formulas. % % Usage: ...
2578097c4f36fcf6e98efc9f9fe27c3ef4b7b873e521e061599f36628c437a3d
MATLAB
1,215
39
function [T] = ml_util_pfstats_struct_to_table(pfStats) % This code converts the pfStats structure into a table. It has to % first be loaded to memory. numCells = length(pfStats); % All of the fields fieldNames = fields(pfStats); % The t filenames are not in an array of 1xtrials like the othe...
34c3bb1bb0b207d446ecbaa244d33536bd443db9486a8e48ce733ffefde80eea
MATLAB
1,215
46
% replaceValuesOutsideThresholdBound.m % % REPLACEVALUESOUTSIDETHRESOLDBOUNDS replaces all values that are above or % below a threshold with the last preceding value that was within the % allow threshold bounds % % INPUT: % data - 1 dimentional array to be processed % threshold - number that defines the +/- th...
4e4057c54fd6bce49b2d7c6fb20913f195257162e116d9fe32da1f0d88b859b8
MATLAB
1,215
43
% calculatedRandomization.m % % usage: calculatedRandomization() % by: eric dewitt % date: 10/28/2009 % purpose: function that decides order of parameters, % function retval = calculatedRandomization(parameter,previousParamIndexes) %%%%%%%%%%%%%%%%%%%%%% % do init %%%%%%%%%%%%%%%%%%%%%% if nargi...
59aef83039aec065b5abc1bb639e751d01bda6fcc68c64f87de742e460d87662
MATLAB
1,215
31
% VL_IMSMOOTH Smooth image % J = VL_IMSMOOTH(I,SIGMA) convolves the image I by an isotropic % Gaussian kernel of standard deviation SIGMA. I must be an array % of doubles. IF the array is three dimensional, the third dimension % is assumed to span different channels (e.g. R,G,B). In this case, % each channe...
736f468a6395f25d20a1f2d09ff4a18c6be47d372912557f1d6081ac99b83dff
MATLAB
1,215
73
% % Draw Zipf plots. This is the transpose of the BIDD plot, i.e., of % the cumulative degree distribution. % % PARAMETERS % $network % % INPUT % dat/data.$network.mat % % OUTPUT % plot/zipf.[auv].$network.dat % a - total % u,v - Row/column based (only BIP and ASYM) % network = getenv('network'); data = load...
722fb7344e9da37f74e254ce6e31e63d8ade112940c87386c54f80d1f029244a
MATLAB
1,217
40
function []= plot_vector_similarity (ds_unit_angles,ds_within_angles) figure(90) utils.set_figure(20) hold on bar([1,2,3],[mean(ds_unit_angles(1,:),'omitnan'),mean(ds_unit_angles(3,:),'omitnan'),mean(ds_unit_angles(2,:),'omitnan')],'FaceColor','w','EdgeColor','k') for i = 1:12 plot ([1 2 3],[ds_unit_angles(1,i),...