sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
7d819d24aaaa4b6d1ca6393eeff08eec7b580dcf52e35769e1bddd75181a010b | MATLAB | 364 | 16 | function sFiles1 = do_find_sfiles(sFiles_name,dd3, tag)
clear idx idx1
for i=1:size(tag,1)
idx{i} = find(contains(sFiles_name,tag(i,:))==1);
end
idx1 = sort([idx{1}, idx{2}]');
clear sFiles sFiles1
for i=1:length(idx1)
sFiles{i} = dd3(idx1(i)).name;
tkz = tokenize(sFiles{i},'/');
sFiles1{i} = fullfile... |
ce9f3178b00f2e796cf6ac4a97b3a45d314e9f517c3b368cc6cdeeb7441feba1 | MATLAB | 364 | 35 | % Add folders to path.
addpath(pwd);
cd sparse_gd_solver/;
addpath(genpath(pwd));
cd ..;
cd line_search/;
addpath(genpath(pwd));
cd ..;
cd problem/;
addpath(genpath(pwd));
cd ..;
cd tool/;
addpath(genpath(pwd));
cd ..;
cd plotter/;
addpath(genpath(pwd));
cd ..;
cd sparse_gd_test/;
addpath(genpath(pwd));
cd ..;
... |
e93c3933553cdd55a6ae30bd72f232255330c7261df1809221007cfdecb9a2eb | MATLAB | 366 | 13 | function [x, y] = interp_fiber_centers(fibers, z)
x = nan(1, height(fibers));
y = nan(1, height(fibers));
for iFiber = 1:height(fibers)
zs = fibers.center(iFiber,:,3);
xy = reshape(fibers.center(iFiber,:,1:2), [], 2);
[~, uniq] = unique(zs);
xy = interp1(zs(uniq), xy(uniq, :), z);
x(iFiber) ... |
97cc0f4081dbfe7b0399620439c75322b707cd25b31d1e2c9b66fe4522301001 | MATLAB | 368 | 12 | function [im,fname]=tpreadframe(dirname,fnameprefix,cycle,channel,frame)
%TPREADFRAME
% read frame from multitiff
%
% 2008, Alexander Heimel
% 2017, Steve Van Hooser
%
fname=fullfile(dirname,tpfilename(fnameprefix,cycle,channel,frame));
cycle_string = ['Cycle_' int2str(cycle)];
im=imread(fname,frame,'info',getfield(... |
0cb7435596b56bd187e09ebc46447ba0cff33dbd5aad7689dd8149fc1f51391b | MATLAB | 369 | 9 | function problem = applyCondMult(problem, factor)
% This function simply replaces the conductivity tensors in the provided
% problem with new tensors that have been scaled by the provided factor
problem.D_tensor.D_xx = problem.D_tensor.D_xx * factor;
problem.D_tensor.D_xy = problem.D_tensor.D_xy * factor;
problem.D_ten... |
bf5a25f022aa2bd3f639db184be5185849aab5e62361e6f51524f7e129f49879 | MATLAB | 369 | 14 | function tbrename(old,new)
% tbrename Rename MySQL table [mym utilities]
% Example tbrename('old',new')
if istable(new)
error('Table %s already exists',new)
end
if ~istable(old)
error('Table %s not found',old)
end
try
mym(['rename table ' old ' to ' new])
catch
error('Table %s not ren... |
46d1269b6f0b6caa6c2c96d0561bde7b7b2d31270d6725788513971de7568dbf | MATLAB | 370 | 10 | function[i] = isdbase(name)
% isdbase True if MySQL database exists [mym utilities]
% Example if isdbase('junk'), dbdrop('junk'), end
if ~myisopen
error('No MySQL connection active; use ''myopen'' to connect')
else
% new compilation of mym returns structure. DJS 1/2013
dbs = mym('show databases');
... |
aa4576a56fb9dbe3bd16deacbab6f9850a467b5a5bb722e144e07f59c62673a5 | MATLAB | 373 | 14 | function idx = wParamIdx(TRIALS,param)
% idx = wParamIdx(TRIALS,param)
%
% Helper function returns index to a write parameter (param).
%
% Returns empty if the parameter is not found in TRIALS.writeparams.
%
% See also rParamIdx, SelectTrial
%
% Daniel.Stolzberg@gmail.com 2016
% Copyright (C) 2016 Daniel Stolzberg,... |
57bcf9c68727f29cce6060b9a68f7b210acb0d9d7be85db76c924a7801b85184 | MATLAB | 374 | 19 | function cm=fluoview_colormaps(c)
%FLUOVIEW_COLORMAPS creates RGB colormaps (red: c=1, green: c=2, blue: c=3) for Olympus
%Fluoview Multitiff or other images
%
%CM=FLUOVIEW_COLORMAPS ( C )
%
%2008, Danielle van Versendaal
cm(64,3)=0;
cm(:,c)=linspace(0.015,0.984,64)';
% cm(64,3)=0;
% j=1/((length(... |
78a0ed2360b8fa12e8400d312f405fd4efd9b30427f8ed917bb9ca5dc372dd95 | MATLAB | 374 | 17 | function pred = mat2pred(mat,lag,paddingval)
% lag will padd on each side
if ~exist('lag','var')
lag = 0;
end
pred = permute(mat,[1 2 3 5 4]);
s = size(pred); s(end+1) = 1;
if lag>0
pred = cat(1,nan(lag,s(2),s(3),s(4),s(5)),pred);
pred = cat(1,pred,nan(lag,s(2),s(3),s(4),s(5)));
s(1) = size(pred,1);... |
d16bc00e6032dd3a538dc55594c98a8e298842f05f9db3cf3d6affe9d3a36357 | MATLAB | 376 | 24 | function X = checkFixate3(x, initBuffSize, Tol)
persistent P i
if abs(x(1)) < Tol && abs(x(2)) < 5
currentValue = 8;
else
currentValue = 0;
end
if isempty(P) || length(P) ~= initBuffSize
P = randi(99,initBuffSize,1);
i = 1;
end
if i > initBuffSize, i = 1; end
P(i) = currentValue;
i = i + 1;
if curr... |
e64f5232b067a65efa88dde16f1a5bb33c0ee1b4971d58f24e10b53cd8ce3008 | MATLAB | 376 | 10 |
overallPath = '/Users/matttang/IDrive-Sync/Matt/Work/Current work/Rodent V1 and prediction/' % where the scripts are stored
dataPath='/Users/matttang/Downloads/Saved' % where the data is stored
outputPath=[overallPath 'Output'];
addpath(genpath([ overallPath 'FinalScripts/Functions']));
figPath =[overallPath 'Figure... |
1998a9fd9e854b80fc255dc1fd33c005c63193c169efa8eec6d6ccd164b5c2a2 | MATLAB | 378 | 13 | function tbdrop(table)
% tbdrop Delete MySQL table [mym utilities]
% Example tbdrop('project.junk')
if ~myisopen
error('No MySQL connection active; use ''myopen'' to connect')
else
try
mym(['drop table if exists ' table])
catch
error('Table %s could not be deleted; use ''tbli... |
76a1e26e27c1c5b27e93ddf75eb8a6c412c0998c5537ae88013f396dd6454f34 | MATLAB | 379 | 14 | function [mergedData] = mergeData(data)
totalLength = 0;
for i = 1:length(data)
totalLength = totalLength + size(data{i},2);
end
mergedData = zeros(size(data{1}, 1), totalLength);
currentEnd = 0;
for i = 1:length(data)
mergedData(:,(1:size(data{i},2))+currentEnd) = data{i};
... |
96e5c4b239a27c018f8d8d26add4307965694a187ee405a12b5a24c3384d9672 | MATLAB | 379 | 17 | function fps = GetAverageFrameRate(self)
videoNames = GetVideoNames(self);
totalTime = 0;
totalFrames = 0;
for i = 1:length(videoNames)
currAnnot = Annotation(self, videoNames{i});
ts = currAnnot.GetTimeStamps();
if ~isempty(ts)
totalTime = totalTime + ts(end);
totalFrames = totalFrames + ... |
7b7e8ac303766c34c12ee6f51dee8754a93cd3cd53ca892be9e2aae8ac8dd8fa | MATLAB | 380 | 25 | function [open, G] = Na_channel_open(phi, G, mesh, t)
%open = Na_channel_open(phi, G, mesh, t)
% Cleft
V(1) = phi(mesh.Nai_cell1)-phi(mesh.Nae_cell1);
if V(1) >= 30
G.Na_closed = 1;
end
if isfield(G, 'Na_closed') && G.Na_closed
open(1) = 0;
open(2) = 0;
elseif t > G.Na_open_time
open(1) = 1;
ope... |
a9cdc2dfaed5178e293a197fc193ceaf7d597bc7e9217024e45e015eb53f9245 | MATLAB | 380 | 17 | function closefigs
% Closes all figure windows except main TP analysis windows
% (twophotonbulkload and analyzetpstack).
%
% GS
hands = get (0,'Children'); % locate all open figure handles
for i=1:length(hands)
if strcmp(get(hands(i),'Tag'),'twophotonbulkload') | strcmp(get(hands(i),'Tag'),'analyzetpstack')... |
ea73429823f6039146e07f940b4339a4e6e6d422194d1f89ec9ab86db5df047e | MATLAB | 381 | 8 | function invariants = compute_dti_invariants(model)
siz = size(model);
mreshape = reshape(model, prod(siz(1:3)), 7);
D = mreshape(:,2:7) * 1e9;
invariants.s0 = squeeze(model(:,:,:,1));
[invariants.FA, invariants.AD, invariants.RD, invariants.ax_dir, invariants.FA_col] = compute_lamda_params(D,siz);
invariants.MD = 1/3 ... |
879b26c73775ce4d249bbd8995df2eb1045462114237899f513a5633944a33f7 | MATLAB | 382 | 15 | function [ ] = write_to_txt(filename, str_to_write,permission,nb_lines)
% Add str_to_write and then nb_lines empty lines in the file filename.
if nargin<3
permission = 'a' ;
end
if nargin<4
nb_lines = 0 ;
end
file_txt = fopen(filename,permission);
fprintf(file_txt, '%s', str_to_write) ;
fclose(fil... |
95802492ab2c9ffb591aac2b12faba4dd4e9f1051dd1f3ad8a4c40122f4e522c | MATLAB | 383 | 14 | function [V, S] = initialiseTT3epi(N_cells)
% This function initialises V and S to the starting values for the TT04
% model (epicardial), creating vectors of length specified by N_cells
% Initial values
V = -86.2;
S = [ 0, 0.75, 0.75, 1, 0, 0, 1, 1];
% Build matrix of these values repeated the requested number of tim... |
b3eea3654ef78dbc18d21056aec32dc0c38059fbf501d28a93e753c750e52cfe | MATLAB | 383 | 15 | function loop_models(func)
% Execute function for each model, e.g. loop_models(@plot_all)
models = get_models_list_flat();
for iModel = 1:height(models)
model = Model.load(table2struct(models(iModel, :)));
try
func(model);
catch ex
fprintf('Error for model %s', model.fullName);
... |
3fd70f4f72e910779ced2914e3f1be0f876841c5033cf0f1e7ad3fae16d3fdea | MATLAB | 384 | 11 | function scatter_plot (labels, predicted_labels, plot_name)
%plot results
figure;
plot (labels, predicted_labels, 'o');
axis ([min(labels(:)) max(labels(:)) min(labels(:)) max(labels(:))]);
%set (gca, 'XTick', [0 1 2 3 4]);
xlabel ('Actual score');
ylabel ('Predicted score');
plot_title = plot_name;
plot_title... |
40fab1935691d2190491415849ddcacd96958bf15bbe83a3428bef4e498092f6 | MATLAB | 385 | 25 | linkout_site=[];
receive_site=[];
% 1. region-to-region
% for i1=1:30
% for j1=1:30
% linkout_site=[linkout_site;[i1,j1]];
% end
% end
% for i1=51:80
% for j1=51:80
% receive_site=[receive_site;[i1,j1]];
% end
% end
% 2. point-to-point
linkout_site=[63,38];
receive_site=[38,63];
LRpo... |
8e8c1c0af4357df5f4dd93931ba1a38c53abe0c7e7cc368eeb1cefbe6eef3071 | MATLAB | 386 | 10 | function numRecrFibers = count_recr_fibers(fiberActive, Q)
% Count the total number of fibers recruited by the active site at each Q level
numRecrFibers = zeros(1, numel(Q));
for iQ = 1:numel(Q)
for iFasc = 1:numel(fiberActive)
numRecrFibers(iQ) = numRecrFibers(iQ) + ...
... |
8cf50348e656f374f820dbcdc3aca3a370486f837e9f20fa8d9eddde4868907b | MATLAB | 387 | 8 | %[ Structs, Locs, LocLinks ] = IO.Local.FetchLocalData('TestData\OverlapCulling');
%PPlot2(Structs,Locs,LocLinks,'Debug',1);
[ Structs, Locs, LocLinks ] = IO.Local.FetchLocalData('TestData\OverlapCullingVerticle');
PPlot2(Structs,Locs,LocLinks,1,100,'um','Debug',1);
%[ Structs, Locs, LocLinks ] = IO.Local.FetchLocalD... |
f3cdf4969a7d611620fd6fa3857aaa793d7b823dda59a8905332d741adabb353 | MATLAB | 387 | 14 | function [V, S] = initialiseTT3breakup(N_cells)
% This function initialises V and S to the starting values for the TT04
% model (epicardial), creating vectors of length specified by N_cells
% Initial values
V = -86.2;
S = [ 0, 0.75, 0.75, 1, 0, 0, 1, 1];
% Build matrix of these values repeated the requested number of... |
04d356f93538b93152c31032fe3fa8ec1da704f99f3322b0de4324b0d50c0b90 | MATLAB | 388 | 15 | function correctedSpectrum = applyPhaseCorr(freqAxis, complexSpectrum, pCorr0, pCorr1, centerFreq)
% based on a script from Ariane Filmer
% 0th order correction
correctedSpectrum0 = exp(-1i*pCorr0*pi/180)*complexSpectrum;
% 1st order correction
freqAxis = freqAxis - centerFreq;
PhpFreq = freqAxis.*pCorr1;
... |
57300b0f278943ac0203538a5b0ece0b29cd6061f2bdd9a6537f8c71b80d7737 | MATLAB | 388 | 12 | function Inew = convertColor(Iold)
Inew = Iold;
for row = 1: size(Inew, 1)
for column = 1: size(Inew, 2)
if(Inew(row, column, 1) == 242 & Inew(row, column, 2) == 0 & Inew(row, column, 3) == 0)
Inew(row, column, 1) = 221;
Inew(row, column, 2) = 2;
... |
bfb60525c4d1dc5a25d0500d4f1ed61e56c12f4547a8a49094ea238bdfb64503 | MATLAB | 388 | 14 | % load the data
util.clearAll
beta = util.load.beta_table();
%% Add averages
beta.mean_low_betas = cellfun(@mean, beta.low_Betas);
beta.mean_high_betas = cellfun(@mean, beta.high_Betas);
beta.mean_rinse_betas = mean(beta.rinse_Betas,2);
beta.mean_HL_betas = mean(beta.high_low_betas,2);
%% Linear modeling
lm = fitlm(... |
e72120309581877e0e8e27f7fc363f20a30a12e2cb4f0b43704f971ed80d8314 | MATLAB | 388 | 12 | %Code by Isaac Arias S - YachayTech University
%Biomedical Engineer Student.
%School of Biological Sciences and Engineering.
close all;clc;clear all
%Load the corresponding netTransfer
load netTransfer5.mat;
%Plot the confussion matrix, target and output values are swap
%to obtain the "know" values as rows... |
1494a7f476a5506fcd9b651e4e75e30cef38c5af397957e4f5da50a9259eeae2 | MATLAB | 389 | 10 | function [data_one_taste] = add_taste_animal(data_one_taste,taste)
%add animal index and taste this is for the separated by taste beta tables
animal_idx_full = char(data_one_taste.animal_idx);
animal_idx = animal_idx_full(:,1:3);
data_one_taste.only_animal_idx = categorical(cellstr(animal_idx));
data_one_taste.tastant ... |
f269dd0a3b7ea3f2e578941f534d8648f96166f9406c14caa7445603e70b6a98 | MATLAB | 389 | 14 | function [im,fname]=tpreadframe(dirname,fnameprefix,cycle,channel,frame)
%TPREADFRAME
% read frame from multitiff
%
% 2008, Alexander Heimel
% 2017, Steve Van Hooser
%
fname=fullfile(dirname,tpfilename(fnameprefix,cycle,channel,frame));
cycle_string = ['Cycle_' int2str(cycle)];
imf = getfield(getfield(fnameprefix,cy... |
f4de9f2feb5bd947bbe71151186a3413792cf10bb5e724021470becd6edaafc9 | MATLAB | 389 | 18 |
%% Update volumes so that all NaN and negative values are set to 0
% Note: writes over original volume.
%
% DJS 17/6/2016
[filenames,sts] = spm_select([1 inf],'image','Select a volume');
filenames = cellstr(filenames);
for i = 1:length(filenames)
V = spm_vol(filenames{i});
Y = spm_read_vols(V);
Y(Y<0|isn... |
46d1347e84afeb62962745f8cf7795bb4bf08873c1caf4565b742f8adb67451c | MATLAB | 391 | 19 | function A = fcn_make_net(omega,ci,M,N)
count = 0;
A = zeros(N);
I = dummyvar(ci);
while count < M
r = randi(K);
s = randi(K);
d = I(:,r)*I(:,s)';
d = d | d';
if rand < omega(r,s)
[u,v] = find(triu(d & ~A,1));
if ~isempty(u)
t = randi(length(u));
A(u(t),v(t)) ... |
330c69c647bfcb1447b87c7afb45f8bac9a58cc595e35f5a533f4b5c29ccbe79 | MATLAB | 393 | 17 | % Field value of each object in an array or cell array.
%
% See also: getfield
% Copyright 2010 Levente Hunyadi
function values = getclassfield(objects, field)
values = cell(size(objects));
if iscell(objects)
for k = 1 : numel(values)
values{k} = objects{k}.(field);
end
else
for k = 1... |
22dd138ee489264c568336ff366b42373b6c81e93c607faabc08a67ced5128b3 | MATLAB | 394 | 17 | function [p] = display_surface(iso_surface, color, alpha)
%DISPLAY_SURFACE display a surface and set color
if ~exist('alpha','var') || isempty(alpha)
alpha = 1;
end
p = patch(iso_surface);
p.FaceColor = color;
p.FaceAlpha = alpha;
p.EdgeColor = 'none';
daspect([1 1 1]);
axis tight;
% set limits
bbox = util.get_para... |
75b1bd20f373e61b8051162a25f3c50a5f10fc7ae285a0a677a4119d3787d3d2 | MATLAB | 395 | 15 | function [ output_nb ] = num2str_padd(input_nb, nb_digits)
% Add 0 at the beginning of the created str from input_nb in order to have
% at leat nb_digits digits.
%
% Eg: num2str_padd(5,2) --> '05'
output_nb = num2str(input_nb) ;
nb_init_digits = length(output_nb) ;
if nb_init_digits<nb_digits
output_n... |
7adbcff3bf7e9bb25fb32c04a13a12cbcf5cf7a0d9439ba7eb1a8506f907efbf | MATLAB | 395 | 17 | function z = ztransform(c,type)
if ~exist('type','var')
type = 'none';
end
switch type
case 'none'
% simple Z-transform
z = atanh(c);
case 'mean'
z = tanh(nanmean(atanh(c)));
case 'std'
z = tanh(nanstd(atanh(c)));
case... |
a6b26ea2bc80abf2a2031cd5a80c8f331190ec059dd3e5a39b037749816c633c | MATLAB | 395 | 9 | function dataV = interpolate_data(model, sol_tag, coord, selection_tag)
solinfo = mphsolinfo(model, 'soltag', sol_tag);
dset_tag = solinfo.dataset;
if(isempty(selection_tag))
dataV = mphinterp(model, 'V', 'coord', coord, 'dataset', dset_tag);
else
dataV = mphinterp(model, 'V', 'coo... |
ae1260171751101fd938db6461f6459c4fa83f227d7247a0a9b634c522b0de00 | MATLAB | 398 | 20 | function play_custom_beep(opt_beep)
% Produce beep sound.
% for opt_beep = 1: need to call beep on ; before.
switch opt_beep
case 1
beep ;
case 2
% cfr test_sounds
WarnWave = sin(1:.2:400) ;
Audio = audioplayer(WarnWave, 22050) ;
%play(Audio);
... |
447006810030c2a390b5f44046f63edb8fcd2a517edb1a076781f02b90ae1e59 | MATLAB | 399 | 19 | function q = mean_thresh(act, n)
if n > 0
act = sort(act(act>0));
if numel(act) < n
warning('Not enough fibers recruited, mean impossible.');
q = NaN;
else
q = mean(act(1:n));
end
else
if any(act == 0)
warning('Not all fibers were recruited, mean impossible... |
99a0cbceae4be4e4b919508791a4b9265624e30716f03b84ace964f41af4037a | MATLAB | 400 | 9 | function stimulationParameters = compute_linear_encoding(jointKinematics, minCharge, maxCharge)
jointAngles = jointKinematics.Angle;
minAngle = min(jointAngles);
t = jointKinematics.t;
Charge = minCharge + (jointAngles - minAngle) ./ (max(jointAngles) - minAngle) * (maxCharge - minCharge);
Frequency = zeros(size(t)) + ... |
344ce27df102f2809ee914430ba39ce9afdc6787156462724922ff7c1dcbfab5 | MATLAB | 403 | 14 | function kstat = fcn_ks(x1,x2)
binEdges = [-inf ; sort([x1;x2]) ; inf];
binCounts1 = histc (x1 , binEdges, 1);
binCounts2 = histc (x2 , binEdges, 1);
sumCounts1 = cumsum(binCounts1)./sum(binCounts1);
sumCounts2 = cumsum(binCounts2)./sum(binCounts2);
sampleCDF1 = sumCounts1(1:end-1);
sampleCDF2 = sumC... |
7db0cb1a26f0999df7666075ba267cb59b2c8fa9922671924c8ccf00fbf29bef | MATLAB | 403 | 16 | function allAnnotT = LoadAllAnnotations(self)
VideoName = self.GetVideoNames('annotations');
Annotations = {};
for i = 1:length(VideoName)
currAnnot = Annotation(self, VideoName{i});
includeAll = true;
currAnnot = currAnnot.Load(includeAll);
currAnnotT = currAnnot.AnnotationTable;
Annotations... |
a309255c855f3b16ccc2b0544fc734e6aac735e759389ab367e7b57ce7dc7e22 | MATLAB | 403 | 26 | function x = pollFastrak(s)
% x = pollFastrak(s)
%
%
% See also startFastrak, endFastrak
%
% Steven Gordon 2016
timeOut = 1;
fprintf(s,'P');
c = clock;
while s.BytesAvailable < 47
% fprintf('*** BytesAvailable = %d\n',s.BytesAvailable)
noData = etime(clock,c) >= timeOut;
if noData, break; end
... |
eb0c7d0ddbeda3e9dbea57ce47e0f38deff2751edf43e4b73cccdadbce0c1f51 | MATLAB | 403 | 14 | function threshold = load_activation_best_AS(model)
% 1 x nFib
fiberActiveAll = load_activation_all_AS(model); % nAS x nFasc {nFib}
nAS = size(fiberActiveAll, 1);
nFib = sum(cellfun(@numel, fiberActiveAll(1, :)));
allThresholdsPerAS = nan(nAS, nFib);
for iAS = 1:nAS
allThresholdsPerAS(iAS, :) = vertcat(fi... |
7677cf85b1f11d790444a50bab66a3d4ba0ec0a57a8ba3633c562a8d32781136 | MATLAB | 404 | 13 | function initial_states_set = correct_init_for_changed_wNa(G, dy_end)
%initial_states_set = correct_init_for_changed_wNa(G, dy_end)
c_idx = 1;
initial_states_set = G.initial_states_set();
[x,y,z] = x_y_z_from_idx(1:G.N, G);
updated_Na = G.initial_conditions(x,y,z,G,c_idx);
Na_channel = find(is_sodium_channel(x, y, z,... |
69cdfbfa8001bff3954ab15e33a281c6f54f9bc3a882d77aea8431c1a0b0a546 | MATLAB | 406 | 8 | function fiberActive = filter_fiberActive_by_diam(fibersPerFascicle, fascIdsByAs, fiberActive, iAS, minDiam, maxDiam)
fascIdsCurrAs = find(fascIdsByAs(iAS, :));
for iFasc = 1:numel(fascIdsCurrAs)
filteredFibersIdxs = filter_fiberid_by_diam(fibersPerFascicle{fascIdsCurrAs(iFasc)}, minDiam, maxDiam);
... |
a7ed66aaa0dd9fb95219a251169714322ec121ac26c053c6130ed25fc3ccea5a | MATLAB | 406 | 12 | function [rep_strings] = rep_underscore(strings)
% REP_UNDERSCORE replace underscore(_) with a dash for variable names
% Note: variable names of tables cannot have dash but underscore is okay.
% The underscore creates issues with labeling
if iscell(strings)
rep_strings = cellfun(@(x) strrep(x, '_', '-'), strings,...
... |
9be6b8acece956ad8479cd2117dabfb38f048c1523595831286d8cde0cbb253f | MATLAB | 407 | 16 | function connectome_write(filename,mat,property,value)
global is_symmetrical_global;
if is_symmetrical_global
mat = copy_upper_to_lower(mat);
else
mat = zero_lower_half(mat);
end
% zero diagonal
mat(logical(eye(size(mat)))) = 0;
if exist('property')
dlmwrite(file... |
a9c4fd837deded6bd71189fe3c7f273b8de96fb92a900630d07433e80b63652e | MATLAB | 407 | 14 | function [im,fname]=tpreadframe(dirname,fnameprefix,cycle,channel,frame)
%TPREADFRAME
% read frame from multitiff
%
% 2008, Alexander Heimel
%
error(['this needs to be updated for Zen']);
fname=[dirname filesep fnameprefix '_t' sprintf('%.4d',frame-1) '.tif'];
fname2=[dirname filesep fnameprefix '_t' sprintf('%.4d',fr... |
d25f93f2eaa37bc6307a245162fae50f1886a1812c472a1848d1c596dc811c20 | MATLAB | 407 | 13 | function plotgenerictpdata(cells,cellnames,dir2plot)
for i=1:length(cells),
A = findassociate(cells{i},'unlabeled resp raw','','');
B = findassociate(cells{i},'unlabeled test','','');
[dummy,ia] = intersect(B.data,dir2plot);
if ~isempty(ia),
data = A.data{ia};
figure;
plot(data.t,data.data,'k');
ylabel('F'... |
509c792802876a91151d2b8044d69ea83826ee8003c14ef553c259aecfbcff30 | MATLAB | 409 | 20 | function [mse,rmse,eps] = compute_mse_rmse_matrix(X,Y)
% Compute mean squared error and root mean squared error between each pair
% of columns in X and Y.
%
% Input
% - X, Y : matrices of same size
% Output :
% - mse : mean squared error
% - rmse : root mse
% - eps: residuals (differences btw X and Y).
... |
b3d067a75237132123a7b012fca63cee27d4c30c9dca45a0a6bd4ab534ab62fa | MATLAB | 411 | 10 | function scale = ConvertScaleUnits( scale, desired_units )
%CONVERTSCALEUNITS Converts a scale structure to the desired units
scale.X.Value = scale.X.Value * ScalarForUnitConversion(scale.X.Units, desired_units);
scale.Y.Value = scale.Y.Value * ScalarForUnitConversion(scale.Y.Units, desired_units);
sca... |
2b8d3c98f7977a2ab1b0d7bf2cbf36f416b7d3dd8537405e9e50a68383653393 | MATLAB | 412 | 19 | function remove_tdtomato_only(fignum)
% REMOVE_TDTOMATO_ONLY - Removes tdTomato only from analyzetpstack
%
% REMOVE_TDTOMATO_ONLY(FIGNUM)
%
ud = get(fignum,'userdata');
v = 1;
while v<length(ud.celllist),
if eqlen(ud.celllist(v).labels,{'tdTomato'}),
set(findobj(fignum,'tag','celllist'),'value',v);
analyzetps... |
a5e863eafc4d3a75ab9e85b50e20bdc465d0f11ee37c57dafbc9e13d2e354bb1 | MATLAB | 413 | 18 | function [] = mkdir(dirPath, verbose)
% Creates the directory if it does not exist already
% Author <ali.karimi@brain.mpg.de>
if ~exist('verbose','var') || isempty(verbose)
verbose = false;
end
% Make folder
if ~isfolder(dirPath)
mkdir(dirPath);
if verbose
disp(['Created directory: ',dirPath])
e... |
1284c4a3124326f7cac03c7a755a0e8f6ebf7da6827d9c3b46ed2fe1e16b8194 | MATLAB | 414 | 16 | %alternate to combvec which more flexible argument and so that I don't need the deep learning toolbox
function [combs] = getCombs(mm)
combs = ones(numel(mm), prod(mm));
for ii = 2:size(combs,2)
for jj = 1:numel(mm)
combs(jj, ii) = mod(combs(jj, ii-1), mm(jj)) + 1;
if(combs(jj, ii) ~= 1)
... |
a6fcc130b0558a00ccb2adc3258b74e626e280e177ef96ca6b0ec35271060344 | MATLAB | 415 | 17 | function [] = matrix_labels(labels_table)
% MATRIX_LABELS add labels
% number of regions
xticks(1:width(labels_table));
yticks(1:height(labels_table));
x_labels = util.str.rep_underscore(labels_table.Properties.VariableNames);
y_labels = util.str.rep_underscore(labels_table.Properties.RowNames);
xticklabels(x_labels);... |
2e3ffcd2c4179bbff9a2786022f25607477ac3c51c3ebd71903d969b8af9f2f8 | MATLAB | 417 | 17 | function [tic_handle] = start_time()
% START_TIME The function initialize timer and print the time of start
%
% [tic_handle] = start_time()
%
% Input:
%
% Output: - tic_handle: tic variable handle
%
% By Federico Ciotti NeuroEngineering Lab, July 2020
% print starting time
fprintf(... |
4235356e3d9a526fe17279b8236b8eb2210082c4c65c7923c2b983fac8842b47 | MATLAB | 418 | 18 | function meansB = BensonMeansGen(yBenson)
meansB = zeros(1,sum(yBenson(:,1)==1));
index1 = find(yBenson(:,1)==1);
for i = 1:sum(yBenson(:,1)==1)
a = [];
if i == sum(yBenson(:,1)==1)
for j = index1(i):length(yBenson)
a = [a;yBenson(j,5)];
end
else
for j = index1(i):(index... |
b6367c8bf0ba73c37f27228cf084c6694e2989f5356066aacc111c3d28b30801 | MATLAB | 420 | 14 | function [ step ] = tfocs_backtracking_search(step_in, w, w_old, grad, grad_old, c1, c2)
%
% This file is part of SGDLibrary, GDLibrary and SparseGDLibrary.
%
% This file originally comes from https://github.com/bodono/apg.
% Modifeid by H.Kasai on Apr. 17, 2017
s = w - w_old;
y = grad_old - grad;
ste... |
cdaa1bdf1a355cc2209854a9ff027481440a35702d871861368883982e26dde1 | MATLAB | 420 | 21 | function cm_data = my_blues3(m)
% Created b y hand to span blue colors, cfr test_my_colormaps
if nargin<1
m = 100 ;
end
c1 = [102, 255, 255]./255 ;
c2 = [0, 153, 153]./255 ;
c3 = [51, 153, 255]./255 ;
c4 = [102,178,255]./255 ;
c5 = [0, 76,153]./255 ;
c6 = [0,0,153]./255 ;
c7 = [51, 51, 255]./255... |
8037319b3f9932c0b2cad535414a5681786c3c16159ab6ea98e4337acc3e8d17 | MATLAB | 424 | 29 | function X = checkFixate2(currentValue, initBuffSize)
persistent P i
X = 0;
if isnan(currentValue)
currentValue = -1*randi(100);
end
if nargin == 1
initBuffSize = 10;
end
if isempty(P) || length(P) ~= initBuffSize
P = randi(99,initBuffSize,1);
i = 1;
end
if i > initBuffSize, i = 1; end
P(i) = cur... |
b3c8005c120b0835cf7862bea7cc847d09782cf6ba4c854e5566b10928b5d393 | MATLAB | 424 | 13 | function nontp = nontpdirname(dirname)
% NONTPDIRNAME - Return test directory associated with a given two-photon directory
%
% NONTPDIR = NONTPDIRNAME(DIRNAME)
%
% Given a 2-photon directory name DIRNAME, return the associated test directory,
% which may or may not be the same. This is the inverse of the functio... |
d2095616feb5e948b744c9a4e4c3f43fc5ad8a6c59c5cddd486370ee02ba45d3 | MATLAB | 424 | 19 | function [] = error_plot(mean_T, sem_T, var, colors, ylimit)
%ERROR_PLOT Make the error barplot for the per run beta averages
arguments
mean_T
sem_T
var
colors = util.plot.getColors().modules;
ylimit = [-0.12, 0.12]
end
e = errorbar(mean_T.(var),sem_T.(var));
for i=1:length(e)
e(i).Color = color... |
f04e760241e60181b3efb74e629492e136e758c34fa49de705933304557cbe82 | MATLAB | 424 | 17 | function [x, y] = cluster_selection()
xC = mean(xlim);
yC = mean(ylim);
h = [text(0.05, 1, 'Align for calibration.', 'Units', 'normalized', 'FontWeight', 'bold'), ...
xline(xC), yline(yC)];
[x0, y0] = ginput(1); % Calibration
delete(h);
h = text(0.05, 1, 'Select center of Ia and Ib fibers', 'Units', 'normalized',... |
20f14b5ee0e6a5a64744f3157ebbf9fdeeac6fd83b3303945a8516d014ed87d4 | MATLAB | 425 | 17 | function [X, X_tril_vec] = tril(X, val)
%TRIL Create a lower triangle matrix by setting the upper part to val
% INPUT:
% X: m x n matrix
% val: value to set the upper triangle to
% OUTPUT:
% X: m x n lower triangular matrix
% X_tril_vec: vector of the lower triangular elements
arguments
X
val = nan
end... |
8dc32142eb413cccb17897f7121fb1ae4fe4312d95f026d58230ee40bf413c47 | MATLAB | 425 | 13 | function [idIFibers, idIIFibers, idIIIFibers] = split_fibers(model, minDiamIFibers, minDiamIIFibers)
% Extraction of primary and secondary fibers
idIFibers = model.fibers{model.motorFascRel}.r >= minDiamIFibers/2;
idIIIFibers = model.fibers{model.motorFascRel}.r < minDiamIIFibers/2;
idIIFibers = ~idIFibers & ~idIIIFib... |
c6f74fd4e0f2a75a629668b25b5e09a3dab978b09826149c79b83ddfe529f7ec | MATLAB | 426 | 18 | function x = compareFixate(curHeading,Headings,Tol)
% x = compareHeading(curHeading,Headings,Tol)
%
% Compare the current heading value to a 1xN vector of target Headings +/-
% a specified tolerance.
%
% Stephen Gordon 2016
Hvec = repmat(Headings,2,1)+[-Tol; Tol];
for x = 1:length(Headings)
if (curHeading(1) > ... |
e066efb84387a7573c2309e6f2d71be71abd7160cb8365248750cf2c3e8153b0 | MATLAB | 426 | 12 | function el_add_symbol(els,elcol,msize,s_b)
if ~exist('msize','var')
msize=20; %marker size
end
if exist('elcol')==0,
elcol='r'; %default color if none input
end
hold on, plot3(els(:,1),els(:,2),els(:,3),s_b,'Color', elcol,'MarkerSize',msize,'MarkerEdgeColor',elcol,'MarkerFaceColor',elcol)
%hold ... |
5d69d2451c7ff4f81d1338b83ce3a8a566610ba71d65416fbceb57bed4f07089 | MATLAB | 427 | 18 | function short_names = get_short_names(long_names)
% Abbreviations for IF, AF, TP.
short_names = long_names ;
for i=1:length(long_names)
curr_n = long_names{i} ;
if strcmpi(curr_n, 'transition')
short_names{i} = 'TP' ;
elseif strcmpi(curr_n, 'frequency')
short_names{i} = '... |
93786e4d13d01dee78ae4ba2db893d6501e0a12a2709c21f0b0642f388988e3e | MATLAB | 428 | 18 | function x = compareHeading(curHeading,Headings,Tol)
% x = compareHeading(curHeading,Headings,Tol)
%
% Compare the current heading value to a 1xN vector of target Headings +/-
% a specified tolerance.
%
% Stephen Gordon 2016
Hvec = repmat(Headings,2,1)+[-Tol; Tol];
for x = 1:length(Headings)
if (curHeading(1) >... |
114e52c08e15650c20342e9d94896f39d47611e82c39b30419e9acf4c1bb2089 | MATLAB | 430 | 16 | function [H1_from2,H2_from1] = compute_entropy(p_1from2,p_2from1)
% Compute the entropies of the input TPs p(I_1|I_2) and p(I_2|I_1) given in
% arguments.
% p_1from2 and p_2from1 must have the same size.
H1_from2 = get_entropy(p_1from2) ;
H2_from1 = get_entropy(p_2from1) ;
end
function H = get_entropy(p... |
c406185fa019f31e8f2be4fda77d7d5f5672ca0214cac199546dc4105621b83a | MATLAB | 431 | 20 | function [h] = my_gscatter(x,y,g,c,varargin)
x = x(:) ;
y = y(:) ;
g = g(:) ;
grps = unique(g) ;
for i = 1:length(grps)
cg = grps(i) ;
h(i) = scatter(x(g==cg),y(g==cg),...
varargin{:},...
'MarkerFaceColor', c(i,:) ,...
'MarkerEdgeColor', c(i,:) * 0.9, ...
'Mark... |
bb71f5317b7745cf830258c87e3aa2185b1de653a77ec149e51ecfa242b82b54 | MATLAB | 433 | 13 | function tags = find_tag_FEM(entities, label, once)
% if once, return char, otherwise return cell array of char
tags = entities.tags;
labels = arrayfun(@(t) char(entities.get(t).label), tags, 'uni', false);
%i = find(strcmpi(labels, label));
%cellfun( labels);
tags = cellstr(string(tags(~cellfun(@isempty, regexpi... |
c767e3124a71db23755826d7d6cbd96da04ba85e76edcdfcc915cc7d4858dfaa | MATLAB | 433 | 14 | function expPath = getExpPath(config, mode)
%GETEXPPATH Uses the info in the config file to build the path to the experiment folder where the stimuli are
%
% We handle 'simulate' mode as follows:
% if we have a train subfolder, use that. Otherwise, check for test. Otherwise work in current folder
arguments
... |
178502cf234af8a4787f5fea04af364541b898905d70796a4cb67899edbb0fb1 | MATLAB | 434 | 13 | function [ TrialsEMGfilter ] = EnvelopeEMG( TrialsEMG, fc )
%FILTEREMG Summary of this function goes here
% Detailed explanation goes here
TrialsEMG.x=TrialsEMG.x-mean(TrialsEMG.x); % le quitamos la media
TrialsEMGrect=abs(TrialsEMG.x); % rectificamos
[z,p,k]=butter(4, fc/(TrialsEMG.s/2)); %filtro pasa-bajo
[... |
c86feebe26baced4531914b8f68ffb1d3bc97c71001af1c1cc61aa45adc1c450 | MATLAB | 434 | 18 | function new_labels=marks_match_label(sub_labels,all_labels)
if ischar(sub_labels);
sub_labels={sub_labels};
end
new_labels={};
j=0;
for i=1:length(sub_labels);
for ii=1:length(all_labels);
if ~isempty(strfind(all_labels{ii},sub_labels{i}));
if isempty(find(strcmp(all_labels{ii},new_labels... |
dde87b743eab933138e40128e476f60754e3c3c179fa9ff287f43cb651d06554 | MATLAB | 434 | 12 | function IND = NHP_decodeResponseCode(RCode)
IND.Reward = bitget(RCode,1);
IND.Hit = bitget(RCode,3);
IND.Miss = bitget(RCode,4);
IND.Abort = bitget(RCode,5);
IND.RespLeft = bitget(RCode,6);
IND.RespRight = bitget(RCode,7);
IND.NoResponse = bitget(RCode,10);
IND.Left = bitget(RCod... |
741825c3907e67af37303b6bc7c75d0858e86756e7d20a00719bd856d5f83b5b | MATLAB | 435 | 11 | function [dataDir, options, c, d] = import_settings()
dataDir = Cloudstation('Vowels\Spatial_Unmasking\Cooling\Vowels\Cross-referenced Behavior');
options = struct('coolThreshold', 11,...
'warmThreshold', 35);
% Define colors
c = struct('ctrl',[0 0 0],'coloc',[1 0 0],'sep',[0 0.5 0... |
051c536702cb2df826f274bc1866469ff7aa0bcf6228d1cb46e5066e9bda8eb0 | MATLAB | 436 | 21 | % PURPOSE: gets current ERPLAB's version
%
% FORMAT:
%
% version = geterplabversion;
%
% or
%
%
% [version reldate] = geterplabversion; % reldate=release date
function [version reldate,ColorB_def,ColorF_def,errorColorF_def,ColorBviewer_def] = geterplabstudiodef
erplab_default_values;
version = erplabver;
reldate ... |
69ce6ebfed6819ba9719538a2cecf0b4ec4ea03c14ccb08db61cf9fad991490f | MATLAB | 437 | 16 | function [Tx,Ty,Tz]=Elem2Node(dx,dy,Tx,Ty,Tz)
%***************************************************
% Transforms elemental tractions to nodal values
% Syntax:
% Ae = Aeq4e(Xe,Ge)
% Input:
% Tx,Ty : elemental values of X and Y tractions
% Output:
% Tx,Ty : nodal forces in X and Y equivalent to Tx and Ty
% Date:... |
c0cf3bb57fcb8df08dd8594629f1a1c146597b7014b5d0c7ee8ebdc25da0c55e | MATLAB | 437 | 16 | function [fascIdsByAs, activeSites, electrode] = load_active_sites(modelPaths)
%LOAD_ACTIVE_SITES Summary of this function goes here
% Detailed explanation goes here
load(modelPaths.fascIdsByAs, 'fascIdsByAs');
if nargout > 1
if nargout > 2
load([modelPaths.elec, 'electrodes.mat'], 'activeSites'... |
75aa77f517bd1fcf082c62d91bb33f6a3e6d71d19cff1ccbe40ade62700a80e8 | MATLAB | 438 | 14 | function [beta, B, mse, Rs, Rs_adj] = get_regression_out(lmem)
% Return useful outputs from a linear regressors lmem (fitlme outcome).
beta = fixedEffects(lmem) ;
B = randomEffects(lmem) ;
mse = lmem.MSE ;
EV = lmem.Rsquared ;
Rs = EV.Ordinary ;
Rs_adj = EV.Adjusted ;
% adjusted to accoutn for the fac... |
3c18fddef71e4b396aecece14d1424e6bdbbb11226943c099d0cfff7ead71427 | MATLAB | 439 | 17 | function [sil,pval] = sil_perm(points,ca,numP)
% the empirical eval
tmp = evalclusters(points,ca,meth) ;
sil = tmp.CriterionValues ;
% scramble
% ca_shuff = zeros(length(ca),numP) ;
res = zeros(numP,1) ;
shuff = @(v_) v_(randperm(length(v_))) ;
for idx = 1:numP
if mod(idx,100)==0 ; disp(idx) ; end
tmp = eval... |
ca0f19258c48d33647b8db24c56444a5428e6280a8d26a3324e627725f75eb17 | MATLAB | 439 | 9 | function myelinfiber_pdf = builtin(nerve)
myelinfiber_pdf_file = dir([get_base_paths().dist 'myelinfiber_pdf*' nerve '*.mat']);
if isempty(myelinfiber_pdf_file)
fiber_distribution.builtin.myelinfiber_distributionVSagediameter_generator;
myelinfiber_pdf_file = dir([get_base_paths().dist 'myelinfiber_pdf*' ne... |
e07711fb95c2d2624ba3a37e84d1290720eaf4774ca28f8605f8eeb424624d45 | MATLAB | 439 | 13 | function [out_T] = extract_hemi_ROI(concat)
%EXTRACT_HEMI_ROI Get the hemisphere and ROI info from the concatenated
%version of them
splits = cellfun(@(x) strsplit(x, '_'), ...
concat,'UniformOutput',false);
hemisphere = categorical(cellfun(@(x) x{1}, splits, 'UniformOutput',false));
region_name = categorical(cell... |
227fb8d530e007c3f185c45fdc29afb787b946c5fa07ca5f4391f56f9af57e7e | MATLAB | 441 | 19 |
function make_yeo_colors
load YeoROIs.mat
YeoColor = [120 18 134; 70 30 180; 0 118 14; 196 58 250; 220 248 164; 230 148 34; 205 62 78; 0 0 256; 0 0 0; 0 0 1]./256;
YeoColors = zeros(116,3);
j=1;
for i=1:116
if yeoROIs(i) == j
YeoColors(i,:) = YeoColor(j,:);
else
YeoColors(i,:) = YeoColor(j+1... |
65ecc9baee818d75ad397c483f56857128a49614ac9d07c9541aea3287493796 | MATLAB | 441 | 14 | function foodRemain = checkSyringe(motorBox)
%Pot value at which the syringe is empty
noFood = 550;
%Pot value at which the syringe is at 60mL
fullSyringe = 280;
%Range of pot values that covers 0-60mL
syringeRange = 270;
fwrite(motorBox,1);
readIn = fscanf(motorBox);
%potValue = str2int(readIn(1))*100 + str2int(readI... |
6e62aac468e9626d2ab36ac6b1d96bcccbbddb5dbf810f8e5eb7347eb3684ba4 | MATLAB | 442 | 29 | a=3;
x=4;
x0=2;
gamma=2.2;
v=1/(1+(2*(x-x0)/gamma).^2);
v2=v*v;
gamma2=gamma*gamma;
av=8*a*v*v;
j1=v;
j2=-av*(x-x0)/gamma2;
j3=av*(x-x0)*(x-x0)/(gamma2*gamma);
delta=1e-10;
jj1=(lorentz(x,x0,a+delta,gamma)-lorentz(x,x0,a,gamma))/delta;
jj2=(lorentz(x,x0+delta,a,gamma)-lorentz(x,x0,a,gamma))/delta;
jj3=(lorentz(x,x0... |
ac3cb5edf7fa9a01da56f7d83142a5c1afb84a34084e454d371c13ad9d7636db | MATLAB | 443 | 16 | function U = projectData(d,M)
%%% Will project each repetition of d on PC space through M
%%% d must be time x clusters x repetitions
%%% U is time x comps x repetitions
% get a few parameters
nTime = size(d,1);
nClu = size(d,2);
nTrials = size(d,3);
nComp = size(M,2);
d =... |
3e95d97e11da2f80f3a9be9a5729583784e19fa71d89572bfbc0d2bb4e55406b | MATLAB | 445 | 19 |
function class_info=gen_class_info_ego()
class_info=[];
class_info.class_names = { 'background', 'hand','void'}';
void_class_value=255;
class_info.class_label_values=uint8([0:1 void_class_value]);
class_info.background_label_value=uint8(0);
class_info.void_label_values=uint8(void_class_value);
% addpath ... |
c71e09494acf974d992e6b53bce3e197972df7fa8b52b06b13118143f99202ac | MATLAB | 445 | 19 | function dirnames = tpdirnames( dirname )
%TPDIRNAMES returns cell list of twophoton subdirectories
%
% Steve VanHooser, Alexander Heimel
%
pathstr = fileparts(dirname);
% figure out how many data directories we have
TPD = dir([dirname '-*']);
if isempty(TPD)
error(['Cannot find any directories ' dirname '-001, -00... |
69fc48f60194357302a64e0bb740b71cdddff6545fa6096328707a94511e6475 | MATLAB | 446 | 16 | function [indices_lower] = indices_tril(X)
% INDICES_TRIL
this_size = size(X);
% select the lower triangular without the diagonal
diagonal = -1;
dim_1 = 1:this_size(1);
dim_2 = 1:this_size(2);
B = rot90(bsxfun(@plus,dim_1,dim_2(:)))-1;
indices_lower = B <= (this_size(1) + diagonal);
% if the given matrix is 3D, repli... |
7ddc93c6a1c003596d40b29246b516d1159a5b33f5b4b2bdab8034afffeb93fe | MATLAB | 446 | 19 |
function class_info=gen_class_info_gtea()
class_info=[];
class_info.class_names = { 'background', 'hand','void'}';
void_class_value=255;
class_info.class_label_values=uint8([0:1 void_class_value]);
class_info.background_label_value=uint8(0);
class_info.void_label_values=uint8(void_class_value);
% addpath... |
c0592fcd9015c3a3384dec12839abfc832caa4b265ddc6b8c803d405b000a61c | MATLAB | 446 | 15 | function clipT = GeneratePredictions(network, clipT, varargin)
mbSize = 128;
if nargin == 3
mbSize = varargin{1};
end
seqT = SplitClipDataIntoSequences(self, clipT);
features = TransposeCellArrayElements(seqT.Features);
[pred, scores] = classify(network, features, 'MiniBatchSize', mbSize);
seqT.Predictions = Tran... |
130ad7f452d0da7ef31e99be8924335815b660c5346931a4439037482e684b44 | MATLAB | 447 | 26 | function new_clim = match_clim(gobj,new_clim)
% TODO:
% - if ax is figures, go through and get all the children and make them a
% set of axes
% - if no input arguments, use get(0,'Children') to get handles
if nargin < 2
tmp_clim = get(gobj,'CLim');
if iscell(tmp_clim)
tmp_clim = cell2mat... |
343fd01554dfdbb5e665aa7de4b1774a17826115ba55bf1e7688361d27c0e25b | MATLAB | 447 | 26 | function new_xlim = match_xlim(gobj,new_xlim)
% TODO:
% - if ax is figures, go through and get all the children and make them a
% set of axes
% - if no input arguments, use get(0,'Children') to get handles
if nargin < 2
tmp_xlim = get(gobj,'XLim');
if iscell(tmp_xlim)
tmp_xlim = cell2mat... |
ee37908c962edeea0ef5d79cc0be8bf40818afad4b9cb7c3cc7e2873bb115ebb | MATLAB | 447 | 26 | function new_ylim = match_ylim(gobj,new_ylim)
% TODO:
% - if ax is figures, go through and get all the children and make them a
% set of axes
% - if no input arguments, use get(0,'Children') to get handles
if nargin < 2
tmp_ylim = get(gobj,'YLim');
if iscell(tmp_ylim)
tmp_ylim = cell2mat... |
7abfb1c395b6b159b5227725c519b10a93d01acefa720f1d47466439fac74348 | MATLAB | 450 | 15 | % part of https://github.com/LudgerS/MRSartifactRemoval
%
% Normalized Absorption and Dispersion mode Lorentzian curve
% From Keeler "Understanding NMR Spectroscopy", 9.1.4
function lineShape = complexLorentzian(frequencyAxis, f0, fwhm)
T2 = 2/fwhm;
absorption = T2./(1 + (frequencyAxis - f0).^2*T2^2);
disp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.