sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
838bb037dd74d43049b5379abb499de6552982e64368b6c974a3e65f297acd1b
MATLAB
868
25
%% Function to load video of fluorescence .avi % Input % FileName: Name of the video % PathName: Directory of the video % Output % mov: Video, Structure with pixel's fluorescence (grayscale) function [mov]=Video_Load(FileName,PathName) %% Read Movie disp('****Loading video***') % [FileName,PathName] = uigetfile('...
d12d8b91963868a8870f5a4dd343ab0262520a6923eaa9d8fc3574e2e5a81bdc
MATLAB
869
30
function [S, Q, lAlambda] = multislice_static_unsigned(A,gplus) % INPUTS % A is the (weighted) connectivity matrix % it is assumsed that all values of the connectivity matrix are positive % Gplus is the resolution parameter. If unsure, use default value of 1. % OUTPUTS % S is the partition (or community assignment of...
03cb07b3d918bf908084165b5ebdd66fe533cba11feda930b730a75ffc490f70
MATLAB
870
33
function [Ps,time,frequency]=Spectrogram_(s,fs,window_size,shift_size,w) dft_size=window_size; length_s=length(s); nframe=floor(((length_s-window_size)/shift_size)+1); % ‘SƒtƒŒ[ƒ€”:shift”‚ÆDFT‚·‚éwindow_size‚ÅŒˆ‚Ü‚é x=zeros(1,window_size); % w=HanningWindow_(window_size); % ‘‹ŠÖ” Ps=zeros(dft_size/2+1,n...
72ceebc50082f0b625a3916f951a35c6a413d0edd747d0bb258b4a19e960798e
MATLAB
871
26
% 准备数据(替换为你的数据) X = selected_variables_values; % 特征数据,大小为 m x n,其中 m 是样本数,n 是特征数 y = ycal; % 目标数据,大小为 m x 1 % 拆分数据为训练集和测试集 cv = cvpartition(size(X, 1), 'HoldOut', 0.2); % 80% 训练集,20% 测试集 X_train = X(cv.training, :); y_train = y(cv.training, :); X_test = X(cv.test, :); y_test = y(cv.test, :); % 创建SVM回归模型 mdl = fit...
03c0f70960d2bbf0a845d9134853b58661d96bf4fe57917d6f7bf27bfd1f5d19
MATLAB
873
28
function derived_resp_signals(app) idx = 0; tmp = nan(1,length(app.data)); for i = 1: length(app.data) tmp(i) = app.data(i).tic_multipl; if strcmp (app.data(i).name,'Respiration Rate') idx = i; end end if idx == 0 idx = length(app.data)+1; end max_fs_idx = find(tmp ==1,1); app.data(idx).name...
8dbfe07ba3529355ab28ff2cc7371945ab19f6022c50f05950c7d62d10cc8a95
MATLAB
873
27
function diagonstic = diagnostic_partitions(P) mx = max(max(P)); % max communities per sample bins = 1:mx; % bins. number of points supporting the distribution h = hist(P',bins); % node histogram p = bsxfun(@rdivide,h,sum(h)); % probabilities e = -nan...
909f80f6dc3a81a9959245d4327e25183289ebbc569331bdc9cbcddd3c416b82
MATLAB
873
17
function Fourierfunction4touchCC(n,U,M) %Autocor‚ÍSpikeArrayADrink‚ÍSpikeArrayWon,WaterOn/Off‚Å‚ÍSpikeArray %Touch‚Å‚ÍSpikeArray‚ÆT‚ðŽg—pB global StartTime FinishTime fname SpikeUnits TurnMarkerTime dpath3... SpikeArray RpegTouchallWon LpegTouchallWon CCresultRtouchWon CCresultLtouchWon [CrossCoRtouchWon]...
36c5c60596c55c179d06748927752f11462596694931058358b897c9103454f3
MATLAB
874
23
function flag = isEqual(val1, val2) %ISEQUAL Generalized check for equality if isnumeric(val1) flag = isnumeric(val2) && ... ndims(val1) == ndims(val2) && ... all(size(val1) == size(val2)) && ... all(val1(:) == val2(:)); elseif ischar(val1) flag =...
bf5d94718248e7e353b08389b5bcd8ff41e62fe02a1178423f84b8d592ee6eac
MATLAB
876
31
% Make grid of values for SVM prediction % % Input: % Xpca matrix pf Principal Components % PC_i i-th PC % PC_j j-th PC % delta Resolution % Npts (optional): default=100 % Output % % function [x1Grid,x2Grid]=makepcagrid(Xpca,ONEpca,TWOpca,deltaPlus,varargin) % N pts: if isempty(varargin) N...
c659f0f298e5aad56239a28d9f3ec7fa4749f7e750ffbaaae570b2861d6a125d
MATLAB
876
32
function TBvol=hbf_TM_Bvol_Linear(DB,Tphi_full, ci,co) % HBF_TM_BVOL_LINEAR makes transfer matrix for B_vol % %TBvol=HBF_TM_Bvol_LINEAR(DB,Tfull,ci,co) % DB: DB matrix, [N x 1] cell array % Tphi_full: BEM matrix for potential % ci: Conductivity inside each BEM surface, [N x 1] % co: Conductivity outside each B...
240bdb1a5f485508e248b53919c9befe3f3f5cb402e9e1cf7d60ec07f257c291
MATLAB
878
33
function [ loading_similarity ] = compute_load_sim( fa_model ) % % computes the loading similarity of each dimension % % Input: % fa_model - (struct), factor analysis model parameters % % Output: % loading_similarity - (list), loading similarities of each dimension's % loading vector % % @ Ak...
aa32c6ee98c0bb9788c8c9502c4456231361c485e756183d51c199d26e3676e3
MATLAB
878
42
function [node,link,cell] = OCY_cell_nodes(node,link,cells) w=size(cells,1); l=size(cells,2); h=size(cells,3); cells=uint16(cells); % get list of cell coordinates cc=bwconncomp(cells); n_cells = cc.NumObjects; cell = []; % generate cell structure if(n_cells>0) for i=1:n_cells cells(cc.Pixe...
688a1e3a3f1e1b0bc870c838fefbb741b70e3e12f17814ac84d779fa1ca6bff1
MATLAB
879
33
function X = dtft1(x, omega, n_shift) %function X = dtft1(x, omega, n_shift) % Compute DTFT of 1D signal x at frequency locations wx % In % x [N,ncol] signal values % omega [M,1] frequency locations % n_shift [1,1] use [0:(N-1)]-n_shift indices % Out % X [M,ncol] DTFT values % % This needs enough memory to store...
653cbee3a494144864f3fe1c8675bc15a818116fc6a277dd32d7562673f4fc36
MATLAB
880
23
% Functions that check repeated pair of coordinates % Ouput % repetidas: indexes of repeated coordinates % Input % Matrix of Coordinates [X,Y] function IndxRepeated=repxychekcker(XY_selected) IndxRepeated=[]; [~,IndexSortedUN]=unique(XY_selected,'rows','stable'); if numel(IndexSortedUN)<size(XY_selected,1) fpri...
c2c77112031ffd27b089a9e67e559613513c7d5e05de1265d44b66495baeb2d8
MATLAB
880
32
function [subtimeseries] = extROITS(targetpath, StimType, GroupType) % This program is intended to extract ROI time series from .mat % % input: % targetpath: % StimType: % GroupType: % % output: % subtimeseries: % % By Hiroaki Hamada, Araya, 2019/08/29th, temporalSub = load(targetpath); if strcmp(GroupType, ...
624f87e7109ad6af712102a310961a63c8d26bb2f0935973b608a5f5e8e052d9
MATLAB
881
21
% plotDistToNearestTip.m: % lines 213 - 214 % my changes - return the whole table data to the calling function borders = borders_table; % Display_Probe_Track.m % lines 231 - 238 % my changes - save relevant data to csv files mm_reference_probe_length_tip = reference_probe_length_tip/100; mm_probe_length = pro...
1280df1d6e250c1bb7b3d9db1fd6265c40edd23bff2c087290840ab9e9076cb3
MATLAB
882
22
function spike_res_out = sel_spikes(spike_res_in, ts, burst_ints) %SEL_SPIKES Summary of this function goes here % Detailed explanation goes here spike_res_in.use_spikes = []; ts_msna = ts(1) : ts(1) : ts(2); spike_res_in.use_spikes(1:length(spike_res_in.spike_idx),1) = ones(size(spike_res_in.spike_idx)); for i =1...
385223fc6f02c79a8e68c690dac8da1f2ae673ceb6da8903fa055e14e492db95
MATLAB
882
33
function miout=MIhigherdim(x,kneig,emb_dim,emb_tau); % Calculate MI value of any high-dimensional vector - to include also % dependencies in time use embedding dimension >1 (see[1], Fig 14) % (rectangular version) % x....input data mxn m...channelnummer n...sampling points m<<n % kneig... k nearest neigbor for MI ...
a1ea3cd1665405721a73df6b33bc58d2b989f0cb948967537af2e63c2f3ff71e
MATLAB
882
28
% Funtion to get oval pixels in retangular ROIs % Input % sROI: Cell of ROIs from ImageJ % Output % XYcenter: Coordinates of ROI center % ROIpixel: pixels Coordinates in Elliptical ROI function [XYcenter,ROIpixel]=getpixelsatROI(sROI) N= numel(sROI); XYcenter=[]; for n=1:N % Get Rectangular Coordinates xy...
d0d893e098e14fe1681b170588167d35fbb5c129c3d3ef9f243f3c07e4dcd60f
MATLAB
882
33
clear; close all; %////////////////////////////////////////////////////////////////////////// % generate input data file x = cumsum(randn(10000,1)); x = x + sin(2*pi*(1:length(x))'*60/1000); hin = fopen('testinput.txt','w'); fprintf(hin,'%14.10f\n',x); fclose(hin); %//////////////////////////////////////...
1ac8ad8cfe5c16699008195bd619716f9b8a8c7db413b9e2cddc743ab1f8390c
MATLAB
883
27
function data=createdatamatc(data,E,Fs,win) % Helper function to create an event triggered matrix from univariate % continuous data % Usage: data=createdatamatc(data,E,Fs,win) % Inputs: % data (input time series as a column vector) - required % E (events to use as triggers) - required % Fs (sampling frequen...
44933050c6e0b499680c4df4f484c35c30d8e500b176815c760f4cd8bad26504
MATLAB
883
35
function EyeClosed = detect_eyeclosure(Eye, SampleRate, Threshold) % Classifies eyes as open or closed, and if stretch longer than 1s, as a % microsleep. % in Lapse-Causes Nans = isnan(Eye); % eye event can't be shorter than 50 ms MinEO = .05; % Convert pupils into 1s for opne and 0s for closed. EyeOpen = Eye > Thres...
5962c9869faa8be2b77f867c900d74647808a350351688ab358555555a2014e9
MATLAB
883
30
% test bids processing pipeline on the ds000117 dataset %% update path % in case spmup was not added to the path location = fullfile(pwd, '..'); addpath(fullfile(location, 'adaptative_threshold'), ... fullfile(location, 'bids'), ... fullfile(location, 'external'), ... fullfile(location, 'hrf')...
d50386a9e202f72dc9151cf8b760e6843daa49512e6915a3be5c2d294c452639
MATLAB
883
27
% Copyright 2024 Eelke Spaak, Donders Institute. % See https://github.com/Spaak/rift-phase-and-visibility for readme/license. % Belongs with: % Spaak, E., Bouwkamp, F. G., & de Lange, F. P. (2024). Perceptual foundation and extension % to phase tagging for rapid invisible frequency tagging (RIFT). Imaging Neuroscience,...
b5e9658b5f5dcc1c6dfb2d07e06b8e497b99952f063d5e0f638202b4fb12cd3f
MATLAB
884
33
function plot_junction(ax,x,y,angles) % angles = [pi/4,pi/2,pi]; angles = sort(angles); Alpha = 0.5; CM2 = [0.8,0,0 ; 0,0.8,0 ; 0,0,0.8]; t0 = linspace(0,2*pi,100); % Angle range 1. t1 = linspace(angles(1),angles(2),100); % Angle range 1. t2 = linspace(angles(2),angles(3),100); % Angle range 2. t3 = [li...
6a4e705789e0b06e5a8a979c61be3463c0d53bdf01017f32cd0a7c3d5432e0ef
MATLAB
885
30
function [map,nodes] = trimmap(map,nodes) %% Remove disconnected nodes from the network % This function removes all-zero rows and columns from the adjacency % matrix. This effectively removes disconnected nodes from the network % % [map,nodes] = trimmap(map,[nodes]) % % Input: % map: projections matrix % nod...
86b7fb34fa68dc7df079a2756bcb4a023fa830509ef5af48b0e5c3602ccd5995
MATLAB
885
33
function plotsingle_tf(hdl,~) D=get(hdl,'UserDat'); time = D{1,1}; timeindx = D{1,2}; freq = D{1,3}; powdata = D{1,4}; powlims = D{1,5}; currchan = D{1,6}; blstring = D{1,7}; cone_oi = D{1,8}; f1=figure; set(f1,'PaperUnits','normalized','PaperPosition',[0.0235308 0.0272775 ...
da82550aa709e0a463959dadcd50ac92cd64826a935e1fe816f38cd481fe595b
MATLAB
885
35
function file_writer = createFile(file_path,varargin) % % file_writer = adi.createFile(file_path) % % This is a work in progress % in.copy_blank_when_new = false; in = adi.sl.in.processVarargin(in,varargin); is_new = ~exist(file_path,'file'); %Possibilities %1) create new file de novo %2) create new file using a...
23fa5313bd66a01dced2439bc99a7553d52887b3cf229474b48c15707e82f834
MATLAB
886
33
function new_file_path = changeFileExtension(file_path,new_extension) % % new_file_path = sl.dir.changeFileExtension(file_path,new_extension) % % This is a simple helper function that makes it obvious what is being % done (i.e. changing the file extension). % % Inputs: % ------- % file_path: str % Pat...
9d8fd36888509c77178e560d27c1b86b27f41610e5da3b5c26948eee39b80fe6
MATLAB
886
32
function Generate_Result_Demo(Workspace) Scale_Factor = 50/140; CB_GS2BW_Threshold = .9; figure(1); clf(1); imshow(Workspace.Image0); set(gca,'YDir','normal'); hold on; for s=1:numel(Workspace.Segments) for r=1:numel(Workspace.Segments(s).Rectangles) plot([Workspace.Segments(s).Rectangles.X],[Workspa...
f02547fd6e34d50c6dc06e54e99ca23ac0c4dcd360143bf9ba30fcbb932672a6
MATLAB
886
28
function bootstrap_se = se_of_median(sample_dist,bno) %SE_OF_MEDIAN Standard error of median. % BOOTSTRAP_SE = SE_OF_MEDIAN(SAMPLE_DIST) calculates bootstrap standard % error of median (BOOTSTRAP_SE) from a bootstrap sample of 1000 % resamplings from the empirical sample (SAMPLE_DIST). % % BOOTSTRAP_SE ...
121b0cc070e74f4d515c53f14a7acd9f9fdb1f17eda486b0dad6a7cf1d693192
MATLAB
888
36
function pv_acg(cellids,resdir,issave) %PV_ACG Auto-correlation analysis. % PV_ACG calculates auto-correlations for PV(+) neurons in 500 ms windows. % ACG results are saved. % % See also ACG. % Balazs Hangya, Panna Hegedus % Institute of Experimental Medicine, Hungarian Academy of Sciences % hangya.balaz...
c28f47da83417d6acf2534cb7d3643434071e619fa3a683b0eb16820502302e6
MATLAB
889
25
function t = tvalue(data1,data2,dim,vartype) if nargin < 3 dim = 1; end if nargin < 4 vartype = 'e'; end if isempty(data2) t = mean(data1,dim) ./ std(data1,0,dim) * sqrt(size(data1,dim)); else switch vartype case 'e' v = (var(data1,0,dim) * (size(data1,dim)-1) + var(data2,0,dim)...
c72edd64b30b6f916fe752655e7a7594517960bd86da3803ec6ab0030d1fe034
MATLAB
890
25
function Trace_Neuron_New(Im,Segments) % TODO: % In Segment_Skeleton.m, prepare skeleton coordinates in the same format as the final segments. % Their coordinates and width will only be tweaked by this algorithm. for s=1:numel(Segments) for r=1:numel(Segments(s).Rectangles) P = Segments(s).Rectangle...
eeee8806593a619f9add6815b0f852e530b0c817de71229e54225b207dcf1d00
MATLAB
890
18
function [gsidx] = truncate_predictions(gsidx); % TRUNCATE_PREDICTIONS Truncate gene interactions to at most 100000 interactions. % GSIDX = TRUNCATE_PREDICTIONS(GSIDX) for gene interactions GSIDX returns % % GSIDX predictions of interactions (#interactions-by-3) with rows % ...
1d8485aeca5fbece63ef4f8d23cb7edd12c2eff54fe101649aca4761648fd050
MATLAB
891
28
function [Power, Freqs] = discrete_time_frequency(Data, SampleRate, EpochLength, WindowLength, Overlap) % Calculates a time-frequency plot for data, but nothing fancy, just % non-overlapping windows. % Data is ch x t. Power is a ch x Freq x t matrix or Freq x t if only 1 % channel provided. nChans = size(Data, 1); Tim...
33352028ae00abc629bf430bef011639050480de9e46ed78540e667404f6a6ca
MATLAB
896
27
function W3distribution global RTroughlocsInterval LTroughlocsInterval LlocsInterval RlocsInterval W3distance LtWindowintervaL RtWindowintervaL %%%%¶‘«W3iâ‘Î’l‚ªÅ‚à¬‚³‚¢j‚ÌŒŸo [InterbalLtouch IndexLtouch]=sort(abs(LlocsInterval),'ascend'); LtouchW3=LlocsInterval(IndexLtouch(1:5)); %%%%%%%W3‚̃XƒpƒCƒN...
e61ea108e5d48094328e9a9159b463ad949441eadbdf0f0b57b8bec874ec7d5c
MATLAB
896
23
function sel_beats(app) %SEL_BEATS Summary of this function goes here % Detailed explanation goes here if ~isempty(app.burst_ints) && ~isempty(app.hb_res) app.hb_res.use_beats = []; ts_beats = app.hb_res.ts(1) : app.hb_res.ts(2) : app.hb_res.ts(3); app.hb_res.use_beats = true(size(app.hb_res.idx)); ...
e9e1b34da99289a6c0fa31141d326fefa20fbd7fd1c4ed9ff92a3d52663b1ab7
MATLAB
896
45
function [gl_node gl distance binary]=global_efficiency_wd(w) %calculate global efficiency %INPUT: w =inverse FCG (functional connectivity graph) %OUTPUT:gl_node = global efficiency per node % gl = total global efficiency of the network % distance = matrix which preserve the weighted shortest path length ...
e0f0355781ea3e1ec973df3a7e6af2073296cc2d9ebdda12a7bab44d4b4b0342
MATLAB
897
44
%function to generate a block diagonal matrix of size p function [Sigma] = Generateblkdiag(ncliques,cliquesize,theta) p = ncliques * cliquesize; sizes = repelem(cliquesize, ncliques); Sigma = zeros(p); lims = [0, cumsum(sizes)]; for i = 1:ncliques ii = (lims(i) + 1):lims(i + 1); signs = 2 * (normrn...
2c80ddfa3353cd86098595b8821f2ead8c10434769a486dcde7612dd1341d3a2
MATLAB
898
25
function inconsistencies = inconsistentFields(obj) %INCONSISTENTFIELDS Check all fields have the correct sizes inconsistencies = {}; vectorFields = obj.unitFields.vectorFields; hFun = @(vals) numel(vals) == obj.nClusters; for i = 1:numel(vectorFields) fn = vectorFields{i}; if ~isemp...
e9c6ffd84d0fb12eac07b084903f3326712b4a04839239528f2da6850f0e4d93
MATLAB
898
25
function [FDR, h, crit_p] = fdr_matrix(pValues, StatsParameters) % applies FDR correction to a N x N matrix of pvalues, by turning them % first into a vector, then back into the original matrix. Dim1 = size(pValues, 1); % turn matrix into vector Indexes = 1:numel(pValues); % a number for every p value Indexes = resha...
ffa3519ae3b7f6e2d3930cde79f9aa0033fc8103c3192d2bd004dd2b4b7b6e7f
MATLAB
898
32
function ica_A = compute_ica_weights(data, num_ICs, term_tol, max_iter) % Reference: Hyvarinen (1999), FastICA (look it up!) num_sources = size(data,1); num_samples = size(data,2); ica_A = orth(randn(num_sources, num_ICs)); % Random seed BOld = zeros(size(ica_A)); min_abs_cos = 0; iter = ...
3a1a11c705115e27bb081aa74dd18ecf62ad9e5f18c10f3ec0e54a7898a7d9ba
MATLAB
899
18
function exportMeanWf(obj, exportAll) %EXPORTMEANWF Export mean waveforms to workspace if exportAll jrclust.utils.exportToWorkspace(struct('meanWfGlobal', obj.hClust.meanWfGlobal), obj.hCfg.verbose); elseif ~isempty(obj.selected) mwf = obj.hClust.meanWfGlobal; primarySites = obj.hCf...
6cda5539edbea8adb7e08c0850d6cd1e5084388a17ee6bc3803af58b5a16dcd8
MATLAB
899
30
function Update_All_MAT_Files_In_Dir() Dir1 = uigetdir; % Let the user choose a directory. Files_List = List_All_Files(Dir1,'mat'); % List all .mat files under this directory (including subdirectories). N = length(Files_List); Multiple_NN_WaitBar = waitbar(0,'Please Wait'); for f=1:numel(Files_List) % For ...
bce8d4c56f6de5d1285ee62e1a2e14459096f3f588ce72d9ff64fdf865f59564
MATLAB
899
48
function miout=MIxnyn(x,y,kneig) % Calculate MI value between 2 vector of any dimension (rectangular % version) % x....input data mxn m...channelnummer n...sampling points m<<n % kneig... k nearest neigbor for MI algorithm %default-values if ~exist('kneig'), kneig=6; end % check input data if format is correct...
9079b03c9a0f210d8dac58bf158626c5882791a01b186281108984bc1c91e2eb
MATLAB
900
25
function hFigWav = setFigWavXTicks(hFigWav, hClust, displayCount) %SETFIGWAVXTICKS Set X axis ticks for main view if ~isfield(hFigWav.figData, 'showSubset') hFigWav.figData.showSubset = 1:hClust.nClusters; end showSubset = hFigWav.figData.showSubset; if displayCount xTickLabels = a...
ced44d7a1fe9bd496b304ca6a65d87e9eb1683356d099f06c9e8bd6af178944b
MATLAB
901
22
% plotting one person scalpmap at a given timepoint (CompLat) clear all; load('D:\BORI\bedrest\RENDEZETT\A) Bedrest_EEG\EEGÖsszes\5.P3a_P3b_abrak\Grandavg_VisualPersons_P3aSkalphoz.mat'); EEG = pop_loadset('D:\BORI\bedrest\RENDEZETT\A) Bedrest_EEG\EEGÖsszes\5.P3a_P3b_abrak\scalptemplate.set'); %az EEG.times-ot ...
46f44ff9974aa091ebf7cc2081e89403149cf0e14f1414954402e9e1f121d580
MATLAB
902
37
function [ spd_dims ] = get_speed_dims_task_balance(p,trans_data_all,q) %% pool trials per task task_sessions{1} = 3:4; task_sessions{2} = 5:9; t_avs = {}; t_pool = {}; for t = 1:2 t_pools = {}; for sub = 1:p.nSubjects t_pools{sub} = []; for ses...
c3935a348857d963376d192dcb31687c6927cb987fe79e2956deff07ab2edf59
MATLAB
902
20
function EEGNarrowbands = filter_eeg_narrowbands(EEGBroadband, NarrowbandRanges) % filters EEG data into the specified narrow bands (a structure, each field % indicating a lower and upper bound like so: NarrowbandRanges.Alpha = [8 12]; SampleRate = EEGBroadband.srate; BandLabels = fieldnames(NarrowbandRanges); % cre...
f067df9da0a4ed2bf996bbef57a8fd79759f690b97c60dd12d971bfb9f19a63f
MATLAB
902
26
function [binIdx,binEdges]=BINfrequency(input_vect,nBins) %Limitation: it may in separate in different bins repeated numbers. Shouldnt be much problem with real numbers were the p %of 2 numbers being equal is small. Q=fix(numel(input_vect)/nBins); R=rem(numel(input_vect),nBins); binCounts=[Q*ones(1,R)+1 Q*ones(1,nBins...
9ef94d7601f354094ef7b40fc5bef43e6a8dd594847063f098da82a05a80d019
MATLAB
903
33
function newmeshes=hbf_SortNestedMeshes(meshes) %HBF_SORTNESTEDMESHES sorts nested triangle meshes ("small to large") % % meshes_out=HBF_SORTNESTEDMESHES(meshes_in) % meshes_in: the meshes to be sorted, cell array of hbf structs % meshes_out: sorted meshes, cell array of hbf structs % % v160229 Matti Stenroos Nm...
c28a8b7f9107d78519651ae455a7352abd87c4b9e288e6aa452bf6989a7486d0
MATLAB
903
34
clear clc close all % generate a random signal SampleRate = 1000; Duration = 10; % seconds t = linspace(0, Duration, Duration*SampleRate); Signal = randn(size(t)); % filter the signal in narrow range (8-12 Hz) FilteredSignal = cycy.utils.lowpass_filter(Signal, SampleRate, 12); FilteredSignal = cycy.utils.highpass_fil...
0eca329b8f6642c4ce5cd95aa7d64d1f1a7d930909988b98e4e6cb7c4e711f32
MATLAB
904
30
function [corrVals, pVals] = cal_sliding_corr(x, y, winSize) % for two given vector x, y of the same length N, calculate the sliding-window correlation with length winSize, the sliding step is 1 % Ensure x and y are row vectors for simplicity if iscolumn(x) x = x'; end if iscolumn(y) ...
aabe47252417f6ec33e5644565c0bc9d2bc885c256eb4529659549d36514d046
MATLAB
904
30
% Matlab script that uses the TikhonovRegularization.m; % It reads a .csv file produced by testTikhonovRegularization.ipynb that % contains a noisy ecg and it's corresponding reconstruction obtained by % the python function TikhonovRegularization.m . It calls the % function TikhonovRegularization.m and adds as the thi...
deefcf9f00646468aa0b844e82b77786206e515e2bdc03659a8af979b15efd98
MATLAB
904
35
function c = get_water_raw(c,lcdir) for npool = 1:length(c) pool_dir = fullfile(lcdir,c(npool).pool); for nsuj=1:length(c(npool).suj) fh2o=get_subdir_regex_files(pool_dir, [c(npool).suj{nsuj}(11:end),'.*H2O$']); if isempty(fh2o) keyboard end f=read_raw(char(fh2o)); ...
3ee0fd34f1f0cd8c0565e6bd0586f3c3d2b4139a0faf97d7133828caccd8f7b7
MATLAB
905
34
function [im_corrected, st, newData] = apply_2DMotionCorrection(kdata_in,mpars,cgIters,oversampFactor) if nargin < 4 oversampFactor = 2; end if nargin < 3 cgIters = 1; end [Nx,Ny] = size(kdata_in); Npars = size(mpars,2); alignMats = zeros(4,4,Npars); this_mpars = mpars; for iT = 1:Npars alignMats(1:3,1:...
4463ca91193872175eb24664163998dade467e4891e18343c1c0e3de292c6654
MATLAB
905
24
function saveprediction20190730 %—\‘ª’l‚ÆŽÀ‘ª’l‚ð”äŠr‚µ‚ăs[ƒN‚Ì‚¸‚ê‚Æ•ü‚ÌJSD‚Ì’l‚Ì•½‹Ï‚ð”z—ñi‰¼à6ŒÂ•ªj‚É‚µ‚ÄpredictƒtƒHƒ‹ƒ_‚ɕۑ¶ global meanXaxiserror1 Envedist1 meanXaxiserror2 Envedist2 meanXaxiserror3 Envedist3 meanXaxiserror4 Envedist4 meanXaxiserror5 Envedist5 tfile... meanXaxiserror6 Envedist6 FL...
8c30123bed887724b78d0c955daf2cabd6bffa4d697ae1ded4bc6742677c1f55
MATLAB
906
25
function Save_Multiple_Demos Dir1 = uigetdir; % Let the user choose a directory. Files_List = List_All_Files(Dir1,'mat'); SaveDir = 'D:\Dropbox (Technion Dropbox)\Omer Yuval\Neuronalizer\PVD Images\Sharon\DEG_for_Menorah_analyser_Filtered_Format_Names\Results_Demos\0.65'; % SaveDir = uigetdir; for f=1:numel(...
9e3c0b7c151bb1f948c454f984c1f26ee9fb073aa4ff27cc6669046b41a176cd
MATLAB
906
24
function positions = spikePos(obj, spikeSites, spikeFeatures) %SPIKEPOS Compute a feature-weighted position for each spike positions = []; if isempty(spikeSites) || isempty(spikeFeatures) return; end nSitesEvt = 1 + obj.hCfg.nSiteDir*2 - obj.hCfg.nSitesExcl; featuresSquared = squeeze(s...
07b27b2ebf9220f9f292624e3974d50bb76488fc3bc45606aa24a27e05860d99
MATLAB
907
27
function [datMemMap,datSize] = getDatMemMap(datFF,nChan) %datMemMap - Create a memory map to dat files % % Usage: % datMemMap = getDatMemMap(datFF,nChan); % % Description: This function uses the full path to the dat file including % the number of channels and creates a memory map to it. This allows ...
884076bfc15b76b5d11b948f9cfe3ca16e6ca1e3e91624a87d3dd94f183e117f
MATLAB
907
23
function SemSegPic_ThinSection = MainFunc_ThinSections(A,B) load E:\SemanticSegmentation_Scale\CPL\GTruth.mat; load E:\trainedNet_resnet50.mat; cmap = GTruth.LabelDefinitions.LabelColor; % A = imread('E:\SemanticSegmentation_Scale\CPL\Train_896\1_18_4.png'); % B = imread('E:\SemanticSegmentation_Scale\XPL\Train_...
884bdc4397fa0efded27e83ddc89911253413b3293af109da958be16b650e32a
MATLAB
908
46
function ro = mean_raw() dir_sel = spm_select(inf,'dir','select a dirs to get result from','',pwd) % s=get_subdir_regex('PROTO_SPECTRO_DYST/LCmodel/Raw',{'pat','control','suj'}); % dir_sel=get_subdir_regex(s,'basis_MEGA_edit_MM_Gln$'); dir_sel=cellstr(dir_sel); pp.gessfile=2; for nd = 1:length(dir_se...
2b2148f0f6fd4784e745c069318d9579e6d8bdf54d6b3326d344ca5bddc4dee3
MATLAB
909
33
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % [ normLabeledDataSet rMin rMax ] = dataSetNormalize(labeledDataSet, vMin, vMax, M) % % The labeledDataSet must have the form: % % Sensor1 Sensor2 ... SensorN labelIndex1 ... labelIndexM % % Only sensors will be normalized using their min and max (also ...
4927c39cfade75c8a0b83181e718a459ad8f1eea278e271a818e48b4f14860af
MATLAB
909
44
function sp = sparse(ob) %function sp = sparse(ob) % return sparse version of object % this uses less memory than full(ob) if ~isempty(ob.handle_sparse) sp = ob.handle_sparse(ob); return end % extract one column at time, determine number of nonzeros, then combine % todo: use blocks of 10 or 100 at a time instead of...
bb870cd46287c5790c29aba7a76ebd9455a715af3731dc325b08e74c7a343e62
MATLAB
909
33
%% script gets mean PDF of Distance: % between or among different conditions of % rasters: % A vector is fromed where Active Cells makes 1 % Input % R_Condition: Cell of rasters % Distance (from matlab): 'hamming' (default), 'euclidean', 'cosine' % Output % MatDist: Matrix Of Dsitacne among Conditions: % MatDis(1...
1f52e857983fb05dfe002ffd8499cc65ac4e9a2687543b74e41c64ea74f779a0
MATLAB
910
38
% example video tracking setup % % Used here for gap-crossing experiments with an AVT Pike F-032B % using the image aq. toolbox % http://www.mathworks.com/hardware-support/allied-vision-technologies.html % % 2014 Jakob Voigts (jvoigts@mit.edu) imaqreset vid = videoinput('avtmatlabadaptor64_r2009b', 1, 'F7M0_Mono8_64...
3683f519d26b858e386e61c7e33e20756a3dd4fe5f32328fe6788d072229ff7a
MATLAB
910
24
function varargout = spikeCov(spikeWindows, hCfg) %SPIKECOV Compute covariance feature for spikes % spikeWindows: nSamples x nSpikes x nSites vnDelay_fet = hCfg.getOr('vnDelay_fet', [0, 3]); [nSamples, ~, nSites] = size(spikeWindows); [shiftsBack, shiftsForward] = jrclust.utils.shiftRange(nSample...
60927e05bef961b230a66da04383fddb7e15b07880a31980e53702abeeb2e950
MATLAB
910
28
function distribution = rst_vincentize(data,quantile,flag) % compute and return a vincentized distribution sorted_data = sort(data); nbin = floor(length(data) / quantile); index1 = 1; index2 = nbin; for i=1:(quantile-1) distribution{i} = sorted_data(index1:index2); % data per quantile index1 = index2+1; i...
cf2321bcf4ef50022179574b04865d3a43808f66a43956337a93f77784d8d02c
MATLAB
910
25
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) if ~isnan(app.settings.channel_idx.bldp) [data,ts,~, ~] = current_signal(app, app.settings.channel_idx.bldp); data = lowpass(data,3,1/ts(1)); try ...
363aab9cd05962204c08c13939e14154ee046a336e805abcdd726d69e09ca56f
MATLAB
911
39
function [Xorth, Lorth, TT] = orthogonalize(X, L) % % [Xorth, Lorth, TT] = orthogonalize(X, L) % % Orthonormalize the columns of the loading matrix and % apply the corresponding linear transform to the latent variables. % % yDim: data dimensionality % xDim: latent dimensionality % % INPUTS: % % X - latent v...
12a21ca167c351d0dd3301d9a25e279bc42485ce5c6cd01f6c2e5dc4370b970c
MATLAB
913
36
function S = str2struct(strval) %STR2STRUCT Convert a string to a struct % (only numerical expressions supported for now) strval = strval'; strval = strval(:)'; keysVals = textscan(strtrim(strval), '%s%s', 'Delimiter', '=;', 'ReturnOnError', 0); structKeys = keysVals{1}; structVals = ke...
ca820f5c1e00b15f59339c77f76343db86bde14c9b631f7512cbddebbc3d2f1a
MATLAB
914
33
function [Data,Scale,dim,metadata]=mnl_Load4Dimage %Function to load the image, and relevant OME metadata using bfopen % Outputs % Data - The image as a matrix (x*y*c*z) % Scale - the size of a voxel (x*y*z) % dim - the dimensions of the image % metadata - the OME metadata file=bfopen; series1=file{1, 1}; metadata=fil...
288040711507289c8540f779627e4c27fc9d066a6b5b27fb07bbbe2c238744f6
MATLAB
916
34
function [MSClass,MSFit,gfp] = RaguFitMicrostates(gm,MSMaps,Smooth,b,lambda,Start,Stop) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License MSMaps = NormDimL2(MSMaps,2) / sqrt(size(MSMaps,2)); ng = size(gm,1); nc = size(gm,2); ne = size(gm,3); nt = size(gm,4); ...
22bc4251856fa8d8164e2423aa493d81354f504c3e47399039adcf9001a63c14
MATLAB
918
41
function [s,peaks] = PiCA4(dat,ref,t0,w,th,wlen,Itr) N = length(ref); for k = 1:Itr refframe = ref(max(1,t0-w):min(length(ref),t0+w)); error = zeros(size(ref)); for i = 1:N ind = max(1,i-w):min(length(ref),i+w); %error(i) = std(refframe(1:length(ind)) - ref(ind),1); c...
f9dfb683d843f817fde15a6a9cb6b8cd480c53117dd7886cbcaf33e7c7475098
MATLAB
918
35
% create Gamma model % ------------------------------------------ % This file is part of the adaptative_threshold SPM plug-in % Copyright (C) Cyril Pernet and Chris Gorgolewski 2012 classdef Gamma < Distribution properties shape scale mu end properties(Constant) free_paramet...
9c69ea53f442be59ac60def629dfc1db789f550b02fc1a28809f030241188e1a
MATLAB
919
45
classdef file_comparison % % Class: % adi.file_comparison %{ fc = adi.file_comparison(p1,p2); %} properties file_path1 file_path2 f1 f2 n_records1 n_records2 end methods function obj = file_...
7a6139a38248676728caaa51c351858c309de647fe3ae99ddceee93e20f6cf43
MATLAB
924
31
function VIP=vip(X,y,T,W,Q) %+++ Calculate the vip for each variable to the response; %+++ T,W,Q are output from plsnipals.m %+++ T: socres, which can be obtained by pls_nipals.m %+++ W: weight, which can be obtained by pls_nipals.m %+++ Q: Y-loadings %+++ VIP=sqrt(p*q/s); %+++ where, p is a constant, den...
d0c24184ff10b2496ad8ab4682aa35f1f874d9a2e9ee4919db257da6c6934e95
MATLAB
924
31
function cluster_quality_stats(cellids, resdir, str) %CLUSTER_QUALITY_STATS ID and L-ratio statistics. % CLUSTER_QUALITY_STATS(CELLIDS,RESDIR,STR) calculates and saves median % and SE of median of Isolation Distance and L-ratio for CELLIDS. These % parameters are stored in CellBase by LRATIO2. STR string in...
bff68370028995b99af4e497275da75d7678d0b4f80b7549ce18ae3fc1f3714d
MATLAB
925
55
clear clc [fname,chemin]=uigetfile('*.*','MultiSelect','on');%loads file if isequal([fname chemin],[0,0]) return else datname=[chemin fname]; d=importdata(datname,',',1); data=d.data; figure % hold on % k=1; factor=k*data(1,1); % plot(data(:,1)) % for i=2:size(data,2) % % % % k= k+1...
8a04def8cc03c50163df81069ad7f61e372e27c663c4250d893654e3efd85e0d
MATLAB
927
28
function lfp = loadLFP(nChan,chan2pull,acqFs,dsFs) %loadLFP - Load LFPs from In Vivo Ephys Recordings % % Usage: % fp = loadLFP(nChan,chan2pull,acqFs,dsFs) % % Description: This function pulls a single channel recording from an In % Vivo Ephys recording and decimates the trace to allow for LFP analys...
1778b8de70a44a89cde5b88be5ab16d0a7c7f73f6e601d04855f2b1f60baea08
MATLAB
928
34
function wat_ppm = find_watter_peack(fids,spec_info) f_inf=4.6; % lower bound in ppm f_sup=4.8; % upper bound in ppm for nbser = 1:length(fids) fid= fids{nbser}(:,1); info = spec_info{nbser}; spec = info.spectrum; spec_metab=abs(fftshift(fft(fid))); ppm_center = spec.ppm_center; zero_filling = spec...
4e1006145414fb2254a692fe4ecd0422d99eae5a6d0c3118686e02ddfb4dfb01
MATLAB
928
27
% Copyright 2024 Eelke Spaak, Donders Institute. % See https://github.com/Spaak/rift-phase-and-visibility for readme/license. % Belongs with: % Spaak, E., Bouwkamp, F. G., & de Lange, F. P. (2024). Perceptual foundation and extension % to phase tagging for rapid invisible frequency tagging (RIFT). Imaging Neuroscie...
567ee5759b4bc0343a133932be21829a342ad3041ef5c4ead77ac093608cbf6a
MATLAB
928
28
% 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_ensembles(RASTER_NAMES,RASTER_FEATURES,Nen...
f0f31fba279e4b0a6f86348046aac1654171a08f80169fdb6706c4d16a4f2076
MATLAB
928
24
function auto_etco2(app) %AUTO_ETCO2 Summary of this function goes here % Detailed explanation goes here if ~isnan(app.settings.channel_idx.co2) if isempty(find(contains(vertcat(app.data.name),'etCO2'))) [data,ts,~, ~] = current_signal(app, app.settings.channel_idx.co2); t= ts(1):ts(1):ts(2); ...
99732349c810c3450889f0afe96657edc843aec540dcc4ff0888660ad6325cb1
MATLAB
929
45
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % [ trainingSet, testSet ] = dataSetSplit(labeledDataSet, percTest) % % The labeledDataSet must have the form: % % Sensor1 Sensor2 ... SensorN labelIndex % % for each class, the last percTest is used as testSet % function [ trainingSet, testSet ] = dataS...
3a56a3f06313b76698bdbffed19f0984ae56b1418a2eb58eb054a2f6f493be98
MATLAB
930
38
function [KSmax] = test_ks(x) % % Calculates the CDF (expcdf) %[y_expcdf,x_expcdf]=cdfcalc(x); yCDF = []; xCDF = []; x = x(~isnan(x)); n = length(x); x = sort(x(:)); % Get cumulative sums yCDF = (1:n)' / n; % Remove duplicates; only need final one with total count notdup = ([diff(x(:)); 1] > 0); x_expcdf = x(notdup);...
55497de09ccaa0eaa9c4a587762bc8e8fa3081a3bd8316a4ce0f4abb3e6f0a86
MATLAB
931
33
function [] = visualizeContrastMadinoHamada(val1, val2, texts, color) % preparation for the count = 1; clear COPE nROI = length(val1); % blue stim control COPE.first(count:nROI, 1) = val1; COPE.second(count:nROI, 1) = val2; COPE.labels(count:nROI, 1) = {'Anesthesia (Mandino2022vsSession3)'}; COPE.color(count:nROI...
ade802680b6b704d1b7c6726e29ec379f2d74a380fc5fed91ebc53bcedc0bb47
MATLAB
931
42
function plotMpars(Amats,t,iRef) % Plot the effect of a series of affine matrices on 3 points located at % (x/y/z) = 50mm nT = size(Amats,3); if nargin < 2 t = 1:nT; end if nargin < 3 % iRef = round(nT/2); iRef = 1; end pts = [1 0 0; 0 1 0; 0 0 1]*50; pts(:,4) = 1; Vpts = zeros(nT,3,3); for iT = 1:nT ...
154ce2b63d5549db13f25e3070b43252de349d2f185fd0126c40b83773ed8a33
MATLAB
932
24
function data = XxReadTiffSmallerThan4GB(TiffPath,start_frame,end_frame,interval) pic_info = imfinfo(TiffPath); [frame_CCD,~] = size(pic_info); if nargin < 4, interval = 1; end if nargin < 3, end_frame = frame_CCD; end if nargin < 2, start_frame = 1; end row_CCD = pic_info.Height; colum_CCD = pic_info.Width; temp=pic...
0bc9e1351c05cee9ae0ac035d02e41bd9ca2329189dadf9f478d2d0e0458e11c
MATLAB
933
20
function abstr = about() %ABOUT Get an about string md = jrclust.utils.info(); abstr = strjoin({sprintf('%s v%s', md.program, jrclust.utils.version()); sprintf('Created by %s', md.authors{1}); 'Maintained by:'; sprintf(' %s', strjoin(md.maint...
03e5e0bc3fc47f1f598501f866d562ac9b0739fbf867bf4984e75deeb83b7aea
MATLAB
934
41
kWorkspaceFolder = 'C:\Users\sergeyd\Workspaces\CIFAR-100\data'; load(fullfile(kWorkspaceFolder, 'train.mat')); kTrainNum = size(data, 1); imagesize = [32 32 3]; TrainX = double(data) / 255; TrainX = reshape(TrainX', [imagesize kTrainNum]); TrainX = permute(TrainX, [2 1 3 4]); classnum = 100; TrainY = zeros(kTrainN...
94d8fe9d33650ced2f96341aba25616d76c7d5de3285b3558e77c486adf6c00f
MATLAB
934
31
function [T0,T1] = find_in_phase_samples(peaks,phase) L = length(peaks); % the signal length rr_intervals = diff(find(peaks)); % the RR-intervals % Avg, Min and Max RR-intervals avg_rr_interval = round(mean(rr_intervals)); min_rr_interval = min(rr_intervals); max_rr_interval = max(rr_intervals); wlen = max_r...
34470bcc7dd3d8da4ab89fe1c5de64fad667d698e252b17249ca4aff0b823ab8
MATLAB
936
30
function tfilecount20191125 path=('C:\Users\C238\Desktop\CheetahWRLV20180729Part1'); cd(path) LS1=ls; tfilecount=0; for i=1:length(LS1(:,1)) trimFolder1=strtrim(LS1(i,:)); if ~strcmp(trimFolder1,'.') && ~strcmp(trimFolder1,'..') && isempty(strfind(trimFolder1,'.mat')) && isempty(strfind(trimFolder...
bb854bca8ebaeef03b38ed0c2e9a3ae2b62be4345eee9aa7cbb77f9acff0970b
MATLAB
937
22
[app.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. datafile = fullfile(path, app.file); %save path file_numes = length(app.datafile); all_files = cell(1, file_numes); for i = 1:file_numes all_files{1, i} ...
33223e356ad6b865f475ccba39c2f82d92b04e74ab4ce55ddc8765811af8e487
MATLAB
940
23
function [ inputFiltered ] = apply_lowpass( p,fr ) %APPLY_LOWPASS Summary of this function goes here % Detailed explanation goes here padSize = size(fr,1); filterSize = [size(fr,1) + 2*padSize , size(fr,2) + 2*padSize]; cutoffFilter = mat2gray(fspecial('gaussian',filterSize,p.filtering.lowpassFreq)); ...
819ea40a96567341460a86b5a6434dd780239615f81e8dc0a8dd415cdd5063d4
MATLAB
940
32
function boxplot_subplot(h, data, regs, labels) %% Boxplot subfigure load('structures', 'regions'); subplot(h); cvg_inf = isinf(data); cvg_zero = data == 0; cvg_nan = isnan(data); include = ~(cvg_inf | cvg_zero | cvg_nan); boxplot(data(include), regs(include), 'BoxStyle', 'outline', ... 'Colors', regions.color*0.7...
92cc612e796a98041c4223a794c632f7a7cfa388f62b6473f63693412616e7ec
MATLAB
940
32
%plot clusters across leyers and leyeres acroos clusters clc clear [filename, path] = uigetfile("MultiSelect","off", ".csv"); datafile = fullfile(path, filename); %save path T = readtable(datafile); cluster_names = {'On Sustained', 'ON Suppressed 1', 'ON-OFF', 'ON Suppressed 2'}; %% %plot clusters across erias figure ...
5f88f41650209bf4ac7c90c58bf69e1d7ae2ea0833d31ec40dda92eab56d389c
MATLAB
941
44
function MSNplot20200107 path=['G:\CheetahWRLV20200121']; cd(path) load('widthPtoT.mat'); X(:,1)=X(:,1)*1/32; X(:,2)=X(:,2)*1/32; X fig1=figure; sz=25; scatter(X(:,1),X(:,2),sz,'k','o');hold on xlabel('Half Peak Width (ms)') ylabel('Peak to Trough (ms)') ThresholdWidth=5*1/32; ThresholdPtoT=10*...
b46a2dbe4206dff300a271445286632f5b8ce80866f9aa6e716d42c3201121a2
MATLAB
941
26
function [myState]=Model_RL_Init(N_state,N_action,N_transition) myState.N_state=N_state; myState.N_action=N_action; myState.N_transition=N_transition; myState.index=1; % current index myState.state_history=zeros(N_transition,1); myState.state_history(1,1)=1; myState.action_history=zeros(N_transition,1); myS...