sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
463ff451f11455e5cc32b2c93830ffac34a06a957a6109aa9be8b4b3160ee32e
MATLAB
581
23
function [pID,pN] = rst_FDR(p,alpha) % % p - vector of p-values % alpha - False Discovery Rate level % % pID - p-value threshold based on independence or positive dependence % pN - "Nonparametric" (any covariance structure) p-value threshold %_______________________________________________________________________...
cca3042f5b0b92884aeb8f0ca18641bf382db81c3b8d5dcca43ed34d0412b783
MATLAB
582
21
data = clusters.all_gm; figure counts = 0; for m = 1:size(data ,3) for j = 1:size(data ,2) counts = counts + 1; for i = 1:size(data ,1) aic(i, counts) = data{i,j,m}.AIC; end end end plot(aic, 'LineWidth', 1.5) title( 'AIC For Various $k$ and $\Sigma$ Choices','Interpreter',...
43e5e17d90e902acbf79e165f2297a0a09b5e9719a518fae791507899441f71c
MATLAB
584
18
load('./dataset.txt'); %matrice dei dati featuresIndex = 1:10; %prime 10 variabili dataSet = [ dataset(:,featuresIndex) dataset(:,end) ]; %una parte per l-analisi, l-atltro eliminato [getSet, skipSet] = dataSetSplit(dataSet, 98); dataSet = getSet; [dataSet vMin vMax ] = dataSetNormalize(dataSet, 0.1, 0.9,1...
5495c21759c52feec70e13ff3583a428c03114ddb5b946276a925871ba8435f1
MATLAB
584
15
%% Get Input for the current time bin... % Input: Events: Event matrix N*X. Entries are the event time for each % neuron (indexed by row number) % TimeN: Number of time bin % dt: timestep % N: Number of E or I neurons % STASHED!!! function InputVec = GetInputFromSeries(Events,TimeN,dt,N) ...
c205398e5c45963eb7dbfc7b4e06113cb9048b0e63818701fc383a602e102857
MATLAB
584
18
%plot of the 2 components of the 3-way PCA function twocomponents(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(...
e3a4880891208d994f9cd3692cbb4264225f5399480175487c5bc681aa0a3cf4
MATLAB
584
21
function [ av_x,av_no_x ] = get_t2_avoid_trials_x(p, traces, evs, bvs, tis, speed_control) %% calc scale factors per subject for sub = 1:p.nSubjects all_tr = cat(2,traces{sub,:}); vars(sub) = nanstd(all_tr(:)); end scale_factors = 1./(vars / max(vars)); for sub = 1:p.nSubjects ...
1574b103e1d12ee903db183211072737e1b6a34468f810834a918f18b75239be
MATLAB
586
17
function ok = sysCheck() %SYSCHECK Check for required toolboxes ok = 1; boxen = {'Signal', 'Image', 'Statistics'}; reqs = cellfun(@(b) logical(license('test', [b '_Toolbox'])), boxen); if ~all(reqs) errmsg = ['You are missing the following toolboxes: ', strjoin(boxen(~reqs), ', ')]; ...
530f5b3fa5761e99649e02a429b10cb6beb416f58edd67941c17011274626cdb
MATLAB
586
24
function h = plot_line_edge(ax,x,y,W) % x = 0:0.1:10; % y = sin(x); xd = gradient(x); yd = gradient(y); Lxy = (xd.^2 + yd.^2).^0.5; xd = W .* (xd ./ Lxy); yd = W .* (yd ./ Lxy); R1 = rotz(90); R2 = rotz(-90); Edges1_XY = R1(1:2,1:2) * [xd ; yd]; Edges2_XY = R2(1:2,1:2) * [xd...
2a2a33a9228616cb6871b3f3ed31ba747c7a1a70ad26b6e552baffebbe8fc8b6
MATLAB
587
30
function [numberOfNeurons] = nonNEU (neuron, pathname, filename) [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...
a4a50eae84618e2f2224f1744fab701c6be33875b227fce29824613331dfd5ba
MATLAB
587
21
function AddTableRowHTML(obj, row, style, lastrow) % A member function of HTMLGenerator for adding rows to an HTML table % Reza Sameni, Sep 2020 % The open-source electrophysiological toolbox (OSET) % www.oset.ir % if(obj.fid) fprintf(obj.fid, '\n\t\t\t\t<tr>'); for k = 1 : length(row) if(style{k} == 'H...
3e340fd35fdff02be45cfdad6c3b52e5c7e0f556406266f8cb1a9d218d474d2a
MATLAB
588
21
function stationarity = moduleStationarity(S, c) %% parameter and output % stationarity: stationarity of community c in S_pxT % S: overall community structure % c: index of the community of interest tS = S; tS(tS~=c) = 0; tS(tS~=0) = 1; existIdx = any(tS); tMin = find(existIdx,1,'first'); tMax ...
a5340f4c954673ff0aab82d10e0862a545bfe399c2cbd69a8bfa00ba3067be3f
MATLAB
588
22
function reorderClusters(obj, by) %REORDERCLUSTERS Reorder clusters by centroids if nargin < 2 by = 'clusterSites'; end argsort = obj.hClust.orderClusters(by); if issorted(argsort) jrclust.utils.qMsgBox('Clusters already in order'); return; else nChanged = sum(a...
1368b29e00a357be9275f342cb7f8e442c8ada24840cce9a7e9214488ceebeda
MATLAB
589
25
function y = fatrix2_do_forw(ob, x) %function y = fatrix2_do_forw(A, x) %| %| implement 'forw' function: A * x %| in array mode, accounting for idiag, odiag, scale x = fatrix2_apply_diag(x, ob.idiag); % [idim *L] y = ob.handle_forw(ob.arg, x); % [odim *L] y = fatrix2_apply_diag(y, ob.odiag); % [odim *L] if ~isequal(...
37a72c74a123517ccf8eee04d18a203a42485d5b394e4f6adee7fe674a7c1f62
MATLAB
589
30
function [ output_args ] = compareMovies(start,stop,FPS,varargin) nMov = length(varargin); x = ceil(nMov/3); y = ceil(nMov/x); f = figure('WindowStyle','normal','Position',[100,200,y*500,x*400]); cvals = []; for i = 1:nMov cvals(i,1) = min(varargin{i}(:)); cvals(i,2) = max(varargin{i}(:)); end %cvals = [.3 .7...
1d2324276c3798865b31c15be249cba308b54fa4126436d14d97599f22960449
MATLAB
590
17
function multiple_boxplot_vec(dataVec,groupIdx,xlab,M) % data is a cell matrix of MxL where in each element there is a array of N % length. M is how many data for the same group, L, how many groups. % % Optional: % xlab is a cell array of strings of length L with the names of each % group % % Mlab is a cell arr...
8a901e618aa381c08d67877a725ebfd74d8df342c11bdd621c2aba1a2147d9c9
MATLAB
590
27
function f = correct_fid_lana(f) for k = 1:length(f) fid = f(k).water_ref.fid; sw = f(k).spectrum.SW_h; np=size(fid,1); timeD=transpose(0:1/sw:(np)*1/sw-1/sw); RtermLor=exp(-timeD/0.15); ywat = transpose(fid); [mConAmpCor mSPhase mT2used] = LineShapeExtract(ywat,sw); fidcor = transpose(LineSh...
3295e146beaa3956bfc0801d26aca1d9b42fd9df273d26ea6925a0a9a6391be6
MATLAB
591
27
function sn(data,filename,voxdims, origin) % function sn(data,filename,voxdims,origin) % % Save a nifti file with an empty header if nargin < 3 voxdims = [1 1 1]; end if nargin < 4 szData = size(data); switch length(szData) case {3,4,5} origin = szData(1:3)/2+1; cas...
5ec1120e23730fa0522f174fb7aad8710a0b80bff249e7fab31d9a959c1c4c71
MATLAB
591
26
function [quantized, gain, bias] = approximate_quantizer(data, gain_mode, bias_mode) switch bias_mode case 'zero' bias = 0; case 'mean' bias = mean(data(:)); case 'median' bias = median(data(:)); otherwise error('Undefined bias calculation mode.'); end data = data - bia...
a6fbe40fd567ccb1d601b7596d477e3672952897f1826b6330e832bd6ea7ab5a
MATLAB
591
15
function check_single_channel_detection(EEGBroadband, EEGNarrowband, ChannelIdx, CriteriaSet) DataBroadband = EEGBroadband.data(ChannelIdx, :); DataNarrowband = EEGNarrowband.data(ChannelIdx, :); SampleRate =EEGBroadband.srate; Cycles = cycy.detect_cycles(DataBroadband, DataNarrowband); AugmentedCycles = cycy.measur...
22a0c80acd2a276d824d5b859f192ff0898e8a38c835457eea2ee687f32769de
MATLAB
592
21
function auto_derived(app) %AUTO_DERIVED Summary of this function goes here % Detailed explanation goes here if ~isempty(app.data) if isempty(app.burst_ints) [~, idx] = max(vertcat(app.data.tic_multipl)); bords = [app.data(idx).ts(1), app.data(idx).ts(2)]; app.burst_ints = struct('name','...
6e167993442687e51d99e30ea9997caba72b0a96b27b9ea892ed2e5bb2d1ded3
MATLAB
592
28
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); for i=1:n_axkids if axkids(i)==h ih=i; break; end end if isempty(...
e85cd39adc3da83ea592390c0b25febb54d4e8737b5eb9c22557bdb62f375e4a
MATLAB
592
22
function updateSubset(obj, showSubset, silent) %UPDATESUBSET Update the subset of units to show if nargin < 3 silent = 0; end showSubset = intersect(1:obj.hClust.nClusters, showSubset); if isempty(showSubset) && ~silent jrclust.utils.qMsgBox('Subset is empty; selecting all units'); showSubset = obj.showSu...
2e7ec3082828da419361a3c1895ceb548bd452e1af91876c7bb471993b335bb7
MATLAB
593
21
function vals = linmap(vals, oldLim, newLim) %LINMAP Rescale vals occurring within oldLim to newLim, saturating at %the boundaries if numel(oldLim) == 1 oldLim = abs(oldLim)*[-1, 1]; end % saturate at the boundaries vals(vals > oldLim(2)) = oldLim(2); vals(vals < oldLim(1)) = oldLim...
55bda8c3cb84a28c995ea0a3854059d07fd72b8cc08a1c7e61b1a3396aac4697
MATLAB
593
18
function [ql,qu]=rst_idealf(x) % Compute the ideal fourths for data in x % The estimate of the interquartile range is: % IQR=qu-ql; % Adapted from Rand Wilcox's idealf R function, described in % Rand Wilcox, Introduction to Robust Estimation & Hypothesis Testing, 3rd % edition, Academic Press, Elsevier, 2012 % Cyril P...
e91f90c925c2c76d2be56735369cb15e6b55f80db9cedd03619d85415485224f
MATLAB
593
41
function fo=add_zer_line(f,fac) lb=2; lineposition = -4.7; %-4.65; lineposition = -4.65;%4.65; fo =f; for nf = 1:length(f) spec = f(nf).spectrum; t=[0:spec.dw:(spec.np-1)*spec.dw]'; fid = f(nf).fid; sfrq = spec.cenfreq; ns = size(fid,2)/2; if ns<1 fid2 = fid; else fid1 = fid(:,1:ns...
f5870773fc088a52243d1ae23a1b87a9efc676ea2240f2007cd4ab79a2bca41f
MATLAB
596
19
function auto_bp(app) %auto_Bb checks if bb is already detected and runs if %not % Detailed explanation goes here if isempty(app.bp_res) [data,ts,~, ~] = current_signal(app, app.settings.channel_idx.bldp); data = lowpass(data,3,1/ts(1)); [ footIndex, systolicIndex, notchIndex, dicroticIndex ] = ... ...
60319e1261fe412e0c66c9aed6ed061d091a1399f38acf14988f52b360ab8825
MATLAB
597
25
function [W, lambda] = orthogonal_gevd(A, B) if size(A, 1) ~= size(A, 2) || size(B, 1) ~= size(B, 2) || size(A, 1) ~= size(B, 1) error('A and B must be square matrices of the same size') end n = size(A, 1); W = zeros(n); lambda = zeros(n, 1); A_proj = A; B_proj = B; for k = 1 : n [v, lambda(k)] = eigs(A_pro...
9a44050eeb6587d109cf85e9a29d5df16df14c131570478cf7482a7324aceb6b
MATLAB
597
24
function pars = mats2pars(Amats, doInv) % Convert affine matrices to rigid-body motion parameters if nargin < 2 doInv = 0; end pars = zeros(6,size(Amats,3)); for iV = 1:size(pars,2) if doInv==0 thesepars = spm_imatrix(Amats(:,:,iV)); elseif doInv==1 thesepars = spm_imatrix(inv(Amats(...
d9fea7f8746bcedb719309515ba94bb1ee1ed42d9371cef26071c187589c74ac
MATLAB
597
14
function [ms_frame,ms_frame_advance,nsamps_frame,nsamps_frame_advance] = get_ms_framespec(ms_framespec,fs) if length(ms_framespec) == 2 ms_frame = ms_framespec(1); ms_frame_advance = ms_framespec(2); else all_ms_framespecs = get_all_ms_framespecs(); idx = strmatch(ms_framespec,all_ms_framespecs.name); if isemp...
d6e033defdf985e718f24af289e820f28ac171bba584b95337bf15db8eee9ea7
MATLAB
598
27
function [H, overlap] = overlapCI(means, CIs) nVals = numel(means); if nVals ~= numel(CIs) error('must provide equal number of means and CIs') end overlap = nan(nVals); H = overlap; for ival1 = 1:numel(means) for ival2 = ival1+1:numel(means) temp_means = means([ival1,ival2]); temp_...
10c9ec9ffef322bfc2d21137d234f2effaf6764d9374746c5cb07306f0595cb4
MATLAB
602
17
% function that builds a table to save ti as CSV % from several data cells of Raster Features % Input % RASTER_NAME: cell with ExpIDs % RASTER_FEATURES: cell of rastrfeatures % Names_Conditions: cell of Condition Names function TableFeatures=maketableraster(RASTER_NAMES,RASTER_FEATURES,Names_Conditi...
31c9dfb98f911b8443b917053f896be961443eb52c71783a7954d87f1fdc9cb1
MATLAB
602
21
function movie = cropMovie(movie,zeroMask) % crops movie (i.e. sets borders to zero), such that every row or column that % is zero because of motion correction for some frame is set to zero for % all frames [N, S, W, E] = getCropCoords( zeroMask ); % getCropCoords gives the values that are included in the...
b28e9297ad639af595520384dc75ee4fe3ccc2ca849010dfd53c392f50ecf2e9
MATLAB
603
30
function F=get_files_recursif(in_dir) 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) )]; else [pathstr,filename,ext] = fileparts(DD(...
d985d5b8b5547f646dcddbd45a9480251a303e32779781eacd1bf9186bbe8455
MATLAB
603
18
function [fs,dyename,NV,NC]=ExperimentSize(NumberofVideos,FN) %% Read Sampling Frequency fs=NaN; % To read fs to get into the following loop: NV=1; while isnan(fs) % Interface error user reading fs fs = inputdlg('Sampling Frequency [Hz] : ',... 'Frames per Second or', [1 75]); fs = str2double(f...
6c759f86081022146189541e343168fa8abce3f88a37cb966b7285efea6973b3
MATLAB
604
17
function beat_spk_lag = get_spike_lag(spike_ts, spike_clust,spike_use, hb_ts, beats_use, int_idx) spike_ts = spike_ts/1000; num_clus = max(spike_clust); spks = {}; spike_use = spike_use(:,int_idx); hb_ts = hb_ts(beats_use(:,int_idx)); for i = 1 : length(hb_ts) spks{1,i} = spike_ts(spike_ts>=(hb_ts(i)-0.5) & spike...
7fef112bee2c800f9964c936c67725743be7a21acbbee1dc98fe87d621df629b
MATLAB
604
4
function [PeakToPeak_corrected, PeakToPeak_differences, matched_peaks_indexes, smoothed_matched_output] = SMFPeakDetector(x, matched_template, type, wlen, PP_diff_wlen, PP_diff_th, average_peak_det_rate, fs) % SMFPeakDetector has been deprecated. Use peak_det_matched_filter_pwr_env instead. warning('SMFPeakDetector ha...
14c506b04ff13a539950bef3594eb7453a19d06a81ea44486078db66b0f20a1c
MATLAB
605
19
function index = ML_gaussian(x,mu,inv_sigma) % function index = ML_gaussian(x,mu,sigma) % x is a vector drawn from some multivariate gaussian % mu(i,:) is the mean of the ith Gaussian % sigma(:,:,i) is the covariance of the ith Gaussian % % Returns the index of the Gaussian with the highest value of p(x). N = size(mu...
4c604cadd28efa6ef1c13d14a39aff497638ffd3f7ca06a25f38507adcb295e0
MATLAB
605
19
function [ F, pValue, df1_total, df2_total] = granger_causality_group( X, Y, maxLag) [n, m] = size(X); SSR_Y_Total = 0; SSR_XY_Total = 0; df1_total = 0; df2_total = 0; for i = 1:m [~,~,SSR_Y, SSR_XY, df1, df2] = granger_causality(X(:,i), Y(:,i), maxLag); SSR_Y_Total = SSR_Y_Total + SSR_Y; SSR_XY_To...
a6654902a13d9aa25f68583dcf0572de4e6d7552e4616d8af48099e0932db78f
MATLAB
605
21
function updateProjection(obj, proj) %UPDATEPROJECTION Update the feature projection try obj.hCfg.dispFeature = proj; catch obj.hCfg.dispFeature = 'vpp'; end % set menu items checked or unchecked where appropriate hProjMenu = obj.hMenus('ProjMenu'); for i = 1:numel(hProjMenu...
23404e6d0ce87cb24c7057c0ca5e0eebd09d1ecd90d591533317fd6e7c68bc39
MATLAB
606
12
function all_ms_framespecs = get_all_ms_framespecs() i = 0; i = i + 1; name{i} = 'less narrowband'; ms_frame(i) = 18; ms_frame_advance(i) = 1.5; i = i + 1; name{i} = 'narrowband'; ms_frame(i) = 36; ms_frame_advance(i) = 3; i = i + 1; name{i} = 'more narrowband'; ms_frame(i) = 72; ms_frame_advance(i) = 3; i = i + ...
564514ec9ad0281deb39ef7f6cc9139d705f4ce2be17ac79719269dafc57268c
MATLAB
606
28
%% load movies thisSub = 13; ses = 1; % preprocessed movPath = fullfile(p.rootDir,'miniscope', ['subject' num2str(thisSub)],['session' num2str(ses)],'preprocessed','preprocessedMovie.h5'); movie = loadMovie(movPath,1,150); % no lowpass movPath = 'G:\E7_2DAA\results\preprocessedMovie_no_lowpass.h5'; movie_nl = loadMov...
b5c97ae12cbb8a3da02e2aa8f63d9fc93f34bb745f4623f50fb586dd47070fe7
MATLAB
606
25
function res = endSession(obj) %ENDSESSION Finish curating and return results if obj.isWorking dlgAns = questdlg('An operation is in progress. Really quit?', 'Operation in progress', 'No'); if ~strcmp(dlgAns, 'Yes') return; end end obj.isEnding = 1; if nargout ==...
99ddc4c7bc50c83978a8e3a2db8f999fd01dc0e009ae07ebc57552ea81516a04
MATLAB
607
19
function criteriaset_diagnostics(Diagnostics) CriteriaLabels = fieldnames(Diagnostics); isUnique = contains(CriteriaLabels, 'Unique'); CriteriaLabelsUnique = CriteriaLabels(isUnique); CriteriaLabelsUnique = replace(CriteriaLabelsUnique, 'Unique', ''); CriteriaLabels(isUnique) = []; Diagnostics = cell2mat(struct2cell(...
89d2037271da76e8ec1fcb1740b44f8e0d88015d2b9afd42ce06d2b04f077f01
MATLAB
608
19
function [weights, trainerr] = cnntrain(layers, weights_in, params, train_x, train_y, type) if (length(size(train_x)) == 3) % insert singletone maps index train_x = permute(train_x, [1 2 4 3]); end; tic; if (strcmp(type, 'cpu') || strcmp(type, 'gpu')) [weights, trainerr] = cnntrain_mex(layers, weights_in, para...
8339e4dbacc5a9f60be0740efe4f2320fe881fa896a4bdf29c805beca2932b01
MATLAB
609
29
function surf_jet %SURF_JET Set up extreme color values using COLORMAP JET % %Syntax % surf_jet % 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 refe...
92fc8cb60f79773d64d2f3b18597dd76d61240b67693051451b23ead67b9f1b0
MATLAB
609
34
clear close all mat_file_after_converting ={ % 'HB329.mat'; % 'HB330.mat'; % 'HB438.mat'; % 'HB593.mat'; % 'HB594.mat'; % 'HB597.mat'; 'HB442.mat'; 'HB328.mat'; }; tubemap_folder_list ={ % 'HB329/'; % 'HB330/'; % 'HB438/'; % 'HB593/'; % 'HB594...
9cf4709ca2ec5652c39aa54b7524dc79bced287a209d38b0c57cfa51a987c49a
MATLAB
609
28
function angle = calculate_ecg_angle(A, B) % function angle = calculate_ecg_angle(A, B) % Formula: atan2(A, B) (degree) % Computes the angle (in degrees) between two ECG signal components % % Inputs: % A: numerator component % B: denominator component % % Outputs: % ang...
cd8de25178de4feae4405eb9e49a7f651f502f1b3a975128fd32c42805565874
MATLAB
609
19
%Shinjini Kundu (c) 2022 function [average, lowerCI, upperCI] = classification_compute_CI(vector,T) %computes confidence interval for a vector assuming normal approximation of the binomal %inputs: vector the vector of values %outputs: mean mean % lowerCI lower range of the 95% con...
ede2e8e8dc62623fedd37fe2aaf42ec438562fc22e62d2216c932f52e4e8a327
MATLAB
609
23
options.color_area = [0.85, 0.85, 0.85]; line_style_MFS = '-o'; hf = figure(4); clf ha = axes(); h = plot(1, 1, '-', 'Linewidth', 2); h.Visible = 'off'; hold on h = plot(1, 1, line_style_MFS, 'Linewidth', 2); h.Visible = 'off'; patch = fill(... [0.2, 0.6, 0.6, 0.2],... [0, 0, 0.5, 0.5],... options...
7a9987a241e6065791881733708379cae5f41d82a331f74e5836cbb00b151201
MATLAB
610
19
function [ql,qu]=idealf(x) % [ql,qu]=idealf(x) % Compute the ideal fourths for data in x % The estimate of the interquartile range is: % IQR=qu-ql; % Adapted from Rand Wilcox's idealf R function, described in % Rand Wilcox, Introduction to Robust Estimation & Hypothesis Testing, 3rd % edition, Academic Press, Elsevier,...
70c8d4ac8b93e26d65dffd8e54fe6a72952552814034344c55e447fab6f3c47c
MATLAB
612
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) cd(path) close all clc %% for x = 1:size(clusters.mean, 1) all_data = []; clusters_name = ['cluster_' num2st...
7619b1db0d99a3b84fbbff4f342153762596158218704647b2f061c4b07497b8
MATLAB
612
18
function [ica_filters, ica_traces] = compute_ica_pairs(spatial, temporal, S, height ,width, ica_W) % Compute ICA pairs ica_traces = ica_W*diag(S)*temporal; ica_filters = ica_W*spatial; % Format the ICA dimensions for output ica_traces = ica_traces'; % [time x IC] ica_filters = reshape(ica_filters, size(ica_W,...
ae88f6dd2cad259c2b4096ca71a74d2f6d667aeb3824baf28c23de50473838af
MATLAB
612
17
function [out, lims] = zeroCrop(data) % up to 3D, crop out edge zeros lims.xMin = find(any(any(data(:,:,:,1),2),3),1,'first'); lims.xMax = find(any(any(data(:,:,:,1),2),3),1,'last'); lims.yMin = find(squeeze(any(any(data(:,:,:,1),1),3)),1,'first'); lims.yMax = find(squeeze(any(any(data(:,:,:,1),1),3)),1,'last'); lim...
0ac6b0e2b6e48c2223a66031a900e06d4a619742d6751e35a074962c3bd6ceb6
MATLAB
613
19
%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) datafile = fullfile(path, file); %save path for i = 1:length(datafile) load(datafile{1,i}); if iscell(all_data)...
da49f51ab59c4d104a49ae62cd220f6d8f22a403fd30e554a76ab916d47600cd
MATLAB
613
18
function [ traces ] = fix_traces_2daa( traces ) % fix for M11S7 (dropped frames 2 times -> add nans) % recording xml file indicates dropped frames: % 46357 - 46369 % 46480 - 46491 % insert one big nan block (also take out frames between the 2 drops) % recording is good until first drop: 1:1159...
f0dbc7f8c7ee790d6ad1e7c9d3901e69274cb5caa95beafd3d74a5575d5a3887
MATLAB
613
20
function [stderrmean] = SEM(signal,dimension) % Created by: Anya Krok % Created on: 26 June 2018 % Description: calculate standard error of mean % % [sem] = SEM(signal,dimension) % % INPUT % signal: matrix to analyze % dimension: 1 or 2 % if dim = 1, then SEM returns row vector containing SEM of t...
e08be4878049129f0e0040c6027b08a61a4f6d7d8fd96d85ba9f2f7da3f495f9
MATLAB
614
26
function dspPMapColorbar(LevelList) cla nNegContours = sum(LevelList < 0); nPosContours = sum(LevelList > 0) ; axis([0 (nNegContours+nPosContours) 0 1]); for i = 1:nNegContours colc = (i-1) / nNegContours; col = [colc colc 1]; patch([i-1 i i i-1],[0 0 1 1],col); end for j = ...
94b9251e350f8ba55341c620699dc3cad9aeb0cfe3b46bc4cabf48cb730d5dc9
MATLAB
615
14
global Vinj V0 gamma Vinj = 1; % (mm^3) lambda_iv = 0.837; %(day^-1) based on in vitro fit to the average DT_invitro = log(2)/lambda_iv*24; % (hours) convPhotCell = 10; % 1 cell \simeq convPhotCEll photons/seconds convPhotMm = convPhotCell*1e6; % 1 mm3 \simeq convPhotMm photons/seconds phot2cell = @(x...
89382e4bcf7a256b5696ff9cc9ba7f51e05d5858a774f48e547b99e3427ef85f
MATLAB
616
20
function [stderrmean] = SEM(signal,dimension) % Created by: Anya Krok % Created on: 26 June 2018 % Description: calculate standard error of mean % % [sem] = SEM(signal,dimension) % % INPUT % signal: matrix to analyze % dimension: 1 or 2 % if dim = 1, then SEM returns row vector containing SEM of t...
1a52f482366b66c38af079292a9e184d50dd06c80ec4687794ed3ab0aade5435
MATLAB
618
18
function [spikeWindows, indices] = interpWindows(spikeWindows, nIterp) %INTERPWINDOWS Interpolate windows subpixel-wise using FFT method if nIterp <= 1 return; end nSamples = size(spikeWindows, 1); % interpolation done on first non-singleton dimension but we assume % columnwise; force w...
72a57dcf53fea2c0c57a56f5af32b47b6d2162744b4b81c8b1949cff4cc6ce71
MATLAB
618
24
function mmil_struct2csv(info,fname,separator) %function mmil_struct2csv(info,fname,[separator]) % % Required Input: % info: struct array % fname: output file name % % Optional Input: % separator: separator between columns % {default: ','} % % Created: 10/17/14 by Don Hagler % Prev Mod: 01/30/15 by Don Hagler ...
858f4c2548772e07e175b79cda903e3f60e5fa29f26ea23cdc08f419b8c8d674
MATLAB
618
22
function auto_derived(app) %AUTO_DERIVED Summary of this function goes here % Detailed explanation goes here if ~isempty(app.data) if isempty(app.burst_ints) [~, idx] = max(vertcat(app.data.tic_multipl)); [~,ts,~, ~] = current_signal(app, idx); bords = [ts(1), ts(2)-ts(1)]; app.bu...
887e2e980591f57ce981cc00f29d298d25110b44e19e2322f6e3659dbd0676e6
MATLAB
618
15
%% Example 1: Visualize neural states with DataHigh % The dataset corresponds to Section 3.1 in the DataHigh JNE paper. % Each datapoint represents a trial. Trials are separated into seven % different reach directions (colors). The space was reduced % from 61 neurons to 7 latent dimensions with factor analysis...
831ce06e2b557534848c0c1e2e0d31cb7a8a50883d0bf1c19e8c88eebf4eb5a7
MATLAB
619
20
clear close all clc fname = 'ICARE_0097_20000102_185034_segment'; load(fname, 'signal', 'sampling_rate', 'channel_names'); signal = signal(:, 1:10000); save('sample.mat', 'signal', 'sampling_rate', 'channel_names'); % Save the raw data matrix in CSV format fout_csv = 'sample_raw.csv'; writematrix(signal', fout_csv)...
0bdba8b123dd9faa0ee6c34666d0166e352c834c73e0580a25fe6cc8cebc3f41
MATLAB
620
22
function syn = getsynapses(map,threshold) %% Use the getpaths() function on a binarized map. % Use getpaths() on a binarized map to get the minimal number of synapses % between any two nodes i and j. % % syn = getsynapses(map,thr) % % Input: % map: projections matrix (uni- or bilateral) % threshold: for filt...
a6a6c72e14c581fdaf32f61505a77911889fb46633a729d43ef88bf7fe336912
MATLAB
620
15
function [hp] = drawTransformedBat(posBat, orientBat, batFaces, batVertices) batVerticesRot = ( rotz( orientBat(3) ) *roty( orientBat(2) ) * rotx( orientBat(1) ) * batVertices' )'; batVerticesTrans = ( batVerticesRot' + posBat )'; drawTriad( posBat, orientBat, 0.10 ); hp = patch('faces', batFaces,...
a99782cede95937ff97d66218acb10d8acd393b45d7c4ba6f19f4273e23b6327
MATLAB
620
28
function [h] = seplot3(dt,data,color,ebars) %[h] = splot(dt,data,color,ebars) if(nargin<4) ebars = 0; end if(nargin<3) color = 'b'; end if(numel(dt)==1) t = dt*(1:size(data,2)); else t = dt; end h = plot(t,nanmean(dat...
756f989166f48525fd22cbd5170457849b09e2e91be5a3759a5ca7170c17930d
MATLAB
621
4
function [penalty_factor, cc, ee, L_curveC, L_curveE] = OptimalSmoothnessFactor(xx, bb, ss, mode, SmoothnessFactor, penalty_factor0, signorm, ACCURACY, MAX_ITERATION, FORGETTING_FACTOR, LCurveSweepLength, LCurveSweepFator) % OptimalSmoothnessFactor has been deprecated. Use optimal_smoothness_factor instead. warning('Op...
771683d9429f89d36e1b95224ee7146af3dec32646b4aeeae88067a0c41e9b59
MATLAB
621
25
function path_out = filepartsx(file_or_folder_path,N) %filepartsx Applies fileparts() function numerous times % % path_out = sl.dir.filepartsx(file_or_folder_path,N) % % Small function to help clean up stripping of the path. % % INPUTS: % ------- % file_or_folder_path : path to file or folder % N ...
8844b264190d0cf3db82229d86280776cebd3adc5b238d714fcd1e80852df15e
MATLAB
621
23
function auto_derived(app) %AUTO_DERIVED Summary of this function goes here % Detailed explanation goes here if ~isempty(app.data) if isempty(app.burst_ints) [~, idx] = max(vertcat(app.data.tic_multipl)); [~,ts,~, ~] = current_signal(app, idx); bords = [ts(1), ts(2)-ts(1)]; app.bu...
10f204e3da802293a59edd1af537cb0ed85c3aed6b3c385edd411e426e105be4
MATLAB
622
18
function check_WC_params(par) if isfield(par,'features') && strcmp('features','wav') if isfield(par,'scales')&& isfield(par,'par.w_post') && isfield(par,'par.w_pre') L = wmaxlev(par.w_pre+par.w_post,'haar'); if L<scale error('[par.scale] exceeds maximum wavelet decomposition level...
71bdeb3a599834ff22dc8001f719ad846d6adef3014427b212c1d83a49fdf2d9
MATLAB
623
17
function [Rep_part,Diag_Par,SIM,ML_rep_part,consensus_idx,ML_rep_part_ALL,ALL_consensus_idx] = Analyse_MSP(S) D = squeeze(mode(S,2)); % group partition for each ML partition [Rep_part, consensus_simm, pairwise_simm,consensus_idx,ALL_consensus_idx] = Find_Consensus_VIn(D); SIM.Consensus = Rep_pa...
8c308284cd5aae351c2b65e844fa52d377094b1ef1c0ae14a977d2634642951e
MATLAB
623
23
function XxPSFGenerator(dxy,dz,SizeXY,SizeZ,lamd,NA,RI,FileName) dk = 2*pi/dxy/SizeXY; kx = (-(SizeXY-1)/2:1:(SizeXY-1)/2)*dk; [kx,ky] = meshgrid(kx,kx); kr_sq = kx.^2+ky.^2; z = (-(SizeZ-1)/2:1:(SizeZ-1)/2)*dz; PupilMask = (kr_sq<=(2*pi/lamd*NA)^2); kz = sqrt((2*pi/lamd*RI)^2-kr_sq).*PupilMask; for ii = 1:SizeZ ...
e3cdd353a2b190e58be845e3ef1b39dd645cf24867fca26c66a5666166164cbc
MATLAB
623
23
function dist=JSDiv(P,Q) % Jensen-Shannon divergence of two probability distributions % dist = JSD(P,Q) Kullback-Leibler divergence of two discrete probability % distributions % P and Q are automatically normalised to have the sum of one on rows % have the length of one at each % P = n x nbins % Q = 1 x n...
06a13ec9945a3bdcc63a919342049ee97d36b40467126acfbcb208ea1fdf6c5a
MATLAB
624
13
function stop = makeLogVertAx(state, whichAx) stop = false; % The function has to return a value. % Only do this once, following the 1st iteration if state.Iteration == 1 % Get handles to "Training Progress" figures: hF = findall(0,'type','figure','Tag','NNET_CNN_TRAININGPLOT_UIFIGURE'); ...
493547bec3aa9604bdf112403842bff682c1b02a109dcfa413271ed833f1bc45
MATLAB
624
19
%% Function that simulates the injection of FMH into the peritoneum. %t_start is the time for the first dose, and t_repeat is the repetition %time in hours. inj_time is time that the injection lasts. Output units in ug/h. function f = FMH_inj(t, t_start, t_repeat, q) inj_time = 1/3600; n=length(t); for i=1:n ...
6c4c810b37afbf6217b4543ebd1b5afccd6c6e23c0e09f3d776a2412521ea945
MATLAB
624
15
cd('I:\My Drive\ELYASHIV\PFC_paper_results_after_revision\effect size\figure 1\1i') g = importdata("side_per_session_data.mat") %% transient sample1 = g.mean_is_responsive(ismember(g.side,'R'),1) sample2 = g.mean_is_responsive(ismember(g.side,'L'),1) [p, observeddifference, effectsize] = permutationTest(sample1,...
9954feb3f5a234af0f104ad399a1e1955da05cae60c29bec35f38e77bc3d571b
MATLAB
624
14
function D = Get_Linearity(XY) % XY = [Np x 2]. v1 = XY(1,:); % Head point. [1 x 2]. v2 = XY(end,:); % Tail point. [1 x 2]. a = v1 - v2; b = XY(2:end-1,:) - v2; d = vecnorm(cross(repmat(a,size(b,1),1),b,2),2,2) / norm(a); % Distance from line. Row-wise cross and norm. d = norm(cross(a,b),2) / norm(a); d1 =...
2fc9cddc285b64162181c4eed5bbbf67a1633a22d92349babe42e2e3ab990d93
MATLAB
625
21
function H = Hindex_distribution(ntcells,taggedcells) %HINDEX_DISTRIBUTION Plot H-index distribution. % H = HINDEX_DISTRIBUTION(NTCELLS,TCELLS) plots tagging (H-) index % distribution for a population of tagged (TCELLS) and non-tagged cells % (NTCELLS). % % See also SALT. % Balazs Hangya % hangy...
3304dc11166c2e8c5f325a55365dfd11e80f8006d54f2f22d1768e4482916925
MATLAB
625
19
%This script will make a "Matched" variable, which contains both the name %of the docking event from red (aka channel 2/right) channel and the time of %fusion from the green (aka channel 1/left) channel. Matched={} MatchedTime=[] for i=1:length(confirmedHits2); idx=find(strcmp({confirmedHits.name}, confirmedHits2(i...
184789d59911bb69e7d7a3dacee18bd56fec933bd44889b20fcededdd7c09976
MATLAB
626
26
function toggleRaw(obj, hMenu) %TOGGLERAW Toggle raw waveform display showRaw = ~obj.hCfg.showRaw; if obj.hasFig('FigWav') hFigWav = obj.hFigs('FigWav'); hFigWav.wait(1); end if showRaw && isempty(obj.hClust.meanWfGlobalRaw) obj.hClust.computeMeanWaveforms([], 1); end ...
3952d21710c7bea7cf6bb7717c6c52e032aa8a478f995c4ceb5bce2e9d3861a7
MATLAB
626
14
% Input % Rclustens: Cells x Frames % SimMethod: 'hamming', etc' % DistThreshold: Maximum Threshold (at least half of neurons) % Ouput % NonSimilarVectors: Frames with Vectos non similar % MaxDistanceIV: Maximum Distance Intra Vectors function [NonSimilarIV,MaxDistanceIV]=nonsimilarframes(Rclustens,SimMethod...
592162efc555549b0abf59053ebe312f878a3fb16d6c980988bcfeb788fc6491
MATLAB
626
21
function [option_names,option_values] = make_option_specs(varargin) %MAKE_OPTION_SPECS Separate keys and values from key-value pairs. if mod(nargin,2) error('Must have even number of args (args are key/value pairs)'); end nopts = nargin/2; option_names = cell(1,nopts); option_values = cell(1,nopts); for iopt = ...
9b4323cced3756ecef442d39c4de435cae149a025217f44746f0843e21208527
MATLAB
626
22
function showmeyourraster(R,Indexes,fs,NSECONDS,NameOutRaster) fprintf('>>Raster Animation Starting:\n') v = VideoWriter([NameOutRaster,'.avi']); % Plot Raster Plot_Raster_Ensembles(R(Indexes,:),fs,1,[1:numel(Indexes)]) FigRaster=gcf; %CAGAxis=FigRaster.Children(1); RasterAxis=FigRaster.Children(2); % Showtime raster R...
f9d6f7bfa3aae8734296019dcf7f05ad8eb8490d05e9308d6ab4f8d712480e8d
MATLAB
626
26
function [ d ] = Projection_metric( A,B ) %This function calculates the projection metric based on the principal %angles between the columns of matrix A and B %Input: % A: Orthonormal matrix N*M % B: Orthonormal matrix N*M %Output: % d: Distnace between column spaces of A and B %Author: % Soheil...
2c279a73e315ba5b3d7f521e675e6b5d7d9b53a268059c0efb3150fb7ba24ead
MATLAB
627
26
function A = shrink(A, sc, st) for d = 1 : length(size(A)) ind = []; for i = 1 : sc(d) - st(d) ind = [ind; sc(d)+i : sc(d) : size(A, d)]; end; newind = ind-sc(d)+st(d); if (d == 1) A(newind, :, :, :) = A(newind, :, :, :) + A(ind, :, :, :); A(ind, :, :, :) = []; elseif (d == 2) A(:, newind, ...
9dd8babdd5e35b3494b0d1840ad331cc51050d1eb9348166fc73f41245f161eb
MATLAB
628
26
% Shinjini Kundu (c) 2014 % Transport-Based Morphometry project (TBM) function [I_out]=gen_pdf(I_in,dc,phi) %Preprocessing of 3D image %Inputs: I_in 3D input image % dc a positive constant % phi kernel for filtering image % %Outputs: I_out 3D output image I = m...
b0fd3cd128515e71cd65d8a525237545fb4fd189650d20219b8754f06b6b700f
MATLAB
629
17
% Authors : Simon Wadle 2019-2023 %function writes tiff stacks faster than generic MATLAB function function fast_tiff_export(filename, image_data) image_data = permute(image_data, [2 1 3]); ftif = Fast_Tiff_Write(filename); [~, ~, frames] = size(image_data); placeholder = ['%',num2str(floor(log10(frames))+1),'d...
b396ddf47d302f8791f99f38e703d09480fcc333da3f895569d8e5ac6a5daec7
MATLAB
631
24
function [fig] = plotRaster(spikeMat, tVec) % Plot the spike matrix generated using poissonSpikeGen % % [] = plotRaster(spikeMat, tVec) % % INPUTS % spikeMat - spike matrix, from poissonSpikeGen % tVec - time vector, from poissonSpikeGen % % OUTPUTS % fig - figure handle % % Anya Krok, March 2021 f...
dc0fb004db9ac2c6be31aecfe6aaa5f1765682e25aab187e62dcfc48db747564
MATLAB
631
29
function [EuD_all]=mnl_GroupColourEuclidean_Simplified(data) %% Help Section % % Inputs % data - data points as vector (cells*ndim) % % Outputs % EuD_all - Euclidean Distance between all points % % Written by Marcus Leiwe, Kyushu University, 2018. If used please cite % Sakaguchi et al 2018 %% Basic Info sz=size(data);...
5ce41b5937ddc57e83da9f6b058c089a9ea8ebe3ae4c9ed2c4613b99c61945bc
MATLAB
632
25
function rho = spearman_rho(deltas,zetas) %UNTITLED Summary of this function goes here % Detailed explanation goes here % input params should be columns of numbers, if they are rows switch them % to columns if size(deltas,1) == 1 deltas = deltas'; zetas = zetas'; end sorted = sortrows([ deltas zetas ]); % ...
849e368d3391eae8dd0be89d0c57f740e9fd9ee9f4ee949512b6b0adc282a2f1
MATLAB
632
13
% - collect data per subject and session (so we can individually analyze them later) % - av_trials % - er_trials % - trans_data (fastest iti transitions, used for decoding) % - trans_data_err (random iti periods) % - trans_data_dr (remaining iti transitions, used for definition of spd dims) % - DR: use half ...
cfc4e0dcbff063d5965d7dfb5af8e5d3217c9494724fd02ccfedc09630b43d32
MATLAB
632
32
function pre = newfft_exact_p(st, om) %function pre = newfft_exact_p(st, om) %| %| precomputed (large) matrix for exact forward NUFFT if ~isvar('om') || isempty(om) om = st.om; % default end if isempty(om), fail 'om or st.om required', end dd = st.dd; Nd = st.Nd; n_shift = st.n_shift; if dd > 3 fail 'only up to 3...
764ad92fbd65de73b6881729a21d66679d12bc7ee455c78b03da38c8a09678db
MATLAB
633
24
data = all_data.cell_4.intensities; x = data(1).intensty_data x = x - data(1).intensty_baseline.mean y = reshape(x,[], 1) binned_y = bin_psth(y, 10); %% f4 = figure; set(f4,'color', [1 1 1]); set(f4,'position',[50 50 2000 250]); plot(binned_y, 'LineWidth', 3) hold on for i = 1:20 % plot([30 30],[-3 8],'--k'); % ...
a4f94c3328345e202316d395dff53a3aaf308ce6a14f1ccf947cc87b9546c7dd
MATLAB
634
18
function Experiment=getExpID(PathName) %% Get the Experiment ID: slashes=find(PathName=='\'); if ~isempty(slashes) Experiment=PathName(slashes(end-1)+1:slashes(end)-1); % Experiment ID else Experiment=PathName(1:find(PathName=='.',1)-1); end Experiment(Experiment==' ')='_'; % REPLACE SpaceS with '_' ExpIDDef{1...
bcded33cad879df855694ab31bbf93596c8fa8437fbb3fac9b1e541158c28867
MATLAB
634
19
%% Function that simulates the injection of escitalopram into the peritoneum. %t_start is the time for the first dose, and t_repeat is the repetition %time in hours. inj_time is time that the injection lasts. Output units in ug/h. function f = SSRI_inj(t, t_start, t_repeat, q) inj_time = 1/3600; n=length(t); for...
fa90fdc6bbf3a054895304721f6af510f142fe26639e8a83795787de3fc3c519
MATLAB
635
26
function Stats = pairedWilcoxon(Data1, Data2) Diff = Data2-Data1; [p,sig, stats] = signrank(Diff); try Stats.zval = stats.zval; catch warning('something weird with z-values again') Stats.zval = stats; end Stats.p = p; Stats.sig = sig; Stats.df = numel(Diff) - nnz(isnan(Diff)) - 1; Stats.N = Stats.df + 1; S...
d1af2122ffcdac684c7a43ea135c64c65fa2e3c522245a3c01e30e13e680822b
MATLAB
637
40
function [T1 S0] = find_T1(f) for k=1:length(f) tr(k) = f(k).TR/1000; y1(k) = f(k).integral_real; y2(k) = f(k).integral_real_all; y3(k) = f(k).integral_abs; end [v,i] = max(tr); v0(1) = y1(i); % S0 start point v0(2) = 1000; % T1 start point of the fit vE=nlinfit(tr,y1,@T1_decay,v0); T1(1) = ...
7c5671b640220b3e3bb7e933b74e49c46923e2173513eefd3c7c88e6af3481db
MATLAB
639
23
function [mu,F] = fcn_fastflx(S) % computes pairwise flexibility on node x layer x repetition matrix, S % % inputs: % S, node x layer x repetition matrix of community labels % % outputs: % mu, node x 1 vector of average pairwise flexibility % F, node x layer x layer x repetition dis...
bc1606069b13a4638a9041bdca91f3b084e1d7f91821e3c9c871d082bf60cfba
MATLAB
640
17
function [filename, dirname] = selectFile(fileSpec, prompt, dirname, multiSelect) %SELECTFILE Select a file or files via a dialog args = {fileSpec, prompt, dirname}; if multiSelect args = [args, {'MultiSelect', 'on'}]; end [filename, dirname] = uigetfile(args{:}); if ~(ischar(filename) ...