sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
0f402354e13ac567673bf968f6ecaf4f27cf914938bca10dd570c4cce003fc7a | MATLAB | 722 | 28 | function SNR = VBA_spm_getSNR(y,u,hrf)
% Computes fMRI SNR from controlled time windows
% function SNR = spm_getSNR(y,uu,hrf)
% IN:
% - y: the nXt1 ROI time series
% - u: the nuXt2 input (experimental control)
% - hrf: the hrf (should be same sampling rate than y)
% OUT:
% - SNR: the SNR (power ratio: signal v... |
51c71053361dd0801013dc84121d30c675c2403e46be3c1132902eb0cd3c7f3f | MATLAB | 722 | 22 | function trialAll = PassiveProcess_noise(epocs)
%% Information extraction
trialOnsetIndex = epocs.Swep.data + 1;
trialOnsetTimeAll = epocs.Swep.onset * 1000; % ms
durAll = epocs.dura.data; % Hz
n = length(trialOnsetIndex);
temp = cell(n, 1);
trialAll = struct('trialNum', temp, ...... |
84b3147612e183ff5f8666065c8a93ea442170e895d78f64e416d58760fa9156 | MATLAB | 722 | 22 | function modelHgivenV = gaussCondition(model, v, visValues)
% p(xh|xv=visValues)
% This file is from pmtk3.googlecode.com
mu = model.mu; Sigma = model.Sigma;
d = length(mu);
h = setdiff(1:d, v);
if isempty(h)
% instantiated down to a constant scalar
muHgivenV = []; SigmaHgivenV = [];... |
b9cddf60c5cf381b320a4bd0619d689c3555bddbc2a947c308c14fd232f98247 | MATLAB | 722 | 35 | % Read a MRC file (3D image)
% Author: Antonio Martínez Sánchez
% head: head size (1024 or 16)
function [a] = readmrc( fname, head )
[fid,message]=fopen(fname,'r');
if fid == -1
error('can''t open file');
a= -1;
return;
end
nx=fread(fid,1,'long');
ny=fread(fid,1,'long');
nz=fread(fid,1,'long');
type= fread... |
c5243cbe8555d30b66f603cb7ce24a56f9fed4388bb414a2f2fc7f29896a7256 | MATLAB | 722 | 45 | %SAVEPPM Write a PPM format file
%
% SAVEPPM(filename, I)
%
% Saves the specified red, green and blue planes in a binary (P6)
% format PPM image file.
%
% SEE ALSO: loadppm
%
% Copyright (c) Peter Corke, 1999 Machine Vision Toolbox for Matlab
% Peter Corke 1994
function saveppm(fname, I)
I = double(I);
if size(I,... |
39e3d652956f004d2fa6e4668859adef030167307e0e68edf48b31687d92cc25 | MATLAB | 723 | 29 | function [edges] = nodal_distance_triangle(a,b,c)
% NODAL_DISTANCE_TRIANGLE Calcultes triangles edges length.
%
% SYNTAX:
% [EDGES] = NODAL_DISTANCE_TRIANGLE(A,B,C)
% NODAL_DISTANCE_TRIANGLE(A,B,C)
%
% [EDGES] = NODAL_DISTANCE_TRIANGLE(A,B,C)
% - A, B and C - are m by 2 matrices of (x,y) cartesian coordinates of
... |
760cf42d00047740d751b288afa6bfa4d37965e173406eaadc6d6e45f5b93251 | MATLAB | 723 | 20 | function [m c] = linmap( li, ui, lo, uo )
% LINMAP Calcultes the parameters for remaping data linearly
% INPUT:
% li - Lower bound input range for independent variable
% ui - Upper bound input range for independent variable
% lo - Lower bound input range for dependent variable
% uo - Upper... |
77b98f5021c8124ad97b68fa2ddf457d39afc6b0096d11c17265c97225b2bf75 | MATLAB | 723 | 40 | clear
clc
close all
rat_names={'P049','P055','P059','P095','P100','P101','P102'};
logreg_parameters.lambda=200;
logreg_parameters.min_perf=0.65;
logreg_parameters.min_beta=0.6;
logreg_parameters.min_trials=100;
logreg_parameters.compute_bootstrap=1;
logreg_parameters.bootstrap_reps=20;
logreg_parameters.compute... |
cd103bb18b19bec49ca07f8b4b94a6466c95205c2d77987a2cc01d3df33c3a08 | MATLAB | 723 | 36 | function xlsAutoFitCol(filename,sheetname,varargin)
%set the column to auto fit
%
%xlsAutoFitCol(filename,sheetname,range)
% Example:
%xlsAutoFitCol('filename','Sheet1','A:F')
options = varargin;
range = varargin{1};
[fpath,file,ext] = fileparts(char(filename));
if isempty(fpath)
fpath = pwd;
end
Excel = a... |
00408486aee6c1de719c346dcc8d158b3622c981b01eea7270e542b99fe22d10 | MATLAB | 724 | 33 | function df = linregDofL2(X, lambdas, doCenter)
% Compute the degrees of freedom for a given lambda value
% Elements 1e p63, 2e p68
% X should *not* include a column of 1s
% This file is from pmtk3.googlecode.com
if nargin < 3, doCenter = true; end
[n,d] = size(X);
if d==0, df = 0; return; end
if doCenter
XC = ce... |
1ac870a136eeb75b4647fc64e6f59c5ec976525517c29a3eb7eded6d33b18865 | MATLAB | 724 | 30 | function [xout,yout] = coords2normfig(x,y,h)
if ~exist('h','var')
h = gca;
end
if ~strcmpi(get(h,'type'),'axes'),
error('Handle must correspond to an axis');
end
xax = get(h,'xlim');
yax = get(h,'ylim');
pos = get(h,'position');
xout = (x - pos(1))/pos(3)*(xax(2)-xax(1)+1) + xax(1);
yout = (y - pos(2))/pos(4)... |
2027112ea6afb5ba4e452a75c9b967ba90ea0f07253da0568c28877b1cba64e8 | MATLAB | 724 | 31 | function [gx,dgdx,dgdp] = g_classif0(x,P,u,in)
% logistic-like observation function for VBA_classification
% function [gx,dgdx,dgdp] = g_classif0(x,P,u,in)
% IN:
% - x: [useless]
% - P: classification weights
% - u: [useless]
% - in: contains design matrix (in.X) and sparsify flag (in.sparse)
% OUT:
% - gx: E... |
52ed493e41cdcffedba489f09d78b9d4cabae3014586dedc3756247dd41132bb | MATLAB | 724 | 17 | function [ ] = bemf2_graphics_surf_field(P, t, FQ, Indicator, tissuenumber)
% Surface field graphics: plot a field quantity FQ at the surface of a
% brain compartment with the number "tissuenumber"
%
% Copyright SNM 2018-2020
ind = tissuenumber;
t0 = t(Indicator==ind, :);
Num... |
7e0eccce84cd09b72f4047f62b41f92b312268a6e397bda4cacb2f4d82c785b3 | MATLAB | 724 | 23 | function isSBFMF = isSBFMFFile(filePath)
% Test if the file at the indicated path is in SBFMF format.
isSBFMF = false;
if exist(filePath, 'file')
% Check if the file is a known version of SBFMF.
% TODO: any other versions lurking out there?
fid = fopen(filePath, 'rb' , 'ieee-le... |
bfb3a95ff4ab25392a476255a3e9a7fea75070f375ae4512ef4329bdd1627ea1 | MATLAB | 724 | 26 | function [Z, cutoff] = find_cluster_cutoff(distMat, num_bins_clustering, linkage_method)
if nargin < 3
linkage_method = 'single';
end
Z = linkage(distMat(tril(true(length(distMat)),-1))', linkage_method);
lkg_vals = unique(Z(:,3));
if length(lkg_vals) == 1 % Equidistant points, hence one l... |
e95ef0d60e6aaf84d8ef6dad510039655aa855a917ee2b19a22e768aa86b3727 | MATLAB | 724 | 21 | function [sems,mus,stds] = nansem( x,dim )
%SEMS=NANSEM(X,[DIM]); standard errors of the mean with missing data (NaN)
% compute standard errors of the mean of x along dimension dim
% Jacek P. Dmochowski, 2019
% send bug reports (or props) to dmochowski AT gmail DOT com
%
% inputs
% x: the data, can be arranged howe... |
57fe0097e270994f815e917e408af49bde19a97560f8a0392facd1ae9aed3660 | MATLAB | 725 | 18 | function dat = afxVolumeResample(volume,XYZorig,hold)
% dat = afxVolumeResample(fname,XYZ,hold)
% resample fname to space defined by XYZ and return data as (linearly
% packed) vector
% hold refers to interpolation method for the resampling (see
% spm_sample_vol.m), (default: nearest neighbour)
... |
c83e7474818cc1bbbb2faef083b96c9f990b54e0ddca8651f59694ad291a6f68 | MATLAB | 725 | 29 | function projectPath = getProjectPath()
% projectPath = utils.getProjectPath();
%
% Returns the path to the project folder
% Iteratively go up the directory tree until the .git folder is found,
% which defines the project root
%% Get current directory
currDir = mfilename('fullpath');
%% Iterate up the directory tre... |
c8d15680d1edc8009d2eeeb2cdb322b0880040fe8e2b97717262cc3421b7ac78 | MATLAB | 725 | 18 | function t = meshreorient(P, t, normals)
% This function reorient triangles (needs to be improved)
% Copyright SNM 2020
N = size(t, 1);
for m = 1:N
Vertexes = P(t(m, 1:3)', :)';
r1 = Vertexes(:, 1);
r2 = Vertexes(:, 2);
r3 ... |
df3328ba887419d09b900f25eb7de6530dcb0b00c5d28ecb8c61d0df6d031eba | MATLAB | 725 | 14 | % Copy of part of the external ChangeCoordinates function, simplified and
% optimized for speed given it gets called many times. Returns the origin
% and rotation matrix.
function [O, R] = RigidCoordinates(FidsColumns)
R = zeros(3);
O = (FidsColumns(:, 2) + FidsColumns(:, 3))/2;
R(:, 1:2) = FidsColumns(:, 1:2) -... |
158423e9b393308b82e35dc1eb84ada5419c5c78f866cc4303d30c1748a486e8 | MATLAB | 726 | 36 | % p = genpath_visible(d)
% save as genpath, but if any of the path is hidden, the directory is not
% added
function p = genpath_visible(d)
hiddenchar = '.';
p = '';
a = genpath(d);
if isempty(a),
return;
end
% find the first character of each path
i0s = [0,find(a == pathsep)]+1;
if i0s(end) <= length(a),
i0s(end... |
2ec6a5ae620188faa04093e57ee2a39451fccc525364d64d6ae10a54055a6d70 | MATLAB | 726 | 28 | function publishTutorial()
%% Publish the pmtk tutorial.
% Remember to do an SVN checkin after running.
% The wiki pages at http://code.google.com/p/pmtk3/wiki/Tutorial
% are manually created - they link to the matlab-generated
% html pages.
%%
% This file is from pmtk3.googlecode.com
recursive = false;
exclusions =... |
4a339b2653f39acb4396e7e0fd757d06121d53b4481a85b18acaca0463467100 | MATLAB | 726 | 22 | % correct jitter in DeltaX
% repeating correction for several iterations, as specified by Jitters.
% e.g. Jitters = [1 2 1] will correct jitters of one image, then two
% images, then one image again
function DeltaXnew = CorrectJitter(DeltaX, Jitters)
DeltaXnew = DeltaX;
LastDelta = length(DeltaX);
LastJitter... |
a4dfed18440d97757d91c366115db53aed97740461a4f0b177a3af73ad7fc87e | MATLAB | 726 | 22 | function h5struct2att(filepath, location, S)
%H5STRUCT2ATT Writes attributes to an HDF5 file from a scalar structure.
% Usage:
% h5struct2att(filepath, location, S)
%
% See also: h5att2struct
if nargin == 2 && isstruct(location); S = location; location = inputname(2); end
if isempty(location); location = ''; end
if ... |
4a0e392bb5776f4791f0f2353eef58b6b62493719a02e01f6e4bdeb94919e9e5 | MATLAB | 727 | 28 | % ApplyMasks.m
% Sarah West
% 5/25/22
% Applies brain masks to data using RunAnalysis.
function [parameters] = ApplyMasks(parameters)
% Message
MessageToUser('Masking ', parameters);
% If there are masks to apply
if isfield(parameters, 'indices_of_mask')
% Apply mask to data (for righ... |
537d9253938121723506eb7a9ebf4fb5330871ea549d378882f722ef162459a6 | MATLAB | 727 | 27 | function [datestr, time] = getFileModificationDate(file)
% Return the file modification date for the specified file.
%
%% Example
% This file is from pmtk3.googlecode.com
d = dir(file);
toks = tokenize(d.date, ' ');
[datestr, time] = toks{:};
%{
[err, raw] = system(sprintf('dir /TC %s', file));
raw = cellfuncell... |
8e50a48a316b0a8c7d770a7f87bf726e0306cf535f787ed246ec96ac0c5e5ccc | MATLAB | 727 | 15 | function [fcost,u_error,sgCurr] = Spring2Dbatch(k0,X_batch,y_batch,params,optims,condition)
fGrad = [];fcost = 0;u_error = 0;
parfor i = 1:size(X_batch,1)
F = zeros(size(params.C,2),1);
F(2*params.ind_input) = X_batch(i,:);
u_output = [y_batch(i,1),y_batch(i,2);y_batch(i,3),y_batch(i,4)]... |
9df071b883d25ce515c5dca996207933aaa8b613f16d8d2a119da348464fb278 | MATLAB | 727 | 36 | function r = circ_dist2(x,y)
%
% r = circ_dist(alpha, beta)
% All pairwise difference x_i-y_j around the circle computed efficiently.
%
% Input:
% alpha sample of linear random variable
% beta sample of linear random variable
%
% Output:
% r matrix with pairwise differences
%
% Refe... |
ab8e723b3d3d0e4dfcee89cf86498489ef8d64134c8fd0aee353f56017a9a410 | MATLAB | 727 | 32 | %
%
disp("This is an example matlab driver");
disp("On output the code prints the pot+grad in example1, and computes the error at 10 source locations");
disp(" ");
disp(" ");
%% source to source, charges only, pot+grad example
%
clear srcinfo ns U1 U2 eps pg;
disp("Example 1: source to source, charge, pot+grad");
di... |
bab9f8aa597b5c8fe360d6aff93f6164b9d6e54e00fd69cf07b33d026e671b46 | MATLAB | 727 | 28 | function LAN = lan_from_ibw(Files, Path)
LAN.data{1} = [];
if nargin < 2
[Files, Path, ~] = uigetfile({'*.ibw','IBW file';}, 'Open .ibw EEG file(s)',...
'*.ibw', 'MultiSelect', 'on');
end
if iscell(Files)
for c = Files
LAN = importibw(LAN, c{1}, Path);
end
else
LAN = importibw(LAN, Fil... |
50e72f7fc12c0b160133433d1c8e25b53877ccf7dcb6c52051a964b38e2d5b9c | MATLAB | 728 | 24 | function [outputStruct] = extract_struct (struct, path, conditionType, conditionValue)
files = dir(path);
fileNames = {files.name};
fileIsDir = {files.isdir};
fileNames = fileNames(cell2mat(fileIsDir)==0); %size of files in MB
for fileCounter = 1:length(fileNames)
% extract only if recording belongs to certain ... |
6ff0578bd35d7432a8b6c8d80cb1b476f2a2b542ea168e12f62250606971ac15 | MATLAB | 728 | 20 | function p = VBA_ncfcdf(x,nu1,nu2,delta)
% NCFCDF Noncentral F cumulative distribution function (cdf).
% function p = VBA_ncfcdf(x,nu1,nu2,delta)
% Returns the noncentral F cdf with numerator degrees of freedom (df), NU1,
% denominator df, NU2, and noncentrality parameter, DELTA, at the values in
% X. The size of P is ... |
a80719f36f35e0b344c22fcbdfd41bf7d1e9eaa425a149f0380508f22610a683 | MATLAB | 728 | 21 | function a = double(s)
%DOUBLE Converts a sparse tensor to a dense multidimensional array.
%
% See also SPTENSOR, SPTENSOR/FULL.
%
%MATLAB Tensor Toolbox.
%Copyright 2015, Sandia Corporation.
% This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others.
% http://www.sandia.gov/~tgkolda/TensorToolbox.
% Copyr... |
e27cab4606065e97243dc1cbd127d4dd77accf746c5f1ab01caea64a2c6c2433 | MATLAB | 728 | 32 | function [x,V,xc] = smooth_timeseries(x,perc)
% Make exponential smoothing function with perc proportion of data points
% (0 < perc < 1)
% OR specify length directly, as % of points to 0 weight
%
% :Usage:
% ::
%
% [x,V] = smooth_timeseries(x,perc)
%
% apply smoothing filter V to data (x), V * x
% (works just as we... |
f28fea71ed94fd674bc0191ac612a931094b743d7d316d8f272911c495bb7186 | MATLAB | 728 | 24 | function a = nnz(t)
%NNZ Number of nonzeros in sparse tensor.
%
% NNZ(T) is the number of nonzero elements in T.
%
% See also SPTENSOR, SPTENSOR/FIND.
%
%MATLAB Tensor Toolbox.
%Copyright 2015, Sandia Corporation.
% This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others.
% http://www.sandia.gov/~tgkol... |
a2471870ccffaf5351fffa4da496b0354c2c5253eeee969b1032b462171844f3 | MATLAB | 729 | 30 | function t = tblvertcatsafe(t1,t2)
% Vertical concatenation of possibly dissimilar tables
%
% Like regular vertcat, except any new field(s) in t1 relative to t2 or
% vice versa are added as necessary with 'null' values.
f1 = tblflds(t1);
f2 = tblflds(t2);
fnew = setxor(f1,f2);
for f=fnew(:)',f=f{1}; %#ok<FXSET>
if... |
18bf1d7e444670a6a50beb097ed140387d1287cd8355b06e8dc32c03a509f5aa | MATLAB | 730 | 26 | function [lens_X, knn_g] = compute_rknn_prelens(X, rknnparam, rknn_directed, rknnbinarized)
if nargin < 4
rknnbinarized = false;
end
[~,~,~,knn_g_bin,knn_g_wtd] = createPKNNG_bdl(X, rknnparam);
if ~rknnbinarized
knn_g = graph(knn_g_wtd);
else
knn_g = graph(knn_g_bin);
en... |
90c7a50220d70671b19ce42e582a2b1efe1ee8731f6ef44e6076052cbd47260f | MATLAB | 730 | 25 | function matout = vec2mat(vec,ncols)
%this function splits the input vector data in 'vec' into an m x n matrix 'matout' where n is the
%number of desired columns specified in the function call and m*n = length(vec(:)). Note: input data
%'vec' is automatically linearized to vec=vec(:). For this reason,
%mod(length(mat(:... |
bcbdb70ca48a424b110933830c0bec3d43815d760c5ef87a4672cef9794b7681 | MATLAB | 730 | 35 | function [LAN] = lan_add_ttl(LAN, path_clock_csv, threshold)
%
% Daniel Acuna, Marcelo Stockle
%
% input :
% threshold (en desviaciones estandar)
% Load csv
if nargin < 2 || isempty(path_clock_csv)
path_clock_csv = uigetfile({'*.csv','CSV file';}, 'Open .csv clock file',...
'*.csv', 'MultiSelect', 'off... |
03571d67ecf666707fe043117c729587421e52db0f5a4af9a26d1154df1a5879 | MATLAB | 731 | 34 | % Returns the mode of a vector.
%
% Was mode not part of Matlab before?
%
% USAGE
% y = mode2( x )
%
% INPUTS
% x - vector of integers
%
% OUTPUTS
% y - mode
%
% EXAMPLE
% x = randint2( 1, 10, [1 3] )
% mode(x), mode2( x )
%
% See also MODE
% Piotr's Image&Video Toolbox Version 1.5
% Written and maintain... |
1465b0a9eeb642577c85c3ec6e38a889f6fc9b26685fdabe5498037f2a509f60 | MATLAB | 731 | 25 | function [model] = logregFitLaplaceApprox(X, y, lambda, preproc)
% Laplace approximation to posterior for *binary* logistic regression
% We use a N(w | 0, diag(lambda) ) prior
% We assume a column of 1s has already been added
% This file is from pmtk3.googlecode.com
[y] = setSupport(y, [-1, 1]);
% First find mode -... |
fd1a1f9c84595c06644676e26870f7746edfa394aa0747951286f3f6a5357f4e | MATLAB | 731 | 35 | function tree = hmmToTree(model, T)
% Convert an hmm model to an undirected of by unrolling the hmm for T time steps
% Similar to hmmToDgm
%
% This file is from pmtk3.googlecode.com
G = mkChain(T);
Nnodes = T;
Nstates = size(model.pi, 1);
nodePots = ones(Nstates, 2);
nodePots(:,1) = model.pi;
nodePotPointers = [1 2*... |
81d00cf7343dd9eba394946eb75f35a6c39151cfb488882ff4d1f461b67de03c | MATLAB | 732 | 32 | function s = fromtable(t)
if any(strcmp(t.Properties.VariableNames,'mov'))
assert(all(t.mov==t.mov(1)));
warningNoTrace('.mov column will be ignored.');
end
if ndims(t.p)==3
s = Labels.fromtableMA(t);
return;
end
n = height(t);
sz = size(t.p);
npts = sz(end)/2;
s = Labels.new... |
92cf9d90e12976c9cd5236b86aca6ab850139dabfef3fc460a478a3217b82b4d | MATLAB | 732 | 33 | % test_kronmult
%
% Short script for illustrating speed of 'kronmult' - function for performing
% matrix-tensor products, in lieu of using making full matrix 'kron'
% Size of component matrices
n1 = 23; m1 = 22; % Matrix 1 size
n2 = 16; m2 = 18; % Matrix 2 size
n3 = 25; m3 = 25; % Matrix 3 size
mm = m1*m2*m3; % tota... |
a6b669324720420c375849e839a7f585e4f619cb41c0ba0b9e2996a843508510 | MATLAB | 732 | 19 | function SafeAxisLimAdjust(Axes2Adjust,Limits)
if size(Limits,2)~=2&&size(Limits,1)~=1
warning on
warning('Not providing proper limits [low high]')
else
if Limits(1)<Limits(2)
if any(strfind(Axes2Adjust,'x'))||any(strfind(Axes2Adjust,'X'))
xlim([Limits(... |
03827d4916d10239a896eefb9adbc04b98ddc7b79369875d78e182d66aa707a4 | MATLAB | 733 | 34 | %% Detect Cells from PCA-ICA for a given component
function Cells=NoCamp_FindCells(A0,Nx,Ny,NeuronSize,PxSize)
% Get 2D filter
A=reshape(A0,Nx,Ny);
% 2D Wavelet
f0=Nx/(NeuronSize/PxSize);
B=real(WaveletLine2D(A,f0,f0/2));
% Find extrema
[a,b,c,d]=extrema2(B);
Cell=b(a>max(B(:))/5);%3 for GCAMP5 arbitrary threshold
... |
53fde83c49fdfadaf2ac1ee3466c26b5902363bce39dff7b23c730c262c4270f | MATLAB | 733 | 26 | function libdaiParseAliasesConf()
%% Parse the libdai aliases.conf file and save the results in a struct
% This file is from pmtk3.googlecode.com
%fpath = fullfile(getConfigValue('PMTKlibdaiPath'), 'tests', 'aliases.conf')
fpath = 'C:\boost\libDAI-0.2.5\tests\aliases.conf';
raw = getText(fpath);
raw = removeEmpty... |
729d6d797071d9a9aded10eabf5fd3c575edddaee03e668ba4dd578d153ab097 | MATLAB | 733 | 41 | %% Plot KL(p,q) and KL(q,p) for 2d Gaussian
mu = [0,0];
Sigma = [1,0.97;0.97,1];
SigmaKLa = eye(2)/25;
SigmaKLb = eye(2);
x1 = [-1:0.01:1]';
x2 = x1;
n1 = length(x1);
n2 = length(x2);
f = zeros(n1,n2);
klqp = f;
klpq = f;
for i=1:n1
f(i,:) = mvnpdf([repmat(x1(i),n2,1),x2],mu,Sigma);
klqp(i,:) = mvnpdf([repma... |
c4950a8fa670d0a1866f53c126487ec47b7676718fa48da980af0457a729b4b5 | MATLAB | 733 | 29 | function value = triangle_is_degenerate_nd ( ndim, t )
%% TRIANGLE_IS_DEGENERATE_ND finds if a triangle is degenerate in ND.
%
% Discussion:
%
% A triangle in ND is described by the coordinates of its 3 vertices.
%
% A triangle in ND is degenerate if any two vertices are equal.
%
% Modified:
%
% ... |
53de74f6c925f70976e99a74cd2134c9695073172d6eb2b45f461c8f27774ecf | MATLAB | 734 | 20 | function params = prepare_flip_angle(tr_tmp,gx, params)
% Flip angle
% tr_tmp Rough estimate of TR, to calculate Ernst Angle
if params.gen.ro_type == 'c'
params.epi.n_lines = ceil(params.gen.n(2)/params.epi.ry)-((round(params.gen.n(2)/params.epi.ry)-round(params.gen.n(2)/params.epi.ry*params.epi.p... |
9fb3ded135994e306aeefc5665b3d15fb7a773a068d92badb13f8529520c316a | MATLAB | 734 | 29 | function dgm = mkRndDgm(nnodes, maxFanIn, maxFanOut, maxNstates, sparsityFactor, varargin)
%% Create a random dgm
% This file is from pmtk3.googlecode.com
SetDefaultValue(1, 'nnodes', 10);
SetDefaultValue(2, 'maxFanIn', 2);
SetDefaultValue(3, 'maxFanOut', 2);
SetDefaultValue(4, 'maxNstates', 2);
SetDefaultValue(5, '... |
a71b8afe54da9115e5de10af4aba5197f3df031f9e44ee0fa927dc51466a7903 | MATLAB | 734 | 20 | % [nr,nc,nframes,bgcenter,bgstd,frame2file,version,differencemode] = sbfmf_read_header(filename)
function [nr,nc,nframes,bgcenter,bgstd,frame2file,version,differencemode] = ...
sbfmf_read_header(filename)
fp = fopen( filename, 'r' );
nbytesver = double( fread( fp, 1, 'uint32' ) );
version = fread(fp,nbytesver);
nc ... |
e20a91aa1b6d0d14acd571f16f04214aa9166646f3d542f0f81ccaabe8ce501a | MATLAB | 734 | 23 | function v=forward_general(dips,fp);
% usage: v=forward_general(dips,fp);
% makes forward for 'arbitrary' methods for dipoles
%
% input:
% dips Nx6 matrix (the i.th row contains dipole locations
% (first 3 numbers, in cm) and moment (second 3 numbers,
% in nAm))
% fp structure containing all infor... |
4a25130dce70a6e59e745db7bca1759e7b0963401d830a1e27193eb9674b83bd | MATLAB | 735 | 25 | function [mu f g H] = maxFuncNumerical(fn, start, options)
% Maximize a function using numerical gradients and Hessians
% fn(X(i,:)) returns the score function for that *row* vector
% This file is from pmtk3.googlecode.com
if nargin < 3, options = []; end
options.Method = 'cg';
options.Display = 'none';
mu = minFun... |
ca87df3fd66f5732dd8cac733a3ba79570098f156b337a34486146f10a4277ff | MATLAB | 735 | 26 | function g = gridSpace(varargin)
% Similar to built in ndgrid except the output g is a single matrix, regardless
% of the number of inputs. Suppose [a,b,c] = ndgrid(1:10,1:10,1:10), if
% g = gridSpace(1:10,1:10,1:10), then g = [a(:),b(:),c(:)];
%
% This file is from pmtk3.googlecode.com
if nargin==1, varargin... |
05d0e234ae87a7893b778cbade1cc54863d33cd350e5a1e23252cb05a2e84c69 | MATLAB | 736 | 18 | function iptabout(varargin)
%IPTABOUT About the Image Processing Toolbox.
% IPTABOUT displays the version number of the Image Processing
% Toolbox and the copyright notice in a modal dialog box.
% Copyright 1993-2008 The MathWorks, Inc.
% $Revision: 1.1.8.3 $ $Date: 2008/06/20 07:59:54 $
tlbx = ver('images')... |
c95c52ecb13f06333562f2bf336050619bf7199dd50675af179cb99329856a5b | MATLAB | 736 | 26 | function [out,out2] = TLerodeMasks(maskImage_in)
[out,out2] = deal(maskImage_in);
[temp,temp2] = deal(erode3d(out));
tempNoNaN = temp(~isnan(temp));
numVoxelsRemaining = nnz(tempNoNaN); %number of nonzero elements
count = 0;
%Goal: One fewer erosion than what resulted in more than 1 remaining... |
cbcb3bde6673f6a20bb28040bb0c3032eebd237b6ed2fe62c0ca37a5a2aeab81 | MATLAB | 736 | 34 | function CleanupSplitTracking(lblFile,infoFile,outTrkFile,outLogFile)
if ~exist(outTrkFile,'file'),
error('Output track file %s does not exist.',outTrkFile);
end
[info,isdone] = CheckSplitTracking(lblFile,infoFile);
if ~all(isdone),
error('Not all jobs are done.\n');
end
fid = fopen(outLogFile,'w');
for i = 1:nu... |
5351472541c7313d355fefe4f14d9ff312037ca50ab4d98488f44da8672ab77a | MATLAB | 737 | 34 | function [A,cost] = minSpanTreePrimSimple(C)
% set absent edges to infinite weight
% See mstDemo for a test
% See Aho, Hopcroft, Ullman "Data structures and algorithms" 1983, p235
% This file is from pmtk3.googlecode.com
n = length(C);
A = zeros(n);
closest = ones(1,n);
used = zeros(1,n); % contains the members of U
... |
8b8f9dfd81e60f8ff70cf84e10a69a748171cde5c0eb7229d9e8ba7c9b04cbb1 | MATLAB | 737 | 36 | function sout = mergeStructures(varargin)
% AL20150827: Probable dup, see structmerge
% Start with collecting fieldnames, checking implicitly
% that inputs are structures.
fn = [];
for k = 1:nargin
try
fn = [fn ; fieldnames(varargin{k})];
catch MEstruct
throw(MEstruct)
end
end
% Make sure the field n... |
b4ade7b16744760071ff9f3a89c134d7c9444e2a9576fe9388ca839b64ed41a0 | MATLAB | 737 | 34 | function te = expand(t,f)
% Expand spatially an image t in a factor f
% in X and in Y.
% t may be complex.
% It fills in with zeros in the Fourier domain.
% te = expand(t, f)
% See also: shrink.m
% JPM, May 95, Instituto de Optica, CSIC, Madrid.
[my mx]=size(t);
my=f*my;
mx=f*mx;
Te=zeros(my,mx);
T=f^2*fftshift(fft2... |
c5c02fbe079274c63f2859d26d220227f40ac8ed792319b08cc30245d4d8bc50 | MATLAB | 737 | 22 | % ReshapeData.m
% Sarah West
% 4/13/22
% Reshapes data for use with RunAnalysis.m. Uses a string cell array as
% input for dimensions.
function [parameters] = ReshapeData(parameters)
% Display progress message to user.
MessageToUser('Reshaping ', parameters);
% Put in reshaping directions to ma... |
c271b80ffe589c077c1dcc7cce5e93ffca7c7188a4b7196209c1adc78aa6d75b | MATLAB | 738 | 22 | % Edited by Jerry. 07/06/2022
function PlotSem_220706(DataX,DataY,se,ax,color)
% PLOT_SEM Plot SE/SEM using rectangular drawing function
% Currently plots SE; in order to change to SEM just divide SE by the
% number of points.
% DataX: x values of data on which SEM plot is centered
% DataY... |
cffccae1bb1d736a03e460adfa2f729a0068edad94c9fc2c6bb520fa07a50368 | MATLAB | 738 | 28 | function smallT = margTable(bigT, bigdom, bigsz, onto, maximize)
% Marginalize a table
% This file is from pmtk3.googlecode.com
if nargin < 5, maximize = 0; end
smallT = reshapePMTK(bigT, bigsz); % make sure it is a multi-dim array
sum_over = setdiffPMTK(bigdom, onto);
if isempty(sum_over)
smallT = bigT;... |
f856ee58a5684b4432940594b6148b83b5754443c4f2a1bed422342e0556400e | MATLAB | 738 | 26 | function result = merge_struct(p, s, donotmerge, deep)
import yaml.*;
if ~( isstruct(p) && isstruct(s) )
error('Only structures can be merged.');
end;
if ~exist('donotmerge','var')
donotmerge = {};
end
if ~exist('deep','var')
deep = 0;
elseif strcmp(deep, 'deep')
deep... |
8e742ed416d50d94c7599f308cf022071cfa0a2fc9d910a6dd258d3212047d47 | MATLAB | 739 | 31 | function X = betainvPMTK(p, a, b, tail)
% Inverse of the beta cdf
% Replacement for the stats toolbox betainv function
%%
% This file is from pmtk3.googlecode.com
upper = (nargin > 3) && strcmpi(tail, 'upper');
if statsToolboxInstalled || isOctave
if upper
X = betainv(1-p, a, b);
else
X ... |
aa6d41fc945d492d589d41a9f967fcd4e3b49505345a1444d965e568f9f1fe5f | MATLAB | 739 | 21 | function unitnormals = meshnormals(P, t);
% SYNTAX
% unitnormals = meshnormals(P, t)
% DESCRIPTION
% For a manifold mesh P, t, this function returns an array of outer
% normal vectors for each triangle
% Inputs:
% P - Vertex array of the mesh (N x 3)
% t - Facets of the mesh (N x 3)
vert1 = P(t(:, 1),... |
ae443cb56aba4bb73e7893ecc59e8e902bbab90a4388730bb6532f61008f39aa | MATLAB | 739 | 25 | classdef LabelerKeyEventHandler < handle
properties
evtMatchFcn % fcn with sig: tf=evtMatchFcn(evt) where evt is a keypress
% event. Return true to handle given keypress
actionFcn % fcn with sig: actionFcn(lObj,evt). lObj is Labeler obj, evt
% is event that matched. Take desired... |
0a4e6f0cfe317a319d09053a19cc6d22b5e1349cb5a0a8160c74063a0667365c | MATLAB | 740 | 30 | function spread = led_spread_to_pd(led,pd,ds,n)
if(nargin<4)
n = 1.46;
end
x_dist = bsxfun(@minus,led.x(:),pd.x(:)');
y_dist = bsxfun(@minus,led.y(:),pd.y(:)');
dist = sqrt(x_dist.^2+y_dist.^2);
angs = atan(dist/sum(ds));
eps = 1e-10;
nang = 91;
dangs = linspace(0,pi/2,nang)';
led_drads = inter... |
2d06b176339fb439f0328cdec8cf64569b945f95b2841cb1e5548f1ba04bc9a4 | MATLAB | 740 | 21 | function corr_mat = CBIG_corr(s_series, t_series)
% Calculate correlation matrix between each column of two matrix.
%
% corr_mat = CBIG_corr(s_series, t_series)
% Input:
% s_series: T x N1 matrix, T is number of frames, N1 number of voxels
% t_series: T x N2 matrix, T is number of frames, N2 number of voxels
% ... |
7b2d12dc379178f643c686aea098504166309273679ac985a21bed9f929ebe8c | MATLAB | 740 | 25 | function path = hmmMap(model, X)
% Find the most-probable (Viterbi) path through the HMM state trellis.
%% Inputs:
% model - a struct as returned by e.g. hmmFit, which must contain
% at least the fields, pi and A for the starting state distribution
% and transition matrix respectively, as well as type, a string in {'g... |
bc5c122759ee53b233e70ea09987bd962894ffe2b23545298feb39aeb843dd8a | MATLAB | 740 | 20 | function ok = checkattributes(a, classes, attributes)
%CHECKATTRIBUTES is like VALIDATEATTRIBUTES but returns true or false
% OK = CHECKATTRIBUTES(A,CLASSES,ATTRIBUTES) takes the same arguments as
% VALIDATEATTRIBUTES, excluding the three optional arguments. However
% CHECKATTRIBUTES returns true or false whe... |
cbb55213fb359afaa8e4080c3b334bd00110650687aa25532f46e753ea320987 | MATLAB | 740 | 17 | function [minus_I_s, minus_I_s_d] = I_s_I_s_d(beta,C_D_beta1_inv,Cov_X_inv,Cov_X,Cov_Y,C_D_cond,S_left,S_right,I_s_d_Const_part)
C_D_beta_inv = beta*C_D_beta1_inv; % 2nd term of eq. (26)
Q_inv = Cov_X_inv + C_D_beta_inv; % Q_inv
norm_t = 1/2*logdet(Q_inv) + 1/2*logdet(Cov_X);
R = beta*inv(C_D_cond)... |
180e5e05854970fa9d1277cfc4ff33ff6ef9103a31b3cf1bc3492aa3fa651cbd | MATLAB | 741 | 40 | % _ _
% ___ _ __ __ _| |__ ___ ___ _ __| |_
% / __| '__/ _` | '_ \/ __|/ _ \| '__| __|
% | (__| | | (_| | |_) \__ \ (_) | | | |_
% \___|_| \__,_|_.__/|___/\___/|_| \__|
%
% modifies data based on mouse clicks
function modify(self,p)
if self.verbosity > 9
disp(mfilen... |
287a4a06e3469ddaf6af686f1ae453bdc028746f0be22af4e8c33e03b1e878b1 | MATLAB | 741 | 29 | function [ gx,dgdx,dgdP ] = g_softmax(x,P,u,in )
% softmax decision rule for Q-learning (2-armed bandit task)
% function [ gx,dgdx,dgdP ] = g_softmax(x,P,u,in )
% IN:
% - x : Q-values
% - P : inverse (log-) temperature and bias
% - u : [useless]
% - in : [useless]
% OUT:
% - gx : P(a=1|x)
% inverse tempera... |
29501ad49c8f1dd4a0810c41904227512d1260d58c736bb556822c1cf0fd5825 | MATLAB | 741 | 29 | % Matlab claims that function arguments are passed by value such that local
% changes to a variable do not affect the variable in the higher scope.
% it also claims to optimize to only pass by value for parts of variables that are being changed
% to test, the time of passing a large array should be equal to the time t... |
52c2b26cf8d1caab8c71c316a28fe48b492a522f041b72900aec4cb85a58d679 | MATLAB | 742 | 31 | function [dydt] = MitchellSchaeffer(t, vm_h, apd)
stim_amp = 0.05;
stim_dur = 5;
vm = vm_h(1);
h = vm_h(2);
tau_out = 5.4;
tau_in = 0.3;
tau_open = 80;
tau_close = apd / log(tau_out / (2.9 * tau_in)); % Gilette paper has 4*tau_in, this gave us larger apd errors than 2.9.
V_min = -86.2;
V_max = 40.0;
vm_gate = 0.1; %... |
8d60ca84acf0f568cf2d0a3b0c10101548f0aac9985295d0e13fe0cd8810dcca | MATLAB | 742 | 32 | function plot_graph(res, save_path)
% PLOT_GRAPH Plot the Mapper Graph
%
% Inputs:
% :param res: the results from running Mapper
% :type res: Mapper struct
%
% :param save_path: where to save the resulting graph
% :type save_path: string
%
n_nodes = size(res.nodeMembers, 1);
if n_nodes == 0
return
end
nodeSize = ... |
40fa31d0e5c7aa49305c76dcd8d57647c123d44808a0f08058eaa5a514265db3 | MATLAB | 743 | 25 | function Simul(file,vid)
start = NB_Init(strcat(file,'.csv'));
out = NB_Run(start,vid);
if vid
gifmaker(file,out);
out = rmfield(out,'MOV');
end
save(strcat(file,'.mat'),'out','-v7.3');
%% Figures
s = out.s; t_lim = out.t_lim;
T = out.RES.T; P = out.RES.P; U = out.RES.U; N = size(out.NEUR,1); UPR = U*ones(... |
776f1e6b41d9cba7fc32362ec4da36cee4dd56cb53bd5c698c72b27af4d1b6f6 | MATLAB | 743 | 29 | function tf = figIsOffScreen(hFig)
% tf = figIsOffScreen(hFig)
%
% tf: true if at least one corner of hFig is off-screen
assert(isa(hFig,'matlab.ui.Figure'));
gr = groot;
mposes = gr.MonitorPositions;
mposUnits = gr.Units;
figUnits0 = hFig.Units;
oc = onCleanup(@()set(hFig,'Units',figUnits0));
hFig.Units = mposUnits... |
858102eb4cd0bd919eb5e0f9bd262707ee055c3b0bc64ffbe414764fd3e7bfbd | MATLAB | 743 | 34 | % MC on change of variables and empirical distribution
function bayesChangeOfVar()
xseq = [0:0.1:10];
function y = ginv(x)
y = 1 ./ (1 + exp(-x + 5));
end
mu = 6; sigma = 1;
N = 10^6;
x = normrnd(mu,sigma,N,1);
% [xheight,xpoints] = hist(x,50); octave
% [ypoints,yheight] = hist(ginv(x),50); octave
[xheight,xpoint... |
c1fcd00962bb80b6975dba3a4dede08f025ae43a05c5370efb6efe2557845c7a | MATLAB | 745 | 18 | % RSKELF_PARTIAL_INFO Retrieve compressed skeleton information from partial
% recursive skeletonization factorization.
%
% [SK,S] = RSKELF_PARTIAL_INFO(F) returns the skeleton indices SK remaining
% at the end of the factorization as well as the accumulated matrix updates
% assembled as a... |
c79cc0f9170bc7d1b1c3b374de67a9927ff45d758460c59c25927cfef5962860 | MATLAB | 745 | 36 | % Demo of topological sorting
% Based on http://en.wikipedia.org/wiki/Topological_sorting.
% For octave source code:
%http://old.nabble.com/topological-sort-td29696263.html
C=cell(11,1);
C{11}=[7 5];
C{8}=[7 3];
C{2}=11;
C{9}=[8 11];
C{10}=[3 11];
D = 11;
adj = zeros(D,D);
for j=1:D
if ~isempty(C{j})
adj(C{j... |
ffd88efcf3f5a8868bd7e9ebe82a7da1626c79b4b3dd44954ee39219984ffbab | MATLAB | 745 | 23 | function coords = sam_unwarp_command_auto(sn3d, svl, coordsFile, talUnits)
%
%
%
% coords = sam_unwarp_command_auto(sn3d, svl, coordsFile, talUnits)
%
% [sn3d] is matrix of sn3d.mat files
% [svl] is matrix of an unwarped a*img file for each subject
% [coordsFile] is mx3 matrix of mni or tlc coords. m=... |
0576451c7b5ff84cdb14e97d3533a63fd641c7d4be09696ffd002e4c648bbe0a | MATLAB | 746 | 22 | function data = augmentImageAndLabel(data, xTrans, yTrans)
% Augment images and pixel label images using random reflection and
% translation.
for i = 1:size(data,1)
tform = randomAffine2d(...
'XReflection',true,...
'YReflection',true,...
'XTranslation', xTrans,...
'YTranslation', y... |
7ea496899d3d9df68b8165e4910e1dacc288105eea4bfcf6224975165095e656 | MATLAB | 747 | 33 | function violinPlot_distribution(x, y, color, shrinky)
% inspired by violinPlot, plots a nice-looking patch
if isempty(color),
color = [0 0 0];
end
if ~exist('shrinky', 'var'),
shrinky = 10;
end
[xHist,yHist] = ksdensity(y);
xHist = xHist / shrinky;
% find the percentiles and make patch
xPatch = xHist;
yPatch = ... |
85e1c5da7e40f5b07d14860581d394c28da76066c79222ef09821ff40c1f24dd | MATLAB | 747 | 26 | %% Plot the Huber loss fn compared to L1 and L2
% cf Hastie book 2e p350
%%
% This file is from pmtk3.googlecode.com
err = -3:0.1:3;
L1 = abs(err);
L2 = err.^2;
delta = 1.5;
ind = abs(err) <= delta;
huber = 0.5*ind .* (err.^2) + (1-ind) .* (delta*(abs(err)-delta/2));
vapnik = ind .* 0 + (1-ind) .* (abs(err) - delta);... |
ee84e232d9d4738ba890075d84e6ea9c76979f221c9c7370063fa737951f2557 | MATLAB | 747 | 21 | function s = accumulate_visits(sites_per_run,return_as_matrix)
if (nargin < 2) || isempty(return_as_matrix)
return_as_matrix = false;
end
assert(iscell(sites_per_run),'sites_per_run must be a cell array');
s = cell(size(sites_per_run));
Gk = arena.calc_grid_visit_matrix(sites_per_run{1});
... |
a6917d369e875b913327fe23b385c881b98b362949d58d0c363b99e5c2da31cb | MATLAB | 748 | 26 | function n = lObjNLabeled(lObj,labelsfld,varargin)
[movis,itgts,gt] = myparse(varargin,'movi',[],'itgt',[],'gt',[]);
if isempty(movis),
movis = 1:numel(lObj.(labelsfld));
movis = reshape(movis,size(lObj.(labelsfld)));
end
if isempty(itgts),
itgts = cell(size(movis));
end
if gt,
movis = abs(m... |
fdcde04b62727385ed83a19c870dd4d7ee7e6572038a96bbd3a94ffcd2b2860d | MATLAB | 748 | 20 | function [uv] = dlt_inverse(c,xyz)
% function [uv] = dlt_inverse(c,xyz)
%
% This function reconstructs the pixel coordinates of a 3D coordinate as
% seen by the camera specificed by DLT coefficients c
%
% Inputs:
% c - 11 DLT coefficients for the camera, [11,1] array
% xyz - [x,y,z] coordinates over f frames,... |
0e0dd08a773e8344224eb492d38746c157e85016a43fdcb7ee6635a4a2b95eaf | MATLAB | 749 | 26 | function B = extendDomainTable(A, smalldom, smallsz, bigdom, bigsz)
% Expand an array so it has the desired size.
%
% A is the array with domain smalldom and sizes smallsz.
% bigdom is the desired domain, with sizes bigsz.
%
% Example:
% smalldom = [1 3], smallsz = [2 4], bigdom = [1 2 3 4], bigsz = [2 1 4 5],
% so B(i... |
39d027d6601fecb3909822983434b847afe4baedec6c0d81150885618840aef1 | MATLAB | 749 | 27 | function idx_opt = oneStdErrorRule(res_mean, res_std, dof)
% We pick the model whose error is within one standard error of the lowest
% We assume models are ordered from least complex to most complex
% If not, pass in the dof field to figure out the right order
% This file is from pmtk3.googlecode.com
n = length(res... |
8000c79504a47b943de06258a8fee3edf16b5957f0a94f63ff2252ff1cecf53e | MATLAB | 749 | 20 | function [time_vec] = traintest(trainA,trainB,testA,testB,timewindow,labels_train,labels_test,train_col)
% Cross decode between condtions. Only within time.
time_vec = nan(1,length(timewindow));
for iTime = 1:length(timewindow) % size of data
% train
train_data = [squeeze(trainA(train_col,:,iTime)); s... |
8cec99bd24ab9c0895a4e3a32836fe68e49a5f78538a3ef37b191c3688a8a034 | MATLAB | 749 | 43 | function [num, num3, ax1Pos, x, y, x2, y2, yNew, y2New] = setThirdAxis(refAxes, av, md)
ax1Pos = get(refAxes,'position');
set(gcf, 'currentAxes', refAxes);
% Get the normalized x-y coordinates of the means
[x,y] = dsxy2figxy(gca, 1, av(1));
[x2, y2] = dsxy2figxy(gca, 2, av(2));
refLims = get(refAxes, 'YLim');
n... |
cab4682a494da01b2a4cdf59d347d324d4dc43dc305c4ef1b92db0696fa1325d | MATLAB | 749 | 24 | % This script does FMM-LU
load(fullfile(model_path,strcat(patno,'_',model_name,'_bemfmm_mesh.mat')));
load(fullfile(model_path,strcat(patno,'_',model_name,'_bemfmm_mesh_p.mat')));
weight = 0.5;
%% Add paths for FMM-LU
run(fullfile('../engines/bem_fmm_engine/FLAM-master/startup.m'));
run(fullfile('../engines/bem_fm... |
0a4e784811856c1ebc312a32d38b3406769063124d57364f1603778767e60b4a | MATLAB | 750 | 31 | classdef MovieIndexSetFixed < MovieIndexSet
properties
mIdxs
end
methods
function obj = MovieIndexSetFixed(mi)
assert(isa(mi,'MovieIndex'));
obj.mIdxs = mi(:)';
end
function str = getPrettyString(obj)
mi = obj.mIdxs;
[tf,gt] = mi.isConsistentSet;
if tf
if gt... |
8a674b81919bf6780ab621ad7564f81b52363bfc12b7700c848e1d534e327fdc | MATLAB | 750 | 30 | function X=ar1noise(n,c,g,a)
% AR1NOISE - Generate zero-mean red noise.
% Syntax: X=ar1noise(n,c,g,a);
%
% Inputs: n - desired length of time series
% c - number of time series to generate
% g - lag-1 autocorrelation
% a - noise innovation variance parameter
%
% Output: X - n by c matrix of r... |
b0c1e98cc4508cd6c61fb75d0bc6d56c6f810811dcc5ada1bec0daf5ae4fad72 | MATLAB | 750 | 29 | % ==================================================================
% SHITTY SOLUTION BECAUSE PRIVATE FUNCTIONS OF SPM8 ARE NOT COMPILED
% ==================================================================
function res = fname(this, name)
% Method for getting/setting file name
% FORMAT res = fname(this, name)
% _____... |
cd31bf63da346d9aab48fe935ad0bf43ec0337d8554417a9d2151e21ee6006b0 | MATLAB | 750 | 57 | function X = polynom(y,n,z,o);
% Return polynomial expansion of data vector d to order n (each order normalised by std)
% Rik Henson 2003
if nargin<4
o = 1;
end
if nargin<3
z = 1;
end
M = size(y,1);
if n>M
error(sprintf('%dth order expansion not possible for only %d points',n,M));
end
X = ones(M,1); ... |
de8111eaa4fd3a99c7d19ff2236f5ee0c15245df84d2d5bb60f7fd67215daf41 | MATLAB | 750 | 38 | function varargout = drawfly_ellipse(x,y,varargin)
% draw an isosceles triangle with center (x,y)
% with rotation theta
% with height maj*4
% with base min*4
if isstruct(x),
fly = x;
t = y;
x = fly.x(t);
y = fly.y(t);
theta = fly.theta(t);
maj = fly.a(t);
min = fly.b(t);
else
if nargin < 5,
erro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.