sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d90b3cf7100927378e3997391a16fad09c7921a8bbc6c299ce882f3fbcc1e26c
MATLAB
521
16
% List of open inputs % Smooth: Images to Smooth - cfg_files % Written by Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md addpath(spm_dir) nrun = 1; % enter the number of runs here jobfile = {[script_dir '/CBIG_MMLDA_smooth_job.m']}; jobs = repmat(jobfile, 1, nrun); in...
dacc251a884e8480ee5b291f587a13a3872b63c15e3c5160903a90aaff28f43e
MATLAB
521
18
function [isFieldResult, substruct] = fieldInStruct (inStruct, fieldName) % inStruct is the name of the structure or an array of structures to search % fieldName is the name of the field for which the function searches isFieldResult = 0; substruct = NaN; f = fieldnames(inStruct(1)); for i=1:length(f) if(strcmp(f{i},str...
db9492a2c1807c921332410e8100928ddc722a919cc225ced66d537d32907f8b
MATLAB
521
29
function alpha = circ_axial(alpha, p) % % alpha = circ_axial(alpha, p) % Transforms p-axial data to a common scale. % % Input: % alpha sample of angles in radians % [p number of modes] % % Output: % alpha transformed data % % PHB 2009 % % References: % Statistical analysis of circular data, N. I. F...
2b7190f3198db5a1ed88e9b7eed4a5c70f52514b348fbff36409abc6feb90d64
MATLAB
522
22
function clu = updateclu(clu,ix,newclu) % updates identities in parts of a clu file %% INPUTS % clu - N x 1 vector of cluster identities for each extracted waveform % ix - M x 1 vector of indices where new identities will be assigned % newclu - integer value for the new cluster identity %% OUTPUTS % clu - N x 1 vect...
5d625b590f8b5c39821fbbc9028b65e3486a20965b69b0de39c9780dc2cf5c54
MATLAB
522
12
function mycolor = ea_explorer_value2color(value,colormap,coloraxis) minval = coloraxis(1); maxval = coloraxis(2); diffval = coloraxis(2)-coloraxis(1); coloridx = round((value-minval) .* ((size(colormap,1)-1)/diffval)+1); coloridx(coloridx < 1) = 1; coloridx(coloridx > s...
6b1331c49b01f0591d3380c8e8ad2c2e10645fa83dc4c4ad465806ab91cfff86
MATLAB
522
18
% Compute the total degree, in-degree and out-degree of a graph based on % the adjacency matrix; should produce weighted degrees, if the input matrix is weighted % INPUTS: adjacency matrix % OUTPUTS: degree, indegree and outdegree sequences % GB, Last Updated: October 2, 2009 function [deg,indeg,outdeg]=degrees(adj) ...
b3774a72635f6dbc9591a765d29643e5ed9e26b435de184be953e2bb4b806dc9
MATLAB
522
12
function control_max_eig = bin_shuffling(SpikeCount,number_of_surrogates) control_max_eig=zeros(1,number_of_surrogates); for surr_idx = 1:number_of_surrogates ControlSpikeCount=zeros(size(SpikeCount)); for neuron_idx = 1:size(SpikeCount,1) ControlSpikeCount(neuron_idx,:) = SpikeCount(neuron_idx,r...
d70bd40078a429d106fe9586083c10405ed3321e702546c51c454c715b2c7eb3
MATLAB
523
25
function mat = SmoothMat(mat, kernel_size, std) % % Smooths matrix by convolving with 2d gaussian of size % kernel_size=[bins_x bins_y] and standard deviation 'std' % % if std==0, just returns mat % % 10 december 2009 andrew if nargin<3 std=1; end if std == 0, return; end [Xgrid,Ygrid]=meshgrid(-kernel_size(1)/2...
fbb25ce641949aa37b143e4243e03189c5e17b817cbeda7b8331e227b604edfd
MATLAB
523
13
function a = ne( x, y ) % Disciplined convex/geometric programming information for NE (~=): % Not-equal constraints violate both the DCP and DGP rulesets. Thus % not-equal expressions may only appear in CVX models when both % sides are constant. b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ),...
e1719acebe2982d516db165be0e47aa965f956db753ff1e7a46ba1a492be76d7
MATLAB
524
21
function out = isnan(fa) % Convert to numeric form % FORMAT isnan(fa) % fa - a file_array % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: isnan.m 1301 2008-04-03 13:21:44Z john $ bs = 10240; m = size(fa); fa = reshape(f...
b3246c2b3591e39de9bd24775a7850a841f99b16dd84d930d0e456655c5754bc
MATLAB
525
21
function cvx_optval = sigma_max( x ) %SIGMA_MAX Internal cvx version. narginchk(1,1); if ndims( x ) > 2, %#ok error( 'lambda_max is not defined for N-D arrays.' ); elseif ~cvx_isaffine( x ), error( 'Input must be affine.' ); end % % Construct problem % [ m, n ] = size( x ); cvx_optval = lambda_max( [ zer...
069c80fcb3aabf52a7e4da50a1824bec622e166fe6c8a8a9c0ee4ec69829a728
MATLAB
526
11
function Handle = GCO_Create(NumSites,NumLabels) % GCO_Create Create a GCoptimization object. % Handle = GCO_Create(NumSites,NumLabels) creates a new GCoptimization % object and returns a 'handle' to uniquely identify it. % Call GCO_Delete(Handle) to delete the object and free its memory. % Call GCO...
3e62334c83241624ba720221a8c149ebaafb0882b920a836b27c0b7ffad8b9a8
MATLAB
526
13
function a = rocScoreSaliencyVsFixations( salmap , X , Y , origimgsize ) % % outputs ROC Area-Under-Curve Score between a saliency map and fixations. % % salmap : a saliency map % X : vector of X locations of fixations in original image coordinates % Y : vector of Y locations of fixat...
5150095fadc847142af6596a9085ca4f9ada955ba4db00b9b4ecc9106f224192
MATLAB
526
26
function ax=plotcolouredROIs(ax,ROIs,templates,facecolours,tempnum) [~,numROIs]=size(ROIs); [Ypix,Xpix]=size(templates{1}); axes(ax); hold on; imagesc(templates{tempnum}); colormap('gray'); for k=1:numROIs currROI=reshape(ROIs(:,k),[Ypix,Xpix]); B=bwboundaries(currROI); for n=1:length(B) bou...
cb62c06bef5b7f0a9b00ec1e760e5a2b3a358fe1542c094a9a622e5ac743ac97
MATLAB
526
16
function [CFCdata,bandRef,bandRefInd] = getBinaryClassifiersCFC(blockTagsAC,blockDatasetAC,mode,folderpath,featureNum) classes = ['OC';'OH';'OW';'CH';'CW';'HW']; if mode == 0%Power [CFCdata,bandRef,bandRefInd] = CFCwithCOH(blockDatasetAC); else%Phase [CFCdata,bandRef,bandRefInd] = CFCwithISPC(blockDatasetAC); e...
9ce3e410d5bb65bf02fb6a1359f681bfc1f566431f78981e7137d8cb5e6ee651
MATLAB
527
14
function varargout = Ent_Permu(varargin) %ENT_PERMU (deprecated) Use ent_permu instead. % Ent_Permu has been renamed to ent_permu. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','Ent_Permu:deprecated') % %...
cfe15c229517a6bc1689e007d0818faa826501cbd7e305ca7112f9eab4358fa7
MATLAB
527
14
function varargout = Ent_xSamp(varargin) %ENT_XSAMP (deprecated) Use ent_xsamp instead. % Ent_xSamp has been renamed to ent_xsamp. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','Ent_xSamp:deprecated') % %...
04ee7ba0b1d4f4e6f8b194ddda62e17bad51468f9a099e634d2378170f2ba815
MATLAB
528
21
function C=PointToClosestPointOnPlane(A,B,C,P) % C = PointToClosestPointOnPlane(A,B,C,P) % % inputs, % A,B,C : Points (x,y,z) describing a plane % P : A certain (x,y,z) point % % outputs, % C : Point on the plane which is closest to point P % % Calculate normal of triangle N = cross(A-C,B-C); N=N....
0cca084add0850b0a545fe2025280673d22de91765739c74a96d471681777e51
MATLAB
528
18
function data_normalized = calc_normalize_timeseries(data) % calc_normalize_timeseries.m % % Normalize timeseries with respect to mean and std % % Input: data : fMRI data [TxN] % T = length of time % N = number of points % % Output: data_normalized : norma...
51cd4fbcfd37dd86cc2d2c9b8bf21b926bec9c5a6df25284c3b26420da4a5905
MATLAB
529
31
% load a trial of mic data % 1000 Hz sample rate assumed % load(trialname); % % figure; plot(trial) figure; spectrogram(micdata(1,:),500,250,'yaxis') % figure; spectrogram(micdata_f3e2(2,:),500,250,'yaxis') %% [b a] = butter(4,[360 440]/1000); filttrial = filtfilt(b,a,micdata(1,:)); %trial); figu...
8c6ea3b379578f2b1ce02c564ce0d8a2ba6b2aa0a57da14e9f354c2484f90456
MATLAB
529
22
function I = Gauss_smoothing_3D(I, fwhm, gauss_std) % Function to apply a 3D smoothing to the image I with Gaussian kernel of defined FWHM, % or given standard deviation gauss_std % % Author: % Dr. Marco Palombo % Cardiff University Brain Research Imaging Centre (CUBRIC) % Cardiff University, UK % 8th December 2021 % ...
e2f437248caf420d8331c19ee4f1ed484b2fb24a3b4738d099bed4abea28a8b6
MATLAB
529
19
files = dir('*stack.mat'); for i = 1:length(files) load(files(i).name); res(i).cameradirection = cameradirection; res(i).flightstate = flightstate; res(i).leftstack = leftstack; res(i).rightstack = rightstack; res(i).rawstack = rawstack; res(i).turns = turns; res(i).flyexp = [...
70c45478df52e54a634097e107f553544d10a4b5754cd8b2b6a3b28a33482c91
MATLAB
530
13
function y = real( x ) % Disciplined convex/geometric programming information for REAL: % REAL(X) may be freely applied to any CVX expression. However, % since REAL(X)=X for all real expressions (including convex, % concave, log-convex, and log-concave), it is only useful in % the complex affine ...
d50dcee4839eb2e5d457b9457f534fed67673386054b5bcd98dd7b491ac56a9f
MATLAB
530
23
function y = pos( x ) % POS Positive part. % POS(X) = MAX(X,0). X must be real. % % Disciplined convex programming information: % POS(X) is convex and nondecreasing in X. Thus when used in CVX % expressions, X must be convex (or affine). narginchk(1,1); if ~isreal( x ), error( 'Argument must ...
4059d558d5ce5af084b43e14dce1c9c1a998d87fa0b6e2b750be1d0b0a28cf03
MATLAB
532
19
function y = end( x, k, n ) %Disciplined convex/geometric programming information for END: % The use of END as an array subscript (e.g., X(:,end)) is identical % with CVX variables as it is for numeric vectors and arrays. sz = size( x ); nz = length( sz ); if k > nz, y = 1; elseif k < n || nz <= n, y = sz...
48d3930701caad131fc89f179d8451be37fd845b3dd2a7c9e36a57a88ea77037
MATLAB
532
14
function varargout = setradius(varargin) %SETRADIUS (deprecated) Use set_radius instead. % setradius has been renamed to set_radius. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','setradius:deprecated') %...
9594b8979ead1704a16e11e1bcdf0d96f80142885685d347ba42823b96eaa89a
MATLAB
532
18
%% Example 1b to visualize topic model results % This example shows how to visualize topics in a 2D map. % % load a document-topic count matrix saved for the nips dataset load 'ldasingle_psychreview'; load 'words_psychreview'; %% % extract the topics in a cell array of strings [S]=WriteTopics( WP,BETA,WO,5,...
dc1588964784661fdcff84a2465a781d1a751c1fef3be773801b1597db0ffbcb
MATLAB
532
26
A=xlsread('power.xlsx'); [r,c]=size(A); for i=1:c temp=A(:,i); ymax=1;%Òª¹éÒ»µÄ·¶Î§µÄ×î´óÖµ ymin=0; %Òª¹éÒ»µÄ·¶Î§µÄ×îСֵ xmax=max(temp);%ËùÓÐÊý¾ÝÖÐ×î´óµÄ xmin=min(temp);%ËùÓÐÊý¾ÝÖÐ×îСµÄ for j=1:r B(j,i)=((ymax-ymin)*(temp(j)-xmin)/(xmax-xmin)+ymin); end B(:,i)=B(:,i)-B(1...
cc005f3fdd3f1a4d0dc553c603c629b2b5a522742ee364c8144c45ef334c48fc
MATLAB
533
17
function y = pow_abs( x, p ) %POW_ABS Internal cvx version. narginchk(2,2); if ~cvx_isconstant( p ), error( 'Second argument must be constant.' ); elseif ~isreal( p ), error( 'Second argument must be real.' ); elseif any( cvx_constant( p(:) ) < 1 ), error( 'Second argument must be greater than or equal ...
eb30972aa773310579cc8eed101dbe3a63dd94f1d95b113851a0638f841241d1
MATLAB
533
11
function cifti = ciftiopen(filename, varargin) %function cifti = ciftiopen(filename, ...) % Compatibility wrapper for cifti_read. wbcmd = 'wb_command'; %don't require a second argument, default to whatever is on PATH if ~isempty(varargin) wbcmd = varargin{1}; %use the specified wb_command for ...
f03a692e014d505da9c688cdcaaa3f85b6f2c9ac00a508620b27596dbec866d9
MATLAB
533
19
% Local Regression and Likelihood, Figure 6.6. % Author: Catherine Loader % % Penny data, piecewise smoothing. % load penny; u = find(year <= 1958); fit1 = locfit(year(u),thickness(u),'alpha',[0 10],'deg',1); u = find((year>1958) & (year <= 1974)); fit2 = locfit(year(u),thickness(u),'alpha',[0 10],'deg',1); ...
65341f0739a234e8c47a1cd057ed0fe7e7e57de621c89992ec8f49ace5a01289
MATLAB
535
23
% Local Regression and Likelihood, Figure 1.2. % % Spencer's mortality data, 15- and 21-point rules. % Doesn't use locfit! load spencer; figure('Name','fig1_2a: Spencer mortality data'); plot(age,mortality,'o'); title('15-point rule'); xlabel('Age (Years)'); ylabel('Mortality Rate'); hold on; plot(age,spence15(mortal...
763ef469c0e8e98ced930af54d41bc1159f038643c7bd2d7980ad0b9ade3a957
MATLAB
535
25
function hideAxesExceptBox(ax, boxWidth) narginchk(1, 2); if nargin < 2 boxWidth = 5; end for index = 1:numel(ax) title(ax(index), ''); xlabel(ax(index), ''); ylabel(ax(index), ''); ax(index).TickLength = [0, 0]; ax(index).XTick = []; ax(index)....
fe5c64d1866241fb13a9afd133dc3794a427f422bfde262264bd7c570cc02615
MATLAB
535
20
function seldir = LeG_lastDir(dialogtitle) saveddir = fullfile(fileparts(which('LeG_lastDir.m')),'LeG_lastDir.txt'); startdir = ''; if exist(saveddir,'file') fid = fopen(saveddir,'r'); %read only startdir = fscanf(fid,'%s'); fclose(fid); end if ~exist(startdir,'dir') || length(startdir)<=1 ...
24a8ea980756aa59bf6cf40847f8f745ea5707ee22aaa3f7615d5bd883389209
MATLAB
536
24
function Faces=GetRemainingFaces(T,F,V) Faces1=T(:,[3 2 1]); Faces2=T(:,[2 4 1]); Faces3=T(:,[4 3 1]); Faces4=T(:,[4 2 3]); Faces=[Faces1;Faces2;Faces3;Faces4;F]; FacesS=sort(Faces,2); Faces=[FacesS(:,1)*(size(V,1)^2)+FacesS(:,2)*size(V,1)+FacesS(:,3) Faces]; Faces=sortrows(Faces,1); FacesOld=0; Faces...
af3c05bfc3eb1373de4da54abf6cfd6e7e1fbfba11e2c16443767891100c57da
MATLAB
536
15
function z = sigma_max( x ) %SIGMA_MAX Maximum singular value. % SIGMA_MAX(X) returns the maximum singular value of X. X must be a 2-D % matrix, real or complex. SIGMA_MAX(X) is synonymous with NORM(X). % % Disciplined convex programming information: % SIGMA_MAX(X) is convex and nonmontonic in X, so X m...
c561f9f9fe0fd666e5db0cac6b27565dc3431594fae87e677b1d9e9c739fdec0
MATLAB
536
20
% Local Regression and Likelihood, Figure 9.2. % % Hardle's Motorcycle accelaration dataset. % Local Variance Estimation. % % Author: Catherine Loader % % NEED: lfknots function to extract fit points. load mcyc; fit = locfit(time,'y',accel,'nn',0.1); y = -2*predict(fit,'fitp','what','lik'); w = predict(fit,'fitp','wha...
1ba28dd0ce995b940d5f646486a7f472e3460dbe3dcd1a99bd689776f2aa4aab
MATLAB
538
14
function varargout = AMI_Thomas(varargin) %AMI_THOMAS (deprecated) Use ami_thomas instead. % AMI_Thomas has been renamed to ami_thomas. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','AMI_Thomas:deprecated...
572611203167153392f1c5648e61b7f3e728bfde84b9fe6148d186ee22fb2d2d
MATLAB
538
14
function fr = computeFR(theseSpikes) spiking_stat_window = max(theseSpikes) - min(theseSpikes); spiking_stat_bins = [min(theseSpikes), max(theseSpikes)]; % Get firing rate across the session bin_spikes = ... histcounts(theseSpikes, ... spiking_stat_bins); min_spikes = 10; use_spiki...
a0d0114695d2383491a42c553eb1a32200c45c88463ff7443357e3cdf0066c93
MATLAB
538
19
function y = cvx_isconstant( x, full ) narginchk(1,2); b = x.basis_; if size( b, 1 ) <= 1, y = true; if nargin == 2 && full, y = y( ones( 1, prod( x.size_ ) ) ); y = reshape( y, x.size_ ); end elseif nargin == 2 && full, bz = b ~= 0; y = cvx_reshape( sum( bz, 1 ) == bz( 1, : ), x.siz...
b19aaec5233aabceff195171f5f42f9a0ef9155385d2076c46e472c73b9549cf
MATLAB
538
16
function out = O_orientation( fparam , img , imgR, imgG, imgB, typeidx ) if ( nargin == 1 ) out.weight = fparam.orientationWeight; out.numtypes = length( fparam.gaborFilters ); for i = 1 : length( fparam.gaborFilters ), out.descriptions{i} = sprintf('Gabor Orientation %g',fparam.gaborangles(i)); end else...
c30f3e6dd6ba4da9034ba2c8a180e2b7fa12f6f3bbc0c5d47f0a8a042834d0a7
MATLAB
538
26
function t = fieldnames(obj) % Fieldnames of a NIFTI-1 object % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: fieldnames.m 1143 2008-02-07 19:33:33Z spm $ if isfield(obj.hdr,'magic') t = {... 'dat' 'mat...
ce83873731805bcefbaaad9fd73ca0c3d44c6bf973a6a3dd735ec1916d15a5c2
MATLAB
538
18
%%**************************************************** %% mcpschur: compute schur matrix of HKM or NT direction %% for MCP and maxG problems. %% %% [schurmat] = mcpschur(X,Zinv,schurfun_par); %% %% Ak= -ek*ek'; %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last...
ef830f99dd7cb07eb7557916ada4ccf8813cc7dd862b23db551cf1a4e8c16409
MATLAB
538
34
function l = FractionRogueSpk(rg,tR,tC) dt = diff(rg); r = sum(dt<tR); if r==0 l=0; else nS = length(rg); %T = rg(end)-rg(1); %better approximation of "true" f.r. (?) fr = 1/median(diff(rg)); %a = r*T/(2*(tR-tC)*nS); a = r/(2*(tR-tC)*nS*fr); % delta = 1-4*a; % l =...
f40eeb039bceb695f6e948a80cdedd28a608bbe1e2cfab2ac352b451067f830d
MATLAB
538
19
function channelcmb = makeChannelCmb_(areaSeed, seedCh, areaTarget, targetChs) % odd rows: seed -> target % even rows: target -> seed nTarget = numel(targetChs); channelcmb = cell(nTarget * 2, 2); seedLabel = [areaSeed, '-', num2str(seedCh)]; for i = 1:nTarget targetLabel = [areaTarget, '-',...
5513225fc3728853f2389df4c88be685e6c81c61ea84a3e29609baf846a1094c
MATLAB
539
10
%CVX: Matlab 6 compatability functions. % This directory contains definitions for 'true' and 'false'. These % functions are used extensively in CVX, and are built in for MATLAB % 6.5 and later. For MATLAB 6.1 we supply these surrogates. It is % *very* important, however, that this directory NOT be placed in % ...
329c7e046adfa560c100ffd6e8e4de075a77d1427243b85dd7fccf3e3c874a33
MATLAB
540
26
% FIRFILT FIR filtering with zero phase distortion. % % matrix columns are filtered; % output is a column vector / matrix. % 19-Jul-02 ES % 27-jan-03 zero phase lag function Y = firfilt(x,W) if all(size(W)>=2), error('window must be a vector'), end if numel(x)==max(size(x)), x=x(:);...
41c1d9e33a8dbce1ccb63571600e050f0ec90738e17d0974ea3216e861778c42
MATLAB
540
21
close all; clear; clc; addpath(genpath('../../functions/')); subInfo = csvread('../../../subInfo/rid_sex_mDoB_yDoB_mExam_yExam_ageExam_dx_icv_bl.csv'); rid_dx = subInfo(:, [1 8]); ridList = rid_dx(:, 1); rid_viscode_examdate_mem_ef = CBIG_get_mem_ef(ridList, 0); indBl = strcmp(rid_viscode_examdate_mem_ef(:, 2), 'bl'...
e0bc510e494c666b9e38d3cf61e4a52911fd757c5adb81b51fbbb62dfa51fca3
MATLAB
540
15
function CSVfiletoNifti(dirtempschi001,Vatl,Datl) Datl(isnan(Datl)) = 0; indfordatout = unique(Datl); indfordatout(indfordatout==0) = []; csvfiles = dir([dirtempschi001,filesep,'*.csv']); for i = 1:length(csvfiles) outname = [dirtempschi001,filesep,csvfiles(i).name(1:end-4),'.nii']; P05 = csvread([dirtempschi00...
ecd77d3708c8f241bbbdc96e58e93f507389e9e08ec8aa6236de238118723838
MATLAB
540
24
function ea_openin(hobj,~,appname,handles) callingfig=hobj.Parent.Parent.Name; if strcmp(callingfig,'Lead Group Analysis') M=getappdata(handles.leadfigure,'M'); uipatdir=M.patient.list; if ~iscell(uipatdir) uipatdir={uipatdir}; end if ~isempty(uipatdir) uipatdir=uipatdir{get(handles...
07a14b0ffb4a9a710046c5701600842b632a6a2584c82a69432a36ee76760264
MATLAB
542
21
% Local Regression and Likelihood, Figure 5.6. % Author: Catherine Loader % % Cumulative Distribution Function % % This function uses cdfplot() from Matlab's add-on statistics toolbox. % % NEED: % predict should backtr by default? load geyser; fit = locfit(geyser,'nn',0.1,'h',1.2,'renorm',1); x = (1:0.01:6)'; z = pr...
3445453cd72975e03033eba2ebd59e660c2c7e1da4883e2f3d4afac91ff27254
MATLAB
542
14
function nirs = setOpticalProps(nirs, props) %SETOPTICALPROPS Fill mua/mus by region for a given wavelength. % props is a struct with region fields 1..5 each containing .mua and .mus (mm^-1) % Example: props(760).r(5).mua = 0.0170; props(760).r(5).mus = 0.74; etc. regions = unique(nirs.region(:)); for rid = regi...
9fd374f078f1453461bd6c524d4f4a10961d9c16b93fd105ffd9825941eb39ed
MATLAB
543
21
%% Figure 5 supp1 YOURDATAPATH = ''; % Load ROIs and PETHs data fileList = searchFilesRecursive(YOURDATAPATH, 'allROIs.mat'); load(fullfile(fileList.folder, fileList.name)) load('allenDorsalMap.mat'); % Using only cue-modulated henceforth allROIs = allROIs([allROIs.modCue] == 1); % Params smoothSD = 0.15; color = 'D4'...
77ab5cf90fa8679be2aa75a0c35458789662844b48313354f9ea5d402b16bd78
MATLAB
544
18
% Counts the number of connected triples in a graph % INPUTs: adjacency matrix % OUTPUTs: integer - num conn triples % Other routines used: kneighbors.m, loops3.m % Note: works for undirected graphs only % GB, Last updated: October 9, 2009 function c=num_conn_triples(adj) c=0; % initialize for i=1:length(adj) n...
027f37c364e2dbac235fd2a0480593794b82e0d20260d25199c5278e3392eba0
MATLAB
546
22
function y = unique_no_nan(x) % Unique() function that ignores NaNs in arrays and 'NA' in cellstr. persistent old_matlab if isempty(old_matlab) old_matlab=verLessThan('matlab','7.14'); end if old_matlab [y,ia,ic]=unique(x); [~,ind]=sort(ia); %Trick to get the original order in older matlab versions y=y...
cadc2f064b6f4caf3bc9716b2eeb9271ebb540246cb4ade9145b148e2fdec7af
MATLAB
546
25
function show_positionMask2d(yy) % Usage ... show_positionMask2d(out_str) if (nargout==0) [tmpname,tmppath]=uigetfile('*.*','Select PositionMask File to Open'); yy=[tmppath,tmpname]; disp(sprintf(' loading %s',yy)); end; if ischar(yy), load(yy), tmpvar=who; clear yy if exist('tmpname','var'), yy=ys; ...
d93e43bd28d8fa64c403ee4fa7201e98c4b021f15b0dde13eb82d6037276f0d9
MATLAB
546
18
function x = dodger(x,draw_data,dodge) %dodging avl_w=draw_data.dodge_avl_w; %Compute dodging and bar width dodging=avl_w*dodge./(draw_data.n_colors); %NEW DODGING if dodge if draw_data.dodge_fallback %No advanced dodging x=x-0.5*dodging*draw_data.dodge_n+dodging*0.5+(draw_data.dodge_ind-1)*dodging; el...
2dfdcbd3d6a29fe33995d6fcfdeeeb2a1caabb8a574678288945344033eb5f5a
MATLAB
548
8
function [sumintensity] = ea_diode_intensitypeaksdirmarker(intensity,angles) %% this function detects 'noPeaks' number of intensity peaks. peaks are constrained to be at 360°/noPeaks angles to each other. %% Function runs a noPeaks * (360°/noPeaks) array over the intensity-profile and finds the angle at which t...
631a04b6f81deb01e47ad1c8ed401a442906ad25391a02cdd95fe21dbf3f1ce9
MATLAB
548
29
function alpha = circ_axial(alpha, p) % % alpha = circ_axial(alpha, p) % Transforms p-axial data to a common scale. % % Input: % alpha sample of angles in radians % [p number of modes] % % Output: % alpha transformed data % % PHB 2009 % % References: % Statistical analysis of circular data, N. I. F...
0c7f3c3656a036613f54bdb2f08a58e951c097b8481ea57a819d824594ee0f77
MATLAB
549
26
function f = Wilcoxon_Rank_Test( x,y ,alpha); %UNTITLED ´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª % ´Ë´¦ÏÔʾÏêϸ˵Ã÷ Z=[x;y]; [z1,z2]=sort(Z,'ascend'); for i= 1:size(x,1) for j=1:size(z1,1) if z1(j)==x(i) X(i,1)=j; end end end end m=size(x,1); n=size(y,1); Ex=m*(m+n+1)/2; Varx=m*n...
b4440a7ef5a9450efd54309198fd83c3777a708f82434e5dab01e1a6bb1a7752
MATLAB
549
14
function varargout = Ent_MS_Plus(varargin) %ENT_MS_PLUS (deprecated) Use ent_ms_plus instead. % Ent_MS_Plus has been renamed to ent_ms_plus. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','Ent_MS_Plus:depr...
e6ddf94a46d6ef3237789073e219298f4de78bb128632af13d435ba3909d6449
MATLAB
549
15
function list = child_match(tree, uid, tag) mychildren = children(tree, uid); list = zeros(length(mychildren), 1); %allocate as many as there could possibly be, to avoid loop growing count = 0; for ch_uid = mychildren switch get(tree, ch_uid, 'type') case 'element' if...
f2bef46fc252ea0e931b08caeb7228a470f03e00383a7922c758a6c5aad33e0a
MATLAB
549
19
function [fxy fcorr] = crossrefract(rgx,rgy,tR,tC) % USAGE: % [fxy fcorr] = CROSSREFRACT(rgx,rgy,tR,tC) % % INPUTS: % % CROSSREFRACT computes the fraction fxy of rogue spike in the merged % spike trains. fcorr is an attempt to normalize it relatively to the % number of spikes in each individual spike train (no...
c4a24da2942f0c2a4dd0170940af8692b44e4f87b0b61d0380ee6112cd0ec50c
MATLAB
550
29
function [ node_num, node_dim ] = triangle_node_size_example ( ) %*****************************************************************************80 % %% GMSH_MESH2D_NODE_SIZE_EXAMPLE: sizes of node information for the example. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % %...
1ca60d22fb345656138b6f15f443c7c556e589d6c813dea1dc3733692e4f967a
MATLAB
551
25
function xm=mymode(y,nbins,nlook) % Usage x=mymode(y,nbins,nlook) if nargin==1, nbins=100; nlook=2; end; if nargin==2, nlook=2; end; if prod(size(y))==length(y), y=y(:); end; for mm=1:size(y,2), [nn,xx]=hist(y(:,mm),nbins); [tmpmax,tmpmaxi]=max(nn); xm(mm)=xx(tmpmaxi); if (tmpmaxi>nlook)|(tmpmaxi...
b05c1936c409938201276079fcafc33c1f79c19a9f0d4d886de7c9d6826ede1c
MATLAB
551
17
function [savedir]=ea_getfsstatesavedir(directory,vsname,fibersfile,seedfile,targetsfile,thresh,mode) % helper function to save fiber states % called from ea_cvshowvatdmri.m [~,fibersname,~] = fileparts(fileparts(fibersfile)); if size(seedfile,2)==2 sides='both'; else [~,sides,~]=fileparts(seedfile{1}); s...
5481ce1f9671ccb82350da8103d80b6545d5308b3573fbc7bc6f7d188952cfd5
MATLAB
552
27
function idx = makeUnionIndex_(axisVec, ranges) % Return union index of axisVec within n x 2 ranges. axisVec = axisVec(:); if isempty(ranges) idx = (1:numel(axisVec))'; return; end ranges = sort(ranges, 2); mask = false(numel(axisVec), 1); for i = 1:size(ranges, 1) l...
93c034d3bb432a6a92536a1791b45b2ebee5fcf3a254236e91774d2f793685b0
MATLAB
552
21
function [fname] = check_file_extension(fname, extension) % See also CLEAR_FILE_EXTENSION, ISFILEXTENSION. % % File: check_file_extension.m % Author: Ioannis Filippidis, jfilippidis@gmail.com % Date: 2012.06.22 % Language: MATLAB R2012a % Purpose: append desired file extension if absent % Copyri...
9c9ee7d53ca3e05654a6847709ce4e5e48289f8a695436e30448fc18bd7e094a
MATLAB
552
20
function [minC, maxC] = coor_extremals(C) % usage % [minC, maxC] = coor_extremals(C) % % input % C = cell matrix of nested cell/numeric matrices, with numeric or empty % matrices at the bottom nesting level, of coordinates. These belong % to different graphics objects. % % output % minC = mi...
a2607e36e04171056d4dfd9e02c55a19a5979ed373a94c6726bfc14810e9d27e
MATLAB
552
16
function tree = setfilename(tree,filename) % XMLTREE/SETFILENAME Set filename method % FORMAT tree = setfilename(tree,filename) % % tree - XMLTree object % filename - XML filename %__________________________________________________________________________ % % Set the filename linked to the XML tree as filename. %_...
979fef23e1b8136181d177e9240a01a05a8a69fb229be027a4926786e3bf6aca
MATLAB
553
16
function names = fieldnames(this) % Fieldnames method for GIfTI objects % FORMAT names = fieldnames(this) % this - GIfTI object % names - field names %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: f...
b015e44d1f9c659f5f978216cb6d561d241cf88f518455b713ff3a1d1303bf50
MATLAB
553
23
% Splits a string into a cell array of strings. % % Input arguments: % string: % a string to split into a cell array % adjoiner: % string separating each neighboring element % % See also: strjoin % Copyright 2008-2009 Levente Hunyadi function strings = strsplit(string, adjoiner) if nargin < 2 adjoiner = spr...
25d59208b86fc87318298f7f3c0ca283599fb8ab53285ee5cc835cf1cfbe0c29
MATLAB
554
15
%% Convenience Wrapper for the MPRWorldCoordinate Class by Florian Bernard % % Andreas Husch % Centre Hospitalier de Luxembourg, Dept. of Neurosurgery / % University of Luxembourg - Luxembourg Centre for Systems Biomedicne % 2017 % mail@andreashusch.de, husch.andreas@chl.lu function [mpr, oc] = createSimpleMPRWorldCoor...
a3fdae42e5472061d3bb99d4ab48c329af66c9f425de19f4c9f15ecc4c11535f
MATLAB
554
21
function [allROIs, subpops] = assignSubpops(allROIs, subpopField) % Hard cluster by assigning subpop identity with largest log prob to each % neuron if nargin < 2 subpopField = 'lpSP'; end fields = fieldnames(allROIs); subpopNames = fields(cellfun(@(x) contains(x, subpopField), fields)); [allROIs.subpop] = deal(...
2971cb9bb207baada4c4a40afe4409f35a538fee315d43f9ff8a1f0d1cfd43bb
MATLAB
555
22
function cvcpt = cvcompute(mat, weights, foldid, nlams) % Internal glmnet function. See also cvglmnet. % Compute the weighted mean and SD within folds, and hence the se of the mean wisum = accumarray(foldid,weights); nfolds = max(foldid); outmat = NaN(nfolds,size(mat,2)); good = zeros(nfolds,size(mat,2)); mat(isinf(...
314b0769e8b792c5daf40cbffabc85264abb17de5152742ff1dae850420387c2
MATLAB
555
20
function [] = print_rhats(stats, varName) % Prints number of rhat values exceeding threshold for a rhat_thr = 1.1; rstats = eval(sprintf('stats.Rhat.%s', varName)); exceeding = rstats(rstats > rhat_thr); % Logging format string format_string = strcat( ... '---> %s: %i [', ... repm...
21e01c778a9807049e8956e114d4c9021c303fff912e450742e41ca8207a0887
MATLAB
556
22
function [rs]=calcRadius6_up(im,rmask_struc) % Usage ... [rs]=calcRadius6_up(im,rmask_struc) check_flag=1; for mm=1:size(im,3), for nn=1:length(rmask_struc), %disp(sprintf('[%d,%d]',mm,nn)); rw=rmask_struc(nn).rw; dx=rmask_struc(nn).dxy; ctr=[rmask_struc(nn).aloc(1) rmask_struc(nn).aloc(2)]; ang=rmask_struc...
601c037b491ed6b736712b8e195e71bc7fd3475e7665548d9369d73bd8c54e74
MATLAB
556
22
% Local Regression and Likelihood, Figure 10.1. % % uses 'module','allcf' rather than 'deriv',[1 1] to get the % second derivative coefficient % % Author: Catherine Loader load geyser; a = [0.5 0.75 1]; f=['a','b','c','d']; for (i=1:3) figure('Name', sprintf( 'figure10_1%c', f(i) ) ); fit = locfit(geyser,'deg',2...
8facedf139c1f59dd2ebde5f2e2d264bf03ecf7697177ca0e69a244eb7244121
MATLAB
556
21
function a = reshape(b,varargin) % Overloaded reshape function for file_array objects % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: reshape.m 1143 2008-02-07 19:33:33Z spm $ if length(struct(b))~=1, error('Can only resha...
9b3f65049cb0d52bb21b88159515e6bb6802e69a5b1a54ac8ff8774cf897a9d3
MATLAB
556
18
function idx = CBIG_MMLDA_find_array_in_array(A, B) % idx = CBIG_MMLDA_find_array_in_array(A, B) % % Find index of array A in array B in order. This function only works for vectors. % % Input: % - A : input array A with shorter length % - B : target array B with larger length % % Output: % - idx :...
0b931943aa6fce038c4b82f18c225e54d2a843ab7657bfde50f3a562b6ea380e
MATLAB
557
13
function [base,wind1,odour,wind2]=poolfluoroverROIs(base,wind1,odour,wind2,avgfluorperiod,k) fn=fieldnames(avgfluorperiod);%gets the field params - base,wind1,odour,wind2, directions=fieldnames(avgfluorperiod.(fn{1}));%one two three four five for p=1:numel(directions) base.(directions{p})(k,:)=avgfluorperiod.base...
52cc9ac7a875f3ff0e165a2f1e255a421d86cb13c01f5e3a081b16944fee0bd4
MATLAB
557
23
function convnfft_install % function convnfft_install % Installation by building the C-mex file needed for convnfft % % Author: Bruno Luong <brunoluong@yahoo.com> % History % Original: 16/Sept/2009 arch=computer('arch'); mexopts = {'-O' '-v' ['-' arch]}; if ~verLessThan('MATLAB','9.4') R2018a_mexopts = {'-R2018a...
8a051a7b8ee486323df423147d2e673294b2d4612a27e0684857e11abad6deae
MATLAB
557
25
function ea_convert_atlas2segmask(gm_mask, segmask_file, threshold) % convert probabilistic GM mask to segmaks for OSS-DBS % IMPORTANT: all other tissue is assumed WM, no CSF! prob_gm_mask = ea_load_nii(gm_mask); % initialize Segment_GM_WM_CSF = prob_gm_mask; % change the name Segment_GM_WM_CSF.fname = segmask_file...
ba926a6a34bff6bdf5b675c1a92f48c84094409d98d6ce3af641d4663a0238a4
MATLAB
557
28
%%********************************************* %% mytime: %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%********************************************* function [hh,mm,ss] = mytime(t) t = round(t); h = floor(t/3600); m = floor(rem(t,3600)/60); s ...
f74aaf9afbf2e6c345c40a183725c6d1b1af5459caebf6343c7e47bbd6e42e27
MATLAB
557
27
% HTMLREPORTS % Version 0.1 Nov-22-2013 % % Summary % % Generate HTML reports directly from matlab % % Description % % Generate HTML reports containing text, values, and figures directly % from Matlab. Reports can be styled using CSS. % Tags % % HTML, Reprots % % Included Files % % ...
18ec6742a05425afc1eaffdc25b37bad05de846ef7ca9a793af8dbc117c88122
MATLAB
558
37
function [V,E] = quadinv(N,NW) % calculates the quadratic inverse eigenvectors % % Input % N: number of samples % NW: time-bandwidth product % % Output % V: The quadratic inverse eigenvectors % E: the quadratic inverse eigenvalues x = 0:N-1; indx = find(x); y = ones(size(x))*(2*NW/N)^2; y(indx) = (sin(2*pi*NW*x(ind...
4fdebea5d5d9e536923ddad50d84155c101eda00adffc089988d068ad12f478c
MATLAB
558
19
function [n, d] = getHesseLineForm(mdl) %GETHESSELINEFORM computes the unique orthogonal unitary vector %corresponding to a given line equation. % [n, d] = getHesseLineForm(mdl) % INPUTS % mdl - 2x1 array containing the slope and y-intersection of a linear % equation in the form y = m·x + b % OUTPUT...
f948b2a023775a89f9f4a73e3c832e5d58555583e679baa731af3bccd0f61048
MATLAB
558
20
function output_mtx = CBIG_MMLDA_cellstr2matrix(input_cell) % output_mtx = CBIG_MMLDA_cellstr2matrix(input_cell) % % Tranform a cell array to matrix. % % Input: % - input_cell : input cell string % % Output: % - output_mtx : ouput matrix % % Example: % input_cell = {'1', '2'}; % output_mtx = CBIG_MMLDA_cel...
1acd983958545404c6dace9458e777821dcbc2ffc745facf492796b84e6ecac3
MATLAB
559
22
%create some obviously unimodal and bimodal Gaussian distributions just to %see what dip statistic does % Nic Price 2006 Cent1 = ones(1,9); Cent2 = 1:1:9; sig = 0.5; nboot = 500; tic for a = 1:length(Cent1), xpdf(a,:) = sort([Cent1(a)+randn(1,200) Cent2(a)+randn(1,200)]); %allocate 200 points in each...
aeb44b51f622428ded1518e67978755d677fdb16bf8f1eaa549fd369f0fec352
MATLAB
559
17
function obj=geom_vline(obj,varargin) % geom_abline Display vertical reference lines in each facet % % Example syntax: gramm_object.geom_abline('xintercept',1,'style','k--') % See geom_abline for details p=inputParser; my_addParameter(p,'xintercept',0); my_addParameter(p,'style','k--'); my_addParameter(p,'extent',2); ...
cc64491c0cc425e301e9b2ed50f2dbed5255215f8565f66e9ca8d9760637a999
MATLAB
559
16
function [n, ts, sv] = plx_event_ts(filename, ch) import CMBHOME.PLX2Mat.* % plx_event_ts(filename, channel) Read event timestamps from a .plx file % % [n, ts, sv] = plx_event_ts(filename, channel) % % INPUT: % filename - if empty string, will use File Open dialog % channel - 1-based external channel number % ...
0786cd777937de043f1c3198ac88b378470aa0c02e5f8d0cf273f70646e163b4
MATLAB
560
14
function varargout = Surr_Theiler(varargin) %SURR_THEILER (deprecated) Use surr_theiler instead. % Surr_Theiler has been renamed to surr_theiler. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','Surr_Theile...
6a0ad16c7a8a09d8f9bd0d6ae21b11baf31e89702fa4fe5c415d5ffad1b86282
MATLAB
560
14
function varargout = Ent_Weighted(varargin) %ENT_WEIGHTED (deprecated) Use ent_weighted instead. % Ent_Weighted has been renamed to ent_weighted. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','Ent_Weighte...
87402d65ce27c4a4aa6970345df3ba26b0de0d4156b9f80d7931d27c2c21070e
MATLAB
560
13
dataset = 2; if (dataset==1) stopfile = '..\kdd\NYTimes\stopwordlistNYTimes.txt'; load 'nips_stream'; % WS DS WO; [ WW , WO , WS , DS , SI , ORIGWSPOS ]=stream_to_collocation_data(DS,WS,WO,stopfile); save 'nipsbagofwordsfromstream' WO DS WS ORIGWSPOS; elseif (dataset==2) stopfile = '..\kd...
a8e4c59749096d7949506b62011d615d6a30f42b6ccb6cfe44bae692c0e059aa
MATLAB
560
14
function varargout = Ent_Symbolic(varargin) %ENT_SYMBOLIC (deprecated) Use ent_symbolic instead. % Ent_Symbolic has been renamed to ent_symbolic. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','Ent_Symboli...
ab090acb972028df049fad2abdd6c0311aa6a74bdae801e20b526beefd2ca4b3
MATLAB
560
14
function varargout = AMI_Stergiou(varargin) %AMI_STERGIOU (deprecated) Use ami_stergiou instead. % AMI_Stergiou has been renamed to ami_stergiou. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','AMI_Stergio...
b34cb787284d081ff175ba7470669214ed4d7a0618c1cd77b74a06ab04dfde08
MATLAB
560
18
function C = maplecolor(X,Y,Z) %MAPLECOLOR Generates truecolor data in the default Maple color scheme. % C = MAPLECOLOR(X,Y,Z) generates an M-by-N-by-3 matrix when each of X, Y, % and Z are M-by-N. The resulting truecolor matrix maps [X,Y,Z] to % [R,G,B], scaled to soften the colors. C = cat(3, X, Y, Z);...
94c719b1d94acf995335e16be4729d8e63d55709a2fe5f94e925bb8d0367a000
MATLAB
561
20
function pluginName = defaultVideoIOPlugin %pluginName = defaultVideoIOPlugin % Returns the name of the default videoIO (videoReader/videoWriter) plugin. % The videoReader and videoWriter constructors will use the returned plugin if % none is specified. % % SEE ALSO: % buildVideoIO % videoReader % videoWrit...
df8c3060dd18fcb5b2c77e7eddb0ae321e560f3ccf82dd7e988f5a400a50d33d
MATLAB
561
22
function [bbox, BW] = ea_autobbox(input, margin) % Calculate the minimum bounding box and binary mask of the nifti image if nargin < 2 margin = 5; % add margin to the calculated bounding box, unit in voxel end nii = ea_load_nii(input); img = nii.img; th = multithresh(img); BW = img > th; [i,j,k] = ind2sub(size...
87f7fdb70ad2976aafc5c3a733e6ef1b3cb36cc6fb57b08c78c860d524c13cfd
MATLAB
562
17
function p = parent(tree,uid) % XMLTREE/PARENT Parent Method % FORMAT uid = parent(tree,uid) % % tree - XMLTree object % uid - UID of the lonely child % p - UID of the parent ([] if root is the child) %__________________________________________________________________________ % % Return the uid of the parent...