sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
bdcce29adf4f8b6b05c77c5e8a8c72855366bcfec6681a57c10b76bbf45a01eb
MATLAB
661
24
function rx8= set(rx8,varargin) % SET Set RX8 properties and return the updated object % Property names are: property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_error(['The property input is not a valid RX8 property']) end val = pro...
8a027d83d57642ac0efeb11deeb8aa11eac1f33b52935059aa36162b441ca788
MATLAB
662
42
function d=filt50Hz(d,fs,hum_fs,f_max) if ~(exist('hum_fs')==1); hum_fs=50; end if isempty(hum_fs); hum_fs=50; end if ~(exist('f_max')==1) f_max=fs/2; end % if ~(exist('M')==1) % M=matlabpool('size'); if M==0; M=1; end % end if min(size(d))==1 d=d(:); end R = 1; r = 0.985; ...
2db16d9f97cb39806653031b7945b056bdf10f005da81248a18b85a7cf5ccab5
MATLAB
663
15
% Compile extract audio MEX helper % In order to extract synchronized audio and video, a MEX file is required % that relies on the macOS AVFoundation frameworks for parsing the audio % and video to extract audio and timestamps. (Video is read using the % standard MATLAB VideoReader class.) % % Once compiled, you can ...
3ad61ca8f3bf6550ce50b849bce4511e6f6dea731e9daaeee1cb5216cc1bb783
MATLAB
663
23
function val = get(comp,prop_name) % GET get Phase_comp property from the specified object % and return the value. Property names are: % Sig_comp,Name,Swp_on,Seq_on,Static_value,Sweep,Seq_values. global PHASE_COMP_DEFAULT; if isa(prop_name,'char') switch prop_name case 'Sig_comp' val = comp.Si...
3f02197654f9fd5e4245b48abfb51d6fd41683f283b2c861e7229ab560bbc837
MATLAB
666
29
classdef RunningState < LogbookState %RUNNINGSTATE happens when an experiment has been started. % Author: Lasse Osterhagen properties (SetAccess = private) % Array of all start times startTimes end methods function this = RunningState(evaluator) this@LogbookState(evaluator) end ...
ee4699d06a1e156a7f304678db0b5397e978974384a242fa21d04ab70fe869d9
MATLAB
667
36
% BH_correct % 26.May.2021 % Mohammad Shams % m.shamsahmar@gmail.com % % correct pvalues for multiple comparisons using Benjamini-Hochberg method % INPUTS % pval: originally calculated pvalues % alpha: alpha level % side: [DEFAULT] two-sided(2) | one-sided(1) % OUTPUT % sig: a logical vector indicating significant pva...
ea0c3d3a18251bba034e5aa31f50c8b0bb36ebc9383078a8f2fd5ffe938f9cf9
MATLAB
668
26
HDSPInInd=6; HDSPOutInd=7; ftab=exp(linspace(log(1000),log(64000),51)); Hz=2*pi/192000; for ii=1:length(ftab) sig=sin(ftab(ii)*Hz*(1:192000)); win=[linspace(0,1,1920) ones(1,192000-1920*2) linspace(1,0,1920)]; sig=sig.*win/10; y=audioplayer(sig,192000,24,HDSPOutInd); samp=audiorecorder(192000,24,2,H...
1a8fa04ef1b2c44c721384d7f2599018c4e4e83f9fd69df77427074a6687de29
MATLAB
669
39
function FS_Tiff_Parse(DIR,varargin) mat_dir=[pwd, '/mat'] if exist(mat_dir,'dir') rmdir(mat_dir,'s'); end mkdir(mat_dir); outlier_flag=0; if nargin<1 | isempty(DIR), DIR=pwd; end mov_listing=dir(fullfile(DIR,'*.tif')); mov_listing={mov_listing(:).name}; filenames=mov_listing; disp('Parsing Tif files'); fo...
d23c23025cb53360dcf0132ff57f120ab6f2d2799285bcd84a8188cc1f8713c5
MATLAB
670
23
function [Result] = AO_SendBlock(ArrayData) %% This function send stream format data to the embedded % ArrayData :Contain the data which will be sended to embedded % Result :Is an integer result of the AO_SendBlock, 0 = no function errors % % Copyright (C) 2011 AlphaLabSnR EthernetStandAlone % Author: Majid...
e51ab706b48bd06345de208030ebf7bc441e64c4a9d313bb311e57dc156a3b08
MATLAB
671
26
%% STD estimation using weighted non-local means (Kullback–Leibler divergence) function [sigma] = Sigma_estimation(im1) w = zeros(size(im1,1)); s = zeros(size(im1,1)); for count1 = 1:size(im1,1) for count2 = 1:size(im1,1) w(count1,count2) = mean2(abs(im1(count1,:,:) - im1(count2,:,:))... .*abs...
0e3cd1dc50b6f231825aee1bc0106552b2cf436c5420e932982390216643e29b
MATLAB
672
21
date = '07.10.20'; filenum = 6; %% load(['C:\maestro_results\Analog_data',date,'\Tables_',num2str(filenum),'.mat']) mdp_table = MDPData.MDPStates; loc = find(mdp_table.type == 'A' | mdp_table.type == 'B' |mdp_table.type == 'C'); reward = 0; mistake = 0; miss = 0; for ii = 1:length(loc)-1 tmpT = mdp_table(loc(ii):lo...
a618b2d1ea0a87dc344e57c45f06d69fa4587c9d8543265fc7ef0836a57ba3ab
MATLAB
673
31
function FS_mov(framerate,videodata) % Convert FS to avi % WALIII % 02.09.15 files = uint8(videodata); writerObj = VideoWriter( 'Output_new','Grayscale AVI' ); % include grayscale AVI if one channel writerObj.FrameRate = framerate; open(writerObj); figure; if size(size(files)) ==4; for i=1:size(files,4) %number of...
1a5082bad79d72168f02f9a1beee63f9e47a33946bf09f41a8b0369577658ce4
MATLAB
675
19
function practiceTrials = createPracticeStartGapTrials(numPracticeTrials) %CREATEPRACTICESTARTTRIALS creates trials for a practice run. % Arguments: % num - the number of practice trials to generate % % Practice trials have a relativly short start delay and are well above % the detection threshold. % Author: L...
8f804be946912c68bdb4d49c1b98b02bee7466776851553ccc7915c00c59f67a
MATLAB
675
27
function maximum = get_max_val(s_comp) % GET_MAX_VAL returns the maximal value for this component in_method_f=get(s_comp,'Input_method_flag'); switch in_method_f case 1 maximum=get(s_comp,'Static_value'); case 2 swp=get(s_comp,'Sweep'); st=get(swp,'Sdata'); et=get(swp,'Edata'); ...
7da477f790e40f8a783f121a8e77a59aa25f1cabd4f5b8bb59e06665d1fe6449
MATLAB
676
27
function minimum = get_min_val(s_comp) % GET_MIN_VAL returns the minimal value for this component in_method_f=get(s_comp,'Input_method_flag'); switch in_method_f case 1 minimum=get(s_comp,'Static_value'); case 2 swp=get(s_comp,'Sweep'); st=get(swp,'Sdata'); et=get(swp,'Edata'); ...
8510f47a47f4ec5b83fb0cf7b1df4668e694e41e503c69bcb83cc9614ca6bec9
MATLAB
678
29
function [] = setConstantAxesLim(ti,tiles) %setConstantAxesLim Set constant XYZ limits % Operates on children of a tiled layout amin = inf; amax = -inf; if nargin==2 figure(ti.Parent) for ii=1:length(tiles) thisPlot = nexttile(tiles(ii)); amin = min([amin,thisPlot.XLim(1),thisPlot...
b2e966059503de3efe84da7e2247f7afef3b155717dd925e245648b0f18f1024
MATLAB
680
33
function y = MirrorFilt(x) % MirrorFilt -- Apply (-1)^t modulation % Usage % h = MirrorFilt(l) % Inputs % l 1-d signal % Outputs % h 1-d signal with DC frequency content shifted % to Nyquist frequency % % Description % h(t) = (-1)^(t-1) * x(t), 1 <= t <= length(x) % % See Also % DyadDow...
beba309670c0d3253d78129e4051393b4dc04ca147a09c28f3b6836f7311add3
MATLAB
682
34
function [loc, trial] = get_defined_data(year, month, day, rat) % JN 2020-07-01 fname = fullfile('..', 'data', 'trial_data.mat'); S = load(fname); loc = S.all_locs; tr = S.all_trials; idx_loc = loc.Year > 0; idx_tr = tr.Year > 0; if year > 0 idx_loc = idx_loc & (loc.Year == year); idx_tr = idx_tr & (tr.Year...
5f7b39091985a3a489a37583ac86d3f399561ae807ca4cf780dd5de6edec7656
MATLAB
683
30
function env_list=show_env_list(m_sig) % env_list=show_env_list(m_sig) returns a column vector of Strings representing the % current envelope list on this main signal. % show_env_list(m_sig) prints a String vector column representing the current % envelope list on this main signal. envelopes=get(m_sig,'Envelope_list...
1a85fab5f566a1f1959e448b87dee0fb645398cb0eb7318ed7337b458bdf04ce
MATLAB
685
24
function line=add_formula(line,comp_tag) % ADD_FORMULA adds a tag-name to the list of graphical tags % that contain a formula as an input. % Line=ADD_FORMULA(LINE,COMP_TAG) adds the given tag-name to % the end of the LINE's list of graphical tags that contain a formula as % their input. if (~isa(comp_tag,'char') || i...
7234a7d76159ac1d4266035931aa0d24c1f532bfbdfbab0370f7e49b26d42224
MATLAB
689
35
clc clear close all % load load xx_108_4_single_e2o_perf exe2obs_cell = cellfun(@mean, test,'UniformOutput',false); exe2obs = cell2mat(exe2obs_cell); exe2obs = exe2obs-100/3; load xx_108_4_single_o2o_perf obs2obs_cell = cellfun(@mean, verif,'UniformOutput',false); obs2obs = cell2mat(obs2obs_cell); obs2obs = obs2obs...
76102345bdb4f167e8bf4db354580d2d4816cde005f4c311079eeb2182672e50
MATLAB
692
22
function val = get(comp,prop_name) % GET get Depth_comp property from the specified object % and return the value. Property names are: % Sig_comp, Name, Static_value, Value_formula, Static_reps, Reps_formula, % Seq_values, Seq_values_str, Coord_index, Index_formula, Wrap, Fixed_num_data, % Sweep, Seq_values, Seq_valu...
304cb3cb164a02e90ce50a80727fc4de0a296ff1cffc0a7c20ddbfba7dd0bb0c
MATLAB
693
19
function [thisAdjMat] = permuteROIpair(adjMats,ROI_A,ROI_B) %permuteROIpair Permute ROI assignments to test ROI differences % adjMat - Nroi x Nroi x Nsubj matrix % ROI_A,ROI_B - indices to permute toFlip = logical(randi([0 1],size(adjMats,3),1)); thisAdjMat = adjMats; thisAdjMat(:,ROI_A,toFlip...
eb956dc39ea6946e434a0f381f2da81f24ee3c39af8c3a33a5e09c962a9c1057
MATLAB
695
22
function [stmForAdap,stmForSupp] = compareSTIMinfo(STIM) % compare stim inputs clear count stmForAdap stmForSupp rowName supTrls = [1554;1593;1660;1765;1767;1890;1926;2335;2378;2408;2785;2799;2861;3111;3145;3208;3329;3335;3391;3592;3652;3782;3857;3965;4023;4057]; adapTrls = supTrls - 1; holder = STIM; count = 0; f = ...
c3051ffe5ca47b8c7d09c350fef2a2708e0d64a1aaeb190231d79ece52a6b2a2
MATLAB
699
17
%----------------------------------------------------------------------- % Job saved on 02-Apr-2020 11:06:38 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- %% function matlabbatch=spm_spatialsmoothing(Dir_a...
c7b7dd2ca19755eb60e0b6f4ea0bf3e8fcbf70e71fe57aa2db9aab71af80edda
MATLAB
703
27
function boolim = find_peaks(signal_vec) means = zeros(length(signal_vec),1); for ind = -100:100 means = means + circshift(signal_vec,ind); end means = means/201; SDs = zeros(length(signal_vec),1); for ind = -100:100 SDs = SDs + (circshift(signal_vec,ind)-means).^2; ...
dbb712d98c00630e72c69275c0067cd8ccd9da87e45892b7d0ba88f0673c1f00
MATLAB
703
36
function lineExamples % % Mixing lines and areas [note that the way notBoxPlot % % sets the x axis limits can cause problems when combining plots % % this way] % % clf % % subplot(1,2,1) % h=notBoxPlot(randn(10,1)+4,5,'style','line'); % set(h.data,'color','m') % h=notBoxPlot(randn(50,10)); % set(h(5).data,'color','m...
e25f058aad79bf72922140c4a5b5e5490ea2c992bf567b80cfafe3857fe4d735
MATLAB
703
29
classdef hstruct < handle %UNTITLED2 Summary of this class goes here % Detailed explanation goes here properties str end methods function obj = hstruct(varargin) %UNTITLED2 Construct an instance of this class % Detailed explanation goes here ...
3039cb0e25f4cfee4b411375ad783a36fbff8e6f2f86ae44baa4d411d6f99fdf
MATLAB
704
28
function stateTransition_plot_FigS7(theHbT,theEMG,theLFP,specT,specF,theTitle,plotTime,plotNum) figure(plotNum+700); subplot(2,1,1); hold on; yyaxis left plot(plotTime,theHbT,'r') ylabel('\Delta HbT (\muM)'); yyaxis right plot(plotTime,theEMG,'k'); ylabel('Log_1_0 (EMG Power)'); ax=gca; ax.YAxis(1).Color=...
4371e4f25d0ad0bde25daa1e00dabd66bad11ac221c0ecd2ad7a9e3e23f10955
MATLAB
705
18
function chan_info_str = get_chan_info(meta,line_number,chan_number) % GET_CHAN_INFO returns information on a givan channel in a given line. % CHAN_INFO_STR=GET_CHAN_INFO(META,LINE_NUMBER,CHAN_NUMBER) returns % information on a givan channel in a given line of the MetaBlock. if (~isint(chan_number) || ~any(chan_numb...
5b5c303eb4ef4eba7c516d56f9fd4a379d297ff80ff70d7208758173c857306e
MATLAB
706
32
function sigma = base10toM(C,N,M) %------------------------------------------------------------------------------------------------- % PURPOSE: convert base 10 to base M % % INPUTS: % C: decimal value % N: the number of digits % M: base % % OUTPUTS: % sigma: base M value %---------------------------------------...
7855c906cc6b01da3ad485106a43b9b9a80e604fb5e043289020ab0e15e8049b
MATLAB
708
22
function outStr = dialogCellstrHelper (inputStr) % Copyright 2010-2011 The MathWorks, Inc. % Helper used by MSGBOX, ERRORDLG, WARNDLG, QUESTDLG to parse the input % string vector, matrix or cell array or strings. % This works similar to the CELLSTR function but does not use deblank, like % cellstr, to eliminate any ...
15dbec1c03e0ce17545fab3201a53ea2ad6bef7dff9ecfeaa316e30eafdf46de
MATLAB
709
24
function [Result] = AO_CloseConnection() %This function closes the connection between Matlab and the SnR/Neuro Omega %% Result is an integer result of the AO_CloseConnection, 0= no function errors %% % Copyright (C) 2011 AlphaLabSnR EthernetStandAlone % Author: Majid Mechael % Last modification: 18/03/2013 Res...
3470c30aec04f1015b5ea0ee4f83895ce7fedec03b442c491f46595fd9772afe
MATLAB
709
28
function p_m = marginalize2(p,index,N, N_st) % --------------------------------- % PURPOSE: marginalize probability distribution p(X,Y) % Input % p: joint probability distribution of X and Y % index: marginalized out other variables than those indicated by index % % Output % p_m: marginalized probability distribution ...
99921d58dbe102d84601b4286c3d539a89518881a4b959d2707958ccd1496321
MATLAB
709
19
% Authors : Tatjana Schmitt & Simon Wadle 2019-2022 %function reads tiff stacks and scales pixels down to end size function image = tiff_stack_import(tiff_fullpath) info = imfinfo(tiff_fullpath); stack_size = size(info,1); rows = info(1).Height; columns = info(1).Width; % preallocate resized_image image = z...
e94cb3290ed29de9e0eb5a49fd246ed60540c906b27a7250d1773e15da772bac
MATLAB
710
24
function table_filestarts = DT_fix_file_open_times(table_filestarts, CD) % JN 2020-04-22 n_res = height(table_filestarts); table_filestarts.Relevant_CD_ms = zeros(n_res, 1); % From Deuteron's manuals: % CD: Clock difference in seconds: Logger clock time minus transceiver clock time % this implies % t_logger = t_tra...
025cacc6d8b305cdfead1b155ab4e6981c2ddbfb7e968c0cb507eeb157ebeef1
MATLAB
712
22
function info_line = get_comp_info(s_comp) % GET_COMP_INFO extract information about the given String_comp object. % info_line = GET_COMP_INFO(s_comp) returns a character array that hold % information on the given String_comp object. % The content of the information depends on the Input method of the % component (r...
4245926789a71c162295a3e7636cacb06ed4b20b04d833c3652bf236ff05b5b0
MATLAB
712
45
function progressbar(n,N,w) % progressbar - display a progress bar % % progressbar(n,N,w); % % displays the progress of n out of N. % n should start at 1. % w is the width of the bar (default w=20). % % Copyright (c) Gabriel Peyre 2006 if nargin<3 w = 20; end % progress char cprog = '.'; cprog1 = '*'; % beg...
a7789b74859ddd12461d2f83d7bb989d406844c3a499ba881ec58d8a0d7f7f67
MATLAB
713
22
function nb = set(nb,varargin) % SET Set NB properties and return the updated object % Property names are: % Level_comp, STime_comp, ETime_comp, Ramp_comp, Freq_comp,Freq_comp(for BW),Envelope_list. property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') ...
b923e94d893ea30ce0ce8859b2cf0231e5873a6d6c0e58b34c400f6a7a0017f5
MATLAB
715
15
function val = get_comp_by_index(m_sig,comp_index) % GET_COMP_BY_INDEX Gets component according to the specified index. % VAL=GET_COMP_BY_INDEX(M_SIG,COMP_INDEX) Gets The given Main_Signal % component according to the specified component index. % Index can be 1,2,3,or 4 (as the number of Main_signalcomponents) % index=...
95ff5a60576aad3a095e5b5a868ce9ef8565e931c824f0d68d84444105cf2b4d
MATLAB
718
22
function env = set(env,varargin) % SET Set Envelope properties and return the updated object % Property names are the component names that build the relevant Envelope. property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_error(['The property ...
722b0d40f5eeab0f2c6603e915e3b3ea43b041125f7dfd9311d857091225f5de
MATLAB
722
22
function [angs, rs] = get_ang_and_rad(loc_x, loc_y) % Function get_ang_and_rad converts the provided X and Y locations to polar coordinates % % Inputs: % loc_x - (Nx1 matrix) - pixel X locations % loc_y - (Nx1 matrix) - pixel Y locations % % Outputs: % angs - (Nx1 matrix) ...
c71cea57199b9c9eb9865e74f5b0815baac12b8031de6549e868d81b10618363
MATLAB
723
22
classdef (Abstract) AudioObjectSampleFactory < handle %AUDIOOBJECTSAMPLEFACTORY creates audio sample matrices from AudioObjects. % Author: Lasse Osterhagen methods (Abstract) outMatrix = makeAudioObjectSamples(this, audioObject, rawSamples) % Modifies the rawSamples so that the AudioObject will be included. ...
d11b81d7a247c5b4c175a7bdd53084dc4c7665db3a4f1726e0aebc9830b0aa4d
MATLAB
725
22
function [Result] = AO_StopStimulation(ChannelNumber); %% This function stops stimulation of the source of the ChannelNumber % ChannelNumber: the Id of the channel % Result is an integer result of the AO_StopStimulation, 0 = no function errors Result=MexFileEthernetStandAlone(11,ChannelNumber); %% Copyright (...
fad969f1437477b5af69dbf062e27cbdff2576f2b2659af8a76854b244ec2c94
MATLAB
725
35
function I_out=im_expand(I,Nx,Ny) % % Simetric expansion of image I % % (Assumes a DCT-like simetry) % % Y=IM_EXPAND(I,Nx,Ny) % % Asumes a specular simetry of image I and replicate Nx columms % and Ny lines. % % If size(I)= [M1, M2] % then size (I_out)=[M1+Ny,M2+Nx] % % Santiago Aja-Fernandez (V1.0) %...
8c7a56db93efeb595dd81f94155bba077ef5a7da16f00369d6574c51b3c19030
MATLAB
727
37
% raster_many % 2021-07-18 % Mohammad Shams % m.shamsahmar@gmail.com %------------------------ % raster(M,C,sz) % M: input matrix k x {trial x time} % C: color map (color x RGB; default = black) % sz: dot size (default = 10) function plotRaster(M,C,sz) switch nargin case 1 C = lines(7); sz = 5; ...
de72de805a5452f8e8dbfc7609494891d3a52f7a271d3869954e7826178bb233
MATLAB
728
21
function [states, t_states] = parse_maestro(rat_dir) % Function parse_maestro() reads the mdp_table.mat that is produced by the Maestro. % % Inputs: % rat_dir - (str) - Location of the mdp_table.mat, inside the experiment folder % % Outputs: % states - (table) - Table of the state...
746af2d0b8d080608b8bcc5f24c31a4ce99bdaabac2071ff1ea5afae4d61286b
MATLAB
732
25
function [yCoordinates, xCoordinates] = Get_ring(ROI_dat,row,col) G = boundary(ROI_dat); G2 = round(G*1); scalF = 2.5; scalF2 = scalF-1; moat = 2; scalF3 = moat-1; h = poly2mask(ROI_dat(G,1)*scalF-mean(ROI_dat(G,1))*scalF2 ,ROI_dat(G,2)*scalF -mean(ROI_dat(G,2)*scalF2),row,col); h2 = poly2mask(RO...
a838688921663824d66dc175c6aa7a179f6956309be95e0be7cb0a3395611723
MATLAB
734
25
function [similar_blocks, Wiener_weights] = MIRO_patch_3DFiltering(similar_blocks,similar_noisy_blocks,D_3d, sigma) m_Shape = size(similar_blocks); Wiener_weights = zeros(m_Shape(2),m_Shape(3)); for i = 1:m_Shape(2) for j = 1: m_Shape(3) Var = norm(mean(sigma(:,i,j))^2); tem_Vct_...
216bdcfe5b86efad798f595d9cf1f3cd7ddb244264bb408eb73a42481e6b8e6c
MATLAB
738
28
function sequence = scanning_sequence() % The order of stimulation for each subject %1: S1 %2: FEF %3: DLPFC %4: aPFC sequence{3} = [4 1 3 2];%S3 sequence{4} = [4 1 2 3];%S4 sequence{5} = [1 4 2 3];%S5 sequence{6} = [1 2 4 3];%S6 sequence{7} = [1 4 3 2];%S7 sequence{10} = [1 2 3 4];%S10 sequence{12} = [2 1 4 3];%S12 s...
fe51f4868815b66e07442055617585c35261c5362dc3d754d615d28e07cc0372
MATLAB
739
32
function do_arena_view(ax, loc, metadata, params, start) start_time = loc.Time(1); axes(ax); hold on temp_image = metadata.bg_image; % increase brightness temp_image = min(temp_image * 1.4, 255); bg = cat(3, temp_image, temp_image, temp_image); imshow(bg) ax.Title.String = {sprintf('%.1f minutes into day %d', ......
caec2b70f67281bc0e7dcd4604bca4a24560d2e06a9b2c9ae022db03bbe8623a
MATLAB
742
45
function fb_plot_roi_stackplot(ROI,T,varargin) % % % % % % % parameter collection nparams=length(varargin); linewidth=1.2; colors=colormap('winter'); spacing=.1; if mod(nparams,2)>0 error('Parameters must be specified as parameter/value pairs'); end for i=1:2:nparams switch lower(varargin{i}) case 'linewidth' ...
df87fcbcd8d51cf3838bb444e9a8c12aac66ad5d1627cf964d988250dbb386a4
MATLAB
743
30
function [succeeded,err]=connect(pa5,interface) global Out_Manager; dev_num=get(pa5,'Device_num'); err=''; actx_cntrl=get(pa5,'Controler'); dev_num=get(pa5,'Device_num'); % if (invoke(actx_cntrl,'ConnectPA5',interface,dev_num)==0) if (actx_cntrl.ConnectPA5(interface,dev_num)==0) err_msg = invoke(actx_cntrl,'GetEr...
1dc9d9217b7905e43cef7da6a48a163abdf3c9f70fb53eaa1c9308dddd908e8b
MATLAB
744
15
function [Final_img_tmp, m_Weight_tmp,Count] = MIRO_patch_matching_and_processing(Final_img_0, m_Weight_0,ii,jj,blk_step,... block_Size, width, height, noisyImg,BasicImg, N, D, DD, D_3d, p, sigma_g, m_Kaiser, beta, lambda_W, adaptive_on) m_blockPoint = Locate_blk(ii, jj, blk_step, block_Size, width, height); [Sim...
7046bd6396ff7fc5dc177afc9be6d24c743f1cd16e14a1b9a5e840e61ec14d83
MATLAB
747
59
function mergelist=fb_merge_peaks(PEAKS,VALS,varargin) % % % % % % win=5; thresh=-inf; nparams=length(varargin); if mod(nparams,2)>0 error('Parameters must be specified as parameter/value pairs'); end for i=1:2:nparams switch lower(varargin{i}) case 'win' win=varargin{i+1}; case 'thresh' thresh=varargi...
dce521a9c4c7d20c832ca2c5d0766cbd8f522a704fb2be471435bbf29f0daa62
MATLAB
748
26
function [dataTable] = loadMergedDataFiles(varargin) o = ecogutils.postHocOptionsParser(varargin{:}); % Load connectivity data dataTable = loadECoG.loadFileList(o); % Add good channels to table [indexChans] = ecogutils.goodChannelIndices(dataTable,o.Hemisphere,o.CompleteChannelSet); dataTable = addvars(data...
3da66d0a1a4fa1df30a9bf4afc06a571050b1dcd58c96d3c53beea27689fd35b
MATLAB
750
36
classdef loadSingleVarFromFileTest < matlab.unittest.TestCase % Author: Lasse Osterhagen properties (Constant) varContent = 'testContent'; end properties config end methods (TestMethodSetup) function initConfig(this) this.config.fileName = 'testLoadVarFromFile.mat'; this.con...
dfeb8550f8f78593974fafc881814f26b92d60924804ba23f85d90cc11672cee
MATLAB
751
19
function sound_table = load_sound_table(rat_dir) % Function load_sound_table() reads the sounds_table.mat that is produced by the pipeline. % % Inputs: % rat_dir - (str) - Location of the sounds_table.mat, inside the experiment folder % % Outputs: % sound_table - (struct) - Table ...
ef7f7eb535367204db4db580fc1c74d36026d6258b50b9f943d4a3b461f4162e
MATLAB
757
22
function [distances] = embDistUsingElbow(obj,maxDimension) %embDistUsingElbow % Calculates pairwise distances in emb for dimensions up to useElbow nodes = size(obj(1).Emb,1); distances = zeros(nodes,nodes,numel(obj)); for iObj = 1:numel(obj) % Unless specified, use obj's Elbow. if ~exist('maxDimensio...
9a21db0ea97ab2a954a15be7ca42c0b36ef88b9a26657e950dc5ca509039cd56
MATLAB
759
21
function [res,err_msg]=check_ears(right,left) res=1; err_msg=''; str={right,left}; for k=1:2 ear=str{k}; other_ear=str{mod(k,2)+1}; if strmatch(ear,'1+2+3+4','exact') cond1=strmatch(other_ear,'1+2+3+4','exact'); cond2=strmatch(other_ear,'1+2','exact'); cond3=strmatch(other_ear,'3+4',...
0630196ba1b94675135af43febef53fa624a52bf701a7adf7777ea0dd6ed3994
MATLAB
760
33
function I_out=filter2B(h,I) % Two-dimensional digital filter, based on FILTER2.m % % Y = FILTER2B(B,X) filters the data in X with the 2-D FIR % filter in the matrix B. The result, Y, is computed % using 2-D correlation and is the same size as X. % % The image X is periodically repeated to avoid edges...
9dadebca496af9be5ec180393568d64e3cce24ad82ffddce110e9ace5b2ef91d
MATLAB
763
25
function [data,succeeded]=read_tag_vex(rx8,buf_name,num_samples,Srctype,Dsttype,nchannels,trial_num) data=[]; dev_num=get(rx8,'Device_num'); succeeded=1; actx_cntrl=get(rx8,'Controler'); data=invoke(actx_cntrl, 'ReadTagVEX', buf_name, 0,num_samples,Srctype,Dsttype,nchannels); if (isempty(data)) succeeded=0; str...
cc8b77eb8621663ee4f0636e41059b1f88298b390ca04413c03b74aa5809bc1a
MATLAB
764
22
function [o] = postHocOptionsParser(varargin) %postHocOptionsParser Input parser for functions loading initial data p = inputParser; addRequired(p,'measure',@(x) isstring(x) || ischar(x)); addRequired(p,'DataSet',@(x) isstring(x) || ischar(x) || iscell(x)); addParameter(p,'StateMap',ecogutils.defaultStateMap(),@...
06d977b1e7a0d567c55cf04916a6038e6a1da7ec3079e0b4e63f87d0d625bca7
MATLAB
765
29
function [labels, tags] = loadLabels_multi(path) % expects path to specify a folder tiff = Tiff(path); labels = {}; tags = {}; last = 0; while ~last index = currentDirectory(tiff); tags{index} = getTagStruct(tiff); try desc = json.load(tags{index}.ImageDe...
d19d4778809188b5ffce48b80390bc234b4512a3501b5c38c98bc4963251fda8
MATLAB
765
23
function values= get_trial_values(s_comp,varargin) % GET_TRIAL_VALUES(S_COMP) returns an array of values that would be generated for % this String component (s_comp) according to it's internal state. % values = GET_TRIAL_VALUES(S_COMP,RANDOM_INDICES_ARRAY) returns an cell % array of strings of length reps % in_metho...
cf446e21d0daa71ff00db32709a8b3fd8f709d8b95a9c6b9dfc3830432af320a
MATLAB
770
34
function area = getFuncArea(x,y, areaTable, centData) x0 = centData(1); y0 = centData(2); R = centData(3); %find distance from center: r = sqrt((x-x0)^2+(y0-y)^2); %if outside the circle if r > R area = -1; return; %if inside inner circle elseif r <= areaTable.r2(1) area = 0; %do nothing (can be changed)...
341eba9621e16ea597e46c0645db2a2c29dba45c40a44e4bbb6c9eec5c85a0d3
MATLAB
771
24
function s_coord = set(s_coord,varargin) % SET Set Sig_coordinator properties and return the updated object % Property names are: % Main_signal. property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_error(['The property input is not a valid Sig...
4c0aae63e454c32e2b1243244bfa90f9505715a56455e9f5cdb452056715cb20
MATLAB
772
24
% Fast evaluation of psychometric function for gap detection experiments % with multiple blocked trials. % Author: Lasse Osterhagen % Unselect practice trials fh = @(x) ~(isnumeric(x.ID) && x.ID == 0); % Evaluate log files fsa = FileBlockedStatsAccumulator('Duration', fh); blue = fsa.condition.b; yellow = fsa.condit...
2ed850325cfd036c7d734f2330eef9a08d6c19800660ee2957b21e0ca2296f71
MATLAB
774
28
function N = createPinkNoise(n,p) % calculation of 1/f (pink) noise process % calculation a priori for entire time % randomness introduced in phase Fmax = 1/(2*p.dt); % maximum frequency of spectrum M = p.numSteps; % number of samples df = Fmax/M; % interval of sampling in frequency domain f = df:df:Fmax; % star...
56fbe0f83fd7da2288fd7f003665621e54207b40e19cffc2534e7930ad4c340b
MATLAB
776
19
% Authors : Tatjana Schmitt & Simon Wadle 2019-2022 %function reads tiff stacks and scales pixels down to end size function image = tiff_stack_import2(tiff_fullpath, file_cnt, num_of_files) info = imfinfo(tiff_fullpath); stack_size = size(info,1); rows = info(1).Height; columns = info(1).Width; % preallocate...
e07c78cf0f3f2f38288278731e9e9712ff76cee0710cf019fbfc79c55c4e436b
MATLAB
777
30
function create_supp_table2(type2AUC, metaDprime, phi, conf_diff, fileName) data = {type2AUC, metaDprime, phi, conf_diff}; %File name output_path = pwd; file = fullfile(output_path,[fileName '.xls']); %Delete previous version of the file and open new file if exist(file) delete(file) end fid = fopen(file,'a'); %...
0e4ea3c65975af346a07ca9b3b9ccc1fc40cc8de80ffb72f882cf10703cfdb14
MATLAB
782
28
function [pathnames] = uigetdiles(start_path, dialog_title) % Pick a directory with the Java widgets instead of uigetdir % copied most of this from something online import javax.swing.JFileChooser; pwd = start_path; jchooser = javaObjectEDT('javax.swing.JFileChooser', start_path); jchooser.setFileSelectionMode(JFil...
337d604c5b61b714056a651b391a43acca1cc8a0923ba4c72d75205570ecaab4
MATLAB
783
22
% remove previously made point folders in composite, fcs_points folders function remove_results_folder(pipeline_data, point_name) % create point folders for composite tifs [~, point_folder] = fileparts(point_name); rm_folder = [pipeline_data.run_path, filesep, 'composites', filesep, point_folder]; ...
728679e0501836402256cdd756fd45c42ffec898a2bf01c1ba63790e504c34ea
MATLAB
784
30
function [bConnected] = AO_IsConnected() %% This function checks if Matlab is connected to the SnR/Neuro Omega %% returns 1 if the system is connected, otherwise returns 0 bConnected=MexFileEthernetStandAlone(9); %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Example for usin...
aa1aa530f61d574c7ef2f195adcb7cb139b94d56936b0f66d1881c285879d917
MATLAB
785
30
function [beamind] = InputBeams(s) % ELN: % modified to take creation and deletion operations outside the main % polling program. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Usage: % s=setupDaqSession(); % Initialize daq session % beaming=InputBeams(s); % read beams % . % . % . % beamind=InputBea...
2abbed93bdde0ca21a834381eb2db910708125cb3e40bfbbaa34e513ce30a73f
MATLAB
786
37
clear close all load data_Fig3B_exe2obs exe2obs_verif_exe = perf.verif; exe2obs_test_obs = perf.test; load data_Fig3B_obs2exe obs2exe_verif_obs = perf.verif; obs2exe_test_exe = perf.test; %% plot color = lines(7); figure('units','normalized','outerposition',[.2 .2 .4 .4]) hold on plot(ex...
25646e53da83a450cd3033e04f10f24a27dfa18c9de7d296b50bc07436fb3b96
MATLAB
788
31
%*******Alex Bhogal 1/29/2019 %function to load niftii images untouched. Output is the image data %and info structure containing matrix and resolution info function [image info] = loadMask(pathname, filename) warning('off') global opts; if isfield(opts,'verbose'); else opts.verbose = 0; end if ~ispc if ...
ba6b3816eb105c1557b29eff7b6704f4b795406919f9d2f5a3de3fe38bdca90d
MATLAB
788
38
function [Bgnd, Npil] = FS_neuropil(out_mov,ROI,resize) % Extract Neuropil % d09/24/17 % WAL3 % Make indexes for the ROI coordinates for i = 1:size(ROI.coordinates,2); if i == 1; X2 = [round(ROI.coordinates{i}(:,2)*resize),round(ROI.coordinates{i}(:,1)*resize)]; else X = [round(ROI.coordinates{i}(:,2...
8d3e0bedde9a5a19aa14b188e81e84375be68b180c12326b4553e8a0c3741a4b
MATLAB
792
24
function nb=NB(varargin) % NB class constructor. switch nargin case 0 % if no input arguments, create a default object m_sig=Main_signal('NB'); nb.num_of_comps=7;%assuming NB have 1 more unique component beside the basic 4. nb=class(nb,'NB',m_sig); fc=Freq_comp; f...
5428ada48cdf00e88f130ff3a6894ae157b75ef0876c7af336d89526cfee461e
MATLAB
793
26
function dataNoAgg = gui_MibiFilterAggregates(data, gausRad, t, gausFlag) % dataNoAgg = MibiRemoveAggregates(data, gausRad, t) % function receives a 2d counts matrix and removes % aggregates. Matrix undergoes gaussian kernel with radius gausRad. Aggregates are considered as connected components of size>t % gausFlag - 0...
075adafeed65344f10fbf5addd3dd92b5d1032f11bca3b3dd5a316b65c67c1d0
MATLAB
795
28
function write(value, filename, varargin) %WRITE Write a matlab value into a JSON file. % % json.write(value, filename) % json.write(..., optionName, optionValue, ...) % % The function saves a matlab value in a JSON file. A value can be any % of a double array, a logical array, a char array, a cell array, or a % st...
2caf90a294f4278350cd6792d4ac05b1078d0431daaeb1079dd752dc577c401c
MATLAB
796
28
function value = read(filename, varargin) %READ Load a matlab value from a JSON file. % % value = json.read(filename) % value = json.read(..., optionName, optionValue, ...) % % The function parses a JSON file and load into a matlab value. By default, % numeric literals are converted to double, string is converted t...
9a0f7c178643adff2fa7ec814caeb0d50940ff80040c0e96695d9d5e82a37918
MATLAB
797
23
function [nearVsMedian,sortedDistance] = localDifferentiation(obj,maxDimension) %centroidDist Euclidean distance between centroids % clusters = Integer indices identifying clusters % nCluster = Number of clusters overall % useChans (optional) = logical array of channels to use % maxDimension (optional) = U...
42cc11d46b2abdc3cf6ff0350df1f29333904ec1d2a94d2d7d748c11fa86b213
MATLAB
800
23
function saveTIFF_folder(counts, labels, tags, path, varargin) rmkdir(path); for index=1:numel(labels) tiff = Tiff([path, filesep, labels{index}, '.tif'], 'w'); setTag(tiff, tags{index}); setTag(tiff, 'Compression', Tiff.Compression.Deflate); if numel(varargin)>0 bits...
61f561e79929ae1ec16eac63de6f974a06bc5ad55e6472d19fe9d81119fe7f94
MATLAB
800
25
function entropy=fuzzyEntropy(x,h) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % INPUTS : 'x' is the fuzzy parameter vector % 'h' is the histrogram of the image % OUTPUT: 'entropy' is the Fuzzy Entropy of the image after fuzzy partition % of the histogram 'h' by the ...
07fc99758623ea27b049c2e3ebaf905499f68fdbddb675ce15243e916eadf2b7
MATLAB
802
38
function [detrended] = detrendHRF(data, breakPT ) global opts %setup detrend data detrended = zeros(size(data)); xdata = [1:1:size(data,2)]; xData = xdata'; xData(breakPT(1):breakPT(2)) = []; for ii=1:size(data,1) input = data(ii,:)'; input(breakPT(1):breakPT(2)) = []; %ft = fittype( 'poly1' ); %option...
e1cc6ec785cc0b6eef1c9594efe79842d8fa15ac33529f2bcccbe8ea9d9d316c
MATLAB
802
17
function [faces, vertices] = readTriByu(filename,fixedwidth) % [faces, vertices] = readTriBYU(filename,fixedwidth) % Reads a BYU file if it holds a triangulated mesh % % filename - path to BYU file % fixedwidth - 0 or 1 refers to which style of byu file (whether numbers are spaced into fixed width columns) % vert...
cef8dade497f45e9d03442b6bd64ecebd576038bb252aada49650502fa5f4acd
MATLAB
805
21
% Authors : Tatjana Schmitt & Simon Wadle 2019-2022 function dF_F_image_resized = dF_F_resized(resized_image) %function fits baseline pixelwise with chronux toolbox %and calculates dF/F for each pixel total_frames = size(resized_image,3); time_for_fit = [1:total_frames]'; [x_pixels, y_pixels, z_pixels]= size(r...
f7587a37ad14a6190156e1949da96cdbbb8ec6906b740b34f98a1e7323cb4ce1
MATLAB
805
16
function generatePanels_FigS7(FigS7) %% P15 Supplemental Arousal State Transitions transNames=fieldnames(FigS7.arousalTransitions); for transNum=1:length(transNames) theHbT=mean(FigS7.arousalTransitions.(transNames{transNum}).IOS.forepaw.dHbT,1); theEMG=mean(FigS7.arousalTransitions.(transNames{transNum}...
70113e22ac7af56f405a1cbfd905414981615df07f32fe4661ca8188ce21b50f
MATLAB
810
28
% function [T, paramF] = createSilenceRows(Told,paramFold,nrows,trdur) % % type = cell(nrows, 1); % type(:) = {'silence'}; % type = categorical(type); % speaker = ones(nrows,1)*3; % samp_rate = ones(nrows,1)*192000; % trial_dur = ones(nrows,1)*trdur; % stime = zeros(nrows,1); % etime = zeros(nrows,1); % ramp = zeros(n...
1397959f7ffdb53f1276e9a91ad79b5d9175dac43c7e7ac03c8718cecb0f4cb0
MATLAB
811
27
function l_coord = Line_coordinator(varargin) % SIG_COORDINATOR class constructor. % L_COORD = LINE_COORDINATOR(BASIC_LINE) constructs a Line Coordinator % for the given Basic Line. switch nargin case 0 l_coord.line=Basic_line; coord=Coordinator(l_coord.line); l_coord=class(l_coord,'Line_coordinator',coord);...
ed151cc2ae0e17234d23f989cac99a5a0a602cac608bdda271f37ae673681e60
MATLAB
812
26
function [f, df, ddf] = rosenbrock(x); % rosenbrock.m This function returns the function value, partial derivatives % and Hessian of the (general dimension) rosenbrock function, given by: % % f(x) = sum_{i=1:D-1} 100*(x(i+1) - x(i)^2)^2 + (1-x(i))^2 % % where D is the dimension of x. The true minimum is 0 at x ...
6e4c87a2471b905a129aa325a5a7a15383da09c72c5bb1ebb0cc768b4d6420d5
MATLAB
814
16
function countsNoNoise = gui_MibiFilterAllByNN(countsAllSFiltCRSum,IntNormD,threshVec) % function filteredData = MibiFilterAllByNN(countsAllSFiltCRSum,IntNormD,threshFile) % function filters images (removes noise) by NN density. countsAllFiltCRSum % - cell array of images. IntNormD - cell array of % intensity-normalize...
812380a4a668bcab774cebf418855cce1664fdd94e44e799b069aaaced0db245
MATLAB
817
25
function shamTrials = createShamTrials(delays, repFactor) %CREATESHAMTRIALS creates an array of sham trials. % Arguments: % delays - an array of delays [default: 1.25:5.25] % repFactor - replication factor % % Creates a sham trial (trial with a NullStimulus) for every delay in % delays. Creates in total leng...
e20f8acfb31e61d541d5f650ac509f5315b425b48fc8dac67babd5a88a45ede1
MATLAB
818
24
filename='TCPTable.mat'; T = table(); paramBBN = table(); paramF = table(); paramGap = table(); paramFile = table(); pr = struct('speaker',[],'samp_rate',[],'trial_dur',[],'stime',[],'etime',[],'ramp',[],'att',[],'blockl',[]); basedir='C:\Users\OWNER\Desktop\maestro_240416_32_chan\SoundFiles\Stimuli'; bfname='cloud_06-...
0da105216a0295e2f0ea655bf47ad7be0d4a1fc6de9f38d5099e7c7caa9f04b1
MATLAB
819
26
RP=actxcontrol('RPco.x',[5 5 26 26]);% starts the RP activeX control in MATLAB invoke(RP,'ConnectRP2','GB',1); %connects an RP2 via USB or GB e2=invoke(RP,'ClearCOF'); %Clears the Buffers and COF files on that RP ee=invoke(RP,'LoadCOF','c:\ella\tdt\rpvds\testindices.rcx'); % Loads circuit('c:\example') invoke(RP,'R...
63daa13d95f4d007836cc0a5f3579f60e342743f457a2f5583707a9ef98f7ad9
MATLAB
819
22
function sig= change_sweep_param_by_index(sig,comp,comp_index,varargin) % CHANGE_SWEEP_PARAM changes sweep's fields of the given component to the given % values and returns the updated signal. % sig=CHANGE_SWEEP_PARAM(SIG,COMP,FIELD_NAME1,VAL1,FIELD_NAME2,VAL2,...) % changes sweep's fields of the given component to the...
19c5360036cc2f61c4976b108110432c869cf395723ef47d9db8e0e646d5e080
MATLAB
820
36
%% Make IDX Variables % dMUAdCOF % Current adaptdcos figure 2 (or 3 I guess...) % This runs in an old repository/archive. The goal of this code is to % update it into the Modular Function Structure and create backup files on % TEBA so it can be accesses, edited, and re-run anytime. % exampleKLS_condCompare % taken ...
7707880c9c3333352e4000d3b0bd99bf8924133f89659cb6b691e0c98a28e05f
MATLAB
824
23
function samp_points=synth(sig,samp_rate,trial_dur,varargin) % SYNTH is FREQ synth function. % SAMP_POINTS=SYNTH(SIG,SAMP_RATE,TRIAL_DUR,VARARGIN) Samples the signal % according to the givan SAMP_RATE and TRIAL_DUR. Returns the sampled % points. % varargin holds the requested Frequency value for FREQ signal. If vararg...
d47a60addaad722ef286f2dfff088279034b7545557565bf79759491325f622e
MATLAB
824
28
function featurevector=calc_feat(d,fs) %frequency b0power= bandpower(d, fs, [0 0.5]); b1power= bandpower(d, fs, [0.5 4]); b2power= bandpower(d, fs, [4 12]); b3power= bandpower(d, fs, [12 64]); b4power= bandpower(d, fs, [64 fs/2]); %spikes q1 = quantile(d,0.05); q3 = quantile(d,0.95); lb = quantile(d,0.25) - 1.5*(quan...