sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
24ac8e7197c0d819f570c61609f605c2f6707f06b7f08f01ffdded81ed2df7e3
MATLAB
952
28
function mydata = analyzetpstack_loadsavedfile(ds,stackname,dirname) % ANALYZETPSTACK_LOADSAVEDFILE - Load a saved tuning curve file % % MYDATA = ANALYZETPSTACK_LOADSAVEDFILE(DS,STACKNAME,DIRNAME) % % will attempt to load saved tuning curve data from the experiment data % that is being read by a DIRSTRUCT object DS...
bf7e40b557e4a353dd0d0f59390b51cb5c5f343d8c6cb4c1f5d58e007d7eb518
MATLAB
953
26
% Indicator of which elements of a universal set are in a particular set. % % Input arguments: % strset: % the particular set as a cell array of strings % struniversal: % the universal set as a cell array of strings, all elements in the % particular set are expected to be in the universal set % % Outp...
dd10ef49c85a89ca749766890e6f82ba3fa595ebf7974fcfba44efd74e47afff
MATLAB
953
31
% part of https://github.com/LudgerS/MRSartifactRemoval % % allows addressing the build-in standard Matlab colors function color = matlabColors(number) switch number case 1 color = [0,0.447000000000000,0.741000000000000]; case 2 color = [0.850000000000000,0.325000000000000,0.098000...
71df2219b421dc4198bc4f7e0beb125b201494410294dd3978074ec273176c25
MATLAB
954
46
function lat = do_laterality(pow_parcel) % datain = [mean(pow_parcel,1)]; % % figure, % bar(datain); % L = length(rois); % set(gca,'Xtick', 1:L,'XtickLabel',1:L); % % set(gca,'Xtick', 1:L,'XtickLabel',rois); % box off % set(gca,'color','none'); % xlim([0,L+1]) % xlabel('ROI'); % ylabel('Source power'); % set(gcf, 'Po...
50fe0890c1f690b9ad7cfcb5140a2f6de3103758fd24f21f5501b91511eff8dc
MATLAB
955
23
% Quality control Q1b % Plot the anatomical image and check its intitial position with reference to the MNI template % Xin Di, July 13, 2022 clear subjfolder = dir('F:\fMRI_QC\fmri-open-qc-rest_bias_corrected\sub*'); for subji = 1:length(subjfolder) imgs = char(['F:\fMRI_QC\fmri-open-qc-rest_bias_corrected\' sub...
b56eaf8b4611af9f074f675beea89124b3e93c209b84dc36438f060b23b4a4d0
MATLAB
955
29
function [v1,v2] = ev2d(grad,rho,Sx,Sy,um,vm,lambda,theta) [m,n] = size(um); v1 = zeros(m,n); v2 = v1; l_t =lambda*theta; for y = 1:m for x = 1:n dx = 0;dy = 0; rhoc = rho(y,x) + ( Sx(y,x).*um(y,x)+Sy(y,x).*vm(y,x)); if rhoc < - l_t * g...
d1a2f558368836a7f120af8bbb2e5ae2c14f232fd0d5403a0675cc81e4381ed5
MATLAB
955
39
function handles = setupResponseandTrialHistory_SanesLab(handles) %handles = setupResponseandTrialHistory_SanesLab(handles) % %Custom function for SanesLab epsych % %This function sets up the GUI response and trial history tables % %Inputs: % handles: handles structure for GUI % % %Written by ML Caras 7.24.2016 glo...
4ed01df6dfef00c3f57897f70e03ea04f6c88b3aa4673691b45d74082b75ca18
MATLAB
958
43
function Sel = LogRegRed(dset,N) current_dir=pwd; YTrain=[]; for c=1:dset.class YTrain = [YTrain;ones(dset.num_tr(c),1)*c];; end if nargin<2 N = 5000; end GeneSel_flag=0; cd ~/MatWorks/Unsup/liblinear-2.11/matlab/ for k=1:3 model{k}=train(double(YTrain),sparse(double(dset.Xtrain(:,:,k)')),['-s 0','liblinear_...
e2231ea4f144b653492d3004e463d82a401bda0f42104d3a38d04ce1fff43b18
MATLAB
959
40
function W = generate_JointMatrix(A,B,n_perc) fc_mat_1 = A; fc_mat_2 = B; % keep only positive values fc_mat_1 = fc_mat_1 .* (fc_mat_1 > 0); fc_mat_2 = fc_mat_2 .* (fc_mat_2 > 0); fprintf('- top percent\n') fc_mat_1 = fc_mat_1 .* (fc_mat_1 > repmat(prctile(fc_mat_1,n_perc,2),1,size(fc_mat_1,2))); fc_mat_1(fc_mat_1<0...
f8b2af08d03b78c71cdfadb59f90cd0689892ba6e6a7193b7f5a9119b496f786
MATLAB
959
34
function [y] = logsumexp(X) % Calculate log sum of exponentials, i.e., log sum_{l=1}^L exp(X) % % Input % X LxN matrix, i.e., x_{l,n} % Output % y log sum of exponentials, i.e., log sum_{l=1}^L exp(X) % % % Here, we define % max_X = {max_1,...., max_n,...,max_N }, where max_n = argmax_{l} % x_...
e3bd802ed2dfd0c5463f9fe980dc4643dec5322fe68d79bde489b3a55079e5c1
MATLAB
960
39
function folders = GetValidSubFolders(parentFolder, varargin) p = inputParser; addOptional(p, 'Contains', ''); addOptional(p, 'DoesNotContain', ''); parse(p, varargin{:}); d = dir(parentFolder); dfolders = d([d(:).isdir]); dfolders = dfolders(~ismember({dfolders(:).name},{'.','..'})); if isempty(dfolders) folder...
9f07f8b04b633a48648c94329472829beb516e41d5d117ae45d1c705775a61b6
MATLAB
962
31
scripts = dir("scripts/**/*.m"); scripts = string(vertcat({scripts.name})); plotting = dir("code/Matlab/plotting/**/*.m"); plotting = string(vertcat({plotting.name})); rootFiles = ["run_all", "run_boundariescondition", "run_meshrefinement", scripts, plotting]; necessaryFunctions = matlab.codetools.requiredFilesA...
321684de1ee723b05da716111bad6e11a6f77609ff2af217e6796bec9cf26660
MATLAB
963
35
function [ server, port, database ] = ReadConnection( filepath ) %READCONNECTION Read default connection settings from a file % File should contain three lines % SERVER % server = []; database = 'rabbit'; port = 1433; try fid = fopen(filepath); server = fgetl(fid); ...
56115710c5584a3243e71aa39c15410638a67cd43b5c895fc3e3791a06c9836b
MATLAB
963
28
function [sc,labels] = reorder(in_sc,in_labels,FULL_IDX) FULL_IDX = FULL_IDX(1:length(in_sc)); sc = in_sc(FULL_IDX,FULL_IDX); if exist('in_labels') labels = in_labels(FULL_IDX); end % nan lower part of functional and structual matrices % and transfer value to other half if ne...
b7e6d2dc258f3ba130d98b8c70f6659c11c0a7a975bb3f239218234f8c7385b0
MATLAB
965
37
function output = updatewater_SanesLab(varargin) %Custom function for SanesLab epsych % %This function queries the pump to obtain the delivered water volume, and %updates the GUI text, if appropriate % %Inputs: % varargin{1}: GUI handles structure % % %Written by ML Caras 7.25.2016 global PUMPHANDLE %Wait for pump...
db0eabdc73105e9f4df964ac7f1dc9815f2ce1bb8d9ee9b4c963d2ae4fcfe976
MATLAB
966
35
function vhlab2p_movecells2firstdirectory(filename) % VHLAB2P_MOVECELLS2FIRSTDIRECTORY - relabel all cells as being "drawn" in first drawn directory % % VHLAB2P_MOVECELLS2FIRSTDIRECTORY(FILENAME) % % Given an ANALYZETPSTACK '.stack' file FILENAME, this function reads in the % definition for all drawn cell ROIs and chan...
f0a6601ccaa5174289d052af1ff4fd123bb5814c6e77a195e3d93094572c0ecb
MATLAB
966
43
%% Create new atlas based on sphere around ROI centroid cubeSize = 1; % mm Patlas = 'D:\ownCloud\PROJECTS\MRI\TPM_Catlas_Slicer4\CombinedAreas_SPLIT.nii'; Vatlas = spm_vol(Patlas); Yatlas = uint8(spm_read_vols(Vatlas)); roi = unique(Yatlas(:)); roi(roi==0|isnan(roi))=[]; vxl = getVoxelSize(Vatlas); vsq = round(cube...
1ff971e062d0e35f555273f47829d6e6522d18af6b9d994ee4dbed468a0dc6d7
MATLAB
967
39
function model = dtip_pipe_NLLSd(model,data,btensors,mask,ind,parallel) % function model = dtip_pipe_NLLSd() % % reshape data and retain voxels within the mask siz = size(data); sizm = size(model); data = reshape(data, prod(siz(1:3)), siz(4))'; model = reshape(model, prod(sizm(1:3)), sizm(4))'; mask = reshape(mask, pr...
913b83573820f68668019e101612114954f43056eb6efb003069a44ff3ec74c1
MATLAB
968
26
function [clu] = epochSpikeTimes(clu,tr, epocType) % EPOCHSPIKETIMES Epoching of spike times into trials (=epochs) based on events from tr struct % % Inputs: % clu.spikeTimes: {1×n cell} % spike times in the session for each cluster % tr.'field': [1×trials double] % tr struct from loadSessi...
a2bae67c12c9fc87b58ac28fd564c297bd181ccb73e9a27254b8c65ade96226a
MATLAB
968
29
function [dataA, dataM] = getOrgData(dat,code,P) % get organized version of the data % dataA contains all / dataM the mean over repeats % dataA is bins x important stim x unimportant stim x clusters x rep %%% supposes that the number of trials is the same for a and v if ~isempty(dat) ...
333949f934fc48dc11cda1837f96a3c4d22846eb5f778984d9f6a06341aea69f
MATLAB
970
25
%%This function is to set the default fontsize for ERPLAB Studio GUIs %Author: Guanghui ZHANG && Steve Luck %Center for Mind and Brain %University of California, Davis %Davis, CA, USA % 2023 function FontSizeDefault = f_get_default_fontsize() % The value is in PIXELS, not points. Studio positions its panels in pixe...
c73fc1e1389c3b94e77df00ec7b02eedd8d7462f6b604d9855369029541bcf37
MATLAB
971
39
function handles = setupTrialHistoryPassive_SanesLab(handles) %handles = setupResponseandTrialHistory_SanesLab(handles) % %Custom function for SanesLab epsych % %This function sets up the GUI response and trial history tables % %Inputs: % handles: handles structure for GUI % % %Written by ML Caras 7.24.2016 global ...
28ae8a5cdf34788ea21426532ed67f5e86f61206b0126d7551b2a6693adfe28a
MATLAB
972
18
function compsV = interp_v_fringe_comps(midCompsV, nNodes, nCompsPerSect) % INTERP_V_FRINGE_COMPS linearly interpolates the voltages on the fringes % of the available fiber compartments % compsV = INTERP_V_FRINGE_COMPS(midCompsV, nNodes, nCompsPerSect) % returns the provided voltages midCompsV enclosed by the...
2dce31e97a41ff1c5b3aad251eebcef381dcbdcc22cbe9d9d0af57219efab66e
MATLAB
972
31
function plot_potential_comparison(model1, model2) disp('Loading potentials...'); V1 = load_potential(model1); V2 = load_potential(model2); assert(all(size(V1) == size(V2)), 'Models must have the same number of AS and fascicles'); nV1 = cellfun(@numel, V1); nV2 = cellfun(@numel, V2); missing1 = nV1 == 0; mi...
98817d390c82248bb14e14e649020505a52cb7f61f5fee72a2ef0a947aaacb57
MATLAB
972
22
%NEED TO FIGURE OUT HOW TO RESCALE IMAGE APPROPRIATELY function [startrt,imagetexture]=display_image(filePath,Window,xCenter,yCenter,screenXpixels,screenYpixels) im=imread(filePath); imagetexture=Screen('MakeTexture', Window, im); framerect = RectOfMatrix(im); [s1, s2, ~] = size(im); lengthScr...
34ea44b77e87ca9079c1aff5bc1c0d1b0d953a147964fd38f7a38045cd13b159
MATLAB
973
36
% Concatenates a cell array of strings. % % Input arguments: % adjoiner: % string separating each neighboring element % strings: % a cell array of strings to join % % See also: strsplit, cell2mat % Copyright 2008-2009 Levente Hunyadi function string = strjoin(adjoiner, strings) validateattributes(a...
fb73a60cb787b79dc068c1660bb6b3c7665cead8a2a5c6c66a1d53f8e29903be
MATLAB
974
34
function comsol_connection() conf = get_conf(); addpath(conf.comsolDir); import com.comsol.model.* % Mind that imports have an odd behavior import com.comsol.model.util.* try % ModelUtil.clear() throws ex if not connected ModelUtil.clear(); catch try %ModelUtil.connect(); % Migh...
6e0b051e2e0d9342f8aaa7a470ee7ce301c18fdadf2e8f87cb35902ed62953e8
MATLAB
977
25
function [changes,gotChanges] = analyzetpstack_getChanges(ud,i,newdir,ancestors) % analyzetpstack_getChanges - get any changes to a cell in analyzetpstack (such as moved, not present, etc) gotChanges = 0; if isfield(ud.celldrawinfo,'changes'), if length(ud.celldrawinfo.changes)>=i, changes = ud.celldrawinfo...
8fa0808c3556da1da8a915a6b9dfe11ccd3d6bb84eb50589072bb5abcbfb6372
MATLAB
977
26
function [critic] = dlRNN_criticEngine(critic,stim_cond) critic.et = zeros(numel(critic.w),1); for t = 1:critic.steps-1 critic.v(t) = sum(critic.w .* critic.x(:,t)); critic.v(t+1) = sum(critic.w .* critic.x(:,t+1)); % where d is TD error, r is reward, v is state value. Next, eligibility traces were upda...
1e7d40ddaf338882e49a72c19b614b15b3c50a9515411503e9601f246aade45c
MATLAB
979
45
function ep_SaveDataFcn_GORDON(RUNTIME) % ep_SaveDataFcn_GORDON(RUNTIME) % % Modified default function for saving behavioral data to include recorded % HeadTracker data. % % Stephen Gordon, 2016 for i = 1:RUNTIME.NSubjects h = msgbox(sprintf('Save Data for ''%s'' in Box ID %d',RUNTIME.TRIALS(i).Subject.Nam...
9a91271ccd244449d635384837e5abbac9a672e1dca5896fd991d0fb9064c3b7
MATLAB
979
26
function index = windingNumberAngles(vx, vy, loc, radius) % Estimate the winding number (Poincare index) around a circle of radius % RADIUS centred on the the row and column coordinates in LOC in the vector % field defined by VX and VY, by computing the angular differences between % all consecutive vectors. % First ch...
3131b1646b118729a5963f79dfcd3121780d5284d77469b1c1da11d1c02361fd
MATLAB
980
35
function fiberThresh = load_fiber_thresh(model, groupFasc) arguments model Model groupFasc logical = true end fascIdsByAs = load_active_sites(model.paths); nAS = size(fascIdsByAs, 1); fiberThresh = cell(size(fascIdsByAs)); % iAS x iFasc missingAS = false(1, nAS); for iAS = 1:nAS fiberActive...
83f8075ae1b20d2a4d6a21f0a8c3b7190317421633c013d88ee0b06b0c650f9b
MATLAB
980
20
erplabver = '13.10'; % current erplab version erplabrel = '29-April-2026'; % DOB erplabdeveloper = 'Winsler,Zhang,Garrett,Simmons'; %ColorB = [170 180 195]/255; % old background color (until version 3) %ColorB = [0.9216 0.8353 0.6078]; % background color for version 4 %ColorB =...
3f363185351cdfdc41230b1723ce1f3b80aa40c8d49eadb52a2f62a3e4806baf
MATLAB
981
35
function [EMGLabel] = EMGdetect(DataEMG,RestEMG) [Nsamples, ~, Ntrials]=size(DataEMG.x); Window=0.05; %Duración temporal de la ventana EMGLabel=zeros(Ntrials,2); stdRest=std(RestEMG.x); T=floor(Nsamples)/(Window*DataEMG.s); for i=1:Ntrials EMGnumber1...
5a862ae57916932763f58b2f4c4b677b855d7c3f51d7413cd8261fff74f442e4
MATLAB
982
34
function [time_mesh, meshstats] = mesh_report(model) %% Mesh % To clear meshes if already computed: % fem.mesh().clearMeshes(); fprintf(' - Start meshing\n'); start_time_mesh = start_time(); model.mesh('mesh1').run; time_mesh = finish_time(start_time_mesh); meshstats = mphmeshstats(model, 'mesh1'); fprintf([...
80db259db4fcf4fadb263c0aa5b8be87049f6203bcdbd6da5e2348004fb95bf9
MATLAB
982
40
function [nfold, folds] = getFolds(s,foldtype) nBins = s(1); nImp = s(2); nUnImp = s(3); nClu = s(4); nRep = s(5); switch foldtype case 'oddeven' nfold = 2; for ff = 1:nfold fold = zeros(nBins,nImp,nUnImp,1,nRep); fold(:,:,:,:,ff:2:end) = 1; % i...
6be32d3055914c144e1d44df89ca11ac9bff5afa4d2755d6840a481c3d5f909a
MATLAB
985
33
%% Split up preprocessed denoised data from CONN into sessions for GIFT sourcedir = 'H:\DataProcessing\conn_project_161208\results\preprocessing'; targdir = 'H:\DataProcessing\PREPROC\DENOISED_DATA'; P = dir(fullfile(sourcedir,'*.nii')); P = cellfun(@(a) (fullfile(sourcedir,a)),{P.name}','uniformoutput',false); % P(1...
9fd6586e8156d1ce8cd3d2b08f999784864e66b05841c314353c418c53ef2733
MATLAB
985
25
function [proj,u,s,v] = pcasvd(data) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/09/2010 % % pcasvd - Principal Components Analysis via (mean-subtracted) SVD. % % Usage: % [proj,u,s,v] = pcasvd(data) % % Description: % PROJ = PCASVD(DATA), where DATA is an M x N matrix, returns the M x N % matri...
e476562b9373f33f605ee5153a242c435d75f4cc1ede4c709c5236878ebeaf30
MATLAB
986
25
%% Easily find and extract the x- and y-channel of interest from a trial % Copyright (C) 2022 Richard Hugh Moulton % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the ...
36020b90ba85ff34fce37c89bec16ee38c40339508b4ac5cba8856791684971a
MATLAB
987
22
% This example script assumes that the data in % https://github.com/filip-szczepankiewicz/Szczepankiewicz_DIB_2019/tree/master/DATA/brain/MD-dMRI % has been unzipped. % % This script requires code from the multidimensional dMRI framework % https://github.com/markus-nilsson/md-dmri clear % Define path to data folder a...
b177a441142fb6df43e8c8f907533b6161fa05bc5d0640207faf9c4384dc1761
MATLAB
991
44
% fresh start clearvars close all %% run config config_file='config_mammals_1.m'; addpath(strcat(pwd,'/config')) run(config_file); %% load data filename = [ DD_PROC '/MamiNum_corrected_proc_2.csv' ] ; ssheet = readtable(filename,'Delimiter','\t') ; %% rt = readtable([ DD_RAW '/vertLife/proc/vertLife_distmat.txt']...
bcef56977b797e5eb309b71029a39e9aa21ae37ead82962d13847b5cb4ae1842
MATLAB
991
29
function [binnedArray, binCenters] = getPSTH(spikeTimes, eventTimes, window, binSize) %%% Adapted from psthAndBA from the 'spikes' toolbox (https://github.com/cortex-lab/spikes). spikeTimes = spikeTimes(:); eventTimes = sort(eventTimes(:)); spikeTimes = spikeTimes(spikeTimes>min(eventTimes+window(1))...
c0b9c19faf63282dcf4b17db6f1f5171deaa59d1b32428e73f39712ae76c9e58
MATLAB
991
42
function [remind_row,varargout] = findReminderRow_SanesLab(colnames,trials) %[remind_row,varargout] = findReminderRow_SanesLab(colnames,trials) % %Custom function for SanesLab epsych % %This function finds the row and column index for the reminder trial % %Inputs: % colnames: cellstring array of column names % tria...
395fcec0a09be818b8a9fe20052b837b551744ec0eecb956d924282937f09ddd
MATLAB
992
26
function el_add(els,elcol,msize) % Copyright (C) 2006 K.J. Miller % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your o...
64a2e3280b737a6d0e26e94fa924adaf6792cfd108bf160023f6e4d0dfe09ca0
MATLAB
992
40
function [N_points_full,pto,N_faces_full,car,Fid]=read_labels2(name) fileID = fopen(name,'r'); %Read number of points format='%s %f %s'; data = textscan(fileID,format,1,'HeaderLines',4,'Delimiter',' '); N_points_full=data{1,2}; %save points format=' %f %f %f'; data= textscan(fileID,format,N_points_full,'Col...
4eb611e4ca9c532c7441c2d9fd952294ef2eb6ec0cee9aee033f3ef26d512b71
MATLAB
994
34
%% Convert EMG txt files into matlab files clearvars close all clc %% %uncomment and change the address %address='YOUR\ADDRESS\'; subjects={'S02','S03','S04','S05','S06','S07','S08', 'S09','S10', 'S12', 'S13'}; nSubjects=length(subjects); runs={'EST','0','1','2','3','4'}; sessions=1; for s=1:nS...
da69e9230e8e7d7bdc12ebd9ed7e6e86106b9d1e9f86d162c437af8c32f304da
MATLAB
994
26
function [X_norm,Y_norm] = get_normalized_from_data_units(ax_orig,xpos_data,ypos_data,axpos) % Convert the xpos_data and ypos_data vectors, expressed in data units, in % normalized units. ax_ylim = ylim(ax_orig) ; ax_xlim = xlim(ax_orig) ; if nargin<4 % Annotation: normalized units so that (0,0) is the lo...
1076ad8e987bf42322b8341ac153a7fbc435c070dbb4ab4164d8142fc09fa2a1
MATLAB
995
33
% Creates a scatter plot between x and y, performs a linear regression and % then displays all the results. function [f,mdl] = scatterAndRegressionWithCIs(x,y,n,xString,yString,titleString,taskName) mdl = fitlm(x,y,'linear'); xVals = linspace(min(x),max(x)); [mdlVals,mdlCIs] = predict(mdl,xVals','Alpha',0.05); titleSt...
df09c7a8120809dc396a83fcd6051485bb11a01c2b23a3b437b80360e24aa3ad
MATLAB
995
34
function P = edges_to_polyline(segments) edgeCoords = reshape(segments, [size(segments, 1)*2 3]); graphNodes = unique(edgeCoords(:, 1:2), 'rows'); nEdges = size(segments, 1); G = graph(); for iEdge = 1:nEdges edge = squeeze(segments(iEdge, :, 1:2)); s = unique(find(ismember(graphNodes, edge(1, :), 'rows'...
341d64ed31107cfeacfd4707185275f3be9416c4bd51dfe368138acb764515cb
MATLAB
996
34
% test a call to exp_one_condition.m with dummy parameters % test_no_LSD = 1 in exp_one_cond % to check that the whole script can be ran without error (eg when saving data at the end) fn_dir = ['./all_data_test/'] ; if ~exist(fn_dir, 'dir') % 0 or 7 if it exists mkdir(fn_dir) end cond_idx = 0 ; ...
7081189833624846b0123e4da90d887c02a503ef63c2f002cfcb9558801f5dac
MATLAB
996
30
function tags = rmTags_SanesLab(tags) %Custom function for SanesLab epsych % %This function removes OpenEx/TDT proprietary parameter tags from a cell %array of tag names % %Written by ML Caras 8.1.2016 %Updated by KP 11.05.2016 (keep fileID tags associated with buffers); % 04.11.2017 (when more than one da...
ade7b6c6e17f5b0c5b6ebdc9d8ddfeb588189e15378118fcf47e89eefcdb6016
MATLAB
996
31
function [windowPtr,ScreenRect,frameRate] = PTB_NormalExpt_Startup(ScreenNum,useBitsPlusPlus,smallScreen) % [windowPtr,ScreenRect,frameRate] = PTB_NormalExpt_Startup([ScreenNum],[useBitsPlusPlus],[smallScreen]) % % Daniel.Stolzberg@gmail.com 2016 Screen('Preference', 'SkipSyncTests', 0); if nargin == 2 && useBitsPlus...
0a34835b5dbdc82a6a81e979eab4dc9bec5b9c65b18577cb10f2f0543c666bf2
MATLAB
999
26
function [beta_tables_taste] = all_taste_betas() % ALL_TASTE_BETAS read all three taste betas. % Note: calls connect.read_matfiles_taste for each taste % Taste strings, current: sour, salt, sweet taste_str = util.str.taste_strings(); % cell of each taste beta tables beta_tables_taste.sep = ... cellfun(@connect.rea...
2d88e4b0f3deab3c315abaa52b68e917b5a913593355ede4ddfcfb654d194178
MATLAB
999
27
function [tc, coefVar]=WaveFilter(coef,NoiseVar); % Model each detail wavelet coefficient as conditional Gaussian random % variable and use several two-dimensional moving window to estimate the % variance of each wavelet coefficient in conjunction with a Wiener-type % denoising filter %Input: % coef: ...
a50e85b84fc9902918662f254768b9d4ffa6a0f7fccb6601324560b23f645f16
MATLAB
1,000
17
%Code by Isaac Arias S - YachayTech University %Biomedical Engineer Student. %School of Biological Sciences and Engineering. clc;close all;clear all; load netTransfer5; % Database se puede reemplazar por cualquier modelo entrenado sample_image_folder = fullfile('C:\Users\acer.LAPTOP-5D7SPG9D\Desktop\Isaac\Yachay...
15c57ecf90ea7ad409f04bd200e264caa34c9553eb45aeec238805dc2fc00ed6
MATLAB
1,002
40
function [ IDs, url] = QueryODataIDs( endpoint, query ) %QUERYODATAIDS Runs an OData query and returns a list of IDs url = [endpoint '/' query]; disp(['Executing OData query: ' url]); try data = webread(url, ODataWebOptions()); catch ME IDs = []; switch ME.identifier...
1b3fb4bbed3f30a2c1283941fcd9efa535db2179b2c71126a67c5e4b716f1baa
MATLAB
1,002
40
function func_SaveFigs(Parm) % Save all open figures FileRun = Parm.FileRun; Stages = Parm.Stage; Ask = Parm.SaveModels; if strcmp(Parm.PATH{1}(end),'/')==0 Parm.PATH{1} = [Parm.PATH{1},'/']; end if strcmp(Parm.PATH{2}(end),'/')==0 Parm.PATH{2} = [Parm.PATH{2},'/']; end FigList = findobj(allchild(0),'flat',...
a1ca9d17ef3b056b8167fc02c2cc83de2428cd71b3ae5db90fc3304813ab2534
MATLAB
1,002
52
function change_wav_fs() % Select the folder containing sound stimulus files [pnst] = uigetdir('D:\stim\','Select folder of stimulus files'); soundfiles = dir([pnst '\*.wav']); soundfiles = {soundfiles.name}; for iWAV = 1:numel(soundfiles) % Select sound file(s) wavfilename = soundfiles{iWAV}; wavfile = importd...
0924dccbc64f49dd26293c7d66eed3c484b7667391e2449bcb2ed3f0e4fbffc8
MATLAB
1,003
40
function bits = Mask2Bits(mask,nbits) % bits = Mask2Bits(mask) % bits = Mask2Bits(mask,nbits) % % Converts a bitmask to an array of bits. % % The input mask must be a scalar integer. An optional second input can be % specified to determine the number of bits to return % % Output will be an array of 1's and...
3e05ac6f8d7231d06de0bee762cba98b5db14ae6fb80fb07c98df297f9a9d17d
MATLAB
1,004
44
function [epochEMG]=ExtractTrialsEMG(address,ID, run, DataEMG,opt) % cargamos los datos de EEG para sincronizar los segmentos de EMG in_EEG=[address '\EEG\' ID '\' ID '_FILT_S1R' int2str(run)]; load(in_EEG); target_ind=stims(:,2)==770; nontarget_ind=stims(:,2)==772; ind=logical(target_ind+nontarget_ind); Can...
55a756bd3a4058f7673d4a36c9de11a0dde1dc225f989be8cf3a09bd995e13a8
MATLAB
1,005
39
function [ratio_htt] = compute_directional_preference(gcMat, nl, nr) % [ratio_htt] = compute_directional_preference(gcMat, nl, nr) % htt stands for "head-to-tail", or rostral-to-caudal. % % compute W_{RC}, the directional bias for ipsilateral links % % Input: 1. gcMat: the GC matrix % 2. nl: numbe...
c8853e80563ce77b421a32a768f1b72b6de18156b7c05ed197a4446ccbdcfb21
MATLAB
1,006
45
function ep_SaveDataFcn(RUNTIME) % ep_SaveDataFcn(RUNTIME) % % Default function fo saving behavioral data % % Use ep_RunExpt GUI to specify custom function. % % Daniel.Stolzberg@gmail.com 2014 % Copyright (C) 2016 Daniel Stolzberg, PhD for i = 1:RUNTIME.NSubjects h = msgbox(sprintf('Save Dat...
fa3657dc4dcdbcedda505d2f1543ada6282316afc8a94185899e5b111f74b833
MATLAB
1,007
39
% Options for the beep sounds %%%%% (1) default beep disp('Sound 1 --- press enter') ; pause ; beep on; beep %%%%% (2) sounds (Cedric) [y1,Fs1] = audioread('Beep.wav'); [y2,Fs2] = audioread('Cue.wav'); [y3,Fs3] = audioread('finish.wav'); % === Long sound % disp('Sound 2 --- press enter') ; pause ; ...
94443e64893fe2ed37d2fb4cf8bcd5c98c94628335d63d620a4159759c148db7
MATLAB
1,009
36
function [AnswersEmb, AnswersViv, AnswersPci] = QuestionnaireData(patient) AnswersEmb = []; AnswersViv = []; AnswersPci = []; questionsViv = 2; questionsPci = 6; numberConditions = 2; filename = strcat('Patient', int2str(patient), '/Patient', int2str(patient), 'Questionnaire....
15e1a3c599e93e03a7909cc11579ef00645c992ff06c459e565c0abd5786428b
MATLAB
1,012
45
%Create a serial connection to the pump clear all; clc pump = serial('com1','BaudRate',19200,'DataBits',8,'StopBits',1,'TimerPeriod',0.1); fopen(pump); warning('off','MATLAB:serial:fscanf:unsuccessfulRead') set(pump,'Terminator','CR','Parity','none','FlowControl','none','timeout',0.1); %% Set up pump parameters. f...
4e39b6d25115bd776f6af2bbe8da8bbf5fc9f2b5a28ac4716502372f7dc9af2a
MATLAB
1,013
27
function [proj_train, proj_test, M, muTimeCourse, mu, sigma, spkData_test_res] = getProj(spkData_train,spkData_test,P) %%% Will compute the components on the train set, and project the test %%% set. %% Get components from the train set [proj_train, M, muTimeCourse, mu, sigma] = getComponents(spkData_tr...
a9f9fded8eef8d999e70e2212edb737193fdd00492643ae5763881e99a0282f0
MATLAB
1,013
39
function model = qtip_pipe_NLLSdc(model,data,btensors,mask,ind,parallel) % function model = qtip_pipe_NLLSdc() % % reshape data and retain voxels within the mask siz = size(data); sizm = size(model); data = reshape(data, prod(siz(1:3)), siz(4))'; model = reshape(model, prod(sizm(1:3)), sizm(4))'; mask = resha...
28145fac54b06c0d98c656efe501ea7f998cfe099881477b0eac228bcf66eee9
MATLAB
1,016
37
%%This function is to compute the specific time-range for xth columns for %%GAP setting function [bindatadjust,Xtimerangeadjust,Xticksadjust] = f_adjustdata_xyrange_xyticks(bindatatrs,Xtimerange,qXticks,offset,NumColumns,PosIndexs,stepX,fs) bindatadjust = []; Xtimerangeadjust = []; Xticksadjust = []; if isempty(s...
648712734812e243bf450ed8f2c8471166c9c0ce6bf690e75854e850db93e7ab
MATLAB
1,016
36
function [fiberActive, recrName] = load_activation(model, iAS, anode) arguments model Model iAS anode = nan end % ... specify activations source file name if isnan(anode) recrFile = model.recr_file(iAS); else recrFile = model.recr_file_bipolar(iAS, anode); end if nargout > 1 [~, r...
792d3ddf245b065066e860abb350af42217d5687d5e827ab439568f79f47605b
MATLAB
1,016
36
function [] = plot_single_topo(data_topo, chanlocs, fn_topo, tit_fig, ... avg_cmap_levels, eps_fig, fig_fig, pdf_fig, topo_style, numC_topo, cmap_topo, add_hc, hc_title) % Plot data_topo on a topoplot & save. taille_axis = 24 ; taille_axis_cbar = 15 ; if nargin<13 hc_title = '' ; end if nargin<12 ...
a79ccb34abf6b7a6071d8b27f6b925b6106df51d638b30bc1104c7eb728f6841
MATLAB
1,016
34
%% This is the program we use to obtian image sequences and mean images clear;clc; temp='SONY_A7II_ISO1600'; img_dir =sprintf('G:/dataset_denoising/%s/',temp); %static scenes out_dir = 'G:/dataset_denoising/added'; imgs = dir(fullfile(img_dir,'*.JPG')); mean_values = zeros(length(imgs),2); mean_values(:,2) = [1:l...
19e72210cb7397c62e5043c5d1f991a78fd6afdf4411404031634d6d14f60a40
MATLAB
1,017
32
%% Script to compare the beta values in relation to the animals used in each experiment % Rinse betas indices all_beatas 31:2:59 util.clearAll; outdir = fullfile(util.get_paths().figs,'controls', 'animals'); util.mkdir(outdir) beta_tbl = util.load.beta_table(); %% Split data by animal identity [G, TID] = findgroups(b...
132592613760ead534eb4a6551c221a99083c80931262f3cdf9ba51595be3da5
MATLAB
1,018
26
function [V, S] = initialiseProblem(cell_models, model_assignments, active) % Initialises the problem at a number of points specified by N, according % to the model specified % Loop over all cell models present in this simulation, processing all % cells assigned to a single model as one batch V = zeros(size(model_ass...
87c09145a237abc7395dc4158b0ded651ddad3677815acc781b04c2e644ce8f0
MATLAB
1,021
35
% gets the number of hyperparams for the horseshoe prior function [dim_H] = getDimH(rank, prior_setup) if( prior_setup.V.N_scales > 0) NS = prior_setup.V.N_scales; else NS = 0; end if(~isfield(prior_setup.V,'N_hyperparams')) NH = 0; elseif(isa(prior_setup.V.N_hyperparams, 'function_handle')) NH = prior...
8e13ffaefc7feb949072c1ffcf049ecbd931e7c9bf8991a14ab23bb20e16d134
MATLAB
1,022
28
function [idx_select_mod, n_tot_epoch, vec_n_epochs] = find_idx_conds(... lwdata_subj, str_to_find) % Function used to find the index of conditions with names containing the % input string 'str_to_find'. n_mod = size(lwdata_subj,2); vec_n_epochs = [] ; % vector containing the nb of ep...
7093a0df5fc74ad5d60f07645cd3ad87fe930de582b6b33857f77b8bda7d7534
MATLAB
1,024
47
function calculateAtten % % This function selects the hold time from a range of possible times % % Required gf parameters: % attenMin % attenMax % attenSteps % aInd % % Parameters generated: % atten global gf % Linerarly spaced array of times from min to max (dB) gf.attenRange = gf.attenMin :(gf.attenM...
596f52d8ef02b04799c7d7a29d53fe535830a1cf717928eb5061a4e915888252
MATLAB
1,025
27
% netBurstDetection_save.m % saves the result of NB detection function netBurstDetection_save(inputFolder, outputFolder, userParameters, NB, NBpattern) numExp = find_expnum(inputFolder, '_BurstDetectionMAT'); trialFolders = dir(inputFolder); trialNames = {trialFolders(:).name}; % discard . and .. trialNames = trialName...
55201e353fb756d63bfc82acb8faddf75c1658f89b88fd47238a27ecfdd091f8
MATLAB
1,026
41
function [ alpha ] = backtracking_line_search(problem, p, x, rho, c) % Backtracking line search % % Inputs: % problem function (cost/grad/hess) % p search direction % x current iterate % rho backtrack step between (0,1), e.g., 1/2 % c parameter bet...
681a6a974b5d959dd09e28d8a65e409100cc68e5abf06f2becd2c4ace4809686
MATLAB
1,026
40
function visualPolar(h,x,prop) persistent p p2 %Define the shape and colour of the dot based on elevation and target %heading if x(6) <= -1*20 dotColour = 'bo'; elseif x(6) <= 20 if (x(5) > (prop(2,prop(1)) - prop(3))) && (x(5) < (prop(2,prop(1)) + prop(3))) dotColour = 'g*'; else dotColou...
230fdb7dbf4ef47a1ed29c7f51d20cc238f6771b686f2deab8c2769cf38b0967
MATLAB
1,027
30
function models = get_models_list_flat() [modeList, electrodeTypeList, placementList, paramList] = get_models_list(); models = table('Size', [nestedNumel(paramList) 4], 'VariableTypes', {'cellstr', 'cellstr', 'cellstr', 'cellstr'}, ... 'VariableNames', {'Model', 'ElectrodeType', 'Placement', 'Paramset'}); i =...
52f5015ae2c388fd654667f00d66868fe2c0ebb7173e7c3664e0973e350392e8
MATLAB
1,028
43
function BitsTrigger(window,vbl) % BitsTrigger(window,vbl) % % Sets the Bits# trigger out (TrigOut) to send a 1 ms pulse on the next % call to Screen('Flip',window,vbl). Call this function just prior to the % Screen('Flip',window) command that you actually want to synchronize with % the external trigger. % % The first...
8b32b921556b0cb16336b70f52f1733559a6a0f53659e857004535c26cc5ed1e
MATLAB
1,028
50
function fit1 = fitness_soea20(A1, paramsvec, eegdata1, paramstoest, T1,tcut, fhz1) paramsinput = [paramsvec, zeros(1,10)]; paramsinput(paramstoest) = A1; % load in the data to fit against eegautocor = eegdata1{2}; a2=[]; parfor RunIter = 1:5 % run 5 times for stability: - take the mean value for the fitness fu...
8c05846914b6c0bd1c38385e100b233bc7be1181e4c312e6e4de05fbf7a2af05
MATLAB
1,029
30
%% Setup util.clearAll; outdir = fullfile(util.get_paths().python_datadir,'connectivity_matrices'); util.mkdir(outdir) c = util.plot.getColors(); beta_tables_taste = util.load.all_taste_betas(); %% Write combined matrices var_strings = {'high_low_betas', 'rinse_Betas'}; save_strings = {'tastant', 'rinse'}; avg_cor_all...
4a7213572dbfbb025a7f0cc2b0d9dcd4068057d203eaa9c34a4451b37a4dd813
MATLAB
1,030
33
function [pgh] = plotBootDistr(meanPl, CIs, xPlotPos, samples) %plotBootDistr function to plot the distribution of all values from the boostrapping procedure % % plotting parameters alpha_pl = 0.001; % alpha for plotting range of distribution distWidth = 0.6; % plotting width of the distribution % create k...
cbb150393a52acf3f473355f37de958cdf8dd16c895ec5809196841a0a97151d
MATLAB
1,031
39
function plotScatterHist(c,P,xedges,yedges,nonewfig) tmpAll = []; for k = 1:P.nMice tmpAll = [tmpAll, c{k}]; end if ~exist('xedges','var') l = prctile(tmpAll(1,:),[1,99]); xedges = linspace(l(1),l(2),30); end if ~exist('yedges','var') l = prctile(tmpAll(2,:),[1,99]); yedges = linspace(l(1),l(2),3...
ad3d2da1af4743afa4f32a928ff89ade5878a7b6e238eb842ba88ddf04d12cf7
MATLAB
1,032
49
% PURPOSE : Compute the default number of row and columns when plot ERP % waves and this function is based on the ERLAB function in ploterpGUI() % % FORMAT : % f_getrow_columnautowaveplot(plotArray); % % % INPUTS : % % plotArray -Index of Grid e.g., [1 2 3 4 5 6 7 8] % OUTPUTS: % % pbox -First...
f167a90e67233343995d73ba37f56d217d7a14a33f29b15e93055bfbf7f55b8e
MATLAB
1,033
49
clc; clear; close all Fig5d=figure(); NN = 500; %number of afferents N_mu=20; %There are \mu independent embedded patterns, 500 simulations (number of simulations) Results1=zeros(N_mu,NN); % w_{\it{BPBP}} Results2=zeros(N_mu,NN); % w_{\it{BP}} for p1=1:N_mu try eval(['load Learnin...
e6852c4c937d432817141432dc6b1e081b8fc0ef7933df56eb48bc64a3192b1c
MATLAB
1,034
37
function m = mode_guesser(x,p) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/09/2010 % % mode_guesser - guess mode of the % % Usage: % m = mode_guesser(x,p) % % Description: % Guesses mode by looking for location where the data is most tightly % distributed. This is accomplished by sorting the ve...
11a9e2d8774670c058200921c4e86a622a342cdd5ebc5215253193cf29b12396
MATLAB
1,036
33
function draw_cross(key,Window,xCenter,yCenter,cross_coords,duration) startTime=GetSecs; Screen('BlendFunction', Window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA'); % Draw the fixation cross in white, set it to the center of our screen and set good quality antialiasing Screen('DrawLines', Window,...
73fa9f72f84f26950de9268497fd357578153fe7ffd8317b2d9a0628d8fa16c2
MATLAB
1,037
37
% Fetches the value of the named property of an object or structure. % This function can deal with nested properties. % % Input arguments: % obj: % the handle or value object the value should be assigned to % name: % a property name with dot (.) separating property names at % different hierarchy levels...
1914ee44029784ed1ef6797e03259454b218ed27a8ffcf624005c9149c179e19
MATLAB
1,038
37
function inf=fluoview_tiffinfo(imgname) %FLUOVIEW_TIFFINFO parses image description information from Olympus Fluoview Multitiff % % INF=FLUOVIEW_TIFFINFO( FNAME ) % % 2008, Alexander Heimel & Danielle van Versendaal % inf=imfinfo(imgname); % parsing inf.ImageDescription % only of first info structure (subsequent ti...
7ddbd2b92f6f0bce3f17cec36a0be63845be51288334106c1abf39bdf4248277
MATLAB
1,038
32
function [Accuracy,auc,C,probs] = DeepInsight_test_CAM(dset,Out) % [Accuracy,auc] = DeepInsight_test_CAM(dset,Out) %Out.bestIdx = BayesObject.IndexOfMinimumTrace(end); %Out.fileName = BayesObject.UserDataTrace{Out.bestIdx}; auc=[]; current_dir=pwd; cd DeepResults savedStruct = load(Out.fileName); %Out.valError = saved...
de1b14998d556d913088c6cf6cddd3749d4bb05d9e6a7821e82a34ad1892fb3a
MATLAB
1,038
36
%% run simulation and save results load('optimized_params.mat'); glmprs = setup_sim(params); [~,sps,Itot, Istm,] = run_sim(glmprs); % Simulate GLM response save('sim_results.mat', 'sps', 'Itot', 'Istm', '-v7.3'); %% Animate results and save as an .avi file load('optimized_params.mat'); figure v = VideoWriter('burst_an...
3bad6b00aa94fd40f22912d258a6b29f9ce24b0d84527b90ac85d66d3a2abb68
MATLAB
1,039
46
function CAMshow(im,CAM) imSize = size(im); if length(imSize)>2 if imSize(3)==1 im=cat(3,im,im,im); end elseif length(imSize)==2 im=cat(3,im,im,im); end CAM = imresize(CAM,imSize(1:2)); CAM = normalizeImage(CAM); CAM(CAM<0.2) = 0; cmap = jet(255).*linspace(0,1,255)'; CAM = ind2rgb(uint8(CAM*255),cm...
f08636f317b9c3e9dd1bf62dd1dfb8b87216d92aeaab31571aa0113947302eeb
MATLAB
1,039
27
%% Copy one task's metadata into another struct % Not all tasks have the exact same set of features, but it should still % be possible to include them. % Copyright (C) 2022 Richard Hugh Moulton % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public...
48436f27e0dd819a208a3fb667a4367f8541a86b653d5103188efa08e6254dc4
MATLAB
1,042
45
function C = TrialFcn_Gabor(C) % Create a parameterised Gabor grating using the function "Gabor" and % Psychtoolbox persistent win w vbl if C.tidx == 1 % Screen('Preference','SkipSyncTests', true); win = 3; w=Screen('OpenWindow',win, 128); vbl = []; end if C.FINISHED || C.HALTED Screen...
9ed1975209710f4e8c3c188a33319e07cd15228e1b55fa4d3dfa8d3721dc6fc2
MATLAB
1,042
35
function y=view_spatialtemporal_evolve(Ve) % look at the spatial evolution of the simulated data % Ve is a N x N x L array to record the simulated data in L steps figure; set(gcf,'Position',[100,50,450,400]); L=size(Ve,3); % wrap = vertcat(jet,flipud(jet)); % Ve=Ve(:,2:L-1); for step=1:L pcolor(Ve(:,:,step)); s...
eb5309b65376c8588b844999167cc4027d128bb68b273341bef53f1b3ab4efe2
MATLAB
1,044
36
function [ratio_ipsi] = compute_ipsi_vs_contra(gcMat, nl, nr) % [ratio_ipsi] = compute_ipsi_vs_contra(gcMat, nl, nr) % % compute W_{IC}, the directional bias for ipsilateral links % % Input: 1. gcMat: the GC matrix % 2. nl: number of neurons on the left chain % 3. nr: number of neu...
321966de2a4c617decd450d71171701dcf97e61f25f98f0da1e9705c68844bf8
MATLAB
1,047
37
function mvpc2memory(MVPC,indx) mvpcm = findobj('tag','linmvpc'); nmvpcset = length(mvpcm); for s = 1:nmvpcset if s == nmvpcset-indx+1 %bottomup to topdown counting set(mvpcm(s),'checked','on'); set(mvpcm(s),'ForegroundColor','#0072BD'); menutitle = ['MVPCset ' ... num2...
aac380620d3c5c4c032fb321fb816db3b5e9f2b9e166708779db49c350682d76
MATLAB
1,047
37
function best2memory(BEST,indx) bestm = findobj('tag','linbest'); nbestset = length(bestm); for s = 1:nbestset if s == nbestset-indx+1 %bottomup to topdown counting set(bestm(s),'checked','on'); set(bestm(s),'ForegroundColor','#0072BD'); menutitle = ['BESTset ' ... num2...