sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a917f0b38172e6438d48a6cf4821ec65cc553f0f6113c889f36fa5e87a56ce43
MATLAB
460
18
function [singleresponse] = extSingleBOLDresponse(timeseries) % This program is intended to calculate the single bold response % % % % % % by Hiroaki Hamada, Araya inc. 2019/Sep/22th [nTime, nROI] = size(timeseries); singleresponse = zeros(120,5,nROI); BOLDStim = [81,201,321,441,561] for nstim = 1:5, temporalsignal...
ce1e3258c9a3290ae00db04eec83b4cd6db35850680420394bb67a7bf8961759
MATLAB
460
16
function B = Test_CPL_XPL_Image(A,GTruth,net) cmap = GTruth.LabelDefinitions.LabelColor; maxrow = 224; maxcol = 224; [C,max_row,max_col] = Partion(A,maxrow,maxcol); Result_Image = cell(max_row,max_col); B = cell(max_row,max_col); for i =1:max_row for j =1:max_col Result_Image{i,j} = semanticseg(C...
da9acbcda086e8f5329f2e2f6bc781878fc3c082c8cbfb85ae827e7a7afa4185
MATLAB
460
21
function X = newfft_exact_for(st, x, om) %function X = newfft_exact_for(st, x, om) %| %| exact forward NUFFT nthread = 1; % todo how = 'outer'; % todo if ~isvar('om') || isempty(om) om = st.om; end if isempty(om), fail 'om or st.om required', end if exist('dtft_mex') == 3 X = jf_mex('dtft,forward', double(om'), d...
0d61358484e39647dd204d35a12e29ec04522fe11ca8fda873ebb74b8114f05a
MATLAB
461
11
function resetFigTraces(hFigTraces, rawTraces, hCfg) %RESETFIGTRACES if hCfg.nSegmentsTraces > 1 tlim1 = ([0, size(rawTraces, 2)] + hFigTraces.figData.windowBounds(1) - 1) / hCfg.sampleRate; tlim1 = round(tlim1*1000)/1000; hFigTraces.axApply('default', @axis, [tlim1, 0, hCfg.nSites + 1]...
f9df11dd4bdf895219d8a7de0832a8e645f0411d12ff393d01b973b09ef205d5
MATLAB
461
19
function Time = bursts2time(Bursts, Pnts) % converts a struct of bursts data into an array of 0s and 1s for 1 if % theres a burst. % t is in datapoints, and will be the same length as Time if isfield(Bursts, 'ClusterStart') Starts = [Bursts.ClusterStart]; Ends = [Bursts.ClusterEnd]; else Starts = [Bursts.S...
07233e29e7f717fb9b583dd7862f9dbcb0fb34bf6e556ea9fe9ebc95de75b999
MATLAB
462
15
% load the module data for 120 reps on R = 5, earlyStop = 60 % if it is of the full length, we need to set earlyStop = 100 with % moduleResultfull.mat clear; close all; epochEarlystop = 100; for i = 1:120 i folderName_R_5_rep_120_diff_data{i} = sprintf('r_5_rep_120_diff_data/%d',i); dataFile_R_5_r...
53fc49753cfbe177b5c068597cdfeaadba9313e8323e968f41abd14862698891
MATLAB
465
18
function [odims_same odims] = fatrix2_same_odims(blocks) %function [odims_same odims] = fatrix2_same_odims(blocks) %| %| check if odims if each block is same; %| if so, return aggregate odims too as cell MM = numel(blocks); b1 = blocks{1}; odims = cell(MM, 1); odims_same = true; for mm=1:MM bm = blocks{mm}; if ~ise...
b3857bb13e6b44575affe0163e855e13879b375b4ec8692524d20e030afd4ef7
MATLAB
465
19
function [ mrf_C ] = calc_mrf_C(Theta, nu) % Calculate normalizing constant for MRF prior for specific edge (i, j) mrf_C = 0; K = size(Theta, 1); % Generate matrix with all possible binary vectors as the rows % From http://www.mathworks.com/matlabcentral/newsreader/view_thread/121631 D = (0:2^K-1)'; B = rem(floor(D *...
cbeed806e32e13c6c194ea3cf02c8ef41e19164fb53d97a8c69e58dc283377cc
MATLAB
465
18
function [idims_same idims] = fatrix2_same_idims(blocks) %function [idims_same idims] = fatrix2_same_idims(blocks) %| %| check if idims if each block is same; %| if so, return aggregate idims too as cell MM = numel(blocks); b1 = blocks{1}; idims = cell(MM, 1); idims_same = true; for mm=1:MM bm = blocks{mm}; if ~ise...
0565e87a6c4ac8d00d916516d4ebf050caaa23860aeb2a33825a5c5a6f7fb517
MATLAB
466
15
function Weighted_Counts = Weighted_Histogram(Values,Weights,Edges_Vector,Sum1_Mean2) Weighted_Counts = zeros(1,length(Edges_Vector)-1); for i=1:length(Edges_Vector)-1 F1 = find(Values >= Edges_Vector(i) & Values < Edges_Vector(i+1)); if(Sum1_Mean2 == 1) Weighted_Counts(i) = nansum([Weights(F1)]); elseif...
bd7ad41eea78ee977d83e9f5ff4b2c719cb9cb868bd540e24a55da9516a0baff
MATLAB
466
4
function [ECG_mean, ECG_median, ECG_cov, ECG_mean_robust, ECG_median_robust, stacked_beats, beats_sqi] = TimeDomainECGFeatures(data, peaks, params) % TimeDomainECGFeatures has been deprecated. Use ecg_features_time_domain instead. warning('TimeDomainECGFeatures has been deprecated. Use ecg_features_time_domain instead....
d5096be46b82efac8d2f78eba3bed1c9b7e38d66c62271bde13fcad02648d7da
MATLAB
466
16
function [EuD_Matrix]=mnl_GroupEuclidean_Matrixv2(data1,data2) %Atempt to speed up the calculation of Euclidean distances %% New Method sz1=size(data1,1); sz2=size(data2,1); Dist_Matrix=nan(sz1,sz2); %Calculate the distances for i=1:sz1 temp=data2-data1(i,:); %Sum temp=temp.^2; %Square it to remove negatives ...
f5d2c1c29176796ebcc79a4eacb99fb1bb2f66267155f8e347b193a90f626e2b
MATLAB
467
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) [data,ts,~, ~] = current_signal(app, app.settings.channel_idx.resp); data = lowpass(data,3,1/ts(1)); data(:,2) = (ts(1):ts(1):ts(2))'; app.res...
064c065fa9d185aeadf8d0916e5330506f744bf8682197a5a416c0bc45e907d3
MATLAB
470
28
function [nx] = normaliz(x) % Normalize matrix rows dividing by its norm % % [nx] = normaliz(x) % % input: % x (samples x variables) data to normalize % % output: % nx (samples x variables) normalized data % % By Cleiton A. Nunes % UFLA,MG,Brazil [m,n]=size(x); nx=x; nm=zeros(m,1); for i = 1:m nm(i)=norm(nx(i,:));...
acf4cb3ee533acd807a21043a72c849c359160bd19298f366963c8136a92dfec
MATLAB
470
15
function c_partition = genRobustCommunity(B, N) % for consensus_comm_wei % C is a pxn matrix of community assignments where p is the number of optimizations % that have been performed. n is the number of nodes in the system. C gives the real partitions. n = size(B,1); p = N; partitions = zeros(p,n); for i = 1:N pa...
96cfb0824903e22049583ebfc6ca0fd8449723b549e12b46edb0045965c1f84d
MATLAB
471
16
function [thisMovie] = dfofMovie(thisMovie) % converts movie to units of DFOF % get the movie F0, do by row to reduce potential memory errors inputMovieF0 = zeros([size(thisMovie,1) size(thisMovie,2)]); for rowNo=1:size(thisMovie,1) inputMovieF0(rowNo,:) = nanmean(squeeze(thisMovie(rowNo,:...
f097987114e1d66c269fd2cd595779bba0fee9752cc54ad8726dab654f705a49
MATLAB
471
15
function setFigPos(figPos) % utility for manually setting the position of the current figure windows figs = get(0,'Children'); keys = figPos.keys; tags = {figs.Tag}; for f=1:length(keys) idx = strcmp(tags,keys{f}); if any(idx) figs(find(idx)).Units = 'normalized'; ...
f8d02e76f4ba1c7c2885e54afc4886cecb66ed867d00ffcf31771c68901adcb1
MATLAB
471
18
[file, path] = uigetfile('cluster_info.tsv'); datafile = fullfile(path, file); w = tdfread(datafile); cd(path) good_idx = find(w.KSLabel(:, 1) == 'g'); A = readNPY('templates.npy'); waveforms = zeros(length(good_idx), size(A , 2)); tamplate_ind = readNPY('templates_ind.npy'); %% for i = 1:length(good_idx) ...
49b29622c93b6ec91a88dd4952955521dee0b9b8b1a84e1dcbdcc2adea0ffd39
MATLAB
472
19
function S1 = mergeStructs(S1, S2, fieldNames) %MERGESTRUCTS Merge a pair of structs if isempty(S1) S1 = S2; return; elseif isempty(S2) return; end if nargin < 3 fieldNames = fieldnames(S2); else % fieldNames can be a cell or a char here fieldNames = inte...
e1a1c0096f3b111c5c39527c5d537d9f9ca0dbcd3f343a72bec4cf8c032af65e
MATLAB
472
19
function [x fs mode] = LoadSeizureEEGFull2(path, fname) % load data load([path fname]); reg = regexp(fname, '_'); varname = [fname(reg(2)+1:reg(4)-1) '_' num2str(str2double(fname(end-7:end-4)))]; md = fname(reg(2)+1:reg(3)-1); if(isequal(md, 'interictal')) mode = 1; elseif(isequal(md, 'preictal')) mode = 2; el...
f135aea7afd470cec810b9a632d0245b67ae93266303ac38b3140a904929a6a4
MATLAB
472
14
% HBF_LFM_B_LC_XYZ builds magnetic lead field matrix based on xyz-oriented % unit-current dipoles % % LFMm=HBF_LFM_B_LC_XYZ(meshes,coils,TB,spos) % meshes: BEM geometry, cell array of hbf structs % coils: coil description, hbf struct % TB: TB matrix built with the hbf BEM solver % spos: source ...
a83af35d9fafc24a8a621548aa358f9fd6e781a36c36195aaa0fe9ada57e3d49
MATLAB
473
17
function samplesOut = fftLowpass(samplesIn, fCut, sampleRate) %FFTLOWPASS Low-pass filter samplesIn if isempty(fCut) samplesOut = samplesIn; return; end shape = size(samplesIn); samplesX = fft(reshape(samplesIn, shape(1), [])); freqs_ = fftshift((1:size(samplesX, 1))/size(sampl...
5ee125727ce311c35747c22a504ea5fa4da8df56891389308c6cc49d8b2fd49b
MATLAB
474
16
function thresVec = getIterThres(vel,indVec,winSize,Fs,nStd,flag) thresVec = zeros(size(indVec)); if flag == 0 for n = 1:length(indVec) ind = indVec(n)-(winSize*Fs); if ind<1; ind = 1; end thresVec(n) = nStd*std(vel(ind:indVec(n))); end else for n = 1:length(indVec) ...
6ea3e34da637116b1be63d886e1ad31190393d8e6d9e29d798c2a003ec0b5bc1
MATLAB
475
12
% HBF_PHIINF_XYZ computes potential due to a xyz-oriented unit-current-dipole % triplet in infinite homogeneous conductor that has unit conductivity % % phiinf=HBF_PHIINF_XYZ(fp,spos) % fp = field points (where the field is computed), [N x 3] % spos = source positions, [M x 3] % % phiinf = resulting ...
a6b672fbd488d96a09e67165ddb379d5992bc750e56f45d7dccdb55982e658fb
MATLAB
475
7
function [HR, peaks, HRPeriodSD] = HRCalculation2(x, f, fs, trim, wlen, averaging_method) % HRCalculation2 has been deprecated. Use hr_calculation instead. Check the options in hr_calculation warning('HRCalculation2 has been deprecated. Use hr_calculation instead. Check the options in hr_calculation'); peak_det_method ...
b628f65df334b2bbdba275b5113eae5c639bd418f12e335f05f1ca33ec6a8cda
MATLAB
475
14
%Shinjini Kundu (c) 2016 %Installation file for Transport-Based Morphometry %Go to the GP file in the TBM folder and run these lines of code codegen GPReduce -args {coder.typeof(1,[Inf Inf Inf],[1 1 1])} -o GPReduce codegen GPExpand -args {coder.typeof(1,[Inf Inf Inf],[1 1 1]), zeros(1,3)} -o GPExpand %Go to the DGr...
46f65ad0a01f88bfb36a2e0773be4fa97ef0b2d42a96d2b1953d89053aa9287a
MATLAB
476
23
function C=ldapinv(X,y,weight) %+++weight: =0 Bayesian approximation. %+++ =1 Fisher DA, classes weighted. %+++ The last element in C is the bias term. %+++Hongdong Li,Nov. 23. y=sign(y); A=length(y); B=length(find(y==1)); C=A-B; r1=A/B;r2=A/C;R=[]; kp=find(y==1); kn=find(y==-1); XX=[[X(kp,:) o...
347721f0c720c7b25501be64822fa811fa31f76a1002a1f70c5619f064134cec
MATLAB
477
14
function [ nexFile ] = nexCreateFileData( timestampFrequency ) % [nexFile] = nexCreateFileData(timestampFrequency) -- creates empty nex file data structure % % INPUT: % timestampFrequency - timestamp frequency in Hertz % nexFile.version = 100; nexFile.comment = ''; nexFile.freq = timestampFrequenc...
64bf056fc59d0b683311546fe01dbe8ab91cfe5f24c7c0d8c48fb0531a323273
MATLAB
478
22
% Sparse Convolution: x_sparse=R*d % Input % d: drive vector % r: response vector % Output % x_sparse: drive vector function x_sparse=sparse_convolution(d,r) d=makerowvector(d)'; r=makerowvector(r)'; L=numel(r); Np=numel(d); % To avoid problems with the size of the response if L>Np r=r(1:Np); ...
66e31ee8411b9f0e6384e9a2be59ffe400ffadca30488f04f52d35efd424e702
MATLAB
478
15
% Functio to calculate time durations of (selected) raster conditions % Input % Onsets (frames) % R_Condition (Cells x Frames) Cell of Nc Conditions % fs: Sampling Frequency (Hz) % Output % Table of Durations function RasterDurations=get_raster_durations(Onsets,R_Condition,fs) % Setup Nc=numel(R_Condition); for...
814831db56a63190ba65fdbab4c539d691f7f04487e9bfc78181b7f4966e2096
MATLAB
478
20
function recluster(obj) %RECLUSTER Recluster spikes if isempty(obj.res) obj.loadFiles(); end if isfield(obj.res, 'hClust') obj.isSort = 1; obj.res.hClust.hCfg = obj.hCfg; % update hClust's config obj.res.hClust.reassign(); obj.res.hClust.autoMerge(); obj....
48ab8a934a1815349b842246ea69d88d53ff46f5e174a1a9dedd9a25746cdce6
MATLAB
479
4
function [h, A, S_mean, S_median, S_max, S_min, S_max_min_avg] = SpatioTemporalInnovationsFilterDesigner(template_records, varargin) % SpatioTemporalInnovationsFilterDesigner has been deprecated. Use spatio_temp_innovs_flt_designer instead. warning('SpatioTemporalInnovationsFilterDesigner has been deprecated. Use spati...
4f7814f455d2b391bd8df26a5c0ff532278e6940600a5de49baa39438188ab20
MATLAB
479
14
% HBF_SOLIDANGLES calculates solid angles spanned by triangles of a mesh in % one point % % omega=HBF_SOLIDANGLES(mesh,fieldpoint) % omega=HBF_SOLIDANGLES(elements,vertices,fieldpoint) % mesh: hbf mesh struct % elements: triangle description, [N(triangles) x 3] % vertices: mesh vertices, [N(vertices...
ff531b28a242632cfcbae771caa23d1b34b88f0402ec989984557acf6c9cda62
MATLAB
479
25
classdef (Hidden) data_writer_handle < handle % % Class: % adi.data_writer_handle % % See Also: % --------- % adi.createFile % adi.file_handle properties pointer_value end methods function obj = data_writer_handle(pointer_value) ...
3b561b5acadaa2ace3f8c52de0c8c25ab82ded36ad5bb366e3b3d27bd05ee45b
MATLAB
480
12
% HBF_DB_Linear makes a DB matrix between a mesh and field points. % The matrix is made for an arbitrary field component and linear basis. % % DB=HBF_DB_LINEAR(fieldpoints,fielddir,sourcemesh) % fieldpoints: a set of points, where DB is computed, [N x 3] % fielddir: field directions (unit length), [N x 3] %...
4ba973ceea82cb448dea76bb55d289d8c120b93e49116df4ed31387490b8c8f9
MATLAB
480
15
function [y] = percentile(x,p) % y = percentile(x,p) % p is a number between 0 and 100 (the percentile value) % x is the data vector (it will reshape any matrix into a single column) % % I know there is the function prctile.m which does this, but it seems % stupid to check out a license for a toolbox just for this ...
50d287d57d2da53ddb4bdfc1a0584629e65c5d304aca8da72594c644202a749c
MATLAB
480
7
function [HR, peaks, HRPeriodSD] = HRCalculation4(x, f, fs, trim, wlen, averaging_method) % HRCalculation4 has been deprecated. Use hr_calculation instead. Check the options in hr_calculation warning('HRCalculation4 has been deprecated. Use hr_calculation instead. Check the options in hr_calculation'); peak_det_method ...
b53e88ecaa1d4669e7cd4ea1394b7d2e0450cdcb748c2a6680ee66a3e9326156
MATLAB
480
13
function success = reassign(obj) %REASSIGN Reassign clusters, e.g., after a change of parameters success = 0; if obj.nEdits > obj.editPos % not at tip of edit history, back out warning('cannot branch from history; use revert() first'); return; end obj.sRes = jrclust.sort.assignClust...
ee8bf99825296e587458d9336efab5a1f4c70e910a0cf8f436d53d6857758e9b
MATLAB
481
15
function updateFigTime(obj, doAutoscale) %UPDATEFIGTIME if ~obj.hasFig('FigTime') return; end hFigTime = obj.hFigs('FigTime'); jrclust.views.plotFigTime(hFigTime, obj.hClust, obj.hCfg, obj.selected, obj.maxAmp, obj.currentSite, obj.channel_idx); hFigTime.setMouseable(); % no special mou...
6554047655f538ba3e58dc1853826f655854314773b071f64ea94c320331a045
MATLAB
482
13
function f = get_save_figure(f, folder, fname) % Create new figure if nargin == 0 %f = figure('WindowState', 'maximized', 'PaperUnits', 'normalized', 'PaperOrientation', 'landscape', ... % 'PaperPositionMode', 'manual', 'PaperPosition', [0 0 1 1]); f = figure('WindowState', 'maximized'); elseif nargin =...
6a340205b178b01f43f0afc4c4f9213b783b201869531f1ec25f04afc1af938f
MATLAB
482
22
function x = newfft_exact_adj(st, X, om) %function x = newfft_exact_adj(st, X, om) %| %| adjoint of exact NUFFT nthread = 1; % todo useloop = false; % todo if ~isvar('om') || isempty(om) om = st.om; end if isempty(om), fail 'om or st.om required', end if exist('dtft_mex') == 3 x = jf_mex('dtft,adjoint', double(om...
786c92a85f3e7ec9b1e9ac0497812c7f00ed7c1c7e8278de88a841fa2550c2e1
MATLAB
482
34
function fo = sum_fid(fids,descr) 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); fid1m = mean(fid1,2); fid2m = mean(fid2,2); % if ~exist('fm1') % fm1 = fid1m; % fm2 = fid2m; % else % fm1 = fm1 + fid1m; % fm...
8c470d9d11914fb7df4c7569114ec7ac5ec664a3e1eeaf958e667a451349a567
MATLAB
483
32
function [a,b,xfit,yfit,fit_error] = fit_ax_b(x,y,doplot) if ~exist('doplot') , doplot=0;end %remove inf var_x = repmat ( sum((x-mean(x)).^2)/size(y,2), size(y,1),1); cv=sum( repmat(x-mean(x),size(y,1),1) .* (y-repmat(mean(y,2),1,size(y,2)) ),2 )/size(y,2); a=cv./var_x; b=mean(y,2)-a*mean(x); if nargout>2 [xf...
2e00da417dbd7cf047297156fdbe3e6868854b8368b753630b2968d88a285c4d
MATLAB
484
15
function clearMemory(obj) %CLEARMEMORY Clear GPU memory and set random seeds if obj.hCfg.useGPU if obj.isDetect || obj.isSort obj.hCfg.updateLog('gpuMemory', 'Clearing GPU memory', 1, 0); gpuDevice(); % selects GPU device gpuDevice([]); % clears GPU memory ...
e9597234308c62f13eb6ab3c58800f0ae6079fff99d78030098316204f50026a
MATLAB
484
24
%% Setup Import_FinderSpiker; %% # Check False Negative: % Rejected and unprocessed Data [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(notSIGNALS{c,v}) Nvidok=Nvidok+1; end end ...
c03b390e91f5077fc8c127870493931d89590f4081bdd307ffac8b31bce14ed5
MATLAB
485
32
function fi=change_exam_number(fi) cur_suj_name = fi(1).sujet_name; ns=1; exa = fi(1).examnumber; exanum = str2num(exa(2)); fi(1).examnumber='N1'; for k=2:length(fi) % exa = fi(k).examnumber; % exanum = str2num(exa(2)); if strcmp(fi(k).sujet_name,cur_suj_name) ns=ns+1; else ns = 1; cur_...
51ea9bdf583cae47d1748e8b833370a52bb0791c92f48026c2971d3b3d9d698b
MATLAB
486
7
function [HR, peaks, HRPeriodSD] = HRCalculation3(x, f, fs, trim, wlen, averaging_method) % HRCalculation3 has been deprecated. Use hr_calculation instead. Check the options in hr_calculation warning('HRCalculation3 has been deprecated. Use hr_calculation instead. Check the options in hr_calculation'); peak_det_method ...
fd7ea1fdded511c1d6052f162be616ebbb7c56dcfdacb555a38709ddf3f27c7a
MATLAB
487
5
function [x_filtered1, x_filtered2] = ECGSmoothingPriors(x, DiffOrder, wlen, lambda, guardlen_l, guardlen_u, adapt, withwindow) % ECGSmoothingPriors has been deprecated. Use ecg_den_seg_wise_smoother instead. warning('ECGSmoothingPriors has been deprecated. Use ecg_den_seg_wise_smoother instead.'); % Note: The order of...
7c643f2284dd8ec56bbcefbbc602436b974761d3b63a492e3f38b17bc3fa47c3
MATLAB
488
18
function R = Calc_Radius_Of_Curvature(X,Y) % This function calculates the radius of curvature of an X-Y vector of coordinates. mx = mean(X); my = mean(Y); x = X - mx; % Translation to 0. mean(x) = 0; y = Y - my; % Translation to 0. mean(y) = 0; dx2 = mean(x.^2); % mean([X - mx].^2). dy2 = mean(y.^2); % mea...
22da7a40293b8d4d6576a231d57cae8477cd80b92503f4f44b3f5f3eb9bbdc17
MATLAB
489
21
function [BOLDresponse] = extBOLDresponse(timeseries) % This program is intended to extract bold response from timeseries % % input: % timeseries: % % output: % BOLDresponse: % % by Hiroaki taiyo Hamada, Araya Inc., 2019/Sep/22th % nSub, nTIm, nROI [nSub, nTime, nROI] = size(timeseries); nTime2 = 120; BOLDrespon...
247ffa7ce22ee5c1c968ae90e8196c3c1262a805a654325a5fcbb5c712686b70
MATLAB
489
21
function vals = subplotApply(obj, plotKey, spIndex, hFun, varargin) %SUBPLOTAPPLY Apply a plotting function to a subplot vals = []; if ~obj.hasSubplot(plotKey) || numel(obj.hSubplots(plotKey)) < spIndex return; end hAxes_ = obj.hSubplots(plotKey); hAx = hAxes_(spIndex); % apply hF...
92ae25f035f7b7cad18979b45bda9f5a630a0ed5b10c41d1284b33165a38cc2f
MATLAB
489
24
function X = myTEOcircshift(Y,k) %circshift without the boundary behaviour... colshift = k(1); rowshift = k(2); temp = circshift(Y,k); if colshift < 0 temp(end+colshift+1:end,:) = flipud(Y(end+colshift+1:end,:)); elseif colshift > 0 temp(1:1+colshift-1,:) = flipud(Y(1:1+colshift-1,:)); else end if row...
58cf8a1468243977e0ab056729099e20751912f8021ca55dbac1a1e0c58ce30d
MATLAB
491
22
function GMLQA = spmup_glmQA(SPM,options) % compute QA metrics related to glm % % FORMAT: GMLQA = spmup(SPM,options) % options are 'write_R2' to write the R2 value per voxel as an image % % INPUT: SPM is the SPM.mat % note outputs vary depending wether the model was estimated or not % % OUPUTS: GLMQA....
43938a7e97e99e33f2043f3f8008e37309a324db126ebb8677f2d11c18fb0e5f
MATLAB
492
25
function [threshold,p]= RaguSingleThresholdTest(rd) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License n_it = size(rd.PTanova,4); %m = squeeze(min(rd.PTanova,[],3)); m = squeeze(mean(rd.PTanova,3)); ms = sort(m,3,'ascend'); idx = floor(n_it * rd.Threshold)...
69214063efb01fd872f70528411d5305216ce3c7849b25635507050ce42339f0
MATLAB
492
34
function fo = average_fid_mega(fids,descr) 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); fid1m = mean(fid1,2); fid2m = mean(fid2,2); % if ~exist('fm1') % fm1 = fid1m; % fm2 = fid2m; % else % fm1 = fm1 + fid1...
995e427592b2084b6ee0ca6e007f1771d3518b15bb37b604bd61dfad9232d177
MATLAB
492
18
%% tryptophan transporter rate from blood to cytosol. % b = btyr %UNITS IN uM and uM/h. function a = VTRPin(b) vmax = 700; % Vmax km = 330; % Kilberg p. 169 (effective Km because of other AA) a = vmax.*b./(km + b); %Partridge75 says Km = 190 muM (with respect to total trp) %Smith87 says Km = 15 muM (wit...
1c7885862f3de659f225ef7bb8500fe8cedcabe16694f284c85325c246aea9a1
MATLAB
493
19
function D=rad2deg(R) %RAD2DEG Convert angles from radians to degrees % % deg = RAD2DEG(rad) converts angles from radians to degrees. % % See also DEG2RAD, RAD2DMS, ANGLEDIM, ANGL2STR % Copyright 1996-2006 The MathWorks, Inc. % Written by: E. Byrns, E. Brown % $Revision: 1.9.4.2 $ $Date: 2006/05/24 03:36:15 $ i...
4be99232b76cbdb1bbb72508ffd8d5be1911bea11b2db08679336867aa1c51ca
MATLAB
493
19
function ImP = Extend_Margins(Im,R) % 1. Find the background peak: h = histogram(Im(:)); v = h.Values; % Values; e = (h.BinEdges(1:end-1) + h.BinEdges(2:end))/2; % Bins centers (locations. Mean of each consecutive edges pair). [Peaks1,Locs1] = findpeaks(v,e,'SortStr','descend'); if(length(Peaks1)) [Rows,Co...
66c21a921d68d8df9b25f79fa947a78d6dfa9e254d75dab62cc66e103d78276e
MATLAB
493
20
function filename = get_filename(session, channel, unit) % Get neuron's filename % % Parameters % ---------- % - session: scalar % Session number with format: yymmdd % - channel: scalar % Channel number % - unit: scalar % Unit number % % Returns % ------- % ...
94818ec5f0cb8e9b92be87f3264799c234066e5cbeab7841436c4a536f71afc8
MATLAB
493
16
% Conident predicted labels % from binary inputs function [Yconfident,ClassRatebin]=getrighclassbinary(Y,Yallbin) Nobser=numel(Y); labelconditions=unique(Y,'legacy'); Nsim=size(Yallbin{1},2); % Get right classes: for k=1:numel(labelconditions) Ybin= false(Nobser,1); Yclassbin=Ybin; Ybin(Y==labelconditions(k))=...
da981bcb8fcbc6fe9aab690fbb137ada16d8b162294ab655e5221af3bc948dd9
MATLAB
493
16
function [Power, Frequencies] = compute_power_fft(Data, fs) % runs fft on signal. Data is a 1 x t array. % Parameters nPoints = numel(Data); % Total number of samples % Compute the FFT of the signal fftSignal = fft(Data); % Compute the power spectrum Power = abs(fftSignal/nPoints).^2; Frequencies = fs * (0:(nPoints...
de88d90e9bd28bd01a876f09a7ca851676222c53a93b545fb64e3c5b6dce6318
MATLAB
493
8
function [score1, score2, peaks1, peaks2, rank1, rank2] = ChannelIndex12(x,f,fs, varargin) % ChannelIndex12 has been deprecated. Use sqi_multi_matched_filter instead. warning('ChannelIndex12 has been deprecated. Use sqi_multi_matched_filter instead.'); num_peak_det_itr = 1; template_type = 0; template_params = [];...
f86794e1586d95c19a5e71ad8e868c4379cdf826de74513e27fc0a89e82be028
MATLAB
493
8
map=readtable('D:\Canada_2020\UK_biobank\reports\AD\genetics\EURnoWB\METAL\chroms_viz\cytoBand.txt'); pos=readtable('D:\Canada_2020\UK_biobank\reports\AD\genetics\reports\summary_stats_ALL_cut.xlsx'); for i=1:length(pos.pos) ix= (map.Var2<pos.pos(i)) & (map.Var3>pos.pos(i) & map.Var6==pos.chr(i)); towrite(i,1)=...
ff1e10bce4e2c3bb34e50ca0628f7ca48acd369bc5f0b1eef57abca4fc327125
MATLAB
493
18
%% results of the 10-fold cross validation addpath 'Analysis codes' load demographic; load paper_indices; load Originals/original_volumes.mat; %age and gender only Z = [ages(inds==1) (genders(inds==1) vol(inds==1)]; L = group(inds==1)'; cross_validation_script(Z(:,1:2),L); %age and gender only cross...
3ec22fd1eaadf699b4e0c7dbbbe5a9fbeaa663c17fe5e2e272057981ea646f81
MATLAB
494
22
function [ROIname] = ExtROIname(roipath) % This program is intended to % % input: % roipath: % % output: % % by Hiroaki Hamada, Araya Inc., 2019/08/29th listing_roi = makeList(roipath, 'ID*.nii'); nROI = length(listing_roi); % extract ROInames and ROIindex for nroi = 1:nROI, % extraction of ROI names roiname = ...
e7bee23ba3d6fcf0f43568781d7c57076418ba40913b376f2396c15f94eda3ff
MATLAB
494
24
function dspCMapColorbar(step,type) cla switch(type) case 'br' x = (-8:8) * step; cm = zeros(16,3); for i = 1:8 cm(i,:) = [((i-1) * 0.125) ((i-1) * 0.125) 1]; cm(i+8,:) = [1 1-i*0.125 1-i*0.125]; end otherwise error('Colormap not yet implem...
bef1f43a9103be6e5fa046b007338f63140c32570f88645375e718bcebb002ad
MATLAB
496
13
function [EyesOpenTrialIndexes, EyetrackingQualityTable, TitleTag] = ... only_eyes_open_trials(TrialsTable, CheckEyes, Paths, Task) TitleTag = ''; if CheckEyes TitleTag = [TitleTag, '_EO']; EyesOpenTrialIndexes = TrialsTable.EyesClosed == 0; EyetrackingQualityTable = readtable(fullfile(Paths.QualityChec...
edd8c2007f49674d964a9314b377269e3611e78447a51cdfd0efd298da12a7ec
MATLAB
496
20
function rd = CollapseAcrossXAxis(rd, Border, Label) V = zeros(size(rd.V,1),size(rd.V,2),size(rd.V,3),size(Border,1)); for i = 1:size(Border,1) % TK 7.2.2017 StartFrame = round((Border(i,1)-rd.TimeOnset) / rd.DeltaX) +1; EndFrame = round((Border(i,2)-rd.TimeOnset) / rd.DeltaX) +1; V(:,:,:,i) = me...
146ac9f533d7180ea8b5c6bdd7436e1285608cf444d4869ee797e6ae4c81c081
MATLAB
497
21
function [CBVresponse] = extCBVresponse_madino(timeseries) % This program is intended to extract bold response from timeseries % % input: % timeseries: % % output: % BOLDresponse: % % by Hiroaki taiyo Hamada, Araya Inc., 2019/Sep/22th % nSub, nTIm, nROI [nSub, nTime, nROI] = size(timeseries); nTime2 = 35; CBVres...
570fe46aa0f9788af9e8be471b61ef01c90242380c9c7073af6ffe2ee3584c44
MATLAB
497
24
function out = gs(data,smthfact, interpfact) %function out = gs(data,smthfact, interpfact) % smooth 2D data with a gaussian if nargin < 3 interpfact = 2; end if nargin < 2 smthfact = 0.5; end dimX = size(data,1); dimY = size(data,2); if smthfact % data = filter2(fspecial('gaussian',9,smthfact),data); ...
7e7ec5b8faf577ee39cab2e4df24b1ccd809125c78b79a3f1fea6be0918c497a
MATLAB
497
20
function Stats = plot_change_in_time(Data, XLabels, YLabels, YLims, Colors, StatParameters, PlotProps) if ~isempty(StatParameters) Stats = paired_ttest(Data, [], StatParameters); else Stats = []; % TODO: plot stars for group comparison end if~isempty(YLims) ylim(YLims) if ~isempty(YLabels) ...
25c5ea38f395ec65389c915d6c12f3c0b391f3286b7640a3ea3ab7b6c0bb0001
MATLAB
498
12
cd 'C:\Users\Admin\Git\repo\ZS-DeconvNet\Python_MATLAB_Codes\data_augment_recorrupt_matlab'; addpath(genpath('./XxUtils')); dxy = 92.6; % lateral sampling, in (nm) dz = 92.6; % axial sampling, in (nm) SizeXY = 27; % lateral pixel number of PSF SizeZ = 13; % axial pixel number of PSF lamd = 525; % emission wavelength, ...
4308a7e299613a701cb02ac2c8bf91dadd69606242a4784e50d3e9721f6a2311
MATLAB
498
4
function [ECG_mean, ECG_median, ECG_cov, ECG_mean_robust, ECG_median_robust, stacked_beats_all_channels, beats_sqi] = PhaseDomainECGFeatures(data, peaks, params) % PhaseDomainECGFeatures has been deprecated. Use ecg_features_phase_domain instead. warning('PhaseDomainECGFeatures has been deprecated. Use ecg_features_pha...
06a04551fdce9775d225cdd19c78ba2920423404c4f5e76caf15404c440f55cb
MATLAB
499
19
function DataOut = load_datafile(Path, Participant, Session, Variable) % loads a mat file containing the data of a single participant and single % session % get filename Filenames = list_filenames(Path); Filename = Filenames(contains(Filenames, Participant) & ... contains(Filenames, Session)); if isempty(Filename...
439fcc8b8223e75c1d88e6e360dafab8dfafeb02b7f5a338c516863ea4249db5
MATLAB
499
21
function success = autoMerge(obj) %AUTOMERGE Automatically merge clusters success = 0; if obj.nEdits > obj.editPos % not at tip of edit history, back out warning('cannot branch from history; use revert() first'); return; end obj.orderClusters('clusterSites'); for iRepeat = 1:o...
5db1d037a685b193aa71565bddc29fb315e4de6330dcc493eebf847231f44bb1
MATLAB
501
15
function B = get_file_from_same_dir(A,B) %for a given cell list of infile A : construct a file list from the same dir % of A with regulare expression given by B %if B is a cell list (already set by the user) just check the length is the same as A if iscell(B) if length(B)==length(A) return else ...
737fc0d62d77bc70ae665c514e559541340f668c703eb88f95f1f87af3608228
MATLAB
501
15
%% voltage to log/photons trial_time = 120; [file, path] = uigetfile('.xlsx',"MultiSelect","off"); datafile = fullfile(path, file); %save path cd(path) T = readtable(datafile); load("interpulated_ramp_range.mat") v = T.V; %voltage l = T.QuantumCatch_logPhotonsCm_2S_1_; %log photons int_index = 6001; ramp = round(linspa...
87cebe99e0e8116098500a1fd5cbac18773c02a0db4f6491f1f9774ffeed4372
MATLAB
502
12
%////////////////////////////////////////////////////////////////////////// function C = Cost_lambda(x, b, s, epsilon2, lambda) % Cost_lambda has been deprecated and integrated into OptimalSmoothnessFactor. % function C = Cost_lambda(x, b, s, epsilon2, lambda) % n = min([length(x), length(b), length(s)]); % x = x(1:n);...
a0c3b659ded143ec7c0196f25dbb2aed1a932e51558705f7e547248336ec2c70
MATLAB
502
27
function fo = change_file_extension(fi,ext) %function fo = change_file_extension(fi,ext) outputchar=0; if ischar(fi) fi=cellstr(fi); outputchar=1; end for nb=1:length(fi) ffin = cellstr(fi{nb}); for nbvol=1:length(ffin) [pp ff ee] = fileparts(deblank(ffin{nbvol})); if strcmp(ee,'....
5c5098695e90eb84ec3bed91b2d8de09b760ae8f0b204e29055f06862eed828a
MATLAB
503
25
function y = RaguClustSize(hits) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License ntime = size(hits,1); nruns = size(hits,2); y = zeros(1,ntime); for r = 1:nruns cnt = 0; for t = 1:ntime if hits(t,r) cnt = cnt +1; else ...
775a8de4feac2dd2568fe26bfec192a27a1a45df3011cd5412ab5d470919cad1
MATLAB
503
15
function acc = getAcc(vel) % Simple function for converting velocity signal (cm/s) into acceleration % % acc = getAcc(vel) % % INPUTS % 'vel' - vector with velocity signal, usually from data.final.vel or % % OUTPUTS % 'acc' - vector with acceleration signal % vel_sm = fliplr(movmean(fliplr(movmea...
84fa8ea6df287482578e54d886912c29df36014648614e4ee46d2c47692f2542
MATLAB
504
20
function TaskPoints = identify_task_timepoints(EEG, Triggers) TimepointsCount = size(EEG.data, 2); TaskPoints = zeros(1, TimepointsCount); TriggerTypes = {EEG.event.type}; TriggerLatencies = [EEG.event.latency]; StartTask = round(TriggerLatencies(strcmp(TriggerTypes, Triggers.Start))); if isempty(StartTask) Star...
6610f990d6818a8057520826c12df24b764ba7f9620f742486c593712fceccf2
MATLAB
505
10
% Adding data, a single-channel ECG recording f_hr = 1.2; % expected HR in Hz fs = 1000; % Sampling frequency num_rounds = 3; % number of times to iteratively run peak_det_local_search and tweak the peak locations [~, peak_indexes] = peak_det_local_search(data, f_hr/fs, [], num_rounds); % peak_det_local_search is from...
47a2ff6099a064b97a52752598d5a9e5f1024940f19740c3638f18ff2221fb5d
MATLAB
506
22
function package_root = getPackageRoot() % % package_root = sl.stack.getPackageRoot() % % Returns the path of the folder that contains the base package. % % Examples: % Called from: 'C:\repos\matlab_git\my_repo\+package\my_function.m % Returns: 'C:\repos\matlab_git\my_repo\' % temp_path = adi.sl.stack.getMyB...
b0dcc18f3c804eb62828e19af9a41ee2d189d8a12d2fc4d966eff9272b78fcfd
MATLAB
506
18
function [X2stat, p] = chi2test_countTable(countTable) row_totals = sum(countTable,2); col_totals = sum(countTable,1); % calc expected vals for irow = 1:size(countTable,1) for icol = 1:size(countTable,2) exp_table(irow,icol) = (row_totals(irow)*col_totals(icol))/sum(row_totals); end end tableSize = s...
dcbe301a015cbfca80dc0b4b09671839ee20b9c5d278cf0d83c204807e332eac
MATLAB
506
14
function Struct = cat_structs(Struct1, Struct2) % Performs "cat" on structures, but also works for empty structs. % % Part of Matcycle 2022, by Sophia Snipes. if (isempty(Struct1) || numel(fieldnames(Struct1)) == 0) && (isempty(Struct2) || numel(fieldnames(Struct2)) == 0) Struct = struct(); elseif isempty(Struct1)...
65e328577745cbe81400e3eff78fc414b7beaa75cd3a58dc10f0bd1e5ed84182
MATLAB
507
17
function [Mean_Pixel_Value,Values_Vector] = Get_Rect_Score(im,Rect1) % Input: an image and a vector of coordinates of a rectangle in the form of NX2 [x y]. % Outputs: % Mean_Pixel_Value is the mean pixels value inside the rectangle. % Values_Vector is vector of the values of these pixels. % Ion = InRect(im,R...
a98d8b8112fa2b7831a8180f05f9dff300d32df57972a65b05641959c1f7f286
MATLAB
507
23
function vals = rowColSelect(mat, rows, cols) %ROWCOLSELECT Select elements of a matrix by their row and column indices % e.g. rowColSelect(eye(3), 1:3, 1:3) returns [1; 1; 1] if isempty(mat) vals = []; return; end if isempty(rows) rows = 1:size(mat,1); end if ise...
3441bcca74a0d5befa298fe0ed851adbdcbcd895c09529b7fe3fb63b03c4d761
MATLAB
508
18
clear; close all; for i = 3:10 i folderName_R_Diff{i} = sprintf('trainRecord_anti_force/trainRecord_R_%d_anti_force',i); generateProcessedModularData(folderName_R_Diff{i}); end for i = 1:10 i folderName_R_5_rep{i} = sprintf('trainRecord_R_5_anti_rep/rep%d',i); generateProcessedModular...
648fcdead2c89db42b44829cc258315a4b3b82aab495e1a0f525679be47bffe1
MATLAB
508
24
%recursive band rejection filter 50 Hz function [cMA,cAR]=rico(z,B,fc,T) % input parameters % z (0.01) minimum attenuation at the center frequency frequency band fc % B (2) Bandwidth which corresponds to attenuation 0.707 % fc (50) Central frequency % T Sampling interval % output parameters % cMA filter coeffic...
716042df46dacf052e994acce152736960ebe3c83c0a3de589e4e41df5063162
MATLAB
508
13
%% Example 3: Single-trial neural trajectories % The dataset corresponds to Section 3.2 in the DataHigh JNE paper. % The data includes two conditions with 15 trials each. The space % was reduced from 61 neurons to 15 latent dimensions with % Gaussian-process factor analysis (GPFA) (Yu et al., 2009). % % Detailed ...
7a7123979743fb80c80846ebd8706b4a00f06ddafb0773fab2c97d90a5799374
MATLAB
508
32
function [arg1,arg2,arg3] = peakfind(S) % function [IP,np] = peakfind(S) % --- or --- % function [IP,AP,np] = peakfind(S) % % where AP = S(IP) IP = find((diff(sign(diff(S))))<0)+1; AP = S(IP); [rs,cs] = size(S); if rs == 1 if cs == 1 error('cannot find peaks of a single number'); else [duh,np] = size(IP)...
a23e41af12221e07d7d857c6ab4c9f9b5cf33ef8b19da47d3244fa8f9a8341d6
MATLAB
508
14
function [spikesOut, sitesOut] = getSpikesInBounds(spikesIn, sitesIn, yPos, yLims) %GETSPIKESINBOUNDS Select spikes by whether their y-positions fall within given limits nSamplesMax = 1000; inBounds = (yPos >= yLims(1)) & (yPos < yLims(2)); if ~any(inBounds) spikesOut = spikesIn; sitesO...
8d347aeccd90c78438f3c24ea023ad6a4630661be5a80ce0eea9ca266a306b44
MATLAB
509
18
function [old2new, new2old] = getOldParamMapping() %GETOLDPARAMMAPPING Get the old-style parameter mapping fid = fopen(fullfile(jrclust.utils.basedir, 'json', 'params.json'), 'r', 'n', 'UTF-8'); fstr = fread(fid, '*char')'; fclose(fid); params = jsondecode(fstr); old2new = params.old2new; ...
0a736be87203c5162768f66553f3176eaed9361916cab8c45b246a80d479ca04
MATLAB
512
15
cd('I:\My Drive\ELYASHIV\PFC_paper_results_after_revision\effect size\f6\d') clear clc x = importdata("saline vs cno.mat") %% stats = mes(x.response(find(contains(x.tags,'dreadds before')),:),x.response(find(contains(x.tags,'dreadds after')),:),'hedgesg', 'isDep',1) flip(stats.hedgesg) %% x = importdata("...
37dc02f87bec20dd277131eadb9a57d71a74aa6a305d09ebec381449b206b5e1
MATLAB
512
5
function y = ECGSmoothnessPriorsDenoiserLTI(x, SmoothnessFactor, mode, FilterParam) % ECGSmoothnessPriorsDenoiserLTI has been deprecated. Use ecg_den_lti_smoother instead. NOTE: ecg_den_lti_smoother accepts inputs in a different order. warning('ECGSmoothnessPriorsDenoiserLTI has been deprecated. Use ecg_den_lti_smoothe...
facd2e8f40583eef6596e0e6d517c55516e1ddf4551d89a7c1dc7ebfbae6f649
MATLAB
512
17
function params = getDefaultParams(merge) %GETDEFAULTPARAMS Get default JRCLUST params % merge - bool,optional: merge common and advanced parameters if true if nargin < 1 merge = 1; end fid = fopen(fullfile(jrclust.utils.basedir(), 'json', 'params.json'), 'r', 'n', 'UTF-8'); fstr = fr...
027951801f7d6bf720886ddf20e567f4988eb1b52ce5b756a91a33bd61453908
MATLAB
513
21
function [SampleN]=mnl_DetermineSampleSize(Zpercent,N,e) % Function to calculate the sample size of a given population % Inputs % Zpercent - the desired confidence value (e.g. 95% -will correct for % two-sided calculations % N - the size of the population % e - margin of error in percent %% Pre-calculations zP=(1-(Zpe...
aaa8dd40acf7aa7cf2657bfeb812014ea253bc7ea7d346bed31bd2a1a9b2344c
MATLAB
513
12
function [index, rank] = ChannelIndex9(x, ff, fs, varargin) % ChannelIndex9 has been deprecated. Use sqi_beat_shape_variability instead. warning('ChannelIndex9 has been deprecated. Use sqi_beat_shape_variability instead.'); if nargin == 3 beat_width = round(0.25*fs); else beat_width = varargin{1}; end n...
58a9de5dca3804b4cbd44e6d0dec5c138e97e82cad88275efdc5b8dc72e18187
MATLAB
514
17
function saveAllOpenFigs(FolderName, FigNameprefix, FileType, renderer) %FolderName = pwd; FigList = findobj(allchild(0), 'flat', 'Type', 'figure'); for iFig = 1:length(FigList) FigHandle = FigList(iFig); FigName = [FigNameprefix num2str(get(FigHandle, 'Number'))]; set(0, 'CurrentFigure', FigHandle); ...