sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
cc77dfc12b40fe94598e0627fcd3f7eeea0a51944f6e84cd7e4528bdf49d671d
MATLAB
941
33
%% load all data %use psth fun to add the 10ms binned psth to the old all data. clear clc %% for i = 1:5 cd('G:\My Drive\תוצאות\PFC') % take the old all data and add to the name orig_exp_name{i} = uigetfile('*.mat'); selpath{i} = uigetdir('E:\2022', orig_exp_name{i}); exp_name{i} = [orig_exp_name...
fe3af6e1a7c6fff6f341689b6d921d69509ee792791aefa303dd492096312d93
MATLAB
941
42
function [ROISignals] = EXPext(niftiList, template, ROIIds) % This program is intended to extract signal extraction from ROIs. % % input: % niftiList: a list from nifti % template: atlas.nii % ROIIds: ROIs' list of atlas .nii % % output: % ROISignals: [List, signalExp] % % by Hiroaki Hamada, oist, 2019/04/22 % extrac...
e7c7b871ef7c2543f637339ee6cfbb115bd2978ca16794b3cdbaac92fb5d2723
MATLAB
943
35
% Function to plot different boxpltos from several column vectors % Input % VC1,VC2,VCN: column vectors % Labels=cell(N,1) Structure of NLabels % Output % Plot of Several Boxplots (different N data) function columns2boxplot(varargin) %% Setup Nc=numel(varargin); if iscell( varargin(end) ) Nboxes=Nc-1; f...
36f13c718ad140e0018424399e14e39738b236480f753872f31f0f0b76c86af0
MATLAB
944
39
function [ dshared ] = compute_dshared( fa_model, var_exp_thresh ) % % computes the shared dimensionality % % Input: % fa_model - (struct), factor analysis model parameters % var_exp_thresh - (scalar, [0,1]), variance explained threshold for % determining dimensionality % % Output: % dsha...
4c2f9a49de55fa58e074fd1962d75758745c385b702074eceedb7afe77f8e8da
MATLAB
944
27
%% Example 3: Extract trial-averaged neural trajectories from PSTHs % Perform dimensionality reduction with DimReduce and automatically % visualize data in DataHigh. The data has 56 trials for two reach % directions. Data is from (Yu et al., 2009). % % Please see User Guide and online videos for detailed instruct...
934ddfa1fe7e98271178bd21f8f4d51d8274d5897a560d6641643740c853507f
MATLAB
944
31
%% Plot Venn Diagram % Input % ActivityGroups % Output % Plot function plotvennCellActive(ActiveCells,Names_Conditions) % 3 main SEPARATED groups: KeepDoPlot=true; if max(union(ActiveCells.AC_1,ActiveCells.AC_2))==max(ActiveCells.CellsIndx) fprintf('>>OK') else fprintf('Something Wrong.\n'); KeepDoPlot...
d39e9e2ba862382e02d52fc637b4ed10639e1c078cf436638e2b94caa1a87185
MATLAB
944
29
function draw_histograms(handles, c2plot,USER_DATA) %This function plot the histogram of the cluster number 'c2plot' %handles should have the axes of that histogram. USER_DATA is the USER_DATA %of wave_clus. spk_times = USER_DATA{3}; classes = USER_DATA{6}; par = USER_DATA{1}; for i = c2plot if classes == 0 ...
fed021e98cd298b68605c42e0dfafb6327e3ed6930ad1b5929cc8bcb5270223f
MATLAB
944
35
%% Please first run s1_Predict_Rsp.py to generate PRsp.mat before run this code %% Prepare data load('PRsp.mat') load('../../Additional_Data/ROI.mat') load('../../Additional_Data/imgset.mat') %% Generate map map = zeros(20480,20480,3,'uint8'); for ii = 1:128 ii for jj = 1:128 xi = 129-ii; ...
37b5e7fed30764cd8682d338c24d8c5e56559b9a1b6cc770a8d95dba2b86b3c0
MATLAB
947
35
%% Function of mast cell travel and activation in the brain. %mc_switch is the presence or lack of neuroinflammation, % mc_start is the time of start of neuroinflammation, t is time. % function f = mc_activation(t, mc_switch, mc_start_time) c = 1; %Amplitude of MC activation. b = 20; %Strength of increase. t...
c6342c42d42fdddeaf7970419e0c248c801a09aca26b9245038595c06264cea9
MATLAB
947
18
function [idx] = get_idx_linear(S,nSites) % GET_IDX_LINEAR Concise index set for a single linear functional module. % IDX = GET_IDX_LINEAR(S,NSITES) for functional module S and total number of observable components NSITES % (without the reference variable s_ref) returns the indices of the elements of the NSIT...
c76cc50cd548979c29c3730da398cf64ec65e28edd77ee542f959c7617305d87
MATLAB
947
51
% Test function for subspace_mapping % % Reza Sameni, 2025 close all clear clc % Parameters ITR = 10; K = 1000; dim1 = 32; dim2 = 3; % Preallocate e1 = zeros(1, K); e2 = zeros(1, K); tic % Monte Carlo comparison for k = 1:K A = randn(dim1, dim2); B = randn(dim1, dim2); [~, ~, e1(k)] = subspace_mapping(A...
ca769a9f262a5e2304ba2e370353f8e4fafd4cce8e89d621d66f4303c047ec41
MATLAB
947
21
function [devianceResiduals,deviance] = getDeviance_null(result) %function [devianceResiduals,deviance,samples_deviance,samples_devianceResiduals] = getDeviance(result,Nsamples) % This function calculates the null deviance from the model. Temp function, % Lior 2018-May-10 % pPred = result.psiHandle(result.data(:...
5c21b72edb049ba3d23cbe0ea63aa30377911a34cf7ce19c4196101fbfb3df9f
MATLAB
948
40
function kern = nufft1_kernel(klist, N, J, K, alpha, beta) %function kern = nufft1_kernel(klist, N, J, K, alpha, beta) % compute equivalent interpolation kernel (real part) % at points in klist if nargin < 4 help(mfilename) J = 7; N = 100; K = 2*N; k = linspace(-J/2-1,J/2+1,201)'; % fine sampling for display ker ...
dab894f63d59d4a5b808413e746e872d83c0549f950891ac9202007b0673e717
MATLAB
949
34
%% Plot accuracy indication plots % input: XData, YData, CData: 1*n vecter % bounds: [lower bound, upper bound] ; can be flexible for 10% % colorcode: [good;ok;bad] what color to indicate % varargin: xlabels; ylabels function [CIndi] = PlotAccu(XData, YData, CData, bounds, colorcode,TitText,varargi...
ba0348a6f3b8306601f2e7006adeeaebb2208dc0959ebcf591ce72e4f47d9c82
MATLAB
952
39
function [radX_c SpikeTimeX_c,first,last] = computeRadFiring(t_ECG,t_SPIKES) % t_ECG=t_events_plus, % t_SPIKES, % ind_SPIKES=1:length(t_SPIKES); t_CORTOpeak=t_SPIKES';%ECG_RESULTS.t_events; %BELT_Rpeak; t_LUNGOpeak=t_ECG;%t_maxima(1:end); %RR interval rrint= diff(t_CORTOpeak); tint=t_CORTOpeak(2:end); tmat_c = {...
24289390a9f641cb82fb222bdb4d7440b6292293ac44206188b9c37ae71114a8
MATLAB
953
35
imagesize = [32 32 3]; batchsize = 10000; batchnum = 5; classnum = 10; kTrainNum = batchsize * batchnum; kTestnum = batchsize; TrainX = zeros([imagesize kTrainNum]); TrainY = zeros(kTrainNum, classnum); for i = 1 : batchnum load(['data_batch_' num2str(i) '.mat']); curdata = double(data)' / 255; curind = batchsi...
2b4b7cf87810ebdcbbfb7a6d4a6b4697d8e4b52a51d8ff8d1935bd09c3a471ec
MATLAB
953
26
function V = gompertz_exp_alpha_beta_ther_gr0(param, DT_invitro, temps, tI, VI, t_start, t_end) % param = [alpha_0, beta] parameters of Gompertz growth, according to % dV/dt = (alpha_0-beta*log(V/Vc))*V % hence alpha_ = relative growth rate at V = 1 cell (volume Vc) % DTinvitro = doubling time in vitro in hou...
9813a71e488ae41980c5cfc05edfe5b257ea7f3e356100fa4ef91a01dd1cb33e
MATLAB
955
29
function mask = XxCalMask(img, ksize, thresh) % ------------------------------------------------------------------------ % XxCalMask: calculate the foreground mask of img % % usage: mask = XxCalMask(img, ksize, thresh) % where, % img -- 2D img to calculate foreground % ksize -- the size of first gauss...
1d9a004ea1f896fc0f1aeaf6b8b1d14395bc276fc6595315dbaebcfed23152ca
MATLAB
957
39
DefaultExponent = 3; DefaultOffset = 1; Duration = 120; SampleRate = 250; WelchWindow = 4; WelchWindowOverlap = .5; SmoothSpan = 3; %% Test_Exponent Exponents = -5:.3:5; NewExponents = nan(size(Exponents)); NewOffsets = NewExponents; for ExpIdx = 1:numel(Exponents) [Signal, t] = cycy.sim.simulate_aperiodic_eeg(Exp...
345f77520fafaa9821a11bb9284fdefeb70d22de0cd489aa6a5311231ddf477c
MATLAB
958
37
function saveFigures(obj, ext) %SAVEFIGURES Save figures prefix = sprintf('jrc4_%s_', datestr(now, 'yyyy-mm-dd-HHMM')); dlgAns = inputdlg('Figure name prefix', 'Save figure set', 1, {prefix}); if isempty(dlgAns) return; end prefix = dlgAns{1}; if obj.hCfg.verbose fprintf('Sa...
ecdef96c60da14f6a5ec8840df358e7a3e7fb4909e9664c5e8fa9f7b6b5bdddf
MATLAB
958
21
cd('I:\My Drive\ELYASHIV\PFC_paper_results_after_revision\effect size\f2\g(latency)') x = importdata("latenceys.mat") %% grpstats(x,"clusters","mean") grpstats(x,"clusters","median") x1 = x(find(~(x.clusters == 2)),:) x1.clusters(x1.clusters == 3) = 2; x1.clusters(x1.clusters == 4) = 3; x1 = sortrows(x1,"cluste...
d0f9f5d319c6a5c6ca52b335344f0abbff00948715251cfa14ddcbe9890b5625
MATLAB
959
27
function [XV,YV] = Get_Rect_Vector(O,Angle1,Rect_Width,Rect_Length,Rect_Rotation_Origin) % 1----------2 % 14 0 |------> % 4----------3 % O = [x,y] is the the reference point for the rectangle's coordinates (rotation origin). % Angle1: Orientation of the rectangle (relative to the rotation origin) in degre...
0d279f27b8470a8e89276621caad57c6bb2398bc471c399c0c56a1dc6c9028e2
MATLAB
961
40
function [fName] = chk_N_Analysis(data) %Check Number of Analysis % % [fName] = chk_N_Analysis(data) % % Description: This function is a helper to the analyzeFP script. It % parses a data structure to see how many final_x array of structures % there are and outputs the next available final_x field name t...
39daa58f4a71a7d7e353dff4ace1289d1aa1787939bb06cd798e43c6ef8ff02a
MATLAB
961
41
clear p = params_2DAA; fpath = fullfile(p.processed_data_dir,'allData.mat'); load(fpath,'evs','tis','bvs','traces') %% plot activity traces for multiple sessions cellIdx = 1:10; for sub = 3%1:p.nSubjects len = 400; start = 2001; stop = start+len-1; sep = 100; figure('Position',[200 200 700 300...
bfb8a712554878227906504046ddc0fbacef6269e4c0241634f06b001b2829fc
MATLAB
962
30
% Use Only if there is a Raster Plotted Already % Input: % THR: Cell of Threshold(s) by Condition % Cell of Raster Lengths (frames) by Condition % Sampling Frequency (Hz) % Outpu: % Segmented line of THreshold in subplot(1,3,3) function plot_CAG_threshold(THR,LENGHTRASTER,fs) [~,NC]=size(LENGHTRASTER); ax=subplot...
c66073984fa6ecae5153237edd207f4b91fd4a72b47985d91bf64d624cce2c54
MATLAB
962
27
%Recursive Zonal Equal Area Sphere Partitioning: Properties of EQ partitions % % Recursive Zonal Equal Area (EQ) Sphere Partitioning Toolbox. % Release 1.10 2005-06-01 % %Functions by category %===================== % % Diameter % eq_diam_bound Maximum per-region diameter bound of EQ partition % eq_vertex_di...
eaa587399554e73b4f269102e162afc1de2f947a154840f9bd3d75474be1474e
MATLAB
962
27
function pred = classify_norm_mat(layers, weights, test_x) layers{1} = cnnsetup(layers{1}, 0); layers{1} = initact(layers{1}, test_x); layers{2} = cnnsetup(layers{2}, 0); layers{2} = setweights(layers{2}, weights{2}); assert(size(test_x, 1) == layers{1}{1}.mapsize(1) && ... size(test_x, 2) == layers{1}{1}.ma...
56df5b097988f3268dbfa324b930da324c9e28bb3d80a2943e1f8c08e3070935
MATLAB
966
30
function [Blob_Skel,xe,ye] = Skeleton_Blob(Blob_Image) Min_Branch_Length = 300; Blob_Skel = bwskel(Blob_Image,'MinBranchLength',Min_Branch_Length); E = bwmorph(Blob_Skel,'endpoints'); [ye,xe] = find(E); if(length(xe) > 2) % If more than two end-points. Pb = find(bwmorph(Blob_Skel,'branchpoints')); % Find ...
625d005254f204360ed2391736fdced723a3e814f40071a2d8a47a25cebbe0a0
MATLAB
966
25
function auto_etco2(app) %AUTO_ETCO2 Summary of this function goes here % Detailed explanation goes here if ~isempty(find(contains(vertcat(app.data.name),'CO2 mmHg'))) if isempty(find(contains(vertcat(app.data.name),'etCO2'))) idx = find(contains(vertcat(app.data.name),'CO2 mmHg')); [data,ts,~, ~]...
c81b38fb667c4ba38e39b253cfae79383e82757b421ca9401d96ccc4634c041d
MATLAB
966
22
function [New_Index,Raster_Condition,RASTER_WHOLE_Clean,XY_clean]=ActivityMatrixSorted(XY) % Call global global RASTER; global Experiment; global fs; global Names_Conditions; % make it nested function---> % Sort by Activation in each Condition: [New_Index,Raster_Condition,RASTER_WHOLE]=SortNeuronsCondition(RASTER,numel...
f8d5802dc86b45fcfb68d71d6dc4d7347f89d66870dde9fbcc4f3fd91069a8c8
MATLAB
969
26
function V = gompertz_exp_alpha0_beta_ther_gr0(param, DT_invitro, temps, Vc, tI, VI, t_start, t_end) % param = [alpha_0, beta] parameters of Gompertz growth, according to % dV/dt = (alpha_0-beta*log(V/Vc))*V % hence alpha_ = relative growth rate at V = 1 cell (volume Vc) % DTinvitro = doubling time in vitro in...
49708c4862d7228058cce75518bda0efa77f3f30df95a2062f7d6e24bd471abd
MATLAB
970
32
clearvars close all addpath(genpath('/storage/stella/MATLAB_toolboxes/')); addpath('/storage/stella/Analysis/matlab_scripts/'); %% intersection between the two WM atlases (done with FLIRT, good in the anterior part; done with FNIRT, good in the posterior part) FA = load_untouch_nii('dti_FA.nii.gz'); FA = double(FA.img...
8577f9af211461b71b9cbdb7f9f00ef257658b6ce9648edde30e506b5a101e14
MATLAB
970
27
function [d,p] = getpaths(map) %% Calculate the shortest paths between any pair of nodes % This function calculates the K shortest paths from any node i to node j % in the network. The length of a path is defined by the sum of the inverse % projection of the nodes along the path. The shortest path (i,j) is the % p...
a3000c55a8482925ee5fd65866689ce7f9b5700071da7737338ec0493fed0307
MATLAB
970
37
function eeg_data(Data, SampleRate, YGap, DisplayName, Color, LineWidth) arguments Data SampleRate YGap = 20; DisplayName = ''; Color = [.3 .3 .3]; LineWidth = 0.5; end % Data is ch x time matrix % YGap is how much to space the channels. Default is 20. [ChannelCount, TimepointCount] = size(Data...
ad791e20182fe59a6750956ad38a4ec00601f6c143608eeea1a12b39325a4bd2
MATLAB
971
37
%% get clc, clear [file, path] = uigetfile('*.mat', 'MultiSelect','on'); datafile = fullfile(path, file); %% for i = 8:length(datafile) load(datafile{i}) cell_names = fieldnames(all_data); new_path = all_data.(cell_names{1}).source_dir; % find the relevant folder cd(new_path) if ~...
e98c9e2fe2cc880955f9e416b35b5abe6a481c3c62dae433650870f34d06b477
MATLAB
972
46
function[]=textBox2() txtf2 = figure ('menu','none',... 'Position', [1050 700 420 150],... 'visible','on',... 'Resize', 'on'); set(txtf2,'name','Are you finished?','numbertitle','off') AnalyzeBtn3=uicontrol('Style','pushbutton','String','Go back',... 'Position', [30 40 160 60],... 'BackgroundCo...
f27397ae18a310fd19328b9b7ce9cb8a9b4f592341252fe80cfae2b17fac19fa
MATLAB
972
48
function M = xfm_read(fname) % M = xfm_read(fname) % % xfm_read.m % % Original Author: Bruce Fischl % % Copyright © 2011 The General Hospital Corporation (Boston, MA) "MGH" % % Terms and conditions for use, reproduction, distribution and contribution % are found in the 'FreeSurfer Software License Agreement' containe...
f6f74531ca00001f00e69e0bcec30f0fd04f4ce3727c46786f12e5c6d6d9356d
MATLAB
974
20
clc; clear; load E:\SemanticSegmentation_Scale\CPL\GTruth_Revolve_1433.mat; load E:\SemanticSegmentation_Scale\Results\MuliImageSS_ResNet50_SeriesClass_ResAttention\trainedNet_resnet50_5.mat; imageDir = 'E:\SemanticSegmentation_Scale\NET_Muli_CPL_XPL_All\Revolve_Imds_Test\'; imds = imageDatastore(imageDir,... ...
e76322c394e7aed7c68a0c0dd70996cf3eedbc62995f9c44e5e6bc6387035e6d
MATLAB
975
29
function [binary w]= threshold_abs(w, thr) % Absolute thresholding % % This function thresholds the connectivity matrix by absolute weight % magnitude. All weights below the given threshold, and all weights % on the main diagonal (self-self connections) are set to 0. % %INPUTS: W = weighted (direc...
61def39f1f47291a7dfe6ffc9a175158315751dc6b85a637e831d5687318ca70
MATLAB
976
41
function vals = meanSubtract(vals, dim, hFun) %MEANSUBTRACT Subtract mean (or other statistic) from vals if nargin < 2 dim = 1; end if nargin < 3 hFun = @mean; end if ~reallyisa(vals, 'single') && ~reallyisa(vals, 'double') vals = single(vals); end % have to res...
e57cd5ddb6f354ef86674d274ac90835ba6dbbe56590a5b1090ec16eefd4991b
MATLAB
976
31
function drawTriad( vecPos, vecOrient, lengthTriad ) triadRot = calcBeamRotation( vecOrient, eye(3) ) * lengthTriad; plot3( vecPos(1), vecPos(2), vecPos(3), '.' ); p1 = [ vecPos ]; p2 = [ vecPos + triadRot(:,1) ]; plot3( [ p1(1) p2(1) ],[ p1(2) p2(2) ], [ p1(3) p2(3) ], 'r', 'linew...
7b6eee890b8631907807c12a509e3822595945de04fe913267139297ea272220
MATLAB
977
34
function [U, S, V] = generalized_svd(A, X, Y) % % [U, S, V] = generalized_svd(A, X, Y) % Generalized Singular Value Decomposition % % input: % A: recrangular matrix (m x n) % X: square positive definite matrix (m x m); row-wise constraints on A % Y: square positive definite matrix (n x n); column-wise constraints on A ...
ee49cbd5592e097e7bf3d640053b477aebd919f052aa4027d2572821f41a3073
MATLAB
978
24
% This file is part of NYU_EffiModel, the code % accompanying the paper "Efficient models of % cortical activity via local dynamic equilibria % and coarse-grained interactions," to % submitted to PNAS. % % Copyright (C) 2023 by Zhuo-Cheng Xiao <zx555@nyu.edu> % % This program is free software; you can redistribute ...
280f1d73fa24defa109b159549dfab5df5fd87456c27343a287c099261a712e2
MATLAB
979
34
% RUN AFTER >>Ensemble_Sorting XY=XY_selectedClean(Index_Ensemble,:); C=fNet.Colors; ColorsInd=C(Index_Ensemble,:)./255; for i=1:size(ColorsInd,1) actcl=ColorsInd(i,:); axx=find(ismember(ColorState,actcl,'rows')); if ~isempty(axx) Iensamble(i)=axx; else Iensamble(i)=0; end end fig...
6e6779afda7a2d27fa7d4e4efa84cb6a8feb45d639b26884da565a86d7ca9d05
MATLAB
979
34
function area = area_of_ideal_region(dim,N) %AREA_OF_IDEAL_REGION Area of one region of an EQ partition % %Syntax % area = area_of_ideal_region(dim,N); % %Description % AREA = AREA_OF_IDEAL_REGION(dim,N) sets AREA to be the area of one of N equal % area regions on S^dim, that is 1/N times AREA_OF_SPHERE(dim). % % The a...
71b63f1622d9ae5627940cc2ac844725db7480062fb3eef2e66ff6f3aea35a17
MATLAB
979
30
function []=mnl_TracesChannelMIPs_TracesAndSomas_NormToMaxValues(dim,data,BkgMean,MaxValues) %function that creates normalised MIPs for each channel based on the values %from the trace extraction % Inputs % dim - dimensions of the original image [x y c z] % data - the image matrix % BkgMean - the background values t...
75a065e80e79d4b8fe8e77271a877be771cbae3c81859489cbe75b497e3d0f99
MATLAB
980
36
function [tx,g]=rst_tsample(x,percent) % function [tx]=tsample(x,percent) % Returns the trimmed sample of x. % x must be a vector % percent must be a number between 0 and 100 % The trimmed sample is calculated by dropping the lower and upper g values from % x, where g=floor((percent/100)*length(x)). If x is empty, the...
acc667cb206b633eaaf437e42d9f7abdbab967d16ce859e5adedda31fbc02fc5
MATLAB
980
27
% load a CTparams file [file, path] = uigetfile('CTparameters.mat'); datafile = fullfile(path, file); load(datafile) %% for i = 1:length(CTparameters.id) figure title(CTparameters.id(i)) subtitle({'half valley duration ' CTparameters.half_valley_duration(i) ... 'half peak: ' CTparameters...
ad2005f480e30cf6ac7d721b93635e283cff48a4cd9dea03c0ff9017fe736696
MATLAB
980
37
function[]=textBox1(putativeHits) txtf1 = figure ('menu','none',... 'Position', [850 500 450 350],... 'visible','on',... 'Resize', 'off'); set(txtf1,'name','Instructions','numbertitle','off') txtFt=uicontrol('Style','text',... 'Position',[50,240,355,55],... 'FontSize', 20,... 'String',['There...
5bcda4ad9182e49b4132ede9ce9947667ddebaffc4f3e1b476e8b760c711c084
MATLAB
981
29
%%%plot della conta dei neuroni nelle immagini di una stessa slices (in %%%ordine temporale prompt1 = {'Enter no. colture'}; dlg_title = 'No. colture'; %see help for informations num_lines = 1; answer = inputdlg(prompt1, dlg_title, num_lines); %coltura di cui si vuol avere il plot answer1 = num2str(cell2m...
69f187b01ddeae069d54999626a5667de040111f5f608401a8ded6d5981965f1
MATLAB
981
25
function TrackingData = even_TData(TrackingData) % Ensures that TrackingData and neural time are of the same length % Input: % TrackingData - Structure containing tracking data % Output: % TrackingData - Modified tracking data with equal length % Check if the length of TrackingDat...
588ba5c94f7c7a1f003725b316d8d68ed327c6496c9b88bdc3c4c6b935438a29
MATLAB
982
27
function [prVecs1, prVecs2, prVecs3] = getPVSpikes(sampledWindows) %GETPVSPIKES Get first 3 principal vectors for sampledWindows on each site % input: sampledWindows is nSamples x nSpikes x nSites % output: prVecs{1,2,3} is nSamples x nSites % mrPv_global = get_(S0, 'mrPv_global'); % if ~isempt...
bf999947dc4ca11108f200fb8bcee72de36baa637e381eef360aa038a5142be0
MATLAB
983
45
% A naive implementation of Householder's 1958 algorithm for nulling % non-diagonal matrix entries (row-wise or column-wise). % Ref: Householder, Alston S. "Unitary triangularization of a nonsymmetric % matrix." Journal of the ACM (JACM) 5.4 (1958): 339-342. % % Reza Sameni 3/1/2019 % email: reza.sameni@gmail.com clc...
2180ff24331ff5d2f119ec9fca29b5f81399478e186fffc849c16aac014ed20d
MATLAB
985
30
function n_regions = round_to_naturals(N,r_regions) %ROUND_TO_NATURALS Round off a given list of numbers of regions % % Given N and r_regions, determine n_regions, % a list of the natural number of regions in each collar and the polar caps. % This list is as close as possible to r_regions, using rounding. % The number ...
cd65edce9c307683160fd0c2aaefacb66dc1fd668418deebe270c8e5364ab002
MATLAB
986
32
function out = spmup_smooth_boostedfiles(P,K) % smooth the data in P with a Gaussian kernel of FHWM [x y z] % and masks out using the mask located in folder above your boosted files % % FORMAT: out = spmup_smooth_boostedfiles(P,[x y z]); % % INPUT: P names of files to be smmothed % x y z the FWHM of the Gaussia...
d7e99e54ad6432434f3b2e3cd6a49fc946fe9ff9d392827b9a0e9a219eb002ba
MATLAB
987
32
% Function to detect empty tables and empty columns of netowrok fetures % % function [ExsitFeature,EXPLIST]=emptycolnettables(GEPHIDATA,Names_Conditions,ActualFeature) % Init Output [NE,NC]=size(GEPHIDATA); % Number of Experiments & Conditions ExsitFeature=zeros(NE,NC); EXPLIST=cell(NE,NC); for e=1:NE for c=1:NC ...
1848a95f84d615d86965b4e7c4c75168dafcefbf15b4d4e833b721132b497fc7
MATLAB
990
30
function [Starts, Ends] = data2windows(Array, Threshold) % Takes an array of numbers. If the data is not 1s and 0s, then it uses the % threshold to convert into windows above the threshold. If no threshold is % provided, then it will take all positive values as above threshold. If % you want everything below a threshol...
4375876e0fd98694e18786b357f1fca7734fee0bba88e560ab00f3dea7e95c26
MATLAB
990
30
function ind = ChannelIndex15(x, ff, fs, wlen, guard, th) % Channel selection based on periodicity of local energies % % Reza Sameni % February 2019 N = size(x,1); T = size(x,2); nfft = T; ind = zeros(N, 1); for l = 1 : N envelope = sqrt(filtfilt(ones(1, wlen), wlen, x(l,:).^2)); % envelope_pulse = ze...
7394eb3948697dfd44e988d572253dfdabd1a1d24d1fe2e22272949081491b82
MATLAB
991
31
for n =1:3 cells = fieldnames(all_data); for j = 1:length(cells) current_cell = all_data.(cells{j}); x = current_cell.x; y = current_cell.new_fit(n).y; curve1 = current_cell.new_fit(n).original_curve; gof1 = current_cell.new_fit(n).original_gof; original_rmse = current_cell.new_fit(n).or...
a8a298885d3333ef2c8399f17a25487289613c53f4b8f7568802edc951c49fe0
MATLAB
992
21
function [D,Fin] = Scale_Midline_Distance_To_Local_Radii(D0,R3,R4) % This function rescales the midline distances to local PVD raddi. % The radii are given as either the dorsal or ventral radii, depending on the side of the corresponding coordinate. F3 = find(abs(D0) <= R3); % Find points that are between the mi...
733f09511cb02b200ed4c6cd71c6f0dc3b2b1072bb69d188339bab30e0f91ace
MATLAB
993
34
function X = prewhiten(X) % Compute and apply the ZCA mapping X = X - repmat(mean(X, 1), [size(X, 1) 1]); W = inv(sqrtm(cov(X))); X = X * W; % X = N-by-P matrix for N observations and P predictors % Z = N-by-P prewhitened matrix % % % 1. Size of X. % [N,P] = size(X); % asser...
8f3c5e80b79326ae612b6e8d9b45a48b0ba169a515291f44a87d06ff87079c51
MATLAB
993
48
% For a pixel vector, show how the map is function [] = ShowField(Vec, Range, XPix, YPix, varargin) if size(Vec,2) == 1 Map = reshape(Vec(Range),YPix,XPix); imagesc(Map) colormap jet set(gca,'YDir','normal') colorbar elseif size(Vec,2) == 3 Map = zeros(YPix,XPix,3); for LgnInd = 1:3 ...
ed132938eba8467937ec93ff01ae982a0c568bf696e85326a9fa5d4039cd0b7f
MATLAB
993
33
function [diss,sc]=computedissandsc(thedata1,thedata2) % computediss: computes dissimilarity and spatial correlation between 2 % data sets % % inputs: data as 2-D numeric arrays where dimension 1 contains the % timeframes, dimension 2 contains the channels % % outputs: diss and sc as 1-D numeric arrays that contain the...
13a024a35f510099c4ce0438a00bd88bc5afb99475957dd2897e0717d5d5a920
MATLAB
994
37
function [h1, h2] = plot_dir (vX, vY,varargin) %function [h1, h2] = plot_dir (vX, vY) %Plotting x-y variables with direction indicating vector to the next element. %Example % vX = linspace(0,2*pi, 10)'; % vY = sin (vX); % plot_dir(vX, vY); %% NOTE!! vX, vY has to be column vectors! if length(varargin)<1 arrC ...
d2077e8be48e13d15ac675c8721d9c43042e0299da601f80c8e06ada85b9b03b
MATLAB
994
36
function annotateUnit(obj, note, confirm) %ANNOTATEUNIT Add a note to a cluster if obj.isWorking jrclust.utils.qMsgBox('An operation is in progress.'); return; end iCluster = obj.selected(1); % set equal to another cluster? if strcmp(note, '=') && numel(obj.selected) == 2 ...
352562a384fc138252bef9cf006c6edfd658405eef25e1964048c30a10eab9d5
MATLAB
995
31
function g = GausVal(t, p) % Compute the Gaussian function values. % % Inputs: % t: Time samples. % p: Gaussian parameters [amplitude, width, center]. Can be a matrix where each % column corresponds to a set of parameters. % % Output: % g: Values of the Gaussian function evaluated at time samples 't'. % %...
71fde16e5aa216e4eb3a6ba1b9adb7ebbeaf9c1366573021e4c046a6c26e071f
MATLAB
997
38
function supp_fig4_dos(folder, save) %% Supplemental figure 4: DOS for unfiltered maps (left side) %% Load and normalize if nargin == 0 folder = 'All'; end load(fullfile(folder, 'data'), 'dos', 'mode'); f = get_save_figure(); mindos = 0; maxdos = 0; for m = 1:3 % Calculate maximum DOS in the 3 displayed matr...
6f87c94dd02f65ce2ae2c5f3c72ee32b8ee87146fb2230b1b82c388393d5f322
MATLAB
998
39
%% fnames = dir(['G:\E7_2DAA\**/*behavior1.avi']); fnames([27,30]) = []; % exclude incomplete sessions for m1 and m4 for i = 1:length(fnames) fpath = [fnames(i).folder '\' fnames(i).name]; fileinfo = aviinfo(fpath); nFrames_b(i) = fileinfo.NumFrames; end %% fnames = dir(['G:\E7_miniscope_concat\**/*.h5...
49898aa6e41bc65575fd2896de1767c40d04dd0a9ce98dd5e21e235e1b922035
MATLAB
999
30
function Z = ECGModelFrequencyBased(X,time) % % The Fourier transform of ECG generated by sum of Gaussians model. % % Open Source ECG Toolbox, version 3.14, February 2019 % Released under the GNU General Public License % Copyright (C) 2019 Reza Sameni % reza.sameni@gmail.com % This program is free software; you can r...
f0488644ddfe3bed6d2f75a1e272c042e65333f8d239369a26606fc0845f3d94
MATLAB
1,000
29
function draw_histograms(handles, c2plot,USER_DATA) %This function plot the histogram of the cluster number 'c2plot' %handles should have the axes of that histogram. USER_DATA is the USER_DATA %of wave_clus. draw_histograms(handles, 0:min(nclusters,3),USER_DATA); spk_times = USER_DATA{3}; classes = USER_DATA{6}; par ...
7f0041c439485529b6672d489955b790490af5ec772a7b9e2e3734bbbbe812e7
MATLAB
1,001
38
% Function that get Lines for the given frames % It Unifies with Lines the points of a given signal x function xdeline=getdeline(delineframes,x) %% Setup *************************************** xdeline=[]; PointA=1; xlinsegment=[]; % Make sure there are not smaller segments than 3 samples delineframes=delineframes(deli...
4d690beec8448fd2de6ef20afc2ac1d7c19be555f8f792bd060d04eb2a7edd97
MATLAB
1,002
27
% Copyright (c) 2008-2026 the MRtrix3 contributors. % % This Source Code Form is subject to the terms of the Mozilla Public % License, v. 2.0. If a copy of the MPL was not distributed with this % file, You can obtain one at http://mozilla.org/MPL/2.0/. % % Covered Software is provided under this License on an "as is" %...
89a2e7c5305d1f756c76b50ad3f8a85c771429dfbbe14646176e1d5ffc044f6d
MATLAB
1,002
39
function area = area_of_sphere(dim) %AREA_OF_SPHERE Area of sphere % %Syntax % area = area_of_sphere(dim); % %Description % AREA = AREA_OF_SPHERE(dim) sets AREA to be the area of the sphere S^dim, % % The argument dim must be a positive integer or an array of positive integers. % The result AREA will be an array of the...
4a960b3dd254eb01771beadffa25075844f19e3b730d9a109ea1d22b3f56ffad
MATLAB
1,003
33
clear clc %% %save only Intensity encoding + IR [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 %% window_names = {'ON', 'Sustanied', 'OFF'}; % for ...
ab0cae675ce463ba87c58785ace2659072323d40dc9d4abf0b8b32953c0649ea
MATLAB
1,005
38
function [curv] = write_curv(fname, curv, fnum) % [curv] = write_curv(fname, curv, fnum) % % writes a curvature vector into a binary file % fname - name of file to write to % curv - vector of curvatures % fnum - # of faces in surface. % % % write_curv.m % % Original Author: Bruce Fischl % % Copyright © 201...
cf41d217389f43fd4768f63133081e6780a46ddd6ee9b346b3e6f4e105a3e0f8
MATLAB
1,005
30
function [SIGNALS,r,H,W,RADroi]=FluorescenceSignals(NC,NumberofVideos,FN,PathName,XY,r) RADroi={}; %% Load Data ********************************************************* % For each CONDITION and VIDEO for i=1:NC for j=1:str2double(NumberofVideos{i}) FileName=FN{j,i}; [mov]=Video_Load(FileName,PathNa...
b6cb986ebbb808168449ddda068a4d4b79fcd5a14920d29acb104977797ab35b
MATLAB
1,006
38
function volume = volume_of_ball(dim) %VOLUME_OF_BALL Volume of the unit ball % %Syntax % volume = volume_of_ball(dim); % %Description % VOLUME = VOLUME_OF_BALL(dim) sets VOLUME to be the volume of the unit ball % B^dim in R^dim which is enclosed by the sphere S^(dim-1). % % The argument dim must be a positive integer ...
aca0bf60f6084f8ead02df7a7e5ae6ad91359dd0dd8e3947c7154a57bda4a9eb
MATLAB
1,008
56
% test baseline wander removal by freq. domain filtering % Reza Sameni, 2018 % clear; close all; load patient165_s0322lre; %load LOUETTE_07-Oct-2005_40s.txt -mat;data = LOUETTE_40s;clear LOUETTE_40s fs = 1000; %d = data(:,4:8); % d = data(:,2:end); d = val'; N = length(d); S = fft(d,N,1); SS = 10*log10(S.^2); f = [0...
662fc2c456952920e868d82bcc56cd2a2dedefc78ba8b94fbea246299eae9cef
MATLAB
1,009
31
function projection = forwardProjectGPU(psf,Xguess) %% Forward projection from 3D volume to 2D projetion (using CPU) %% Input: % @psf: the phase space PSF % @Xguess: the projection obtained from "forward project" %% Output: % projection: estimate volume % % [1] JIAMIN WU, ZHI LU and DONG JIANG etc, % Iter...
8bb6a1cee129721bed27377624cd4ef52751e69b62a625a3f3d2a51e485b0834
MATLAB
1,009
49
function co = remove_big_correlation(c1,seuil) if ~exist('seuil') seuil=-0.5; end if iscell(c1) for k=1:length(c1) co{k} = remove_big_correlation(c1{k},seuil) end return end co=c1; for npool = 1:length(c1) cormat = c1(npool).cormat; met = c1(npool).met; for nbsuj=1:leng...
a4c9cc981d282851d52f72f562f182612c24e9c8cd864868a268703e3d6e8088
MATLAB
1,009
30
function movie = prepareBatch(p,movPath,regPath,extractionFlag) % extractionFlag should be 1 when using this function for singal extraction % extractionFlag should be 0 when using this function for annotation or % applying filter to full movies % load movie if p.PCAICA.approximateExtraction.flag &&...
0367bbfb9ac7a8edb195618df47b3e5dc16a925448a663dda94fbbcf73cc37a6
MATLAB
1,010
25
function [spikeSites2, spikeSites3] = findSecondaryPeaks(obj, spikeWindows, spikeSites) %FINDSECONDARYPEAKS Find secondary peaks % spikeWindows: nSamples x nSites x nSpikes evtNeighbors = 2:obj.hCfg.nSitesEvt; % sites within merge radius, excluding ref sites siteNeighbors2 = obj.hCfg.siteNeighbors(evt...
483f28ea3a2b48526df410b38d4dd93a631984f973084d8e29c33a09315951ea
MATLAB
1,011
28
function [multiBounds, multiRange, multiEdges] = sampleSkip(windowBounds, nSamplesTotal, nTimeTraces) if nTimeTraces == 1 || isempty(nTimeTraces) multiBounds = {windowBounds}; multiRange = windowBounds(1):windowBounds(end); multiEdges = []; return; end nSkip = floor(nSamples...
aa17fede29bdc4a44116895c3b184e787eed879c899878a6e40da106d60f535d
MATLAB
1,011
25
function success = revert(obj, revertTo) %REVERT Summary of this function goes here success = revert@jrclust.interfaces.Clustering(obj, revertTo); if success obj.templatesByCluster = arrayfun(@(iC) unique(obj.spikeTemplates(obj.spikesByCluster{iC})), ... 1:obj.nClu...
b309e94106bb69f04cc855f37607c074cb5f4db8de9bfc4fa7f65031ac930593
MATLAB
1,011
39
function updateLog(obj, logTag, message, start, finish) %UPDATELOG Save and optionally output a message if nargin < 4 start = 0; end if nargin < 5 finish = 0; end if obj.hasLog(logTag) logEntry = obj.logEntries(logTag); logEntry.lastUpdate = now(); else ...
d3e30688709be7944e5b3c5757a82ef03628cc25bdaf410145dfdf8ab8b3d7dc
MATLAB
1,012
27
function plotFullSweeps(data,incldVel) if isfield(data,'final') mouseName = data.mouse; expDate = data.date; nSweeps = size(data.final,2); left_color = [0 0.7 0]; right_color = [0 0 0]; for n = 1:nSweeps allFPnames = data.final(n).FPnames; nFP = data.final(n).nFPchan; ...
4122b451f4199fd142e2121196b11fa0e2823148a392c6c720dd1ba30ad0aa7a
MATLAB
1,013
16
function Negative_Positive20200302 global RtouchSpikeOffUnit LtNegativeSpikeOffKaisuu RtNegativeSpikeOffKaisuu RtPositiveSpikeOffKaisuu LtPositiveSpikeOffKaisuu... RtouchSpikeOnUnit LtouchSpikeOnUnit LtouchSpikeOffUnit LtNegativeSpikeOffKaisuu RtNegativeSpikeOffKaisuu ... RtPositiveSpikeOffKaisuu LtPosit...
6b92e5db7eeebdc42f9d022840f0519fde557222f010e44249415222b9edf9dc
MATLAB
1,013
26
function Save_Longitudinal_Axis_Demos Dir1 = uigetdir; % Let the user choose a directory. Files_List = List_All_Files(Dir1,'mat'); % SaveDir = 'D:\Omer\Dropbox (Technion)\Neuronalizer\PVD Images\Sharon\DEG_for_Menorah_analyser_Filtered_Format_Names\Results_Demos\Longitudinal_Axis'; SaveDir = 'D:\Omer\Dropbox (T...
98869b8b045e884ebc99f73c920a7b7d654709a9b43c0cb2354d252fe83f44a0
MATLAB
1,013
33
function data = XxReadTiffLargerThan4GB(TiffPath, DataType) pic_info = imfinfo(TiffPath,'tif'); pic_info = pic_info(1); img_desc = pic_info.ImageDescription; img_amount = txt_find_value(img_desc,{'images=','\n'},1); slcies_amount = txt_find_value(img_desc,{'slices=','\n'},1); frames_amount = txt_find_value(img_desc...
80e5843015ccec56134eb86554bc7f79189669dd8690a3e51af77b33a0e27de1
MATLAB
1,014
30
function [spikes1] = int_spikes(spikes,par) %Interpolates with cubic splines to improve alignment. w_pre = par.w_pre; w_post = par.w_post; ls = w_pre + w_post; detect = par.detection; int_factor = par.int_factor; nspk = size(spikes,1); extra = (size(spikes,2)-ls)/2; s = 1:size(spikes,2); ints = 1/int_factor:1/int_fac...
391bf45ddc093c119e93b48ccd66537226f7273ba31bd01cda8f3b2fb0b84889
MATLAB
1,015
26
%% Example 2: Extract single-trial neural trajectories from Raw Spike Trains using DimReduce % Perform dimensionality reduction with DimReduce on raw spike trains % and automatically visualize the extracted single-trial neural % trajectories in DataHigh. The data has 56 trials for two reach % directions. Data i...
d5c49cbbea1567e4406a52237fad7d435322439a10b20ebfa568f5e329e56308
MATLAB
1,015
20
function [P] = get_P_from_prediction_ranks(prediction,pidx); % GET_P_FROM_PREDICTION_RANKS Significance levels of interactions according to ranks. % P = GET_P_FROM_PREDICTION_RANKS(PREDICTION,PIDX) for a vector of ranks PIDX and interactions PREDICTION (#interactions-by-3) % with rows [TF_INDEX, NTF_INDEX, PVA...
d9c27bced03ab03e08fd59ce270f66574bbbd3651c4374c48adf8e52ab5d89e8
MATLAB
1,015
24
function V = GompExp_ther(param, time, t_start, DT_invitro, k_e, Ci, Vc, Vi) % param: alpha0, beta, k alpha0 = param(1); % relative growth rate at size V0 = 1 cell beta = param(2); k = param(3); DT_invitro = DT_invitro/24; % conversion in days lambda = log(2)/DT_invitro; time_eg = log((Vc/Vi)*exp((alpha0...
e5ceb41a31979839817744585dd3d6ae54d6a4bbef1dcad5b172051597aeaeb5
MATLAB
1,018
29
function success = commit(obj, spikeClusters, metadata, msg) %COMMIT Commit a modification of clustering to history log success = commit@jrclust.interfaces.Clustering(obj, spikeClusters, metadata, msg); if success && isfield(metadata, 'unitCount') && any(isnan(metadata.unitCount)) flagged = find(is...
f9728777ed6f7b3874f9e8bc31c8486f79e9dcd069b6eccad835b35c221c68ea
MATLAB
1,020
31
% Function to Retrieve Signals From Selected Frames of the Experiment % Input % Onsets: Cell of Sample Onsets per Condition % R_Condition: Selected Raster per Condition (cell) % X: Original Signals (cell) % XY: Original Set of Coordinates (Matrix) % XY_selected: Selected...
74e97912b4205b258b602ef1517ad847e8afdc9e902936270d3ce24d48e91e72
MATLAB
1,021
33
function [] = visualizeFullTS_mandino(CBVtime_aligned, ROIname, resultpath_madino, color) % This program is intended to visualize full time series from Mandino et % al., 2022 % % % % by Hiro Taiyo Hamada, Araya Inc. color = [0.3, 0, 0.3]; nROI = length(ROIname); % calculate the pvalues for iroi = 1:nROI, % ...
c8fe9a6315cc52ff1202cf8dcf9f1b6615ea0ccc85b7ae2568074321e4e90db4
MATLAB
1,021
41
function [x_sg1]= savgol(x1,width,order,deriv) % Savitsky-Golay smoothing and differentiation % % [x_sg1]= savgol(x,width,order,deriv) % % input: % x (samples x variables) data to preprocess % width (1 x 1) number of points (optional, default=15) % order (1 x 1) polynomial order (optional, default=2...
1f6e4f2edf57814449dd11f1adb990557270c13e8d610098ffa58eb1aceea3bc
MATLAB
1,022
35
function [BkgVx]=mnl_SubSampleBkgFromMask(nBkg,dim,AllVx) %Function to extract a set number(nBkg) of values that are not in the mask %Inputs %nBkg - The number of background voxels that you want %dim - The dimensions of the image %marked as 0 %AllVx - The list of voxels that are 1 in the BW %Outputs % BkgVx - The [x,y,...
b25523d28c461f49dc44cf61d8a9905cb4854e516f2a44664ee0b20c0b07b664
MATLAB
1,022
32
%Shinjini Kundu (c) 2014 %Computes Cohen's Kappa for contingency tables function [ kappas] = CohensKappa(cms) %The function computes Cohen's Kappa, a measure of interrater agreement %(classifier and gold standard). Because accuracy does not take into account %the fact that correct classification could be a result of ...
fb4aaeef99a81adbcc3366ed4d317e24c4f3ef1818d4a1cb5f5a72a84dff85c1
MATLAB
1,023
26
%% change cells with eria [file, path] = uigetfile('*.csv');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) mkdir('arias') datafile = fullfile(path, file); %save path T = readtable(datafile); cluster_num = length(unique(T.cluster)); [positions, ~ ,idx] =...