sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
168098c6fcc17e353dff74ac67eec0a1f4626ae81b7a47c60adeb88e473ffb37
MATLAB
751
19
function h_takeNoteForROI3(handles) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); roi = findobj(handles.imageAxes, 'Tag', 'annotationROI3', 'Selected', 'on'); if length(roi)>1 error('more than one ROI selected! this should not happen!'); elseif length(roi)==1 %roi c...
17ad234b60ee879ccf47d7269135eb281d47ab1daac63d24b838ec7279489c40
MATLAB
751
36
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % destroys all axes and associated % UI control elements in self.handles.ax function destroyAllA...
6555456578370f933dc8d1fccc5d471e7edecea0b09014c2244562bad61472a0
MATLAB
751
21
function [fx] = f_Qlearn_gammaLR(x,P,u,in) % evolution function of q-values of a RL agent with dynamic learning rate % [fx] = f_Qlearn_dynLR(x,P,u,in) % Here, there are only two q-values to evolve, i.e. there are only two % actions to reinforce (2-armed bandit problem). % IN: % - x_t : q-values and learning rate % ...
8706c49bcaa89ec50e371d18118c76b902f462c553e1259c56911d2e5ddfeb46
MATLAB
751
26
function [wl,wr] = fdct_wrapping_window(x) % fdct_wrapping_window.m - Creates the two halves of a C^inf compactly supported window % % Inputs % x vector or matrix of abscissae, the relevant ones from 0 to 1 % % Outputs % wl,wr vector or matrix containing samples of the left, resp. right % half of...
98d3ab636c00049e2af4d239fab74c1a4dd7732c5373bea1031ea1bd31da9362
MATLAB
751
30
%% Reproduced fig 5.3 from Bishop's book % %% % This file is from pmtk3.googlecode.com fns = { @(x) x.^2, @(x) sin(x), @(x) abs(x), @(x) (x>0) }; for fi=1:length(fns) fn = fns{fi}; setSeed(0); N = 50; X = linspace(-3, 3, N)'; y = fn(X); options.Display = 'none'; options.MaxIter = 100; lambda = 1e-5...
01d5914f2a000ced9f0e2a8d08d05029fbe23f64f4c6f19385f541d1312467a3
MATLAB
752
32
function r = struct2rowsexport(s,varargin) % r = struct2rowsexport(s,varargin) % Optional PVs: % - nansAsStrings: If true, numeric scalar NaNs are replaced with the % string 'NaN'. Defaults to false. nansAsStrings = myparse(varargin,... 'nansAsStrings',false); assert(isstruct(s)&&isvector(s),'Expected d to be a...
062b126fa583216c3a50918067c09b2f9d3610cb19f7dafb16c292bafa6067d4
MATLAB
752
31
function Qdec = num2Qdec(M,Vars) % Qdec = num2Qdec(M,Vars) % % Converts numeric matrix M to two dimensional cell string array Qdec. % % Input % M: Numeric matrix. % Vars: One dimensional cell string array with the name of the Qdec % variables corresponding to the columns of M. % % Output % Qdec: Two dimensional cell s...
35db39a246ee3db2d566de3f979052cde0453541689eebf2a86904276052b803
MATLAB
752
21
function [FileList]=CurrentVariableMemoryUsageTracker(Details,CutOff) %use CurrentVariableMemoryUsage(whos,CutOff) in bytes warning on all warning off verbose warning off backtrace for i=1:length(Details) if Details(i).bytes>CutOff warning('============================...
3a5cd26b6474447b3d2e117bc602556de835a06fd9a7caa645557eb27221352c
MATLAB
752
29
function create_ds_SegmentsHeadMotion (ds_name, x, period, output) % ------------------------------------------------------------------------- % Create new MarkerFile.mrk % Check if markers are given as a vector if ~isvector(x), error('Markers should be a vector.'); else x = reshape(x,[],1); end % Check if ...
7341c09b142c4593e3bbc7aec6cc5538958dd5ced82a4caf47ba3f0d7eddf908
MATLAB
752
17
%% 统计特征 | statistical features %% 一阶差分平均值 | Mean of First Difference/Mean Curve Length(MCL) % 描述了时域信号强度的变化,是一种量化信号复杂性的简单度量,在分析和经验上与Katz分形维数相关,上述两者是同一个东西,可用于区分不同被试 % X: single channel EEG signal (either a row vector or a column vector) %% Reference % [1] Yahyaei, R., and Esat Özkurt, T. (2022). Mean curve length:...
c99808897656c84269df1469c27858722a796883f33940861c51c9822d118ac2
MATLAB
752
27
classdef FrameDecimation < handle methods (Abstract) dec = getDecimation(obj,labelerObj) end methods function [str,decval] = getPrettyString(obj,labelerObj) assert(isstruct(labelerObj), 'labelerObj, despite the name, must be a struct') ; decval = obj.getDecimation(labelerObj); if decval...
3e9cd4a8a9c8db7b5f11fc5e67eace2c7a9d684fbfd5da598ffd98b02e195e01
MATLAB
753
23
function res = easyStruct(fieldName,fieldVal) evalstr=['res=struct(']; %% if certain field is double defined, delete the old one deleteIdx= []; fieldN = unique(fieldName); if length(fieldN) ~= length(fieldName) for i = 1:length(fieldN) if sum(strcmp(fieldName,fieldN{i})) > 1 idx = find(s...
216cb063254e79b9c9d9e126e966b091e19aecec211db9c9c4023f2433e57c3a
MATLAB
754
17
measResults = imgPair.measResults; xmin = 4;%in pixels xmax = size(measResults,1); xvals = [xmin:xmax]; notNaNindices = xvals(~isnan(measResults([xmin:xmax],3))); xvals = notNaNindices * imgPair.info.pixelWidthExpanded/imgPair.info.expFactor; edges = 0:.5:80; [bincounts] = histc(x...
3ee2d7740a5f76bfcc60850e0d7630df17072e9f8eaba720c614afbd6e81c3b9
MATLAB
754
28
function [lblDate,lblCat] = findCat(flyID,lblDate,lblCat) flyID = unique(flyID); assert(isscalar(flyID)); lblDate = cellstr(lblDate); lblDate = unique(lblDate); ndate = numel(lblDate); if ndate>1 fprintf('%d, %d dates: %s. choosing lowest, %s.\n',... flyID,ndate,String.cellstr2CommaSepList(lblDate),lblDate{1});...
5e5674008e4ca4d41f73bedc17ebb7b9b7ac5638225da1cb9f9161f1aeb8a192
MATLAB
754
28
function clf = clfDecTree( p, varargin ) % Wrapper for treefit that makes decision trees compatible with nfoldxval. % % USAGE % clf = clfDecTree( p, varargin ) % % INPUTS % p - data dimension % varargin- params for treefit, ex: 'splitmin'',2,'priorprob',ones(1,n)/n % % OUTPUTS % clf - model ready to be tr...
67bc8352fb799775f3f14267fde9b61e44b86462e1df8d6e24a3b25d4cecc1be
MATLAB
754
21
function [F, J] = funfitDoGModelParams(params, xvals) %UNTITLED Summary of this function goes here % Detailed explanation goes here %========================================================================== outparams = params.outparams; %========================================================================== % ge...
934dd9ba5798e8089fb232f7b4a97ecfeb1145dd047864423a88f9a2db2a39fd
MATLAB
754
22
function [brainMask,subjectMasks] = afxLoadMasks(fmasks,fbrainMask,XYZmm) fprintf(' Loading masks ... ') % load (individual) tpms and resample to func space (trilinear interpolation) % if necessary subjectMasks = []; parfor i = 1:size(fmasks,1) subjectMasks(:,i) = afxVolumeResampl...
82de4725fbe03552b4ada3b03600ddad6ecd33a28584b0debb02315340b371a9
MATLAB
755
21
function ImageArray_WithStim_DeltaGFPn = Norm_BCDeltaGFP(ImageArray_WithStim_DeltaGFP, ImageArrayRegBC_WithStim, ImagesPerSequence) NumOfSequences = size(ImageArrayRegBC_WithStim, 3) / ImagesPerSequence; warning off all for SeqNumber=1:NumOfSequences FirstIndex = (ImagesPerSequence * (SeqNumber - 1)...
953b6dfc3c6d819b43f55d3b7462f3b1216171c1dae29b0d8331d6d51c52957b
MATLAB
755
35
%% fnc_getSobolSetMatlab: give a set of sobol quasi-random by using Matlab % implemented functions % % Usage: % X = fnc_getSobolSetMatlab(dim, N) % % Inputs: % dim number of variables, the MAX number of variables is 40 % N number of samples % % Output: % ...
a920ba45b3cba6506a5f6d09d2bd15b484b681c171cfe0394f7dca8f787dd40b
MATLAB
755
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(connectivityda...
d2d65dfd2e9741dfc6fa05ceb7d174c6211d04869863b7e115bd52a21f7ab4db
MATLAB
755
22
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Withening the EMG signal % Input: % signal: row-wise signal % E = full matrix E whose columns are the corresponding eigenvectors % D = diagonal matrix D of eigenvalues EIG(A) produces a diagonal matrix D of eigenvalues % covarianceM...
4b66bbdf906ee986fc509c20ae1b7df2c3c85147227aff76e87892ea90dddae1
MATLAB
756
27
function CPD = noisyOrCpdCreate(leakI, parentsI) %% Create a noisy OR CPD % %(from BNT) % A noisy-or node turns on if any of its parents are on, provided they are % not inhibited. The prob. that the i'th parent gets inhibited (flipped % from 1 to 0) is parentsI(i). The prob that the leak node (a dummy parent % that is ...
88c0024853029d8bf233d1ef1718620289092165ab0af98ef898eb7d2ef3cedc
MATLAB
756
32
% RSKELF_LOGDET Compute log-determinant using recursive skeletonization % factorization. % % Typical complexity: O(N) in all dimensions. % % LD = RSKELF_LOGDET(F) produces the log-determinant LD of the factored % matrix F with 0 <= IMAG(LD) < 2*PI. % % See also RSKELF. function ld = rskelf_...
a2940ea0170fa425b76bcc5f8d660e535ad49cb33a96204268216d27b1eedf94
MATLAB
756
22
function s = secondstr(seconds, format, minFields) if nargin == 2 minFields = 0; end switch format case 0 s = sprintf('%.2f', seconds); case 1 if seconds < 60 && minFields < 2 % seconds s = sprintf('%.2f', seconds); ...
d9ff4b1af1b50e409f47f3ae721d3843d87068de0caa30f47c12231179f23f29
MATLAB
756
26
function m2 = mapKeyRemap(m,keyOrig2New) % Remap keys of a containers.Map % % m: containers.Map % keyOrig2New: containers.Map. keyOrig2New(oldKey)==newKey where oldKey and % newKey are of the type m.KeyType. keyOrig2New must contain all keys of % m. % % m2: new containers.Map. For each key in m, knew=keyOrig2New(k...
b36b8ba037b7361a62a2f671da22d0da54bbc7b752d494890008812808c2f737
MATLAB
757
28
function positions=remove_video_noise(targets, timestamps) % DB_Nov '18 % Uses targets provided by Nlyx to plot all the x and y detected by the % software during recording (including both LEDs light position and other % sources of noise picked up by the software). positions.x=[]; positions.y=[]; positions.timestamps=...
bbf6875fb6c1988cd43e0dfd3710c6a548bc3bf1f82963eba8a9e117d7a812aa
MATLAB
757
18
function args = get_args_set_default(cell_with_args,varargin) n = numel(varargin); assert(mod(n,2)==0 ,'get_cell_set_default :: varargin must have pairs of arguments and values'); assert(iscell(cell_with_args),'get_cell_set_default :: cell_with_args must be a cell with pairs of arguments and value...
d3ff32081473acff36f0e55dc7afb2d13da97440bbfe72362a93e9e31793b746
MATLAB
757
18
function args = get_cell_set_default(cell_with_args,varargin) n = numel(varargin); assert(mod(n,2)==0 ,'get_cell_set_default :: varargin must have pairs of arguments and values'); assert(iscell(cell_with_args),'get_cell_set_default :: cell_with_args must be a cell with pairs of arguments and value...
e309497c308ff1c2e0b5f378bc2b8a9db6cbdfe0da52beaaed3de56dfc0e4157
MATLAB
757
15
function [Y_grayMatter_mask,V_grayMatter_mask,... Y_whiteMatter_mask,Y_CSF_mask,... grayMatterMask_eroded,whiteMatterMask_eroded,csfMask_eroded] ... = TLmakeMasks(FreeSurfer_segmentation_Atlas_path) [Y_grayMatter_mask,V_grayMatter_mask] = TLmask(FreeSurfer_segmentation_Atlas_path); Y_wh...
a37a01c62c6eb447f216fc1aba2fa8a7cdb5637480d6c2d5a912c87937fe9545
MATLAB
758
43
clear clc close all %%% (generated by number_sessions_per_rat.m) load data/numsessions_all_rats rat_list=rats(find(numhits>=100000)); for iii=1:length(rat_list) ratto=rat_list{iii}; [d_shap1(iii),f_shap1(iii)] = plot_logistic_regression(ratto,'half1','slope',0,0,0); [d_shap2(iii),f_shap2(iii)]...
a46d8d1191a68673d850d884b187f8f60b2377b91d6ce6d4e44b6ea103f13ffd
MATLAB
758
45
% Point Distribution colors = 'brgkcm'; if ~exist('n_ima')|~exist('fc'), fprintf(1,'No calibration data available.\n'); return; end; check_active_images; if ~exist(['ex_' num2str(ind_active(1)) ]), fprintf(1,'Need to calibrate before analysing reprojection error. Maybe need to load Calib_Results.mat file.\...
eb245cabfc76933838524eada475c90a40320746d65fed277f174ee32081eeae
MATLAB
758
21
function C = cropt( T, x, y, z ) % CROPT Crop a tomogram % INPUT: % T - input tomogram % i = [li hi] - range for coodinate i % OUTPUT: % C - output cropped tomogram % % See also: % % AUTHOR: Antonio Martinez-Sanchez (an.martinez.s.sw@gmail.com) % REFERENCES: % [1] Martinez-Sanchez, A., et al. A...
586d791bd0fffebfb18490fa1b5a77a497c01d22e3358ae897dd3f35290a2dba
MATLAB
759
28
%% Vector Quantization Demo % %% % This file is from pmtk3.googlecode.com setSeed(0); loadData('clown'); % X is 200x320 image figure; imagesc(X); colormap(gray); title('original') printPmtkFigure('vqDemoClownOrig'); [nrows ncols ncolors] = size(X); data = reshape(X, [nrows*ncols ncolors]); % data(i,:) = rgb value for...
b1dbe98a46bda6023d66dfd336cfdd858cf066786e5d313115a0cdbd41523eb8
MATLAB
759
22
scanner = 1; % disable this to test the code outside the scanner global t0 if scanner outportb(890,32) % sets pin for tristate in base+2 to up state. This allows to read from the port %at the beginning of your script, include these lines: I never understood exactly what they do, but you %need them...
b37da51be439684bccfe30d027f6394dcf7d2213f7ab984805ed64c9ad9e3689
MATLAB
759
35
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} % parseGuid: % Parses a Microsoft encoded GUID from bytes % function guid = parseGuid (guidBytes) guid = strrep(sprintf(... '%2x%2x%2x%2x-%2x%2x-%2x%2x-%2x%2x-%2x%2x%2x%2x%2x%2x',... guidBytes(...
b49a39244d1c1bfda0f23294b9680196ea636ecf1df417160dc58d05c9d7156f
MATLAB
759
30
function [xn,alpha] = linesearchSimple(f, x, p, fx, gx, sigma, alphamin) % % Uri Ascher % % line search: given current iterate x and direction p, % find alpha in [alphamin,1] such that xn = x + alpha*p % gives sufficient descent in f, as specified by sigma. % Upon return, if alpha <= alphamin then failure % This file ...
bf0d21c6a2e61c77063ff9de33c3b65311e12f48a4a4847fe159987c95377a7c
MATLAB
759
22
% Boston housing data from UCI repository data = load('housing.txt'); X = data(:, 1:13); % feature 4 is binary (1 = close to charles river, 0 otherwise) y = data(:,14); % cts [n d] = size(X); seed = 0; rand('state', seed); perm = randperm(n); X = X(perm,:); y = y(perm); istrain = [ones(1,300) ze...
d367d5552cea92fc4489506a00d6b991bb115f88d0f41178af37525f481394b1
MATLAB
759
25
function r = reshapeTTest(t, sz) sz = sz(:)'; r = t; r.h = reshape(t.h,sz); r.hFDR = reshape(t.hFDR,sz); r.p = reshape(t.p,sz); r.t = reshape(t.t,sz); r.Cohen_Mahal = reshape(t.Cohen_Mahal,sz); r.effsz = reshapeLines(t.effsz,sz,'3darray'); if ndims(r.effsz) == 3 r.effsz = mea...
e3b1ddd506c6e7b381e63a229a681edf8d6588678a92890584d65039c27c128f
MATLAB
759
14
%% 微分熵 | differential entropy (DE) % 微分熵实际上是香农熵在连续信号上的推广,微分熵并不像上文单指一种频带分段方法,而是对特征附加的非线性变换,尤其在频域能量特征中效果显著 % 简化计算:直接对能量特征求log % X: single channel EEG signal (either a row vector or a column vector) %% Reference % [1] https://blog.csdn.net/zhoudapeng01/article/details/108596687 (theory) % [2] https://blog.csd...
71c81e492dfa31e61173257ffab2706106b8e3f67a05529863aa4d185038abb2
MATLAB
760
29
function figSetPosAPTDefault(hFig) % figSetPosAPTDefault(hFig) % % Default position is centered on primary display, with original size if % primary display is big enough to accomodate; otherwise smaller/scaled to % primary display size. gr = groot; units0 = gr.Units; gr.Units = 'pixels'; scszPx = gr.ScreenSize; gr.U...
7e097ee3dc2ba1aa2034a3c6c25fc9c45b094f87821a611ca9fbee7a8dbce7d0
MATLAB
760
52
%% plot(sort(V2-V1)) %% Volumes [~, id1] = sort(V1); [~, id2] = sort(V2); subplot(1,2,1) % Sorted by V1 plot(sort(V1)); hold on plot(V2(id1)) legend('V1', 'V2') title('Volumes, Sorted by V1 ') xlabel('Sorted cell index') ylabel('Volume, um^3') grid subplot(1,2,2) % Sorted by V2 plot(V1(id2)) hold on plot(sort(V2));...
8246441243153c8a09cf93e31c55e54ca23831affd8865ffee6ecbce96de8742
MATLAB
760
29
function Y = gampdf(X,A,B) %assert((isequal(size(A),size(X)) && isequal(size(B),size(X))),'X, A and B must be of common size or scalars'); sz = size(X); Y = zeros(sz); k = find(~(A > 0) | ~(B > 0) | isnan(X)); if any(k) Y(k) = NaN; end k = find((X > 0) & (A > 0) & (A <= 1) & (B > 0)); if any(k) if isscalar(...
f11941d4848d9b7addb3ae4fd0104b387d6f39b3b53ce368486eb6f4f15a56e3
MATLAB
760
21
function motion_skip = CBIG_ABCD_proc_load_motion(tsvfile,skipframes) % motion_skip = CBIG_ABCD_proc_load_motion(tsvfile,skipframes) % % This function load the ABCD motion tsv file into a matrix and discard the first a few frames % % Inputs: % - tsv_file: % Path of the ABCD motion file % - skipframes ...
09c06c85eec87ae10d907afe72cc8494a6b38ad1bd246a3ceb22c09c8e14d9f3
MATLAB
761
17
% This script loads mesh data into the MATLAB workspace. The data include % surface meshes and the potential integrals. It also loads the previous % solution (if exists) % % Copyright SNM/WAW 2018-2020 %% Define EM constants eps0 = 8.85418782e-012; % Dielectric permittivity of vacuum(~air) mu0 ...
159dede4c9bf83d2c2da943196e3752cc690ff699843c964610f3d4c748058ac
MATLAB
761
28
function hh = plotmarkers(h, marker, col, frac) % add the specified marker to the figure handle at a sparse set (frac) of locations % Example usage %figure(1); clf %h1 = plot(1:1000, 'k-', 'linewidth', 3); hold on %hh1 = plotmarkers(h1, 'o') %h2 = plot(1000:-1:1, '-'); %hh2 = plotmarkers(h2, 's', [1 0.5 0.25], 0.05) %l...
3a165cb6d2f276b2b13d7d8cbbb01b9aa5e86b808f4e053557b2880372bcea8c
MATLAB
761
43
function LAN = lan_add_elec(LAN,elec_ind,chanloncs ,interp) if nargin <3 interp=true; end LAN = lan_check(LAN); labels = LAN.tag.labels; labels{end+1} = 'PHANTOM'; mat = LAN.tag.mat; i_l = length(labels); elec_ind = sort(elec_ind); for e =elec_ind r = 0; for t = 1:LAN.trials e = e+r; ...
48c8c97b55e577e4395cbecc333dd5198273343d7cd3f351364a8a5d92ba18ea
MATLAB
761
33
function traceAB = CBIG_MFMem_rfMRI_Trace_AXB(A,B) %------------------------------------------------------------------------ % traceAB = CBIG_MFMem_rfMRI_Trace_AXB(A,B) % % This is a function to caculate y = trace(AB) % % Input: % - A: matrix A % - B: matrix B % % Output: % - traceAB: trace of AB % % Ex...
82132859ccee1267709a25a87cc4658ff31bb1212851e3b82d63ae1ec0905769
MATLAB
761
43
function [pnt, tri] = read_vtk(fn) % READ_VTK reads a triangulation from a VTK (Visualisation ToolKit) format file % Supported are triangles. % % Use as % [pnt, tri] = read_vtk(filename) % % See also WRITE_VTK % Copyright (C) 2002, Robert Oostenveld % % $Id$ fid = fopen_or_error(fn, 'rt'); npnt = 0; while (~npnt)...
8f21c6d2e13b4d8465521a3f095b8ae7057a0b5c59c434a55995d814dbc3f527
MATLAB
761
21
function menu_fieldtrip(handle, cfg, allowsubplot) % MENU_FIELDTRIP adds a FieldTrip-specific menu to a figure. % % See also MENU_ABOUT, MENU_PIPELINE if ~allowsubplot && numel(findobj(gcf, 'type', 'axes')) > 1 % do not add a menu if there are multiple axes, i.e. subplots % these may contain different data struct...
1376eac33f2d40ca827cd170ad67ea2bb8bcc0e7bfbab55bd536904fb8fb5707
MATLAB
762
42
function I = bwrotate(I,theta,iscleanup) % get out of degrees theta = theta*pi/180; % find all 1's in the image [y,x] = find(I); x = x(:); y = y(:); n = length(y); % rotation matrix R = [cos(theta), sin(theta), -sin(theta), cos(theta)]; % center of rotation [nr,nc] = size(I); mux = nc/2; muy = nr/2; % ...
345a6d3a2e3c5425aa6a4af1752877a8fc52cf2bd7f1bbf42c6291cca8c82acb
MATLAB
762
37
function varargout = dim(varargin) % Format % For getting the value % dat = dim(obj) % % For setting the value % obj = dim(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id$ if nargin==2, varargout{1} = asgn(vara...
b5d84490a26f71cb585c14f67dec85f8e007a4cb3469b658653d1f96ba929756
MATLAB
762
24
function copyStimFile(run, location) if nargin<2 location = 'L2'; end stimDir = 'stimuli'; stimFile = sprintf('taDetectDiscrim%d', run); source = sprintf('%s/%s.mat', stimDir, stimFile); switch location case {'L2','L1'} vistaDir = '~/Desktop/Rachel/vistadisp/Applications2/Retinotopy/standard/storedIm...
2a1c85524c8b9498278e6d3301794d1ced16c4bf34c3e889879809e321102e35
MATLAB
763
30
%% Run linear regression on the mlcomp system % See also mlcompLocalDemo %% we first compile some code that will run on the mlcomp server % This file is from pmtk3.googlecode.com %PMTKinprogress if 0 tmpFolder = 'C:\kmurphy\GoogleCode\mlcomp'; else tmpFolder = tempdir(); end lambdaRange = []; % auto-generated in...
379d23d431e22c40b22982af517f7ae16eebe95f2d06061577af3d16c56ef1c9
MATLAB
763
25
function checkerboard3dmm_wrapper(fnprefix,savefn,type,edgesize,gradingflag) % checkerboard3dmm_wrapper(fnprefix,saveloc,type,edgesize) % % Converts inp files (surface mesh) to a fem nirfast mesh % % fnprefix is the location of one of the inp files, or the ele file location % saveloc is the location to save the mesh t...
707e30bb365f28d32e0dbfbf21666acfe0bd65c5c450ddef67927c658ce2ac42
MATLAB
763
20
function [grad] = lpeval_lap_g(targs,sinfo,charges,rfac,nover,eps) [~,nt] = size(targs); npatches = sinfo.npatches; centers = sinfo.centers; verts = sinfo.verts; [~,nv] = size(verts); triind = sinfo.triind; area = sinfo.area; rnormals = sinfo.normals; grad = zeros(3,nt); ...
974fa8db818c262dfbad80981df9f9991e79836c6e7531ffcef6f174151fad83
MATLAB
763
34
function [order, excluded] = bz_plotRasterTrial(spikes,interval,countLimit,order,ex) for c= 1:length(spikes.times) [idx] =find(InIntervals(spikes.times{c},interval)); ts{c} = spikes.times{c}(idx); mu(c) = median(ts{c}); end % mu(isnan(mu)) = 0; if isempty(order) [a b] = sort(mu'); order = b; else...
a34fbba06170dc139c984b0ec0f4e468b21fe96a71445eb2c5d02a256c8ea5cb
MATLAB
763
43
%% Anisotropic gaussian filtering % Author: Antonio Martinez-Sanchez % I: input tomogram % s: scale % r: aspect ratio % F: filtered output function F = angauss( I, s, r ) %% Intialization [Nx,Ny,Nz] = size( I ); if mod(Nx,2) Nx2 = floor( .5*Nx ); Vnx = -Nx2:Nx2; else Nx2 = .5*Nx; Vnx = -Nx2:Nx2-1; end...
da20cda04d84f5edf5bbdb60a7596253bce18e8c6b48b61a9aa56f0910ccb8b9
MATLAB
763
29
function [h, p, cc, stats] = chi2ind(Y, corr); % _ % Chi-square test for independence given count data % % Sources: % - https://de.wikipedia.org/wiki/Chi-Quadrat-Test#Unabh%C3%A4ngigkeitstest % - https://de.wikipedia.org/wiki/Kontingenzkoeffizient#Kontingenzkoeffizient_nach_Karl_Pearson % get observed counts O = Y; ...
e9b88e6244180a3a51fc25f7b34a92196aaac7daae8f794acb5867e2e6d50120
MATLAB
763
21
function [madeBgIms, madeTargIms] = makeIms(display, backgroundIms, maskedIms) %make contrast target images madeBgIms = cell(size(backgroundIms)); %backgroundIms = phase madeTargIms = cell(size(maskedIms)); %maskedIms = position x phase x condition %make backgroundIms Textures for iPhase=1:length(backgroundIms) % pha...
10e2259f2481f693f657642b92d68db2f523a66e810530c132af4c92399588f1
MATLAB
764
26
function [ outputImg ] = makeDebugImageOfPoints(points,imgSize) %makeDebugImageOfPoints Make a 3D volume of 0s with values of 100 at the %specified 3d points (Nx3 array) outputImg = zeros(imgSize); for i = 1:size(points,1) centroid_pos = round(points(i,:)); %Watch out for the XY shift y_indices = ...
38e4ddb124f83c7e23b47d88c3cf952a9137eb5ac2dbdda49d3df243187a4950
MATLAB
764
34
function Qdec = fReadQdec(fname) % Qdec = fReadQdec(fname) % % Reads a Freesurfer's Qdec table file into cell string array Qdec. % % Input % fname: The name of a Qdec table data file. % % Output % Qdec: Two dimensional cell string array with the data. % % $Revision: 1.1.1.1 $ $Date: 2012/02/02 11:25:52 $ % Original ...
53f6eacbd99c5f0c8d72a02eaeebb09f1c7392c8d3ae7f86809802b9cb049caa
MATLAB
764
19
% proxy function function [Kpxy,nbr] = pxyfun_helm_dirichlet(x,slf,nbr,proxy,l,ctr,zpars,nu,area) % PXYFUN(X,SLF,NBR,L,CTR) computes interactions between the points % X(:,SLF) and the set of proxy points by scaling the proxy sphere to % appropriately contain a box at level L centered at CTR and then % calling helm_di...
95d4d61ca3b39f8bde82dabe779ebe7372062399346c4292d73a6056c5dcff19
MATLAB
764
33
function options = KeplerMapperOpts(resolution, gain, dist_type, eps_kvalue, verbose) if nargin < 3 dist_type = 'euclidean'; end if nargin < 4 eps_kvalue = 50; end if nargin < 5 verbose = false; end options = struct; options.verbose=verbose; options.preprocess_type = 'none'; options.dist_type = dist_typ...
a162fa780f3aa4a33a6bc45d496a9e99bd3193113d7fae3f74b0a463d492c35f
MATLAB
764
20
function [psdx, freq] = periodogram_pwelch(x, fs) % 使用pwelch方法计算功率谱密度 % 输入: % x - 信号样本 % fs - 采样频率 % 输出: % psdx - 功率谱密度估计 % freq - 对应的频率向量 % 使用pwelch计算PSD % 默认情况下,pwelch使用信号长度的一半作为窗口长度,50%的重叠,并使用默认的汉宁窗 % 这里,'onesided'选项告诉pwelch返回单边谱 [psdx, freq] = pwelch(x, [], [], [], fs, '...
b671cdbf6b321717869cf6618ff090ad784ea19d06714516612c44a139cb09a5
MATLAB
764
30
function [ model ] = logregFitL2Dual( X, y, lambda, varargin) % L2-regularized logistic regression model in the dual space % This file is from pmtk3.googlecode.com %PMTKauthor Hannes Bretschneider [R, V, pp] = process_options(varargin, ... 'R', [], 'V', [], 'preproc', ... preprocessorCreate('standardizeX', tru...
127b3796517d3efdcd66f5e4e9307349a2a6b8ff698655736d2aa480343053f9
MATLAB
765
27
function [OutputArray]=String2Array2(InputString) NumChar=length(InputString); OutputArray=[]; if strcmp(InputString,'[]') OutputArray=[]; else Count=0; position=2; while position<=NumChar isvalue=1; CurrentNum=[]; while isvalue ...
21ff9a3c0b4931e2e264fce6227e787230c9ac86389e6b71dd8634e747d7e10e
MATLAB
765
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:length(x); f...
546509acde4bb0a0ebe23827a58fee5a367361700ac8c3c380493f877e883738
MATLAB
765
37
%% MLP Regression Demo % Based on Mark Schmidt's Demo from % http://people.cs.ubc.ca/~schmidtm/Software/minFunc/minFunc.html#8 %% % This file is from pmtk3.googlecode.com setSeed(0); nVars = 1; nInstances = 400; options.Display = 'iter'; options.MaxIter = 50; [X,y] = makeData('regressionNonlinear',nInstances,nVars); ...
b923e2f682278ad84fbaf04b917bd2f2bb8e952c2ca69cdc9d2bfd3040c657b8
MATLAB
765
25
function Surf = fs_read_surf(fname) % Surf = fs_read_surf(fname) % % Reads coordinates and triangles of a Freesurfer's surf (Depends on % Freesurfer's read_surf function). % % Input % fname: A Freesurfer's surface file. % % Output % Surf: Surface which represent a coordinate system where the analysis is % to be done...
13ac738817cb50278fc20e3cabdc9ede34f2bc622a92a3edc30daf3249d1ef05
MATLAB
766
30
function features = ReadLandmarkFeatureFile(filename) rawpropinfo = yaml.ReadYaml(filename); features = EmptyLandmarkFeatureArray(); featuretypes = fieldnames(rawpropinfo.Features); for i = 1:numel(featuretypes), featuretype = featuretypes{i}; x = rawpropinfo.Features.(featuretype); if isfield(x,'CoordSyste...
4726c56afb5c6ee7d74891123a234f919cffc339e981f94dca42c1556e31be74
MATLAB
766
27
function q_area_ratio=quality_triangle_area(p,t,area) % Calculates the quality of triangles defined in p and t % p is the list of node coordinates % t is the list of node connectivity (n by 3) % if 'area' is given, this routine will use as the calculated area of each % triangle and it won't attempt to calculate it. di...
bd202170af3a135aa88d9c799e27cb425cdc8363f8c93427408ca4e52bac7c1d
MATLAB
766
24
function [vals, val_names] = get_stats(Dt,pp,pi,range) val_names = [string('number of peaks'), string('maximum peak amplitude'), ... string('integral of highest peak'), string('total integral')]; %% get peak data for low and high beta for j=1:size(range,1) for i=1:Dt.nchannels ...
c1b0ff2e3b0c33549dacf81dcabcd3774af5522a07cc4ac27d6418a6f1c1b5b5
MATLAB
766
79
% Field Trip-related test scripts - Synthetic FT data. % % See LICENSE.md for distribution information. % % % Includes. do_ft_init % % % Configuration. % NOTE - This is moved to its own file, so that we can invoke it elsewhere. do_ft_synth_config % % % Generation. % % Make a synthetic trace, if we don't alr...
c2c15ceb71d08416c58334efb8c1f683927aa500b36951cb2176a3059c7038de
MATLAB
766
23
function a = ctranspose(a) %CTRANSPOSE Complex conjugate transpose for tenmat. % % C = CTRANSPOSE(A) swaps the row and column indices of A. % % See also TENMAT. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia...
c61af94cd3f43555d8c2565d042e43e6f7bb57d4a40a78b590fb2e7d85bb8932
MATLAB
766
24
% TiffreadStructureToMatrix.m % Sarah West % 8/26/21 % Takes the output structure from tiffread functions and turns the .data % fields into one big matrix. function [data_matrix]=TiffreadStructureToMatrix(data_structure, frames_list) % Inputs: % data_structure -- a structure of images outputted by tiffread % frames...
ea3cf91de8b9f21fb894b970117bce0d837b099f017e4f77739ddb2f298fe19e
MATLAB
766
26
function [h, p] = plotSurface(fn, xyRange, varargin) % Plot the surface of the function % evalauated at xyRange = [xmin xmax ymin ymax]. % % All other args (varargin) are passed directly to the surf function, % except for 'npoints', which is by default 100. %% % This file is from pmtk3.googlecode.com [npoints, args] ...
4002974503ec5dffb4caec7f284bceba0bed9accdd24dce1e06b39d7cb80a387
MATLAB
767
26
function col = findQdecVar(Qdec,name) % col = findQdecVar(Qdec,name) % % Gives the column of a variable in a Freesurfer's Qdec table that was read % into the two dimensional cell string array Qdec. Returns empty if the % variable is not in the Qdec table. % % Input % Qdec: Two dimensional cell string array of Qdec da...
42ccba8f16b9e1aa036dc7689e00bcbb2918090d71e3ac15715cc5a7b9958215
MATLAB
767
30
function messages = initializeMessages(G, sepSets, nstates) %% Initialize belief propagation messages to uniform % %% Inputs % G - an adjacency matrix % sepSets - the separating sets, (domain intersections) of the cliques) % nstates - nstates(k) is the number of states of variable k % %% Output % % messages...
90379c2aa694227b7a7310d5c9f723dcb8709e736397ae47042a049428f96bf1
MATLAB
767
45
% % a=[]; % % for i=1:length(gn) % % display(i) % % x=strcmp(gn(i),gene_name); % % s=p(x); % % m=find(s==max(s)); % % gp=gene_profile(x,:); % % gp=gp(m,:); % % a=[a;gp]; % % end % % b=[]; % bn={}; % for i=1:length(geneName) % i % x=strcmp(gn,geneName(i)); % b=[b;a(x,:)]; % b...
2b00c612db13ef2c3b126f5c2bed6fe43b830e58defb9a17645fb0ecc4905a94
MATLAB
768
30
function [] = write_image(I, kk , calib_name , format_image , type_numbering , image_numbers , N_slots), if format_image(1) == 'j', format_image = 'bmp'; end; if ~type_numbering, number_ext = num2str(image_numbers(kk)); else number_ext = sprintf(['%.' num2str(N_slots) 'd'],image_numbers(kk)); end; i...
d23a31f814aabb5009543eb539ba8dbd4b6872044ac43c22c548fcd8cebe2812
MATLAB
768
27
function C = compatibility_matrix(pos,connectivity) n = size(pos,1); m = size(connectivity,1); x = pos(:,1); y = pos(:,2); C = zeros(m,2*n); ux = sym('ux',[n,1]); uy = sym('uy',[n,1]); u_vec = sym(zeros(2*n,1)); u_vec(1:2:end) = ux; u_vec(2:2:end) = uy; for i = 1:m i...
96e053e374ad496ba4a16690e55179164fdef2f34a6a361c35ffcd502bc22471
MATLAB
769
34
% get a labelelled set of spikes on this nerve % works nicely for mulitple units function [spiketimes, labels] = getLabelledSpikes(self) if self.verbosity > 9 disp(mfilename) end spiketimes = []; labels = categorical(); this_nerve = self.common.data_channel_names{self.channel_to_work_with}; if ~isfield(self.spike...
a13330857695bf5a19cdba54ae340470fbb3771f65a39d8c729428d3795e7a9e
MATLAB
769
20
function mscmd_merge_stage(timeseries_in_path,firings_in_path,firings_out_path,opts) if (nargin<4) opts=struct; end; if (~isfield(opts,'clip_size')) opts.clip_size=100; end; if (~isfield(opts,'min_peak_ratio')) opts.min_peak_ratio=0.7; end; if (~isfield(opts,'min_template_corr_coef')) opts.min_template_corr_coef=0.5;...
dee72518de7f5886a27588e592a7a6ee2c0f253aee52bff008bc4389f0935dea
MATLAB
769
26
function Arep = replicate(A, Adims, sz) %% Replicate A along possibly multiple dimensions so that size(Arep) == sz % Adims indicates the dimensions in 1:numel(sz) that A currently contains. % % Replicate is like repmat but only copies where needed to achieve the % desired size. % %% Example % In this exmaple, suppos...
f8ee9fd742e0b707c3bdb5f66df5bad478cbadf9a57d94431f2e594ddcf02679
MATLAB
769
33
% % disp("This is an example matlab driver"); disp("On output the code prints the pot+grad in example1, and computes the error at 10 source locations"); disp(" "); disp(" "); %% source to source, charges only, pot+grad example % clear srcinfo ns U1 U2 eps pg zk; disp("Example 1: source to source, charge, pot+grad");...
fdd62cec6e7466602c046ea2e7bd3d1b7bb9b50da362f6cf37371e352b8a1504
MATLAB
769
26
function LAN = lan_from_nsx(chan, srate_new) % *************DEPENDENCIES************* % - openNSx (Neural Processing Matlab toolkit) [File, Path, ~] = uigetfile({'*.ns*','NSx file';}, 'Open .nsx file', '', 'MultiSelect', 'off'); NSx = openNSx([Path, File]); LAN.srate = NSx.MetaTags.SamplingFreq; LAN.importrec.files =...
2bcf079ba4924c3234180bfc0787bbeeeccb9d17cc3480adeda2ecedf98be926
MATLAB
770
19
function [ ] = bemf2_graphics_surf_field_default(P, t, FQ, Indicator, objectnumber) % Surface field graphics: plot a field quantity FQ at the surface of a % brain compartment with the number "tissuenumber". Interpolates over % triangles % % Copyright SNM 2017-2021 t0 = t(Indicator(:, 1) == objectnumber, ...
510cbffa777460b2088162ff58b1944f9ea2c81aa5e1b0c8aa8033717e16101a
MATLAB
770
51
function[do_print,tolerance,fx_stop,max_eval,method,scale]=... do_options(options,nx) DEF_PRINT = 0; DEF_TOL = 1e-4; DEF_FXSTOP = 0; DEF_MEVAL = 100*nx; DEF_METHOD = 0; DEF_STEP = 0.1; % [row,col] = size(options); if (col < 18) options(18) = 0; end % if (options(1) < 1) do_print = DEF_PRINT; else do_p...
c6a215561d876de538ea2d8dd26b82daad64f4983b530b408ffae722b2af37d1
MATLAB
770
30
function [Dm, varargout] = remove_mean(Dm) % [Dm] = remove_mean(Dm) % Remove mean per column. % Assumes stats/pandas representation: % rows are observations, cols are data dimensionality (or variables). % % Parameters % ---------- % Dm : matrix % The dataset to be processed. % % ...
104246b51c988a4b7cd90d8d1d09bd09fbd8183a00dab5613044b5be0f32878f
MATLAB
771
26
function [adja_pruned, prunedMat, prunedBins] = prune_graph_full(memberMat) % Input: % - memberMat: matrix of nr small bins by nr datapoints. 1 if datapoint in % smallbin %% Find identical rows prunedMat = unique(memberMat,'rows'); %% Create weighted adjacency matrix n = size(prunedMat,1); % adja_pruned = zeros(n); ...
5df713f82b19826d61c144c24423cdf2d0dea5d955e8133c66db44a7cfb7c91d
MATLAB
771
28
%% Logistic Regression on the SAT data using Bayesian inference % We use Laplace approximation to posterior % and MC approximation to postpred % % This file is from pmtk3.googlecode.com stat = loadData('sat'); y = stat(:,1); X = stat(:,4); %pp = preprocessorCreate('standardizeX',true, 'addOnes', true); %model = l...
6ebc1122cb9ee0503a0f03b838985b26f5b516f7f5a0fb5d0133c04157bb5fce
MATLAB
771
36
function xx = degexpand(x, deg, addOnes) % Expand input vectors to contain powers of the input features % This file is from pmtk3.googlecode.com [n,m] = size(x); if nargin < 3, addOnes = 0; end xx = repmat(x, [1 1 deg]); degs = repmat(reshape(1:deg, [1 1 deg]), [n m]); xx = xx .^ degs; xx = reshape(xx, [n, m*deg]);...
7a47cd01de4b31b6bbb448fb4d8b0f9faab114d8a57edb507fde6194a4dec283
MATLAB
771
33
function s=mergestruct(s1,s2) % % s=mergestruct(s1,s2) % % merge two struct objects into one % % authors:Qianqian Fang (fangq<at> nmr.mgh.harvard.edu) % date: 2012/12/22 % % input: % s1,s2: a struct object, s1 and s2 can not be arrays % % output: % s: the merged struct object. fields in s1 and s2 will be comb...
822dc3cc081ed8b5d64ecd7d193d9c33b151683a05c0cee1bda7b69521efdabc
MATLAB
771
26
% Copyright Christopher Fricke, University Leipzig Medical Center, % Neurology 2024 folder = 'data\prep\coreg_indiv\datscan_normalized\Average'; fn = 'average_ct_noskull.nii'; mv = medicalVolume(fullfile(folder,fn)); targetVoxelSize = [0.5 0.5 0.5]; ratios = targetVoxelSize ./ mv.VoxelSpacing; origSize =...
f7a7b88463c106f1e086fa050fa7a023fafde3f83b2002d24732bb08265315dc
MATLAB
771
32
function [f, xsp] = lan_cspd(LAN, chn1, chn2, twin, nomean) L = max(LAN.pnts); if nargin < 5 nomean = false; if nargin < 4 twin = hann(L); end end if LAN.trials == 1 disp('Se requiere señales segmentadas') f = []; xsp = []; else NFFT = 2^nextpow2(L); f = LAN.srate/2 * linspace(...
512529da0e93ac5ab2becc61673537911a0ac3f51ab51cddf04a1678bbb24abb
MATLAB
772
34
function [mu,sig] = compute_bg_mean(readframe,nframes,varargin) [bgstartframe,bgendframe,bgnframes,roi,verbose] = ... myparse(varargin,'bgstartframe',1,'bgendframe',nframes,... 'bgnframes',200,'roi',[],'verbose',1); if isempty(roi), im = readframe(bgstartframe); nr = size(im,1); nc =...
5192ec1bef3bc915648213afc21f90082ae9d3f2e2485f3897cb023e9d2f9518
MATLAB
772
36
%this small class combines all voltage and camera/i sweeps into one sweep %(two traces, can be any traces); function [newtrace1, newtrace2] = combine_sweeps (t1, t2, numswps) t1 = downsample (t1, 100); t2 = downsample (t2, 100); n = size (t1, 1); fulln = n * numswps; newtrace1 = zeros (fulln,1); newtrace2 = zeros...
99fff4998a76056bec01438ceccd14fa70f870758173c43f5efd5cdea0f435e0
MATLAB
772
37
function model = mrf2FitStruct(y, varargin) % Fit pairwise MRF using group L1 on the edge weights % % Input: % y: Ncases * Nnodes (1,2,.., Nstates) % % Optional inputs: % % lambdaNode L2 strength % lambdaEdge L1 strength % % OUTPUT: % model is same as crf2FitStruct % % Uses code from http://www.cs.ubc.ca/~murphyk/Sof...
ca902a7f323a08c3c6d49e35ad8844ee9a5bb25696f20e57efb2b07d3a9c1706
MATLAB
772
20
function [fx,J,dfdp,d2fdxdp] = f_fullDCM4fmri(Xt,Theta,ut,inF) % DCM for fMRI evolution function (attn: embedding of HRF!) % function [fx,dF_dX,dF_dTheta] = f_fullDCM4fmri(Xt,Theta,ut,inF) % This function evaluates the evolution funciton of the neuronal level in % DCM for fMRI. For the sake of HRF convolution purposes,...
d205cab2ac320cf2171973dc34576c22180dc932dab629933842829dadfe2679
MATLAB
772
21
function [F, J] = funfitGaussianModelParams(params, xvals) %UNTITLED Summary of this function goes here % Detailed explanation goes here %========================================================================== outparams = params.outparams; %==========================================================================...