sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e4dec8078b65aef79c1c49678a90af0336d7cc565a04091586b789c90e0a075c
MATLAB
514
19
classdef (Abstract) FigureController < handle %FIGURECONTROLLER A controller driving one or more figures properties end %% LIFECYCLE methods function obj = FigureController() %FIGURECONTROLLER Construct an instance of this class % Detailed explanation goes here ...
f4cce8b86f1d0903466fc253b59ef415fea2deed70ccc361e8a14e660145fed5
MATLAB
514
12
% Copyright 2024 Eelke Spaak, Donders Institute. % See https://github.com/Spaak/rift-phase-and-visibility for readme/license. % Belongs with: % Spaak, E., Bouwkamp, F. G., & de Lange, F. P. (2024). Perceptual foundation and extension % to phase tagging for rapid invisible frequency tagging (RIFT). Imaging Neuroscie...
bd97e72ad1cb12f734ce8c1594baf6fdc16aa1e07512aa744090b6bd87d00c1d
MATLAB
515
20
clear [file, path] = uigetfile('*.mat');%When the user clicks the load data button, a window should open to enable the user to select a file. datafile = fullfile(path, file); %save path load(datafile) close all clc %% data = clusters.matrix; for i = 1:size(data,1) figure plot(cell2mat(data(i,5:end))) hold ...
5f0b285cd7e30db95cc5f0e84ef40e01a2e9c9a72ac63edfe13a9e4d749d39d3
MATLAB
516
33
function metname = find_metab_list(field_list) if isstruct(field_list) oo = field_list; field_list=fieldnames(field_list); end k=0; for nf=1:length(field_list) ind = findstr(field_list{nf},'SD'); if ind k=k+1; metname{k} = field_list{nf}(3:end); end end if ~exist('metname') fprintf('Taking...
145301432bc76fe51a81109736d3ad14681dc77f01df5d0b0a232f8bf9be2bbe
MATLAB
517
16
function ob = ctranspose(ob) %function ob = ctranspose(ob) %| %| "ctranspose" method for this class %| A = Do G Di => A' = Di' G' Do' ob.size = fliplr(ob.size); [ob.odim ob.idim] = deal(ob.idim, ob.odim); [ob.omask ob.imask] = deal(ob.imask, ob.omask); [ob.handle_forw ob.handle_back] = deal(ob.handle_back, ob.handle...
1e58aa5482704e3392ad6aa9b6a689c826b7c6bfcaf4358160d906eee7ef5160
MATLAB
517
18
function updateFigProj(obj, doAutoscale) %UPDATEFIGPROJ if ~obj.hasFig('FigProj') return; end hFigProj = obj.hFigs('FigProj'); if isempty(hFigProj.figData) || ~isfield(hFigProj.figData, 'boundScale') boundScale = obj.maxAmp; else boundScale = hFigProj.figData.boundScale...
92ce84c84daa291b2d59747514f7e3b57c03406c5c39d2108f18caab7e04616b
MATLAB
517
34
function c=concat_conc(c1,c2,prefix) if ~exist('prefix') prefix='' end if length(c1)~=length(c2) error('differenct pool number') end for npool = 1:length(c1) cc = c1(npool); % for kk=1:length(cc.suj) % if ~strcmp(cc.suj{kk},c2(npool).suj{kk}) % fprintf('arrrgggg') % keyboard % end % end...
6ecb164320e1026f93839457cd4dacbd1f05ee92c4cf1399eca4b620956e04e8
MATLAB
518
12
function [index, rank] = ChannelIndex14(x, ff, fs, varargin) % ChannelIndex14 has been deprecated. Use sqi_beat_shape_variability instead. warning('ChannelIndex14 has been deprecated. Use sqi_beat_shape_variability instead.'); if nargin == 3 beat_width = round(0.25*fs); else beat_width = varargin{1}; end num_pe...
b6380fb5dc4fbef6329f8ea3f596f0df21ab84f3b6776cf59442b75b2da9eb5d
MATLAB
518
22
function Indexes = labels2indexes(Labels, Chanlocs) % function for converting from labels to indexes. Labels = string(Labels); % handles exception of Cz, which for some stupid reason I saved as Cz. Labels(strcmp(Labels, '129')) = 'CZ'; ChanLabels = string({Chanlocs.labels}); [Members, Indexes] = ismember(Labels, Ch...
b011b28f63d0a6fbdfc8efe12b6e7a15523addb72a70e9deb07f9054b0d5bee2
MATLAB
519
33
function fo = sum_fid_local_mega(fids,nz) % fid_struc = sum_fid_local(fid_struc,nb) % this will remplace each spectra by the average of the nb nearest spectra fo=fids; for nbser = 1:length(fids) fid = fids(nbser).fid; ns = size(fid,2)/2 fid1 = fid(:,1:ns); fid2 = fid(:,(ns+1):end); ff = fids(nbser...
c392f53ba0880396c90ffd1fadca5087abd4dbeb43e1f774281840a774ac2d72
MATLAB
519
24
function [] = makeSymmetrical(filepath, filename) % This program is intended to transform asymmetrical image to symmetrical image. % % input: % filename: .nii % output: % filename: (.nii) % % by Hiroaki Hamada, oist, 2019/April/22th marix = load_untouch_nii(); %size(A.img) division = 29; for ii = 30:58 % if ii = ...
ba27f53b9abec569107b5e2f3491859df47c29d46d0b0fad4c4fc2b5c8780335
MATLAB
521
24
function d = getpathlength(L,p) %% Calculate the pathlength of a path in a network % The pathlength is the sum of the edge lengths in L between all nodes in % path. % % d = getpathlength(L,p) % % Input: % L: length matrix (dot inverse of projections matrix, uni- or bilateral) % p: (cell) array of nodes in pa...
3b36da9ead14d6e3517992dfc0197a2299a32609f27376d7dceb25d9ccc2d16c
MATLAB
522
25
function [model, fullfilename] = load_model(session, channel, unit, fold) % Load neural model for a given fold number % % Parameters % ---------- % % - fold: integer scalar % Fold number % % Returns % ------- % - model: struct (todo: need more details) % Neural model % - fullfilename: char vector % Filename of sa...
db12766335fb19617aa7648b15e669cd249c675076a40aa0d82198f93f3a1183
MATLAB
522
19
function Filename = get_most_recent_file(Folder, Extension) % Provide a folder and an extension, and this will return the most recently % created file with that extension in that folder. Content = dir(Folder); Filenames = {Content.name}; Content(~contains(Filenames, Extension)) = []; if isempty(Content) warning(...
092c745810b79c1bc7b80873800f3229bab3b71831e09172486a9e8d1f11f9f0
MATLAB
523
13
%% Autoreceptor 5-HT1B control of SERT density, from surface to pool. %Likely mediated by protein kinases. 5ht1b activation increases g-coupled %protein which downregulates PKA, which reduces the phosporilation of SERTs %(removal) and increases the density of SERTs. function ratio = k_5ht1ab_rel_sp(g, gbasal) g...
180d73b02de27af9de2c44985b40e1cd5c79a96331506a7a3bc4efd53c55073a
MATLAB
523
19
function [emax, err] = nufft1_emax(varargin) %function [emax, err] = nufft1_emax(varargin) % % Compute exponential approximation error for each input frequency for 1D NUFFT % and return worst-case. % % in % everything is passed to nufft1_build() % out % emax [1,1] worst-case error over all frequencies specified % % Co...
819c51a720422a8a88749dfb04f6f5bad13368bd08272dea8e8ff93328aeb6e6
MATLAB
523
24
%% Autoreceptor 5-HT1B control of SERT density, from pool to surface. %Likely mediated by protein kinases. 5ht1b activation increases g-coupled %protein which downregulates PKA, which reduces the phosporilation of SERTs %(removal) and increases the density of SERTs. function ratio = k_5ht1ab_rel_ps(g, gbasal) gdiff ...
c93343632c668a46cf15de0b8c9569ad88ee31180dc5541d4f10d1e93d623407
MATLAB
523
16
%% create jitter added to the brain_render data clear clc [file, path] = uigetfile('*.csv','MultiSelect','off');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path T = readtable(datafile); %% add the jitter rng(1)...
8377fba713977786e156d7cf0ac6abb9c7f0b31445886d41dcf7e408d40863bd
MATLAB
524
12
% HBF_BINF_XYZ computes an arbitrary component of the magnetic field due to % xyz-oriented unit-current-dipole triplet in infinite non-magnetic medium % % Binf=HBF_BINF_XYZ(fp,fpdir,spos) % fp = field points (where the field is computed), [N x 3] % fpdir = field orientations (which component is computed)...
b66208b019ca7085ee9e137169895b020e422972e1bbd0b960514bb72a5cedc9
MATLAB
525
19
function setProp(obj, propname, val) %SETPROP Set a property if isfield(obj.oldParamSet, propname) propname = obj.oldParamSet.(propname); obj.isV3Import = 1; end if isfield(obj.fullParams, propname) if ~isprop(obj, propname) obj.addprop(propname); end ...
a6dbe30cd07ee1c4511384a8bbd6c812d460ae3115d3bdc4633534f4bee0da5a
MATLAB
526
11
function [mn, mx] = ratioscatter_subplot(h, ipsix, ipsiy, contrax, contray, ipsilabel, contralabel) subplot(h); mn = min([ipsix ipsiy contrax contray 0]); mx = max([ipsix ipsiy contrax contray 0]); hold on; set(gca, 'Color', 'none'); axis equal tight; line([mn mx], [mn mx], 'Color', [1 1 1]/2); xlim([mn mx]); ylim([mn...
c01c14110bdaa187a356e2a8de7919e5cb179f2c09d1ac6c2f0de2dfb5736261
MATLAB
528
28
function F=get_files_recursif(in_dir,endwith) F=[]; for nbdir =1:size(in_dir,1) cur_dir = deblank(in_dir(nbdir,:)); DD = dir(cur_dir); DD=DD(3:end); for i=1:size(DD,1) if ( DD(i).isdir ) F = [F;get_files_recursif( fullfile(cur_dir,DD(i).name),endwith )]; else [pathstr,filename,ext]...
c6c583851ee630dc6a42649188df91ee8c81c472c0533ae572b1ee0a7dec010e
MATLAB
528
19
function result = x2stereo(x) %X2STEREO Stereographic projection of Euclidean points % % result = x2stereo(x); % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. % $Revision 1.10 $ $Date 2005-06-01 $ % Documentation files renamed % $Revision 1.00 $ $Date 2005-02-12 $ % % For licensing, see COPY...
2a1b08090e36aefcfefabd281a068cd646fa752acf4fc38fc5a1f73e35479477
MATLAB
529
15
% Default Values for Signal Processing *************************** L=60; % seconds of the Fluorophore Response % AutoRegressive Process Estimated by 'lpc' function ************* p=3; % AR(p) initial AR order % Using fminsearch algorithm to fit AR ************************** % process im...
ea8ce506d6a13935f99f9768fe704ebe0775d14cb18541ab1b64c56ee4ee9507
MATLAB
529
16
function pred = classify_mat(layers, weights, params, test_x) layers = cnnsetup(layers, 0); layers = setweights(layers, weights); assert(size(test_x, 1) == layers{1}.mapsize(1) && ... size(test_x, 2) == layers{1}.mapsize(2), ... 'Data and the first layer must have equal sizes'); assert(size(test_x, 3) =...
f5a587029dd06be855d2cc54ba52d7427211aa2fadf2b70748e6686e7896716d
MATLAB
529
22
x = clusters.mean; n = 4; %% calculate new sem data_matrix = cell2mat(clusters.matrix(:, 5:end)); s_data_matrix = smoothdata(data_matrix, 2,"sgolay", 4); for i = 1:n data_sem(i,:) = sem(s_data_matrix(cell2mat(clusters.matrix(:, 4)) == i,:), 1); end f4 = figure; set(f4,'color', [1 1 1]); set(f4,'position',[50 50 12...
07429e84ea05591e059e6f73f7b69ac813fbf93b3c6b82fc7847df65623c55e3
MATLAB
530
22
function img_out = XxFourierDamping(img_raw, ksize, kstd, Center) if nargin < 4 Center = [372,528,670,653,496,354; 613,685,585,412,341,441]; end [Ny, Nx] = size(img_raw); img_fft = fftshift(fft2(img_raw)); yc = Center(1,:); xc = Center(2,:); G = fspecial('gaussian',[ksize ksize],kstd); G = XxNorm(G,0,100); Mas...
35f9467419dfef1201271ff32c5080aa71d441fa423ab0a1e441826c303749ee
MATLAB
531
20
function pred = cnnclassify(layers, weights, params, test_x, type) if (length(size(test_x)) == 3) % insert singletone maps index test_x = permute(test_x, [1 2 4 3]); end; tic; if (strcmp(type, 'cpu') || strcmp(type, 'gpu')) pred = classify_mex(layers, weights, params, test_x); elseif strcmp(type, 'matlab') ...
488428fc274b76679512451fd11d05bff4daefe114efaf75f327552765c9727b
MATLAB
533
19
function edit_regressor_table(app,action) table_data = app.tbl_regressor.Data; switch action case 'add' idx = find(strcmp(app.popup_regressor.Value, table_data)); if isempty(idx) table_data{end+1,1} = app.popup_regressor.Value; table_data{end,2} = app.edt_lagtime.Value; ...
4d8a9a67292b03a91aca72ad046f82dee61d1bd617640cf60e6e42379e022a0f
MATLAB
533
17
function[Kappa]=mnl_FindCohensKappa(Tp,Fp,Fn,Tn) %Tp - Number of True Positives (A) %Fp - Number of False Positives (C) %Fn - Number of False Negatives (B) %Tn - Number of True Negatives (D) TotalNum=Tp+Fp+Fn+Tn; Ppos=(Tp+Fp)/TotalNum; Pneg=(Fn+Tn)/TotalNum; %Calculate Prob Observed Po=(Tp+Tn)/TotalNum; %The probabili...
93fdcd0b3c9883b82b4905994da672bf5f56e297982cbff15efe6c815df8e3b6
MATLAB
533
14
function [Nr,Nc] = Find_Blank_Boundaries(Im) [Sr,Sc,Sz] = size(Im); Cols_STD = std(double(Im),0,1); % A row of coulmns std Rows_STD = std(double(Im),0,2); % A column of rows std. Fc = find(Cols_STD > 0); % Find non-zero std columns. Nc = [max(1,Fc(1)) , min(Sc,Fc(end))]; % The first columns (from left and ri...
b504b216d6ded31baa34a8efdbb8eab1691d7e0fc1bb9a7b4e10486de74c5a5e
MATLAB
533
32
function plot_time_delay_map(map) % Plot time delay sensitivity map % % Parameters % ---------- % - map: matrix % (time x delay) sensitivity map info = get_info(); times = info.times; [T, D] = size(map); % surf(map'); % view([0, 90]); % shading('interp'); imagesc(map'); axis('xy'); colorbar('XTick', unique(round(...
26b3d6aec921d2a788aa1077b2f85e6471a043e34f565010200fda0f47e44afe
MATLAB
534
16
%% Just make sure 22.5 is using the same function at all..... % LDEFrfuncS 4*4 cell % mapping: [1,2,3,4;a,b,c,d]; generally 4,3,2,1 function LDEFrfuncSOut = FuncSwap(LDEFrfuncS,mapping) LDEFrfuncSOut = LDEFrfuncS; for ii = 1:4 for jj = 1:4 LDEFrfuncSOut{ii,jj} = ... (LDEFrfuncS{ii,jj} ...
717567ad5d45451f94f70f96047cd600234ce0271f4bc0522ef7688fa2ca55d1
MATLAB
534
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...
c166896a6686ab272cc4ca8fa55f89e89633b47ba1debc28fba1dcb517a76e2e
MATLAB
534
27
function fo = zero_filling(f,z) fo=f; if z>0 for nbser = 1:length(f) np = f(nbser).spectrum.np * z; npadd = f(nbser).spectrum.np *(z-1); fo(nbser).fid = [f(nbser).fid ; zeros(npadd,size(f(nbser).fid,2))]; fo(nbser).spectrum.np = np; fo(nbser).spectrum.n_data_points = np; end else f...
fd38cab59f0f37ed4892e2618b0a200a430c6872c7c5e0a468a527c8e3ce8184
MATLAB
534
20
function [PVal,Test_Name] = Stat_Test(X,Y) [~,PV_TTEST] = ttest2(X,Y); % TTEST. if(isnan(PV_TTEST)) PVal = 1; Test_Name = 'T-Test'; return; end if(~ttest(X) && ~ttest(Y) && ~kstest(X) && ~kstest(Y)) % If both datasets come from a standard normal distribution (kstest), AND if t...
2226ac76594f8a967938570e9e97936de01c67409d5f5bc0ca535829fea5304f
MATLAB
535
12
function [ output_args ] = runJointExtraction( p ) %RUNJOINTEXTRACTIOMN runs joint extraction for every subject for sub = 1:p.nSubjects disp([char(datetime('now')) ' Starting joint extraction for Mouse ' num2str(sub) '/' num2str(p.nSubjects)]) tic thisSub = p.subjects(sub); ...
bf098e191bbd9bfd3c04cc5a979936daa8e91512ac4ea088019e888186262e98
MATLAB
535
25
function [result, fullfilename] = load_result(session, channel, unit, fold) % Load results of a neural model for a given fold number % % Parameters % ---------- % % - fold: integer scalar % Fold number % % Returns % ------- % - result: struct (todo: need more details) % Results % - fullfilename: char vector % Fil...
7adb7e60ed2d5c781316a6631cf8eb27ef2580ce43eb3020f0a21c6740b9914e
MATLAB
536
21
function res = TestForSingleGroups(handles) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License d = get(handles.output,'UserData'); res = 0; if d.ContBetween == 1 return; end Groups = unique(d.IndFeature(~isnan(d.IndFeature))); for i = 1:numel(Groups) if...
8b5fba6d03c232679fc7fdc296aa9adf08cfebec20f4c2d90ef8851756af2fb3
MATLAB
536
12
% HBF_BINF_DIR computes an arbitrary component of the magnetic field due to a % current dipole in infinite non-magnetic medium % % Binf=HBF_BINF_DIR(fp,fpdir,spos,sdir) % fp = field points (where the field is computed), [N x 3] % fpdir = field orientations (which component is computed), [N x 3] % spos...
6c2595fe7464b736b460cd2e56d614ea012452d96fb1c776cefd6451e5830e50
MATLAB
537
28
function [ theta_t ] = getprojangle( Q, R0) %find angle of projection of dipole onto theta-phi plane theta_t = zeros(size(Q,1)); R = sqrt(R0(:,1).^2 + R0(:,2).^2 + R0(:,3).^2); theta = acos(R0(:,3)./R); phi = atan2(R0(:,2),R0(:,1)); %Get theta unit vector thx = cos(theta).*cos(phi); thy = cos(theta).*sin(phi); thz =...
fa0ef1184f8e1e00b165b5584e06edfce67d075eca86ffd34946c071ce6a5cac
MATLAB
537
12
ii = 0; for w=1:numel(Workspace) for v=1:numel(Workspace(w).Workspace.Vertices) if(length(Workspace(w).Workspace.Vertices(v).Angles) == 3 && length(Workspace(w).Workspace.Vertices(v).Corrected_Angles) == 3) ii = ii + 1; Angles(ii).Angles = Workspace(w).Workspace.Vertices(v).Angles; Angles(ii).Corrected_Angl...
03022e959678d70c9aba4d080a7188a001a899fc8637425558ca3e8972dd83f4
MATLAB
539
31
function power_spectrum(Power, Frequencies, LogX, LogY, Legend, Colors) arguments Power Frequencies LogX = false; LogY = false; Legend = {}; Colors = cycy.utils.pick_colors(size(Power, 1)); end hold on for idxPower = 1:size(Power, 1) plot(Frequencies, Power(idxPower, :), 'LineWidth', 2, 'C...
581ffe5518e1e2859b1d6b81b1fb9e01563d7a6ad309a34c4e34cd62869b2b2e
MATLAB
539
22
function moveback(hax_or_h,h) % function moveback([hax],h) % move h back by one if nargin < 2 || isempty(hax_or_h) h = hax_or_h; hax = gca; else hax = hax_or_h; end axkids = get(hax,'Children'); n_axkids = length(axkids); ih = dsearchn(axkids,h); if isempty(ih), error('handle(%f) not a child of hax(%f)', h, hax...
e31bd1ea6d27d8aeb277d8a6f0e81e6cdcad2656605fab7437e0f45271961a52
MATLAB
539
25
function [ ] = plotBlocks(A, S, linewidth) % plot the communities, A is the adj-mat, S is the community labels [~,idx] = sort(S); %subplot(211) imagesc(A(idx, idx)); hold on; x = 1; for i = 1:max(S) y = 0; w = sum(S == i); for j = 1:max(S) h = sum(S == j); if mean(mean(A(S==i, S==j))) > 1.5...
06b3244fa7ff84db3e1d993c3fd44833371ebf931e5340f7a92ee2bf43f49e71
MATLAB
540
16
%% get allen session metadata %% load csv file metadata = readtable('sessionInfo.xlsx'); %% get info about which animals contributed to which state % state = 0 (stationary), 1 (locomotion), nan (both) stat_idx = find(metadata.state==0 | isnan(metadata.state)); run_idx = find(metadata.state==1 | isnan(metadata.state)...
5aa91eb0445ddcc2bd1738d0296f300d87f0365208e3d5651db7344ac48dc928
MATLAB
540
19
%% Initalization Data Output SIGNALS=cell(NV,NC); DETSIGNALS=cell(NV,NC); ESTSIGNALS=cell(NV,NC); SNRwavelet=cell(NV,NC); Responses=cell(NV,NC); preDRIVE=cell(NV,NC); preLAMBDAS=cell(NV,NC); TAUSall=cell(NV,NC); % SIGNALSclean=cell(NV,NC); RASTER=cell(NV,NC); isSIGNALS=cell(NV,NC); notSIGNALS=cell(NV,NC); LAMBDASSpro=c...
e419b480b35df7be26b6927f460617b7df3799b8ba8f4366d6842b6737c1d801
MATLAB
540
27
%% Setup Import_FinderSpiker; %% # Check False Positive % Accepted and processed Data global indxSIGNALSOK; indxSIGNALSOK=cell(size(isSIGNALS)); [C,V]=size(SIGNALS); Ndata=0; Nvidok=0; for c=1:C for v=1:V if ~isempty(SIGNALS{c,v}) Ndata=Ndata+1; if ~isempty(isSIGNALS{c,v}) ...
53e504003bb8711e803581fe8bd3ba5572ce56478eb933dcce579ba90cb4aeb0
MATLAB
541
16
function dirname = nettoie_dir(dirname) % cherche s'il y a des caracteres non alphanumeriques dans la chaine str = isstrprop(dirname,'alphanum'); spec = find(~str); % remplace les caracteres non alphanumeriques par des '_' dirname(spec) = '_'; % pour fignoler, on supprime un '_' s'il y en a 2 qui se suivent while ~ise...
b25afb99a75e23ed591e69652aa16beec0cc4abf7834820ea3fa65cf74604c03
MATLAB
541
22
function deprecateCmd(obj, oldCmd, iMsg, newCmd) %DEPRECATECMD Print a message regarding deprecation % if newCmd is specified, sets obj.cmd to newCmd if nargin < 3 iMsg = ''; end if nargin < 4 newCmd = ''; end % set a default iMsg in case of an alias if isempty(iMsg) &...
3524e12426ccf4e457e8bd750cd10017a9fdcf066b0e1d8c60dd540c13c4d8ce
MATLAB
542
18
function [hAxes] = plotChanHist(AD,varargin) % Manage Inputs ############################### varInputs = inputParser; addParameter(varInputs,'hAxes','',@ishandle); parse(varInputs,varargin{:}); varInputs = varInputs.Results; if isempty(varInputs.hAxes) hAxes = gca; else hAxes = varInputs.hAxes; end %Add chan...
629f088b3cf3089005f7e8b65f2e905fc6c97abe377f501f7335877b9c3f35cd
MATLAB
543
24
function out = rn(filename) % function out = rn(filename) % % Read in a nifti file without 'touching' it... inName = filename; if ~exist(filename,'file') if strcmp(filename(end-2:end),'nii') filename = [filename '.gz']; else filename = [filename '.nii']; if ~exist(filename,'file...
a266390a244bae017e9954384f99e967f7a16810f32148d6139b6a9c9f812cf0
MATLAB
543
23
function [p] = PermDesign(d,NoXing) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License if nargin < 2 NoXing = false; end if ((size(d,2) == 1) || (NoXing == false)) p = randperm(size(d,1)); else [i,j,k] = unique(d); d = reshape(k,size(d)); [i...
e81e23e93ad1e473eda97768fc6af892b8ffe20346904e6ddc19eef85d46d030
MATLAB
543
17
function auto_resp(app) %auto_resp checks if respiration is already detected and runs if %not % Detailed explanation goes here if isempty(app.resp_res) if ~isnan(app.settings.channel_idx.resp) [data,ts,~, ~] = current_signal(app, app.settings.channel_idx.resp); data = lowpass(data,3,1/ts(1)); ...
f059f2e8bd2d7193613789bb77e277759ec172f64f6777734341ccf0185bdd89
MATLAB
543
18
%% PLOT RESULTS if exist('RASTER_Selected_Clean') disp('>>Showing Cleaned Raster') Plot_Raster_Ensembles(RASTER_WHOLE_Clean,fs); RC=R_Condition; disp('>>Done.') else disp('>>Showing <preprocessed> Raster') Plot_Raster_Ensembles(RASTER_WHOLE_Clean,fs); disp('>>Done') % Clean Whole Raster ...
fdd3814d7c693a36955fca37343ba44c4618a3d271f97b5299afcc9a3fb3fd5e
MATLAB
544
19
function B2 = Test_Muli_Image(A,B,GTruth,net) cmap = GTruth.LabelDefinitions.LabelColor; C = Muli_Two_Image(A,B); maxrow = 224; maxcol = 224; [C_cell,max_row,max_col]=Muli_Partion(A,B,maxrow,maxcol); [C2,~,~]=Partion(A,maxrow,maxcol); Result_Image = cell(max_row,max_col); B2 = cell(max_row,max_col); for i ...
a617ed85e8397389cbb13fbea54100dccf42dfcdaf98c165437bba2889221f39
MATLAB
546
22
function C = matrix_trace_of_product(A,B) % Return trace(A*B) for real matrices, A of size (M x N) and B of % size (N x M). % % Parameters: % A: matrix % A matrix of size (M x N) % B: matrix % A matrix of size (N x M) assert(ismatrix(A), 'A has to be a matrix of size (M X N)') assert(ismatrix(B), 'B h...
e5ba127ce5aea51021e603d087d3e2d2c83dac0a1090152689ce4777f5340f0a
MATLAB
546
18
function [option_names,option_values] = make_option_specs(varargin) if mod(nargin,2) ~= 0, error('must have even number of args (args are key/value pairs)'); end nopts = nargin/2; if ~nopts option_names = {}; option_values = {}; else for iopt = 1:nopts iarg_opt_name = 2*(iopt-1) + 1; iarg_opt_val = 2*...
5d2592010e99fdd9de152943789937ba7b6535b722fc298be58d4678cdf645c1
MATLAB
548
17
function ica_input = compute_spatiotemporal_ica_input(pca_filters, pca_traces, mu) num_PCs = size(pca_traces,1); % Create concatenated input for spatio-temporal ICA if (mu == 1) % Pure temporal ica_input = pca_traces; elseif (mu == 0) % Pure spatial ica_input = pca_filters; else % Spatio-temporal ...
bdc4447698bf2974c4bcbe03e2babc7a2a06650ae22db259177a56fbfcf9391b
MATLAB
552
30
function [numberOfNeurons] = nonNEUfluo [filename, pathname] = uigetfile({'*.jpg;*.tiff;*.bmp;*.png;*.gif','All Images Files'}, 'Pick an image','Multiselect','on') nu=length(filename) numberOfNeurons = zeros(nu, 1); if iscell(filename)==1 for k = 1:nu slice=imread(filename{k}); ...
169b2980d51af1f8bc38592cdb833f9cbb5ea24cf8b7df905db81d62490130e5
MATLAB
554
29
function index = medoidIndex(sequences, maxStretch) index = -1; lowestInertia = Inf; for i=1:length(sequences) tmpInertia = sumOfSquares(sequences{i},sequences, maxStretch); if (tmpInertia < lowestInertia) index = i; lowestInertia = tmpInertia; end end ...
dbe4d4383dee216bc610eae2301b8fed9ea66f21f20ec433989bea0bc2120e54
MATLAB
554
23
function flip_angle = spmup_ernst(TR,ToneTime) % this returns the theoretical optimal flip angle for a given TR: % cos(flip_angle) = exp(-TR/T1) % % FORMAT flip_angle = spmup_ernst(TR,ToneTime) % % INPUT TR of the pulse sequence % ToneTime (optional) is the T1 recovery time, default is 1400 optimized for gray ma...
54c2c39b8fad920624c73cd91a37f65a5b64040ab82675ab345c6797a79372ee
MATLAB
555
18
%add_before_and _after %split before and after clear clc [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) %% for i = 1:length(file) if contains(file{i}, 'before') all_data{1,1} = load(file...
6c0b228b31a548808f1670e54666004b7a11d1637dd001cc07d73752b744adcc
MATLAB
555
26
function [name, line] = caller_name(level) %|function [name, line] = caller_name(level) %| %| return name (and line) of calling routine or file (if level=1, the default), %| or name further up or down the stack by changing level. %| %| freemat does not have 'dbstack' so return placeholders: name='?' and line=-1 if n...
41b74cf76e527b6e6cd9be1fe3bf91f65e06dbe4697e8424ee725c8a1468eb6a
MATLAB
556
15
function [stvel,timestim]=ReadStimFile(FileIDStim,synclen,framebin); % fidstim=fopen(FileIDStim,'r'); nstim=fix(synclen/framebin); stdivisor=fread(fidstim,nstim,'int16'); divfreq=8*10^6; % frequency of master clock pulsewin=framebin-0.0001; % window in which pulses are sent stepsperdegree=10000/360; % stepper mo...
a9fb6fe4c5b7786cac0251423e22349d221ebcadea58242215b8e670623b708b
MATLAB
556
21
function [D] = surfdot(q,X,Y,Z) %surfdot - returns dot product of q with surface input at each point %on the surface siz = size(X); assert(length(siz) == 2,'Surface dimensions != 2'); assert(siz(1) == siz(2)); D = zeros(siz); %Iterate through all x, y, z values, make a vector v of each at each point, %calculate q ....
fb9071cca7234c9fc37b846f18f90d1804f343542f8fae187453db5d7cb9a845
MATLAB
556
27
function GPUNFT = getGPUNUFFTobjFromCoords(nkx,nky,nkz,dataDims_mm,fullMatrixDims,oversampFactor,sMaps,dcf) if nargin < 7 sMaps = []; end crds = [nkx(:).'*dataDims_mm(1); nky(:).'*dataDims_mm(2); nkz(:).'*dataDims_mm(3)]; gpu.k = crds/2; if nargin < 8 gpu.w = ones(size(gpu.k,2),1); else gpu.w = dcf; e...
0b294bddecd57a864b9ef22bee1f6e5dd1171f7c57833ab0394c1ae66420ff47
MATLAB
557
19
function edit_regressor_table(app,action) table_data = app.tbl_regressor.Data; switch action case 'add' idx = find(strcmp(app.popup_regressor.Value, table_data)); if isempty(idx) table_data{end+1,1} = app.popup_regressor.Value; table_data{end,2} = app.edt_lagtime.Value; ...
8757a0fe1a98efe4778da7b90fd2ca2baf64851adf38418257caaef1fbbf83d3
MATLAB
558
16
function update_cluster_popup(app) %UNTITLED Summary of this function goes here % Detailed explanation goes here str_cell = {[]}; for i = 1: max(app.spike_res.cluster) str_cell{i} = num2str(i); end app.popup_cluster_transduction.Items = str_cell; app.popup_cluster_transduction.Value = app.popup_cluster_transduct...
e9c13f6bd0be0e6bbac825297be5a379d45950537cc7e9c062e35cba7ef40738
MATLAB
558
37
function do_delete(f,ask) if ~exist('ask') ask=1; end %do_delet(f) %f a list of cell containing images to be deleted cf = char(f); if isdir(deblank(cf(1,:))) ddir=1; else ddir=0; end if ask fprintf('Are you sure you want to delete those %d files \n',size(cf,1)) R = input('yes or no\n','s'); else R='yes';...
285836645707e0e9b67c28750f56e14b9fa95acef87ef630f84f09eeade5a455
MATLAB
559
25
function [in,out] = getdegree(map,node) %% Return the degree of a node (the number of connections in or out) % % [in,out] = getdegree(map,node) % % Input: % map: projections matrix (uni- or bilateral) % node: node number(s) - optional, default: all nodes % % Output: % in: no. of incoming connections % out...
29bb3758251879f08e987fff6c5d1bf463184ab0b27cba96baee358218b10721
MATLAB
560
23
% test the Spikes and Bumps phenomenon in ICA using simulated data % Reza Sameni, Copyright 2006 % Modified June 2018 clear; close all; randn('seed',0); rand('seed',0); x = cumsum(randn(40,1000),2); [s, A, W] = fastica(x,'approach', 'symm','displayMode', 'off','epsilon',.001); % % % W = jadeR(d); s = re...
60836782e556213ecca38a09e946d07a9bfce45e486f65a6a2e98bfe6698b335
MATLAB
560
32
function [xr, mask] = squash(x, m) % function [ret, mask] = squash(x) % % performs ret = reshape(x,prod(size(x)),1); % % [ret, mask] = squash(x, m) % masks and then squashes, returns the mask % m can be a mask or a threshold % % see unsquash [xr, dims]=sq(x); if(nargin > 1) if(size(m)==1), coords = find(sq(...
614340b5bbd25ed4497be7dc41ee8ca8c40babd0b7c4493283117b1ad4a6f446
MATLAB
560
16
function Tally = tally_timepoints(Tally, Vector) % Tally is a Ch x 2 array, the first column indicating the total number of % 1s, and the second column the total number of points in Vector. if isempty(Tally) Tally = zeros(size(Vector, 1), 2); end TotChannels = size(Vector, 1); for Indx_Ch = 1:TotChannels Tal...
df526e4d96efd243b8d63177b2f66dad644084659a5507f3b120355c96622679
MATLAB
560
17
function latency = spmup_computelatency(beta1,beta2) % implement Henson et al 2002 % latency=2*1.78/(1 + exp(3.1*beta2/beta1))- 1.78 xBF.dt = 0.5; xBF.name = 'hrf (with time derivative)'; xBF.length = 20; [xBF] = spm_get_bf(xBF) latency=2*1.78/(1 + exp(3.1.*beta2./beta1))- 1.78; % figure; plot(beta1*xBF.bf(:,1),'--'...
72e97f7deb2989c9c9eada7b662541c64c4fafcea0f403d4f5d85c0d2de09b28
MATLAB
562
19
function Summary = disp_summary_table(Data, ColNames) % gives summary table of means and so on Dims = size(Data); if istable(Data) if isempty(ColNames) ColNames = Data.Properties.VariableNames; end Data = table2array(Data); else if isempty(ColNames) ColNames = string(1:Dims(2)); en...
01646846b60033ef93db216645b7a7f94b235507af56b1505822335d1c5f4f5c
MATLAB
563
19
function overlay_cycles(Burst, EEG) SampleRate = EEG.srate; CycleCount = numel(Burst.NegPeakIdx); hold on for idxCycle = 1:CycleCount PrevPoint = Burst.PrevPosPeakIdx(idxCycle); NegPoint = Burst.NegPeakIdx(idxCycle); NextPoint = Burst.NextPosPeakIdx(idxCycle); Cycle = EEG.data(Burst.ChannelIndex, Prev...
cc9e63f876e3619499d9e305bfc8b839bb10b9b86f88b8a2b9364e15b14e4022
MATLAB
563
23
function fontScale(scale) % function fontScale(scale) H = gcf; allText = findall(H, 'type', 'text'); allAxes = findall(H, 'type', 'axes'); allFont = [allText; allAxes]; fontSize = get(allFont,'FontSize'); if ~iscell(fontSize) fontSize = num2cell(fontSize); end newFontSize = LocalScale(fontSize, scale, 2...
526460bfdbf4891bedbfd3b5544ce7c12eb7df9ac63bbf3e972e7fbdee033711
MATLAB
564
23
function [Neighbors_Mat,Im] = Get_Neighbors_Coordinates(Im,x0,y0,Avoid) Neighbors_Mat = []; % [x,y,type]. type 0 = 4 connected neighbor. type 1 = corners. for x=-1:1 for y=-1:1 if(Im(y0+y,x0+x) == 1 && ~(x == 0 && y == 0)) Neighbors_Mat(end+1,1) = x0+x; Neighbors_Mat(end,2) = y0+y; if(x == 0 || y =...
6756cf75a4aaf6ef9e6aee346c565844b0b58cf2316223122224fcabbe207b2e
MATLAB
564
17
% create channels mapping %load cluster cordinates [file,path]=uigetfile('*.csv','clusters_coordinates'); cluster_coordinates = readtable(fullfile(path, file)); cd(path) %load cluster info [file2,path2]=uigetfile('cluster_info.tsv','cluster_info'); cluster_info = tdfread(fullfile(path2, file2)); cluster_coordinates.c...
746699bd2697af0047b20d48826c4d3df6c8e09f5ec605769f669aa68c855334
MATLAB
565
15
function ng = gam_dens(shape, scale, data) % This code was ported from the nipy project (http://nipy.org) and was % originally contrributed by Bertrand Thirion - returns the gamma density % ------------------------------------------ % This file is part of the adaptative_threshold SPM plug-in % Copyright (C) Cyril Perne...
d4ff7dc96212379f3f465cef67d59174f6a9ed9e820b677effca20bab128e31c
MATLAB
565
21
function [eu, dens] = load_euclidean(ids, ipsi, contra) if ischar(ids) || isstring(ids) load(fullfile(ids, 'data'), 'ids', 'map'); N = size(map.density, 1); ipsi = map.density(:, 1:N); contra = map.density(:, N+1:end); clear map N; end eu = load('euclidean', 'map', 'ids'); [a, b] = ismember(eu.ids...
a08fd8cc219247bb6fd974c17bb8d066e25f61742efaa5fe3a9a255cdd642220
MATLAB
566
25
function om = nufft_samples(type, Nd) %function om = nufft_samples(type, Nd) %| %| default simple sampling patterns if nargin < 2, ir_usage, end switch type case 'epi' % blipped echo-planar cartesian samples if length(Nd) == 1 om = 2*pi*[-Nd/2:Nd/2-1]'; elseif length(Nd) == 2 o1 = 2*pi*[-Nd(1)/2:Nd(1)/2-1]' /...
005ffbed31df57b757cff54bc4a97dee17e6eb09ac1fc070aa7601a5541b9fe0
MATLAB
567
22
function newlist = removeprefixtofilenames(filelist,prefix) % filelist must be a cell array where each element is a char-array % containing a list of file names. newlist=cell(1,length(filelist)); for i=1:length(filelist) wfiles=[]; for img=1:size(filelist{i},1) [pth,nm,xt] = fileparts(deblank...
4a5468c1f0365c369f1bc91afcad93907125878fe06018012b096f405f292439
MATLAB
567
22
function output_str = simple_name(input_str) %SIMPLE_NAME removes special caracters from the template interval name % Detailed explanation goes here tmp_idx = strfind(input_str, '<$§'); if ~isempty(tmp_idx) input_str(tmp_idx:end) = []; end tmp_idx = strfind(input_str,'§$>'); if ~isempty(tmp_idx) input_str(1...
72f1ea23f49f9106a74a02890fee4314ac3a64be2cca5a663e4abebeba0dc3fb
MATLAB
567
19
function statbrushlink1(handles,tf) %STATBRUSHLINK Set brushing and linking for graphics objects % STATBRUSHLINK(H,TF) turns off brushing and linking for the objects % whose handles are given in the array H if TF is false, and turns it on % if TF is true. % Copyright 2007-2010 The MathWorks, Inc. for j=1:num...
bf6c6c72bbbb885e1b32c288d3e30de439b03c16dc40f745954883057a0cfe41
MATLAB
567
13
%% Temporal vector, change resolution: % Res: New Resolution % WinSize: Old resolution % SNWData: The original data function SNWDataRes = ResFine2Coarse_TimeData(Res, WinSize, SNWData) %change bin resolution to 4ms NewBinSz = floor(Res/WinSize); Len = length(SNWData.SpE); SNWDataRes.SpE = mean(reshape(SNWData.SpE,Ne...
cc3e099180b9601a6a7778a30c34a0404293bad5c9c6f86f3491c1a8f4a0a506
MATLAB
568
22
function Bursts = categorize_burst_frequency(Bursts, FrequencyBins, Labels) arguments Bursts FrequencyBins = 0:4:40; Labels = []; end BurstFrequencies = [Bursts.BurstFrequency]; BurstFrequencies = discretize(BurstFrequencies, FrequencyBins); for BurstIdx = 1:numel(Bursts) if isnan(BurstFrequencies(B...
e7ab17db9091bc62e83d9c80a045db0227c7b7f0ef4807661d71196bf2000261
MATLAB
568
23
classdef LossSonoNERF < nnet.layer.RegressionLayer properties handleSonoNERF handleERTFReturn indexERTFSmoother ERTFSmoother smoothingKernel end methods function layer = LossSonoNERF( name ) % Create an L1LossLayer object with the specified n...
58283f10fb9567c7dadaefb35c0bc129dcf6191d988142ec74f2a982f1373db4
MATLAB
569
14
clear all, close all load data_conc_noise.mat fig = figure(1); fig.Position(3:4) = [330 290]; semilogx(IonConc, NoNoise, 's--', 'LineWidth', 1, 'MarkerFaceColor', 0.95*ones(1,3),'Color','#F5266D', 'MarkerSize', 14) hold on semilogx(IonConc, WithNoise, '^--', 'LineWidth', 1, 'MarkerFaceColor', 0.95*ones(1,3),'Co...
ccb0b93d3e8833765a481d3a65298645c58311f01560546885f0b184cbabaf82
MATLAB
569
22
function [ trace ] = align_trial_traces( trace ) %ALIGN_TRIAL_TRACES Summary of this function goes here % Detailed explanation goes here %% figure out starting quadrant q = get_quadrant(trace(:,1)); %% adjust trace according to starting quadrant if q == 2 % flip horizontally trace...
ea104ba70965c0e728e87e9a2cdde030846c5aa069b6026a103ee44634c9cb8b
MATLAB
569
24
function z = zscore(X, w, dim) %ZSCORE Compute z-scores ((X - mean(X))/std(X)) for observations in X if isempty(X) z = []; return; end if nargin < 2 w = 0; end if nargin < 3 % try to infer which dimension to work along dim = find(size(X) ~= 1, 1); if isem...
d20d21afbeb8a364af3d183704dd7bfc86b027273138c57882f44ad13d179f06
MATLAB
570
23
clear, close all load data_vout.mat fig = figure(1); fig.Color = [1 1 1]; fig.Position = [25 25 450 360]; scale = 1; Vout = (Vout-mean(Vout))*0.34 + 0.78; skip = 1; ax1 = nexttile; ax1.LineWidth = 1; plot(time-time(1), Vout*scale, "LineWidth", 2, "Color", "#F5266D"); xlabel("Time (s)") ylabel("V_{spik...
b144e431a47e41b444532c9f74efe6548de4ac1d5095e84c6d165be9a43050a3
MATLAB
571
17
function fulldir = path_find_dir(part) %function fulldir = path_find_dir(part) %| %| find full path to a directory given only the trailing part of it, %| searching the current matlab path %| if nargin < 1, ir_usage, end p = path; % long string separated by ':' (pathsep) dirend = [0 strfind(p, pathsep)]; % all the ':'...
5362280b2d8e308c81423e0428321de0ee9a071a0f8bd78891ca9ec44cccedb8
MATLAB
572
18
function verstr = version() %VERSION Get version info md = jrclust.utils.info(); verstr = sprintf('%d.%d.%d', md.version.major, md.version.minor, md.version.release); if ~isempty(md.version.tag) verstr = sprintf('%s-%s', verstr, md.version.tag); end if ~isempty(md.version.codename) ...
120773d5f3eae52f7e16ce245a80291a4c89ee8a7ab3a3b492f9d70e516fa2d3
MATLAB
575
27
function [stm, psk, off] = get_s_knls(session, channel, unit, fold) % Get kernels of specific s-model % % Parameters % ---------- % % - fold: integer scalar % Fold number % % Returns % ------- % - stm: 4D array % (width x height x time x delay) stimulus kernel of s-model % - psk: vector % (delay x 1) post-spike k...
0ceb14cd5bf71cf4ac947961db0b6aa7bdf5d936bb34444ce229b29a73c95578
MATLAB
578
19
%Recursive Zonal Equal Area Sphere Partitioning: Tests % % Recursive Zonal Equal Area (EQ) Sphere Partitioning Toolbox. % Release 1.10 2005-06-01 % %Functions %========= % % eq_area_error Total area error and max area error per region of an % EQ partition % Copyright 2004-2005 Pau...
47ca62d86463fe5b5382d30c56079c681d911993c8f258451aaf7d66fbe3f938
MATLAB
579
18
%plot of the 2 components of the 3-way PCA function vartuck(x,k) figure color=['r' 'g' 'b']; [o,v]=size(x); h=plot(x(:,1),x(:,2),'.'); set(h,'color',color(k)) set(gca,'XLim',[(min(x(:,1))-(0.05*(max(x(:,1))-min(x(:,1))))) (max(x(:,1))+(0.05*(max(x(:,1))-min(x(:,1)))))]); set(gca,'YLim',[(min(x(:,2))-(0.05*(max(x(:,2))-...
be053e964ed50b2b7fd99f2e6089db37a6d3760681c91749bc9bb9bc419ba900
MATLAB
579
24
function show_s2_sphere %SHOW_S2_SPHERE Illustrate the unit sphere S^2 % %Syntax % show_s2_sphere % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. % $Revision 1.10 $ $Date 2005-06-01 $ % Documentation files renamed % $Revision 1.00 $ $Date 2005-02-12 $ % % For licensing, see COPYING. % For re...
88add05fe9ae56a6597405bef40bc25dadc4d9056a6fb174504f9f232ee612d0
MATLAB
580
18
%split before and after single exp clear clc [file, path] = uigetfile('*.mat','MultiSelect','off');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path load(datafile); if iscell(all_data) new_data = ...