sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d21273e0a1cd6509f276b71da73db6c07fe29d0c50912625a3be54ee0ff7c1f5
MATLAB
772
30
% plot of EP updates for the TrueSkill model psi = inline('normpdf(x)./normcdf(x)'); lambda = inline('(normpdf(x)./normcdf(x)).*( (normpdf(x)./normcdf(x)) + x)'); xs = -6:0.1:6; figure; plot(xs, psi(xs), '-', 'linewidth', 3) h=title(sprintf('%s function', '\Psi')); set(h, 'fontsize', 15) printPmtkFigure('PsiWin') ...
717440b1b9dcba24f1360da49e9982009e6f62899dbb5913809408c20695013f
MATLAB
773
29
function img = cell_with_nucleus_plot(name, cell_mask, cell_nucleus_mask, cell_channel); % Show cell and nucleus Segmentation projection cell_zp = cmp_z_proj(cell_mask); cell_nucleus_zp = cmp_z_proj(cell_nucleus_mask); % cell_nucleus_zp = imfill(cell_nucleus_zp > 0, 'holes'); % cell_channel = stack_con...
7f398b5d3fcd201f48ad170d90e4f7235ba44d9755f0874cf4f7b83e154cbf4f
MATLAB
773
28
function Y = clfDecTreeFwd( clf, X ) % Apply the decision tree to data X. % % USAGE % Y = clfDecTreeFwd( clf, X ) % % INPUTS % clf - trained model % X - nxp data array % % OUTPUTS % Y - nx1 vector of labels predicted according to the clf % % EXAMPLE % % See also CLFDECTREE % % Piotr's Image&Video To...
1a59229c47ebdfe60607a2b75a85f36030ef1fae22c356d765b5da52b7e32256
MATLAB
774
27
function [prevNodes] = treeOrderNodes(adj, root) % Compute node ordering, parents before children, in a rooted directed tree. % This is a breadth first search of the tree. % This corresponds to the top-down pass. % The bottom-up pass is simply the reverse order. % Based on code by Erik Sudderth if nargin < 2, root = ...
cf59d8d3cc5a275b8e51b32f079f6b069426e908ef14079c44897905b6f630cd
MATLAB
774
17
function [PkRtsBySes,FinFrstDiffs] = SesBySesPkRates(Cums,LVs) ns = size(LVs,2); % # of sessions PkRtsBySes = nan(ns,4); % initializing output for c = 1:ns % stepping through the sessions CSdr = Cums(LVs(:,c),3); CSdr = CSdr(end) - CSdr(1); % cum duration of CS during session ITIdr = Cums(LVs(:,c),5); I...
e25ef244a62558d456e759485864a774674b7c86bd13cd8f3d6a584f6df58838
MATLAB
774
23
function varargout = setChildColorToMatchParent(child,parent) %setChildColorToMatchParent Sets color of child to match parent's color. % setChildColorToMatchParent(child,parent) matches the child's % BackgroundColor property to the parent's color. The parent may be a % figure, uipanel, or uicontainer. The child i...
c3285fae605d403b65b3e6b68d9dbcc6167d1b62ecd9d427ea9238764675eb41
MATLAB
775
28
function [phi,theta] = sphCoord(Coord3D) % [phi,theta] = sphCoord(Coord3D) % % This function transforms spherical 3D XYZ spherical coordinates to 2D % (theta,phi) spherical coordinates. % % Input % Coord3D: Data Matrix with the spherical XYZ coordinates at the first % three columns respectively. % % Output ...
d0a266f0881d0d23335a08319b47c5ee152ae4fca55fd51c72b28c691bd71574
MATLAB
775
22
%----------------------------------------------------------------------------------------- % Plot multimodal banana neuron % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 5g % Author: Marcel Kehl % License: MIT License %----------------------------------------------...
2abf57f64a9a99e656889188f58a649a8aa5b108e558b0f593a25d8214d1930e
MATLAB
776
24
function n = ndims(t) %NDIMS Number of dimensions of a sparse tensor. % % NDIMS(T) returns the number of dimensions of sparse tensor T. % % Examples: % T = sptenrand([3 2 2],5); % ndims(T) %<-- should return 3 % % See also SPTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is ...
34493b019cd6a5cb0bff0c78a670a5f6b1bc3f63684617ac2242fc229c57c1a0
MATLAB
776
26
function ... [measLength_in_preExM_um, ... measLength_NaN_in_preExM_um, ... RMSerror_in_preExM_um] = ... export_measurementError_XY( ... measResults, ... pixelWidthExpanded, ... expFactor) preExM_pixel_to_um_ratio = pixelWidthExpanded / expFactor; %%% Assumes that the input images are size...
e62d40d65332b69f4b807a40a8b45392afdd3ff5c6592e15955a44e2e103a89f
MATLAB
776
21
function [rrmat, stats, QCFC, QCFCed]=plot_distance_QC(fc,motion,distances); %% Plot correlation coefficient-QC vs edge distance Nsubjs=size(fc,3); Nroi=size(fc,1); rr=zeros(Nroi*Nroi,1); connectivitydata=reshape(fc,[],Nsubjs);%fc-X-subjs rr=corr(connectivitydata',motion,'type','Pearson'); [rr p]=corr(connec...
f453698e5b1d21276ef829a0acff95885fc08fc92effda6b3a3f4d17ac1e2b4d
MATLAB
776
21
function C = ldivide(A,B) %LDIVIDE Array right division for sparse tensors. % % LDIVIDE(A,B) is called for the syntax 'A .\ B' when A or B is a sparse % tensor. A and B must have the same size, unless one is a scalar. % % See also SPTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This i...
002291b1811fa28041c04abfc5b12cdf1e2826efa33fa598471aee43541675a3
MATLAB
777
40
%%%% a5 normalized on mean before injury(4 times) %%%% a6 mean normalized for all mice a=b1; a3=a(1:4,:) a4=nanmean(a3) a5=[]; a7=size(a) for i=1:a7(2) a5(:,i)= a(:,i)/a4(1,i); end a6=nanmean(a5') before = a5(1:4, :); before=before(:); after1=a5(5, :); after1=after1'; after = a5(5:end, :); after=after(:); figure pl...
0ff73959bcd5edebe67bedde4ff5db4102e6c7fdfaeb91e819a2ef8e74b3afdd
MATLAB
777
22
function trxGraphicParams=cookTrxGraphicParams(trxGraphicParamsRaw) trxGraphicParams=cookMarkerParams(trxGraphicParamsRaw); if isfield(trxGraphicParamsRaw,'colormap') && ~isempty(trxGraphicParamsRaw.colormap) trxGraphicParams.colormap = trxGraphicParamsRaw.colormap; else trxGraphicParams.colormap = 'jet'; end if...
1c32f4828ae2a3f4fe2c0f12f56ed8e117c2f8dffd9ad766c7368a59f7af633f
MATLAB
777
28
function traj = UnitTraj(unit, var, dt, varargin) if length(varargin) > 0 taskName = varargin{1}; else taskName = 'RL'; end taskIdx = find(cellfun(@(t) strcmp(lower(taskName), lower(t)), unit.taskList)); t1 = unit.taskStart(taskIdx); t2 = unit.taskEnd(taskIdx); spkTimes = unit.spkTimes; spkTimes = spkTimes(sp...
7b8565beece2c9a6f13589284fcc263b7a1bf4c14060b986663385d0141d6085
MATLAB
777
23
function [nodeBel, edgeBel, logZ] = mrf2InferNodesAndEdges(model, clamped) % Compute node and edge marginals, and log partition function % clamped is an optional 1*D vector, where % clamped(i) = 0 means node i is not observed % and clamped(i) = k means node is clamped to state k % This file is from pmtk3.googlecode.co...
90283f3030621e09de1d0c9e3af85a4282df285750ad93a044dcdb9f6e27ef7e
MATLAB
777
21
% Pipeline_Z_Control_AssignationsHistogram NumClusters = som_dim(1)*som_dim(2) ; % Simuliamo i dati dei cluster per ogni soggetto e misura ripetuta. % I cluster sono rappresentati da numeri interi da 1 a NumClusters. data = randi(NumClusters, numSubjects, NumRest); % Inizializziamo un array per memorizzare i...
f0858e993b7ef520844f67cdb7fc00e2213c2c64b6cc9e903ab7a012f92651fb
MATLAB
777
32
function [v] = ind2subv(siz,ndx) %IND2SUB Multiple subscripts from linear index. % IND2SUBV is used to determine the equivalent subscript values % corresponding to a given single index into an array. % % [V] = IND2SUBV(SIZ,IND) returns the array V containing the % equivalent subscripts corresponding to the inde...
0b56644ee5f537b152519cff3cfab63cb12d5c31380f4169b7cd0de3ed89899c
MATLAB
778
35
function idxval = do_ft_calcFindThresholdIndex(dbval, dblist) % function idxval = do_ft_calcFindThresholdIndex(dbval, dblist) % % This function looks up the threshold array index corresponding to a given % threshold dB value. The array is sorted in ascending order. % % "dbval" is the dB value to look up. % "dblist" is...
6a3bb0a717d83def6bbc6bf543469273f4102bc6fbf772beb074b588fa85cf4f
MATLAB
778
21
function t = ones(t) %ONES Replace nonzero elements of sparse tensor with ones. % % S = ONES(T) generates a sparse tensor with the same sparsity % structure as T, but with ones in the nonzero position. % % See also SPTENSOR, SPONES. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MAT...
8b5d9113a41c16fe8ae0a67e119fcaeebad2f2efb7ade2e8713b323b836a83a4
MATLAB
778
30
function pool_load (parameter, path, group1, group2, group1_label, group2_label) % path = 'E:\GAD67 results\Recordings\'; % parameter = 'pair_corr'; %group1 = 'dff.dfftot.pyr'; %group2 = 'dff.dfftot.int'; % group1_label = 'pyr'; % group2_label = 'int'; files = dir(path); fileNames = {files.name}; fileIsDir = {files.i...
d021326c3e3fd41e902c05f99af33d18c1ebb32402e07590814474b189cc7150
MATLAB
778
26
basepath = 'D:\app_ps1\data\hpc04\hpc04_day09_220221_094101'; basename = basenameFromBasepath(basepath); epoch = [7268.332 7800.357]; % epoch to remove in seconds % locate lfp file fileName = fullfile(basepath,[basename,'.lfp']); % use dir to get size of dat file in bytes filenamestruct = dir(fileName); dataTypeNByte...
eb12e51e4dd05485b032005351bec7e55582cd56d836558f35e93abaaab4c038
MATLAB
778
40
%{ _ _ ___ _ __ __ _| |__ ___ ___ _ __| |_ / __| '__/ _` | '_ \/ __|/ _ \| '__| __| | (__| | | (_| | |_) \__ \ (_) | | | |_ \___|_| \__,_|_.__/|___/\___/|_| \__| ### showFullTrace(self,~,~) **Syntax** ``` showFullTrace(sel...
086011eec15ab001eb1a6cd597ebc5546d914ec6202e1a7c1fd6d2a1a4675ec9
MATLAB
779
38
function err_shape = error_depth(param_dist,xcn,xpn,R,T,X_shape,ind); X_new = depth_compute(xcn,xpn,[param_dist],R,T); N_pt_calib = size(xcn,2); % UnNormalized shape extraction: X_shape2 = X_new; X_shape2 = X_shape2 - (X_shape2(:,1)*ones(1,N_pt_calib)); % map the second vector at [1;0;0]: omu = -cross([1;0;0],...
0b81342d09398e080c195e070afe2bad94356b58d039fa3e79680249f1dfcf76
MATLAB
779
23
function [Fout, J] = calcGaussianActivationsGrating(params, xvals) %UNTITLED Summary of this function goes here % Detailed explanation goes here %========================================================================== spfreq = xvals(:, 1); ori = xvals(:, 2); %==================================================...
61313dc7f8d1a1467be468ae09030cc9d7b055beb811d3b23b459efdcade08dc
MATLAB
779
35
function [pvals, clustMass, clustIdx, rawP] = clusterMassOneSampZ(x,varargin) [nShuff, nTP] = size(x); dat = x(1,:); shuff = x(2:end,:); z = ( dat - mean(shuff,1) ) ./ std(shuff,[],1); mask = abs(z) > 1.96; rawP = 1-normcdf(z); [clustIdx, ~, clustMass] = getClust(mask,z); nIter = nShuff-1; nullMass = n...
7cac0726ae0c22340aa139fdc634c6509b2a46353b608376218a295977748633
MATLAB
779
34
function params = rotateFixCoords(params, rotation) % rotation = pi/4; fixCoords = params.display.fixCoords; center = params.display.numPixels/2; for i = 1:numel(fixCoords) coords = fixCoords{i}; nCoords = size(coords,2); coordsRot = zeros(size(coords)); coords0 = coords - repmat(center',1,nCoor...
f65f266e2bb2a9a312c62d878402113c6e72ca6b22d00586ad779a3e8d031054
MATLAB
779
48
function dip=ran_dip(center,radius,ndip,type,bias); [n1,m1]=size(center); if m1==3 & n1==1 center=center'; end if nargin==5 [n1,m1]=size(bias); if m1==3 & n1==1 bias=bias'; end center_b=center+bias; else center_b=center; end if type=='cart' diploc=[]; f...
025b79f551072af898cb9b9495e13b1369be9c974a7da1ec4b61bd3dd3bdd063
MATLAB
780
25
function sqnorm = multisqnorm(A) % Returns the squared Frobenius norms of the slices of a 3D matrix. % % function sqnorm = multisqnorm(A) % % Given a 3-dimensional matrix A of size n-by-m-by-N, returns a column % vector of length N such that sqnorm(i) = norm(A(:, :, i), 'fro')^2. % % See also: multiprod multitr...
0a619b60237ced58095b31df2d513eeb1e333178fd7519cb600579766324be6f
MATLAB
780
30
function v = generate_main_variables() %Retrieves the variables for modelling and analyses % Environment parameters v.env.dx_sq = 100; v.env.dy_sq = 100; v.env.dx_rct = 173; v.env.dy_rct = 100; v.env.bin_size = 9.1; v.env.Nx_sq = round(v.env.dx_sq/v.env.bin_size); v.env.Ny_sq = round(v.env.dy_sq/v.env.bin_size); v.en...
1e09728c2d2c0d86d042409b01bd055d8e4996e6a9b9fd7a0de0f195c6ff13d4
MATLAB
780
23
function bf10 = t2smpbf(t,nx,ny,r) % % bf10 = t2smpbf(t,n,[r=0.707]) % % Calculates JZS Bayes Factor for a two-sample t-test given t and sample sizes nx and ny. % The optional input r is the scale factor which defaults to 0.707. % This quantifies the evidence in favour of the alternative hypothesis. % See Rouder et al...
37bacea9ea504567584de75560cabd257911d26ba14b5c4f5ef9254cdbc8a710
MATLAB
780
41
function [locs_n,inds]=select_chans(locs,nin) % usage [locs_n,inds]=select_chans(locs,nin) % selects a sparse subset of locations, such % the selected locations are as equally distributed as % possible % % input: % locs: locations of sensors (2D or 3D), each row is the location of one sensor % nin: number of desire...
3cd24657c75928aebc122babde20fe55c9309bea8505ecf088349721311cce61
MATLAB
780
30
function stage_normalization() loadParameters; %Save the loadParameters into the output director in case we need to do %later debugging copyfile('loadParameters.m',fullfile(params.normalizedImagesDir,... sprintf('loadParameters.m.log-%s',date))) [ret,messages] = check_files_in_normalization...
9ea99de6484ec25bea6c9547ce5be099b7aa146067b50ed261cad4c8c4d780ba
MATLAB
780
28
function sigstring= HumanOdorRep_get_sig_string(p) % function to get significance stars depending on provided p value %----------------------------------------------------------------------------------------- % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Author: Marcel Kehl ...
d3e4247e7c76963bd4b0ea35437975ed3aefb3f8e3aea6e20029f5df39a656be
MATLAB
780
25
function spkDat = CleanClusters(spkDat, cleanDat, errCriterion, varargin) clustList = arrayfun(@(x) x.id, cleanDat); for i = 1:2:length(varargin) switch varargin{i} case 'clust' clustList = varargin{i+1}; otherwise disp('invalid optional argument passed to CleanClusters') ...
e17028f654f897f05aa12232919d4f46da7afa94625effd82e466c9543f562b2
MATLAB
780
22
%----------------------------------------------------------------------------------------- % Plot multimodal licorice neuron % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 5h % Author: Marcel Kehl % License: MIT License %--------------------------------------------...
86f2c4b2344be3a9489858245f58fcf5e0672c8b92899e2e1cab285e1d9989c6
MATLAB
781
31
function [p,U2]=watsons_U2_approx_p(A1,A2) % % [p,U2]=watsons_U2_approx_p(A1,A2) % % Computes approximate p values for a given value of U2, a statistic % relating to the differences in distribution between two samples of % circular data. This function uses the approximation suggested by Watson % (1961). % % Inputs: % A...
8b51871e3983525a36134c2b25b041785042d79b1bf505c758685c508768c937
MATLAB
781
29
addpath(genpath('/home/kristin/software/videoIO')); %vw = avifile('test.avi'); vw = videoWriter('writertest.avi', ... 'width',320, 'height',240, 'codec','xvid'); hfig = 1; figure(hfig); clf; set(1,'visible','off'); img = imread('peppers.png'); [nr,nc,three] = size(img); h = fspecial('motion',10,5)...
9cf3274621f41899cf96b70bbfd1084fb1b3056b57a25f1b9c44d83f06e26035
MATLAB
781
25
%% Rosenbrock 2D demo %PMTKneedsOptimToolbox fminunc %% % This file is from pmtk3.googlecode.com requireOptimToolbox; xstart = [-1 2]; % basic usage with anonymous function and numerical derivatives [x fval exitflag output] = fminunc(@(X) (1-X(1))^2 + 100*(X(2)-X(1)^2)^2, xstart) % now specify gradient and Hessian ...
d01720ec33d581941c9a440a6a131d52d519fbdab8ded00f4d89cbc42e055ec0
MATLAB
781
31
function clf = clfKnn( p, k, metric ) % Create a k nearest neighbor classifier. % % USAGE % clf = clfKnn( p, k, metric ) % % INPUTS % p - data dimension % k - number of nearest neighbors to look at % metric - [] distance function, squared euclidean by default % % OUTPUTS % clf - model ready to be ...
0429b058da1821d2c5bb600b40665f9922f170452d6f111f4263033b0d6ce719
MATLAB
782
27
function [data_cond,label_cond,datatypes,labeltypes] = SHGTInfo2CondData(gtinfo,useisdup) if nargin < 2, useisdup = true; end if useisdup, isnotdup = gtinfo.isduplicate==0; else isnotdup = true(size(gtinfo.isduplicate)); end nlabels = numel(gtinfo.istrain); data_cond = zeros(nlabels,1); data_cond(isnotdup & gtin...
1fe09e8e2d828043b057d6d734ca77a36ad12a3e825fdd62c803f37995eb7fcd
MATLAB
782
31
function EWsig=Enrichment_Figs2(dataOut,IM,B) % Plot network pairs meeting significance if ~exist('B','var'),B=1;end Pth=0.05./B; PthMcN=0.05; [NNidx,Tidx,TNidx]=IM2idx(IM); Npairs=length(TNidx); Nnets=max(IM.key(:,2)); NetKey=[[1:Nnets]',[1:Nnets]']; cMap=[1,1,1;0,0,0]; %% Significant stats by network block Xpos=8;...
5859a2a1fd7951dbd3c9c60e689bc9ade1bcebdb15aa96faf6dedf881e546605
MATLAB
782
26
function fullresidual = projectout(vector, whattoprojectout) % projects one vector out of the other % Anne Urai, 2015 % make sure everything is the same size vector = vector(:); whattoprojectout = whattoprojectout(:); % ignore nans idx2use = (~isnan(vector)); idx2use(find(isnan(whattoprojectout))) = 0; prj = whattop...
a2da0fe2c2c766b24160435f90ffd32e1278a1c4b75316dadd6c1050db6fadc7
MATLAB
782
23
function out = periodAssign(times, periods) % out = periodAssign(times, periods) % TIMES is a vector of times % PERIODS is an N by 2 list of start and end times % Returns the index of the period that each time falls into. If a time % does not fall into one of the periods, a zero is returned. % This function assumes th...
dd1b7fe5348136bff67743fc8910c129d27c11df8f0147584d48601e38cb87a1
MATLAB
782
33
function [variables, expression] = parsefilterstring(inputstr) pattern = '\$[\w\d_.]+([^\w\d_]|$)'; variables = regexp(inputstr,pattern,'match'); if isempty(variables) error(['Not a valid filter: ',inputstr]); end for i = 1:length(variables) variables{i} = regexprep(variables{i},'[^\w\d_.]',''); end expressi...
60be4fa0db3de908bf5563534af07f3b31a325cd0b3da226541eba13fd358b0f
MATLAB
783
33
function [Ic,xyc] = croproi(I,xy,roi) % I: [nx1] column image vec % xy: [nxnptx2], 3rd dim is x/y % roi: [nx4] [xlo xhi ylo yi] roi crop coords (inclusive) % % Ic: Like I, but cropped % xyc: like xy, but relative to Ic assert(iscolumn(I)); n = numel(I); npt = size(xy,2); szassert(xy,[n npt 2]); szassert(roi,[n 4]); I...
6b28cf89373742650585b72b23ff15cafa6c97e0530cecede0122cfe384dfe67
MATLAB
783
45
function idx = label2idx_elec(chanlocs,label) % <*LAN)<Toolbox % % LABEL2IDX_ELEC find the index of the label electrode % idx = label2idx_elec(chanlocs,label) % % v.0.0.2 % Pablo Billeke % 19.12.2012 % 13.07.2011 if ischar(label) % for e = 1:length(chanlocs) le = chanlocs(e).labels; ...
93c2d0aeb7aa734aabb15c78e1d4d3414d5b9ef4216f7a19d6831eadfd3f5de2
MATLAB
783
26
function s = tt_size2str(sz) %TT_SIZE2STR Convert size to a string that can be printed. % %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 ...
dc1391bd8931684d6bf35bc552555bf8f3d5ba954d0766593f7a8ec56b8d550e
MATLAB
783
24
classdef ManualDetector < FeaturesDetector % This is just a dummy class to allow workspaces saved with the old manual detector to open in newer Tempo's that use FeaturesAnnotator's instead. methods (Static = true) function obj = loadobj(data) obj = FeaturesAnnotator([]); ...
002691f92ef64231433ea9247486aa7fbdf0bee1186a08a8a59006070bacd62f
MATLAB
784
20
function [I, J, K]=mapxyz2ijk(p,deltax,matrixdim,llc) % maps coordinates of point 'p' to a matrix based index. % dx,dy and dz are the the mapping factors. % deltax=[dx dy dz] and matrixdim=[nrow ncol npln] % this routines assume that matrix has 1 extra row/column/plane in each % dimension such that the real object(mesh...
46bf1ddcc63b02ab874b3abcda8b6c07bf66fd1f58f50c6ae10a66d4596f5780
MATLAB
784
33
function m = sqdist(p, q, A) % SQDIST Squared Euclidean or Mahalanobis distance. % SQDIST(p,q) returns m(i,j) = (p(:,i) - q(:,j))'*(p(:,i) - q(:,j)). % SQDIST(p,q,A) returns m(i,j) = (p(:,i) - q(:,j))'*A*(p(:,i) - q(:,j)). % Written by Tom Minka [d, pn] = size(p); [d, qn] = size(q); if pn == 0 || qn == 0 m ...
6d50047283be6d436c3e1beabc1905029ea4c5fbb5c2ca0ee135f7c20c50694f
MATLAB
784
49
function LAN = add_field(LAN, field) % v.1.0.5 % % % Pablo Billeke % % 24.01.2011 add ';' % 26.08.2010 puede agregar variables de otros workspase. % oreden: % de la funcion > base > del la funcion que la llamo. % 12.06.2009 % % field = ['phase.cfg.stata = ''boot'''] if iscell(LAN) ...
3988fd6450ec3dd88053b7d148b669b7a0e02914f0a4f76898eddf3079633c7a
MATLAB
785
27
function [ret,messages] = check_files_in_normalization() loadParameters; ret = true; messages = {}; for do_downsample = [true,false] if do_downsample && ~params.DO_DOWNSAMPLE continue end if do_downsample FILEROOT_NAME = sprintf('%s-downsample',params.F...
5ad3e982ca3ad328822afdddd2c1591a4322189549440085e4f17f1c809ae651
MATLAB
785
36
%% Shattered sin % %% % This file is from pmtk3.googlecode.com domain = 0:0.0005:1.005; f = @(x)sin(50*x); hollow = [0.03,0.04,0.05,0.15,0.28,0.52,0.66,0.67,0.8]; solid = [0.22,0.23,0.35,0.58,0.6,0.71,0.86,0.97,0.98]; plot(domain,f(domain),'-r','LineWidth',3); hold on; plot(hollow,zeros(1,numel(hollow)),'sg','Li...
f1e99d66a936f212c7737cd7916487e84a276d5699c13689d9014aaf670f1ba9
MATLAB
785
17
% HIFIE3 Hierarchical interpolative factorization for integral equations in 3D. % % This is essentially the same as HIFIE2 but extended to 3D, compressing % first cells to faces, then faces to edges, and finally edges to points. % % This implementation is suited for first-kind integral equations or matrices %...
fd36ce6865f99d653379787decc2055f4ccf9e5fca65d69db92e32587c206ab3
MATLAB
785
25
function [a,b] = fdct_wrapping_pos2idx(NX,NY,SX,SY,s,w,x,y) % fdct_wrapping_pos2idx.m - For a fixed scale and a fixed direction, returns % the curvelet which is closest to a certain point on the image % % Inputs % NX,NY,SX,SY values returned by fdct_wrapping_param % s scale index % w ...
5935c358b907ab07264acc6cfe6734253259ac65663772f61cdc25b13fcbbc86
MATLAB
786
23
function [velocity, acceleration, distance_vector] = linear_motion(x,y,t,fr) % computes linear velocity and acceleration from position coordinates % inputs: % x: position vector of x-coordinates of length n % y: position vector of y-coordinates of length n % t: position vectpr of timestamps of length n % fr : ...
6b16a48cff81c4dbbf33e209389131d95d4c74c4a8834bd4f2cd6bfd9d3e9f00
MATLAB
786
28
function model = linregRobustHuberFit(X, y, delta, includeOffset) % Minimize Huber loss function for linear regression % We assume X is an N*D matrix; we will add a column of 1s internally % w = [w0 w1 ... wD] is a column vector, where w0 is the bias % This file is from pmtk3.googlecode.com %PMTKauthor Mark Schmidt ...
843d731700d8e829d96fb10553c11c5e5fb51a84f143b2e219793850b919e39a
MATLAB
786
46
function sev = read_tdt_sev(filename, dtype, begsample, endsample) % READ_TDT_SEV % % Use as % sev = read_tdt_sev(filename, dtype, begsample, endsample) % % Note: sev files contain raw broadband data that is streamed to the RS4 fid = fopen(filename, 'rb', 'ieee-le'); if nargin<3 begsample = 1; end if nargin<4 ...
8e61703596485d54ac0e32faf8aafbb5549247b4bab7c04ba357c972114cda22
MATLAB
786
38
function [foci,ecc] = conic_foci(A,B,C,D,E,F) [type,x0,y0,theta,A2,B2,C2,D2,E2,F2] = conic_standard_form(A,B,C,D,E,F); if strcmpi(type,'circle') foci = [0,0]; ecc = 0; elseif strcmpi(type,'ellipse') || strcmpi(typ,'hyperbola'), a2 = 1 / min(abs(A2),abs(C2)); b2 = 1 / max(abs(A2),abs(C2)); c2 = sqrt(a2 - b2)...
a151b6566d28c51e3c7395d76277d434588c2e22ef2bf1fe6347a7a5e270ada2
MATLAB
786
30
%% fnc_GetInputs: give the vector of the inputs corresponding to the index % (useful to scan all the possible combinations of the % inputs) % % Usage: % ii = fnc_GetInputs(i) % % Inputs: % i scalar index of the inputs (given by fnc_GetIndex) % % Output: % ...
f8cb416df2b5d435c50e4bcf021ab29e58a14a0e220db1caa503aade6ff6f724
MATLAB
786
26
rgb = [0.1 0.4 0.5; 0.7, 0.4, 0.7]; for iCond = 1: 2 figure('color',[1 1 1]) switch iCond case 1 cmp = 'Singleton distractor'; case 2 cmp = 'Non-singleton distractor'; end vx=-1:0.02:1; ax = gca; mato= hist(index{iCond},vx); colormap(ax,r...
40d34e7bc562f4ae7f769f6891261e98c9526dfdca8125355c3540094332b59c
MATLAB
787
33
%% Simple bolasso demo % %% % This file is from pmtk3.googlecode.com setSeed(0); n = 1000; %number of data points d = 25; %number of dimensions r = 10; %number of relevant dimensions, (first 8) ndataSets = 1; lassoSignConsistent = false; [X,y] = bolassoMakeData(n,d,r,ndataSets,lassoSignConsistent); trueSu...
59122993884a586d144ba2ecc7e946f9dd37d68eabd9d26aaf9ddce240296373
MATLAB
787
27
function IDIF_extraction_wrapper(PET_dyn_path, t_PET_emi, t_PET_delta, anatomy, qc_path, IDIFVessels_path, IDIF_path, options) if nargin < 7 options = get_default_options(); end [IDIF_raw, TACs_selected, xyz, number_of_final_voxels] = extract_raw_IDIF(PET_dyn_path, t_PET_emi, anatomy, qc_path, IDIFVessels_path...
32a723f57430e5df4a5bdb5382cf4f195eed564eb161f2661b9b207216f495e7
MATLAB
788
53
function varargout = montageArray(A,clim) [m1,m2,m3] = size(A); n = ceil(sqrt(m3)); M = zeros(m1*n, m2*n); k=0; for p=1:m1:(n*m1) for q=1:m2:(n*m2) k=k+1; if k>m3, break end M(p:(p+m1-1),q:(q+m2-1)) = A(:,:,k); end end if nargout == 0 if nargin == 1 i...
92f676a1fb1ea02b9f45f8f0e4456e7e1ce13e1a212a97275f9d98d6dfec5efa
MATLAB
788
17
%% 非线性(动力学)特征:基于时域的熵 | nonlinear features: time-domain-based entropy %% 香农熵 | Shannon Entropy % 表征时间序列数据的复杂性(complexity)和规律性(regularity),值越大,时间序列越复杂、越不规律 % X: single channel EEG signal (either a row vector or a column vector) % See also: % feat_ApproximateEntropy, feat_SampleEntropy, % feat_PermutationEnt...
3a0a511e98f57580a1921956f2230b649237f0817cb8c908401521163018fe5c
MATLAB
789
17
function cfg = readDefaultCfg() % Read the default project config from the default config YAML file. % % In the YAML file the optional fields ViewNames and LabelPointNames are left % blank, and yaml.ReadYaml() represents a blank field as an empty double % array ([]) rather than an empty cell array ({}). Down...
5eea655d73335042f661eaab2d9a4c2640666f7e1dafae04e0b9ed9d5c11c576
MATLAB
789
28
function BoundingBox=SafeBoundingBox(Image,BoundingBox) ImageHeight=size(Image,1); ImageWidth=size(Image,2); if BoundingBox(3)>ImageWidth||BoundingBox(4)>ImageHeight error('This box will not fit!') end if BoundingBox(1)<=0 warning('Adjusting X') BoundingBox(1)...
644a67ee98ae0f619762b079974608ef7f17f104622731c439241a1766f13d93
MATLAB
789
34
function TF = tabularFactorMultiplyLogSpace(varargin) % Multiply tabular factors in log space % (currently does not do the logsumexp trick) % T = tabularFactorLogSumExp(fac1, fac2, fac3, ...) % Each factor is a struct as returned by tabularFactorCreate and has % fields T, domain, sizes. %% % This file is from pmtk3.go...
a75ce931d2a2471d5b4176973651ecb1a1f68065e57ed2d77ae14df5f9f8ad58
MATLAB
789
29
function di_angles = get_tetrahedron_dihedrals(e,p) v1 = p(e(:,2),:) - p(e(:,1),:); v2 = p(e(:,3),:) - p(e(:,1),:); v3 = p(e(:,4),:) - p(e(:,1),:); v4 = p(e(:,3),:) - p(e(:,2),:); v5 = p(e(:,4),:) - p(e(:,2),:); n1 = cross(v2, v1); n2 = cross(v1, v3); n3 = cross(v3, v2); n4 = cross(v4, v5); di_angles(:,1) = vector_...
bf8affa1b7dd7abb05245bb9d4ce86fa3776138c18f9ba04b0e995744be3b566
MATLAB
789
25
function Draw_ROIs_Through_Cortex_3_Views(Anat,roi,Conn,params) % This function displays hemispheres with ROI spheres and sticks connecting % them in 3 views. Px=0; Py=-110; Pz=-125; Txt='+'; Ctxt=[1,0,0]; disp('<<< Drawing ROIs and sticks on transparent brains, please be patient') figure('Color','w','Position',[50...
cf5142c394b43c4fce376d63089d1a53c12759d41a54d2ff46da3b7009a2162b
MATLAB
789
36
function VBA_disp (str, options, carriageReturn) % // VBA toolbox ////////////////////////////////////////////////////////// % % VBA_disp (str, options) % display string or cell-arry of strings according to verbose option % % IN: % - str: string or cell array of strings to display % - option structure containing th...
01885d8a16d7a76db69e2fb9351e852d0552946a1ee04ede24e06a8dda346efc
MATLAB
790
25
function extra = pmlUnusedDemoReport(bookSource) % Generate an hmtl report of the PMTK demos NOT currently used by pml. % %% Input % % bookSource - path to the PML latex source containing e.g. pml.tex % (default = C:\kmurphy\dropbox\PML\Text) %% Output % %% extra - a cell array of the dem...
1a6731265bbd39f416510f668bfb2efcebf7be98ead224fc788e934c9e36f68f
MATLAB
790
35
%% pdf_Normal: Normal Probability Density Function % % Usage: % x = pdf_Normal(N, mu, sigma) % % Inputs: % N scalar, number of samples % mu mean % sigma standard deviation % % Output: % x vector with the sampled data % if N==0...
50067050a65605780b113e850e7417405ce0132838c8c8ca942dbe230e701858
MATLAB
790
29
function [model, logev] = linregFitBayesZellnerPrior(X, y, g, preproc) %#ok % Bayesian inference for a linear regression model using Zellner's g prior % This file is from pmtk3.googlecode.com [model.preproc, X] = preprocessorApplyToTrain(preproc, X); [N,D] = size(X); [Q,R] = qr(X,0); wmle = R\(Q'*y); % posterior mea...
57ecd8fccf734851bfaee85a5d39b6af6c8dd694fe1367201b33b9704ae296ae
MATLAB
790
42
% demo for GLM with missing data clear all close all % generate data under GLM n = 1024; % # observations p = 8; % # regressors d = 16; % # missing data in GLM design matrix s = 1e0; X = randn(n,p); b = randn(p,1); g = X*b; y = g + s*randn(size(g)); % remove data in GLM design matrix tmp = randperm(n*p); Xmd = X; Xm...
e9cb469979ecdc674ef1c04108f0f9a49b36fcc1f76650bab104229cfefc6f36
MATLAB
791
20
function pt = plot_square(ax,x_boundary,y_boundary,stretch_ratio,color,varargin) if (nargin < 4) || isempty(stretch_ratio) stretch_ratio = 1.5; end if (nargin < 5) || isempty(color) color = 'r'; end args = func.get_args_set_default(varargin,'FaceColor','none','EdgeColor',color,'LineW...
19ac8d5da2017a3a098c1a541d2d3e88df1113c779d2541cebc1acf957140172
MATLAB
792
43
function [P] = multiSigmoid(X, w) % Softmax function %#eml % X is n*d % w is d*(C-1) last column is all 0s % P is n*C % % Based on code by Balaji Krishnapuram % This file is from pmtk3.googlecode.com [N,d]=size(X); %X->Nxd W=reshape(w,d,[]); M=size(W,2)+1; % M = nclasses % Activation for the sigmoids: a...
9b44b3d12849b3b6d8f2c35388d8a3eab2d1e9e3f3ba898570fdfc0daf51f1b5
MATLAB
792
15
atlas_img = 'E:\Project\AHBAenrich\rawdata\brain_atlas\brodmann.nii';%% recepter matrix of brodmann v1 = spm_vol([atlas_img]); [AAL_image, XYZ] = spm_read_vols(v1); %256*256*256 XYZ = XYZ'; roi=unique(AAL_image(:));roi(1)=[]; v_test = v1;v_test.fname = atlas_img;img_test = zeros(size(AAL_image)); mean_MNI = zeros...
de5f1417cd768ff30d7a974b9ecbe25d7923f0cdd88a9153cdb208e09a002d28
MATLAB
792
25
%% Classify the MNIST digits using a one nearest neighbour classifier and Euclidean distance % % Compare to mnist1NNdemo, which uses various tricks % to scale things up % This file is from pmtk3.googlecode.com loadData('mnistAll'); trainndx = 1:10000; testndx = 1:1000; ntrain = length(trainndx); ntest = length(tes...
de73c4e35d4d7bce246afa3d64d879675c59be29574bc4d9e78107eff5cc400c
MATLAB
792
21
function candoit = canGetPrecon(problem) % Checks whether a preconditioner was specified in the problem description. % % function candoit = canGetPrecon(problem) % % Returns true if a preconditioner was specified, false otherwise. Notice % that even if this function returns false, it is still possible to call % ...
24d560d3179e1d73c96511eabe69157167a617509556e014f429f491036c1bf8
MATLAB
793
28
% calc euclidian distance between all pairs of ROI file % Muriah Wheelock 11.2.2017 roi_radius = 4; % change this to your roi radius datadir= ('/path to roilist.txt'); a=importdata(strcat(datadir,'roilist.txt')); %expects collumn 1 = x,2 =y, 3 = z x=a(1:end,1); y=a(1:end,2); z=a(1:end,3); for i = 1:leng...
3f874c3a61e63274d2421f1ada9c497c206e735047c2df23705eb04a4da92ee4
MATLAB
793
28
% - calculate the perturbation responses based on linear analysis % Transpose the connectivity matrix 'w' to obtain 'W' W = w'; % Calculate the matrix 'A' using the inverse of the identity matrix minus 'W' A = inv(eye(N) - W); % Initialize an empty array to store the differences in response rates dr_all = []; % Loo...
1d63709d5a0e33ceaf05943a4b97a9014f8ade9e91e0ceb58012fb26e1e73e34
MATLAB
794
30
% ShortenFluorescenceWarningPeriods.m % Sarah West % 7/31/23 function [parameters] = ShortenFluorescenceWarningPeriods(parameters) MessageToUser('Shortening ', parameters); % Pull out input values indices_to_shorten = parameters.indices_to_shorten; data = parameters.data; shorten_dimensions = par...
e28dd501df5fe8d0d86d635d68213ca0fc6b35f05c634ae4ed43fc33c477516a
MATLAB
794
31
% GLEGQUAD Gauss-Legendre quadrature nodes and weights. % % [X,W] = GLEGQUAD(N) produces the nodes and weights X and W, respectively, % of the Gauss-Legendre quadrature rule of order N on [-1,1]. % % [X,W] = GLEGQUAD(N,A,B) produces the quadrature rule on [A,B]. % % See also GPGW. function [x,w] = glegqua...
20a3d8131471fb7ff190cf9c378e6353275cc994c1cbc81ed08e26f5a3ff20e7
MATLAB
795
20
function h = htmlTagKey(tableAlign) %% Return the html text for the demo/synopsis tag legend table % This file is from pmtk3.googlecode.com if nargin == 0, tableAlign = 'right'; end tableData = ... { 'S' , 'stats toolbox needed' , 'I' , 'interactive (user input required)' 'B' , 'bioinformatics toolbox needed...
5f06f7b4f9484eab9dbc6b1965c801a36dfd28c3a320ab55a354ed11ab8248fa
MATLAB
795
23
function [indices] = splitArrayIndices(inputarray_dims, dim, chunksize) % Similar to linspace, given an array and a desired chunk size, this % function returns an array of indices separated by chunksize. The last % entry may be less than chunksize. indices = [1]; ctr = 1; while (ctr<inputarray_dims(dim)) next = mi...
8180d3df72377f79e7e4d18660b99c652f27f8aec1bf8213709dabae771fd1b6
MATLAB
795
34
function [gx,dG_dX,dG_dPhi,d2G_dXdPhi] = g_ERP(x,Phi,u,inG) % neural mass observation function (DCM for ERPs) n = size(x,1); % should be 9 nPhi = length(Phi); % should be 1 g = exp(Phi(1)).*[0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0.3 0 0 0 ...
b040aec41d51060c75b40b953313e762b36d7b2205fb7456e3710f640cc447ea
MATLAB
795
34
function [eout p] = remove_unused_nodes(ein,p,nnpe) % Removes the nodes from 'p' that are not being used/referred in 'e'. % The return 'e' is renumbered based on new list of nodes. % Only supports hexahedrons, tetrahedrons and triangles % ein: elements % p: coordinates % nnpe: optional number of node per element value ...
5735d6c0997b2641e847e0fff6871f32039952a52b0b3ddcd6161f4538c802ac
MATLAB
796
24
% Author: Birgit Nierula % nierula@cbs.mpg.de %% Define individual interpolation windows srmr_nr = 2; ana_dir = '/data/pt_02151/'; bids_dir = '/data/p_02151/SRMR2_experiment/bids/'; cfg_path = [ana_dir 'analysis/manuscript_sep/scripts/cfg_srmr2/']; % here is important info for the analysis % Add paths addpath('/data...
d806058d03777a18f4bd76ab51e40ff66a65f8e6b359cb46bf2ba7802e174a90
MATLAB
796
19
function s = prob_matrix_to_site_struct(si,P_matrix_label,idx) % si -> struct result of import.import_simulation_files % with fields 'P_indpt' and 'P_cprob' % P_matrix_label -> either 'P_indpt' and 'P_cprob' % si.(P_matrix_label) % idx -> index of the 'P_indpt' or 'P_cprob' cell array % if...
200f837b75b75fdd6fde20231cca5fbef0403a237e5e187159e12781db37f0ba
MATLAB
797
24
function e = end(X,k,n) %END Last index of indexing expression for sptenmat. % % The expression X(end,:) will call END(X,1,2) to determine % the value of the first index. % % See also SPTENMAT, SPTENMAT/SUBSREF, END. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolb...
9f1825ef49e7a48e3bed2a69cfb3b3363fa74574ab93b57c0da4aa0ebd284b3d
MATLAB
797
34
function [pVal rate bsln] = ResponseAssess(spk, evt, param) % unpack parameters bB = param.bslnWin; rWin = param.responseWin; bW = param.binWidth; pol = param.responsePolarity; sided = 1; if pol == 0 sided = 2; end bE = [rWin(1):bW:rWin(2)]; nBins = length(bE) - 1; if iscolumn(evt) evt = evt'; end bCount = ...
caaa9138f7646f60c9308d24188c8f14c0635a9043d188793b57446afbf17850
MATLAB
798
25
function W = y_kendallW(Data) % Calculate Kendall's W (also known as Kendall's coefficient of concordance) for a 3D matrix. Based on https://en.wikipedia.org/wiki/Kendall%27s_W % FORMAT W = y_kendallW(Data) % Data - the data (before ranking). object x judge x instance % Output: % W - Kendall's W (also know...
d991e4b494c6650daf8a1a0fee99408c0d21a59125af350d0c51d573f59f8e99
MATLAB
798
19
function [ClockSorted,Index] = ClockWiseSort(NewVertices) NewCell = 1 : size(NewVertices,1); NewCellLength = length(NewCell); % first we need to find the center of mass of the vertices if NewCellLength == 1 Center = NewVertices(NewCell,:); else Center = sum(NewVertices(NewCell,...
0871a66cbc17011cb367c952856ac861555f438cf0be91995db900e5b44d05b6
MATLAB
799
19
function max_pool_size = concurrency_size_in_downsample_apply(cond) loadParameters; if ~isfield(params,'DOWN_SAMPLING_MAX_POOL_SIZE') main_mem_usage = params.MATLAB_PROC_CONTEXT; par_worker_mem_usage = 2 * cond.imgsize_dbl + params.MATLAB_PROC_CONTEXT; max_pool_size = min(params.NUM_RO...
26844bd2f6362c2cc0f8e65543a8d112ca694684a380eb8f45acaa642ec93114
MATLAB
799
30
function [SortedMatrix,maxIndex]=SortThisMatrix_Mean(whamatrix,fromhere,tohere,SortWithThis) dbstop if error if isempty(SortWithThis) maxIndex=[]; maxValues=[]; for as=1:size(whamatrix,1) this=whamatrix(as,:); thisMax=nanmean(this(fromhere:tohere)); maxIndex=[maxIndex;thisMax(1)]; %...
3fc9fbe54ffb5681277969f9c5918d8df52bce719cd48e14b74afef91e934b2d
MATLAB
799
18
% 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,...
88761af8a27d53ad75272a9cc2ced96ce3e07eb09c75482ee8f86b5107bb155f
MATLAB
799
29
function SetFigureSize(hfig,width,height) screen_size = get(0,'ScreenSize'); old_units = get(hfig,'Units'); set(hfig,'Units',get(0,'Units')); pos = get(hfig,'Position'); center = pos(1) + pos(3)/2; middle = pos(2) + pos(4)/2; pos = [center-width/2,middle-height/2,width,height]; % make sure it is on the scre...
d9fa32ce0ea22bff276543a79facc7d3323bfcef82b3e8e3da9dfc3735ef1314
MATLAB
799
38
function out = crossProduct(varargin) %% Return the cartesian product, (all combinations) of the input lists % out = crossProduct(A, B, C, ...) each row of outcontain all combinations % of A, B, C, ... Example % C = crossProduct(1:2, 2:4, 3:4) % 1 2 3 % 2 2 3 % 1 3 3 % 2 3 ...