sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
13693af75f8c273f8e1cc76ad87ea94dfead0e854f2708bbc8cda0874f5b0739 | MATLAB | 1,040 | 34 | function [funcMatrix, funcLabels] = load_fc_as_one(parcellation)
%
% Usage:
% [funcMatrix_ctx, funcLabels_ctx] = load_fc_as_one(parcellation)
%
% Description:
% Load functional connectivity data (cortical + subcortical in one matrix)
% (author: @saratheriver)
%
% Inputs:
% parcellation (string, optional) ... |
a18a8caad9bf907bec6bc5734a6d75811eecfc38da0834c02200efa8a7e5c757 | MATLAB | 1,040 | 43 | function [A xy] = wheel_graph(n)
% WHEEL_GRAPH Construct a wheel graph of order n
%
% The wheel graph is a cycle graph of order n-1 along with an additional
% vertex that connects all the remaining vertices. (Run the example and it
% will be extremely clear if you are still confused.)
%
% [A xy] = wheel_graph(... |
e6e750ecc999e2e92c1ae7440ab064ed5a6e2ea4ac33e641a5890e138e0bca38 | MATLAB | 1,040 | 27 | % List of open inputs
% Written by Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
addpath(spm_dir)
nrun = 1; % enter the number of runs here
jobfile = {[script_dir '/CBIG_MMLDA_deformation_job.m']};
jobs = repmat(jobfile, 1, nrun);
inputs = cell(4, nrun);
for crun = 1... |
78a7986cb16b310146dd6ecf625b8b1007761344d6033c0025e4029e4b860543 | MATLAB | 1,042 | 26 | %% Figure 8 supp1
% RUN fig8_analysis, then return here
fig8_analysis
% Params
metricFields = {'duration', 'sharpness', 'linearity', 'persistence', 'variation'};
cmap = cmapAreas();
%% Panel A:
% Metric PDFs from the components of each area-specific GMM, M2
colors = colormapVal(cmap(1,:), linspace(0.5, 1.5, areaGMMs(... |
8069e3f0442f4e97dc297d8f5cbbfa3d2bc086c0afd51b42a540cbb492e42492 | MATLAB | 1,042 | 26 | function target = copyfig(source)
%COPYFIG Duplicate all children of a figure.
% COPYFIG(FIG) makes a copy of the figure specified by the handle FIG in
% a new figure. The copied figure includes all children of FIG.
%
% FIG2 = COPYAXES(FIG) returns a handle to the copied FIGURE.
%
% See also COPYOBJ,... |
95b07858b4f7f7ce52302bf7ba21b13048778deaf129592b8bff2540f0d31067 | MATLAB | 1,042 | 45 | %% set path and load some data
addpath('funcs')
image = double(loadData('test_image.tif'));
pps = 5; % projected pixel size of 15nm
% typical parameters for resolution estimate
Nr = 50;
Ng = 10;
r = linspace(0,1,Nr);
GPU = 1;
%% apodize image edges with a cosine function over 20 pixels
image = apodImRect(image,20);
... |
adec9e0dc897d1657c26ef4ee97e5c9c4bb1c2b4e3e0e3e2cdd8a3c61d30c4d0 | MATLAB | 1,042 | 24 | function ea_unified_draw_tracts(obj,vals,group,side,alphaind,fibcell,fibcmap,cmapind,usedidx)
% Plot fibers if any survived
if ~isempty(fibcell{group,side})
prefs = ea_prefs;
obj.drawobject.fiberfiltering{group,side} = streamtube(fibcell{group,side}, prefs.d3.fiberwidth);
nones=repmat({'none'},size(fibcell{... |
0bcbefc4f37576baf86f07c7405625e919122d50ae8937608ef81547b73e016c | MATLAB | 1,043 | 40 | function eventsOut = dan_get_event_latencies(eventsIn, recStart, srate)
% Takes an events table with datestrings and converts them from durations
% from recStart
%%
% Authors: Dan Denis
% Date: 2021-07-14
%%
% Recording start time is t0
t0 = datetime(datestr(recStart, 'HH:MM:ss.FFF'), 'Format', 'HH:mm:ss.SSS');... |
a12dc6dfac111eab53997e16ad52d6a58650123d1802a623cc7e194e8d0216cd | MATLAB | 1,043 | 28 | % Local Regression and Likelihood, Figure 7.1.
%
% Estimating the hazard rate for censored survival (or
% failure time) data. Hazard rate estimation is specified
% by 'family','hazard'.
%
% The censoring indicator variable is passed as the 'cens'
% argument. This should be a vector of 0's and 1's, with 1
% indi... |
a7fd7ba2e9e7ced77a1ca49426367e6e1f2a737a27710ecbe990c722b4b4ee83 | MATLAB | 1,043 | 34 | function genes = fetch_ahba(csvfile)
%
% Usage: genes = fetch_ahba(csvfile);
%
% Description
% Fetch Allen Human Brain Atlas microarray expression data from all
% donors and all genes (author: @saratheriver)
%
% Inputs:
% csvfile (empty or string, optional) - Path to downloaded csvfile.
% For more threshold a... |
d379cbb63973bd62ed1dfc917f6fc41fc8704ea0d6176352ef27ad8570720f54 | MATLAB | 1,043 | 27 | function A = read_raw_file(filename,framenum,window,FOV,bitsize)
%% Starting from frame number: 'framenum', read 'window'
fid = fopen(filename);
imsize = FOV(1)*FOV(2)*bitsize; % Bit size of single frame
current_seek = ftell(fid);
fseek(fid, 0, 1);
file_length... |
d8db88ad7f34e32650987321bf880b9d081f3b20bd88603546384565264642b2 | MATLAB | 1,043 | 34 | function bz_PreprocessExtracellEphysSession(basepath)
if ~exist('basepath','var')
basepath = cd;
elseif isempty(basepath)
basepath = cd;
end
%% Assuming one already did bz_SetAnimalMetadata
bz_RunSessionMetadata(basepath);
%% making an xml if needed
basename = bz_BasenameFromBasepath(basepath);
txmlname = fu... |
e94deaacc08ff5f986cb4441a6034003b7a7a40a3eb248e33383ef964fd2835b | MATLAB | 1,043 | 29 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% demo script for mesh generation from binarized volumetric image
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% preparation
% user must add the path of iso2mesh to matlab path list
% addpath('../');
% user nee... |
128d718783e459155a7455b16664735cbef0fe73a85a457ddfa12c6dc3546e36 | MATLAB | 1,044 | 42 | function sims=ea_probeexpressions(testmap,db,generange,smoothkernel)
if exist('db','var') && ~isempty(db)
load(db);
else
prefs=ea_prefs;
load([prefs.genetics.dbdir,'genedb.mat']);
end
if ~exist('smoothkernel','var')
smoothkernel=0;
end
if ~exist('generange','var')
generange=1:size(genedb,2);
end
if... |
23fe605a682a359d3a7481f764e0a418a445d428279fc64f5ff3bb6a647e378a | MATLAB | 1,044 | 57 | %% Set topology input parameters
topology = struct;
topology.T = 0.07;
topology.L = 0.4;
%% Set homogeneous input parameters
homparam = struct;
homparam.gamma = 116;
homparam.r = 0.086;
homparam.nu0 = 0.756;
%% Set topology grid size and timestep in accordance to homogeneous parameters
topology.Nx = 200;
dx = to... |
3d1ab9a374b7bc70f0f7b50e1f2df235b3bc7f655c50a71bfe6fd064c3dfdfeb | MATLAB | 1,044 | 48 | function st = type( x )
x = cvxaff( x );
if isa( x, 'double' ),
st = 'unassigned';
return
end
if iscell( x ),
strs = cell(1,numel(x));
for k = 1 : numel(x),
strs{k} = type(x{k});
end
strs = sprintf( '%s, ', strs{:} );
st = strs(1:end-2);
return
end
s = size( x );
len = prod( s... |
70066b0d42bf0243e80d005b55f67e4b664b23bcbdc52a43533c1800e74c4028 | MATLAB | 1,044 | 17 | function R = LeG_genRotMat(vec1,vec2)
% Generates rotation matrix R for rotating vec1 to match vec2 in 3D space.
vec1 = vec1/sqrt(sum(vec1.^2)); %unit vector in start direction
vec2 = vec2/sqrt(sum(vec2.^2)); %unit vector in end direction
Theta = -acos(dot(vec1,vec2)); %angle between vec1 and vec2
RotAxis = cr... |
852c3f73e4e894e15f3fc92809006b376a3775f01fe0fee827646cebba9569b8 | MATLAB | 1,044 | 38 | % written by Yiyuan Han, Essex BCI-NE Lab, 08/04//2020
% getCOHchannel: Measure the ISPC between two specific channels from a
% EEG data series
% Input:
% -phase: the input phase data series
% -channel1: the label of channel 1
% -channel2: the label of channel 2
% -electrodes: the electrode map between channel labels a... |
8d4d5b7f62d62111ff6ea2fa8cd8e782a51d2e989b3834b0011167ee96b289f6 | MATLAB | 1,044 | 44 | function yd=tcdetrend(y,order,range,norm,do_warningoff)
% Usage ... yd=tcdetrend(y,order,range,norm,warningoff_flag)
%
% y must be in columns!
if size(y,1)==1,
disp('warning: y should be in columns');
end;
if nargin<5, do_warningoff=0; end;
if nargin<4, norm=0; end;
if nargin<3, range=[1 size(y,1)]; en... |
974ee16b865c60d736f31da30d92b7e708b83eb9449befe27a2591e38ae0a62d | MATLAB | 1,044 | 44 | function cvx_optval = prod_inv( x, dim, p )
%DET_INV Internal cvx version.
narginchk(1,3);
if ~isreal( x ),
error( 'First argument must be real.' );
end
sx = size( x );
if nargin < 2 || isempty( dim ),
dim = cvx_default_dimension( sx );
elseif ~cvx_check_dimension( dim ),
error( 'Second argument must ... |
0c50718708deca60d2bb72519644e799ea263fe0b7cdf775642322b18d33f3fa | MATLAB | 1,045 | 28 | function plugin_deactivate(foldername);
% get plugin path
% ---------------
fullpluginfolder = fullfile(fileparts(which('eeglab.m')), 'plugins', foldername);
if ~exist(fullpluginfolder)
error([ 'Could not find folder ' foldername 'in extension folder' ]);
end;
disp('Removing extension ... |
9335c7a2192dba6b5636533602fab36f4c44b0249b4666be36dab7ebd138843b | MATLAB | 1,045 | 42 | function y = avg_abs_dev( x, dim )
%AVG_ABS_DEV Internal cvx version.
if ~cvx_isaffine( x ),
error( 'Disciplined convex programming error:\n ABS_AVG_DEV is convex and nonmonotonic in X, so X must be affine.', 1 ); %#ok
end
try
if nargin < 2, dim = []; end
[ x, sx, sy, zx, zy, nx, nv, perm ] = cvx_reduce_... |
a4861c6de67896a02de5d919ad7ba8bfddcb9d3b2cd048b81a66d90cad924425 | MATLAB | 1,045 | 35 | function printMethodsText(param, varargin)
% bc.qm.printMethodsText - Print generated methods text and references to the command window.
%
% ------
% Inputs
% ------
% param : struct
% The BombCell parameter structure (from bc.qm.qualityParamValues).
%
% Optional name-value pairs (passed to bc.qm.generateMethodsText)... |
f9fcb6ca3d75d69736509ebeb00523c82807583c21b63edcc8cec4db9c44d43f | MATLAB | 1,045 | 23 | function J=mtfftc(data,tapers,nfft,Fs)
% Multi-taper fourier transform - continuous data
%
% Usage:
% J=mtfftc(data,tapers,nfft,Fs) - all arguments required
% Input:
% data (in form samples x channels/trials or a single vector)
% tapers (precalculated tapers from dpss)
% nfft (length of pad... |
06ea73968fc2505db34bb38636cc8849b81dffd1b5dcd6e226b03d1fa4516ef3 | MATLAB | 1,046 | 37 | function l = length(tree,r)
% XMLTREE/LENGTH Length Method
% FORMAT l = length(tree,r)
%
% tree - XMLTree object
% r - 'real' if present, returns the real number of nodes in the
% tree (deleted nodes aren't populated)
% l - length of the XML tree (number of nodes)
%_______________________________________... |
170865f290a0b423d8fbb46fb1edbc02bd21f21de338c49d37e19005b817f6bd | MATLAB | 1,046 | 43 | function plotAreaCountBars(allROIs, areas)
% Plot bars for the cell counts in each area
% Create figure and params
fig;
panelwidth = 1.5;
panelheight = 1.5;
leftoffset = 0.5;
bottomoffset = 0.5;
formatFigure(gcf, panelwidth, panelheight, leftoffset, bottomoffset)
% Colormap
colors = cmapAreas5();
% Compute counts
ar... |
8e0019bbd2adda1bd662417c33063e48e8e65ee1b24c9d3546cc576523ad5465 | MATLAB | 1,046 | 36 | function ov = struct2mat(si)
%
% Creates an output matrix for each field of the input structure. Assumes
% that the field is same type between all cells.
fnames = fieldnames(si);
[nr nc] = size(si);
for i = 1:length(fnames)
tv = eval(['si(i).' fnames{i} ';']);
if (~iscell(tv) & numel(tv) ==1 & ~iss... |
70e72b13d3f282bf7ec42fe71c0332d9866d1493258d3c061106036dfa8dca25 | MATLAB | 1,047 | 39 | function [t2, v2] = upsample2x(t, v);
% [t2, v2] = upsample2x(t, v);
%
% Upsample an array of sampled voltages by a factor of 2. Cublic spline
% interpolation is used to create the new samples. The function returns
% the interpolated data along with a new time vector.
%
% Example:
% >> [t_amplifier_2x, amplifier_dat... |
8d2922204934b09fb780ef95037a1e5b8db9bd68562382537dffe8688e9e797b | MATLAB | 1,047 | 19 | % CVX: Top-level commands to control CVX.
% cvx_begin - Starts a new CVX specification.
% cvx_begin_set - Starts a new cvx CVX specification.
% cvx_cd - Change current working directory to a CVX subdirectory.
% cvx_clear - Clears all active CVX data.
% cvx_end - Compl... |
36492b1974667742d7822ed76a423ad88826e70c8e43460aee38e9449b38a17a | MATLAB | 1,048 | 39 | %% This is the main script to run myPLS Toolbox
%
% ------------------------------STEPS-------------------------------------
%
% The script includes:
% 1. Call of a script with PLS inputs and their description
% 2. Call of the functions to run PLS and plot the results
clc; clear all; close all;
addpath('./myPL... |
3d0ed4a19d5392221e8ea38b8dbdda875acd18fb0149ab24c298aa42d6b35f77 | MATLAB | 1,048 | 29 | %% Axes with colorbars inside layouts
% This example demonstrates how to correctly layout axes that have
% associated legends or colorbars by grouping them together using a
% uicontainer.
%
% Copyright 2014 The MathWorks, Inc.
%% Open the window
% Open a new figure window and remove the toolbar and menus
window = figu... |
57ffa6a40b0319e0f288ef01263f1d6b1db0d61d84e18a4b42b1fee7947071c7 | MATLAB | 1,048 | 35 | function [no,el,regions,holes]=v2s(img,isovalues,opt,method)
%
% [no,el,regions,holes]=v2s(img,isovalues,opt,method)
%
% surface mesh generation from binary or gray-scale volumetric images
% shortcut for vol2surf
%
% author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)
%
% inputs and outputs are similar to those defi... |
d2cd6e89613c32a1d119f82f758b0ee6b3cae1fc0f9d47b614ba8ab60e610128 | MATLAB | 1,048 | 32 | function rfmt=RF_MT(T2c,w1,dw,lineshape)
if strcmp(lineshape,'SuperLorentzian') %SuperLorentzian
% step=1/10000;
% sup_theta = 0:step:pi/2;
cutoff=10;
G=zeros(1,length(dw));
for j=1:length(dw)
if abs(dw(j)) >= cutoff %% the superlorentz has a pole: this avoids infinities
... |
2e3ef02e0295c5e34d7c033d63401d2c66f21ab741b89f7c14d01201f15f1f17 | MATLAB | 1,049 | 19 | %% Add path to the data directory
% This assumes that the Data dir is saved in the default Documents dir
documentsPath = fullfile(getenv('USERPROFILE'), 'Documents');
cohortPath = fullfile(documentsPath, 'Distributed-burst-activity-in-the-thalamocortical-system/Data');
% Extract the folder path of this script to save... |
464d69152ff6e6565d46dfdbd94a0b4199d4e769e2584eb29adf5260d7d02260 | MATLAB | 1,049 | 30 | function varargout=ea_explorer_stats_bend(varargin)
% Function to estimate a certain mass univariate test (see below) as used
% in explorer apps.
% - Expects valsin as V x N matrix where
% V is the number of
% voxels/streamlines/etc and
% ... |
4a94c9a346be53a647085ada6d97f6fb6a3122ada26dae9d3a01aa5ef7da61c0 | MATLAB | 1,049 | 41 | function y = hsv2hsl(x)
%hsv2hsl - Convert hue-saturation-value colors to hue-saturation-luminance.
%
% USAGE
%
% y = hsv2hsl(x)
%
% x Nx3 RGB matrix (values in [0..1])
% Copyright (C) 2013 by Michaël Zugaro
%
% This program is free software; you can redistribute it and/or modify
% it under the te... |
6216014361c4b9f6886a2451429810e17be80cd5b89e19699b9ab5bc3efd0af9 | MATLAB | 1,049 | 30 | function [node,elem,face]=volmap2mesh(img,ix,iy,iz,elemnum,maxvol,thickness,Amat,Bvec)
%
% [node,elem,face]=volmap2mesh(img,ix,iy,iz,thickness,elemnum,maxvol,A,B)
%
% convert a binary volume to tetrahedral mesh followed by an Affine transform
%
% author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)
% date: 2008/01/... |
c47b12114517805ac4389ec637c4f44458ec4822f467ab80dac8400d536fe3e2 | MATLAB | 1,049 | 33 | % Section 4.5.4: Frobenius norm diagonal scaling (GP)
% Boyd & Vandenberghe "Convex Optimization"
% Joelle Skaf - 01/29/06
% Updated to use GP mode by Almir Mutapcic 02/08/06
%
% Given a square matrix M, the goal is to find a vector (with dii > 0)
% such that ||DMD^{-1}||_F is minimized, where D = diag(d).
% The... |
d87034287582c68cc72ef5956b63272e204f8c0204896cdd12b048333b41d9cc | MATLAB | 1,049 | 35 | function mycols = ea_explorer_isocolors(img,vertices)
%% use this if you have RAM issues
fprintf('Sampling exact isocolors for volume.\nIf taking too long or too RAM-heavy please downsample mesh using the hullsimplify option.\n')
tic
vertices=single(vertices);
[x,y,z] = ind2sub(size(img),[1:numel(img(:))]);
coords = v... |
304519a3beef8e9312b527634fb2e8a5d4e843be1811e2255724eeeed802a9a6 | MATLAB | 1,050 | 42 | % Plots a cantilever beam as a 3D figure.
% This is a helper function for the optimal cantilever beam example.
%
% Inputs:
% values: an array of heights and widths of each segment
% [h1 h2 ... hN w1 w2 ... wN]
%
% Almir Mutapcic 01/25/06
function cantilever_beam_plot(values)
N = length(values)/2;
for k ... |
936251c2aefda59b15be3695f42d4243958dd7f0a59ebc5a67b7139bbb9136d8 | MATLAB | 1,050 | 32 | function [inter,inter_x,inter_y,inter_z]=LineTriangleIntersection(A,B,C,P1,P2,ignore_corners)
if(nargin<6), ignore_corners=false; end
% http://www.cs.brown.edu/~scd/facts.html
% Calculate normal of triangle
N = cross(A-C,B-C); N=N./sqrt(sum(N.^2));
Pline = P1; Vline = P2-P1;
% Normalized plane intersection po... |
dc71e37c4fb5270db7b34c81aa005e10f3db1cb9c1570801ffe7885ac00307a4 | MATLAB | 1,050 | 48 | function f = CBIG_forestPlot_xRev(A)
% f = CBIG_forestPlot_xRev(A)
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
f = figure('Position', [100, 100, 1000, 285]);
hold on;
% 0 lines
plot([0 0], [0, 6], '--', 'LineWidth', 8, 'Color', [1 0.8 0.6]);
% plot(xrange, [0 0... |
10b623cc1c9afcaba129925d10a3564e43572d48350cd0031df4179c39e24ff1 | MATLAB | 1,051 | 31 | function cvx_optpnt = norm_ball( sz, varargin ) %#ok
%NORM_BALL Norm ball.
% NORM_BALL( sz, ... ) returns a variable of size sz, say 'x', that is
% constrained to satisfy NORM( x, ... ) <= 1. Any syntactically valid
% and _convex_ use of the NORM() function has a direct analog in
% NORM_BALL. The convex requ... |
2abceb52f25519777d020197ed4f930d1934ed310e620b67132ebc0db132b9b4 | MATLAB | 1,051 | 42 | function plotPETHsGrid(PETHs, ROIinfo, layout, tPts, titles)
% Quick function to make a grid of PETHs from a list of chosen cells
% See fig3 main script for required layout of ROIinfo cell array
if nargin < 3
layout = [5,5];
end
if nargin < 4
tPts = -200:10:400;
end
if nargin < 5
titles = false;
end
% C... |
7d4230a76ba8137847003bfadc22b124e1582e45758cfadb93f15354915877dd | MATLAB | 1,051 | 31 | function ea_synthseg(input, output)
% Wrapper to run SynthSeg
arguments
input % path to the nifti to segment
output % path to the segmented image
end
% Check Conda environment
condaenv = ea_conda_env('SynthSeg');
if ~condaenv.is_created
ea_cprintf('*Comments', 'Initializing SynthSeg conda enviro... |
d88a8b0167ca5cec6d851b3616fbb7137e09d33026a669196180e54d405a384b | MATLAB | 1,051 | 41 | function D = johnson_all_sp(A,varargin)
% JOHNSON_ALL_SP Compute the weighted all-pairs shortest path problem.
%
% Johnson's algorithm for the all-pairs shortest path problem
% works only on graphs without negative edge weights. This method should
% be used over the Floyd-Warshall algorithm for sparse graphs.
%
% T... |
b227b793327ef468044a179e41e7a4b8f727969a54c099e7b728f2f67539825b | MATLAB | 1,052 | 45 | function hdr = encode_qform0(M,hdr)
% Encode an affine transform into qform
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: encode_qform0.m 1143 2008-02-07 19:33:33Z spm $
% Convert from first voxel at [1,1,1] to first vox... |
25ae176a066e41b64d60533d7f48b8442972851543d571b2bddcd0e38a32fd54 | MATLAB | 1,053 | 37 | function allROIs = getLogProbsAreaGMMs(allROIs, models, metricField, fieldStr)
% Computes log probabilities for all neurons under the GMMs for each area,
% using all within-area GMM components
if nargin < 3
metricField = 'metrics';
end
if nargin < 4
fieldStr = '';
end
% Get metrics z-scored for all neurons
s... |
30cd0a36b29efc46feaff44fde9ff0cb2ff7ddb5b358f692c03ad71ded915377 | MATLAB | 1,053 | 42 | function xi = cvx_invert_structure( x, compact )
global cvx___
if nargin < 2, compact = false; end
%CVX_INVERT_STRUCTURE Compute a right-inverse of a structure mapping.
if ~isreal( x ),
x = [ real(x), imag(x) ];
x = x(:,[1:end/2;end/2+1:end]);
if nargin < 2, compact = false; end
xi = cvx_invert_struc... |
e2fc2a94eadbfbd8a8f511f80cabfcbbabc651ab7673b0eb6bc75561c184f107 | MATLAB | 1,053 | 51 | function [yy,ff]=fermi1d(y,co,wid,amp,dt)
% Usage ... y=fermi1d(y,co,wid,amp,dt)
%
% Ex. fermi1d(y,10,10,1);
if ~exist('amp'), amp=[]; end;
if isempty(amp), amp=1; end;
if exist('dt','var'),
df=(1/length(y))*(1/dt);
co=round(co/df);
wid=round(wid/df);
wid(find(wid==0))=1;
disp(sprintf(' actual... |
e4bdb92d0ad3e1851dfb3897a82054739c8c86a306ac668ded3eadf55a8812fa | MATLAB | 1,053 | 30 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% demo script for mesh generation from binarized volumetric image
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% preparation
% user must add the path of iso2mesh to matlab path list
% addpath('../');
% user nee... |
db4fcab0e86561088e68e7cbbbda6ca802f841dcfe0f3d2ea4796310fb09c0bf | MATLAB | 1,054 | 34 | function [strucMatrix, strucLabels] = load_sc_as_one(parcellation)
%
% Usage:
% [strucMatrix_ctx, strucLabels_ctx] = load_sc_as_one(parcellation)
%
% Description:
% Load structural connectivity data (cortical + subcortical in one matrix)
% (author: @saratheriver)
%
% Inputs:
% parcellation (string, option... |
2e52e408d9e6f632d0c7e0ee1ab7447d328ae6478534f393028e2f8a3edb40ab | MATLAB | 1,056 | 33 | function data = AFOFdata_struct10(inputdata, filenames)
% USE THIS FOR EXP1+5 (CEM)
% how it works:
% fly = AFOFdata_struct(data,filenames) where data and filenames are
% outputs from rotoball_importer()
for e = 1:length(inputdata)
for t = 1:size(inputdata{e}{1},1)
trial.filename = filenames{e};
... |
8ce14b8e059126b3a76e02731dc68cc038f0a2089adda58d0e62987e4fcb6f19 | MATLAB | 1,056 | 39 | function out=parse_aes(varargin)
%Parse input to generate esthetics structure
p=inputParser;
% x and y are mandatory first two arguments
my_addParameter(p,'x',[]);
my_addParameter(p,'y',[]);
my_addParameter(p,'ymin',[]);
my_addParameter(p,'ymax',[]);
my_addParameter(p,'z',[]);
my_addParameter(p,'label',[]);
% Other a... |
45b438a6d7f81d3910c3afebc13e29b539aeb8ffba6bb0a2351a1801681135e3 | MATLAB | 1,057 | 29 | %% info
% data
ephysPath = '/media/julie/Elements/dataset/kilosort2/';%pathToFolderYourEphysDataIsIn; % eg /home/netshare/zinu/JF067/2022-02-17/ephys/kilosort2/site1, whre this path contains
% channels to plot
channelsToPlot = 1:20;
timeToPlot = [1,2]; % in seconds
[spikeTimes_samples, spikeTemplates, ...
templ... |
d08cac038ba3436b75a19065b1aa20fae702dcf485dd431fff7e58e9800e709c | MATLAB | 1,057 | 34 | function [data, missingFields] = addMissingFieldsWithDefault(data, defaultValues)
% JF, Check input structure has all necessary fields + add them with
% defualt values if not.
% ------
% Inputs
% ------
if ~isstruct(data) && ~istable(data)
error('Input must be a structure or table');
end
if ~i... |
f8f6911aa03c9f04fe41016cc082a17d249aeb050070b8f6c4b4e602965e360a | MATLAB | 1,057 | 30 | %% Showing/hiding a panel
%
% This example opens a simple user-interface with a panel full of
% buttons. We can then show/hide the entire panel in one go. Note
% that the previous state of the buttons is preserved.
%
% Copyright 2009-2013 The MathWorks, Inc.
%% Open a window and add a panel
fig = figure( 'Nam... |
43398e39aa622dd005acef56e85f48fa60b1e8cc15a2c8c83d66db6f624ee421 | MATLAB | 1,058 | 30 | function new_string = LCN_string(stringarray)
% this function will replace _ by \_ which is useful for printing strings
% because _ is leading to a subscript for the next character
%
% This routine is supplied as is.
%
% Comments or questions can be send to:
% Patrick.Dupont@med.kuleuven.be
%__________________________... |
c6cb19c62eb5fdea00c2ae5a8dc2a61cf156a057cf197200ce4229a97cd3642f | MATLAB | 1,058 | 45 | function writestreamstring4( WS , WO , ncharsperline , maxlines , fid , c , z , proba , focustopics , thr , NC );
L = [];
N = length( WS );
NL = 0;
for i=1:N
if (WS( i ) == 0)
L = [ L '. ' ];
spanst = 'normal';
word = '. ';
else
word = WO{ WS( i )};
... |
f6cd4df0c696f4b337dfc142205065f7912c2601c69574c4d16bbfe539954ffa | MATLAB | 1,059 | 33 | function vout = matlabversion
%MATLABVERSION Sortable version number for current Matlab.
% V = MATLABVERSION returns a sortable version number for the instance
% of Matlab invoking MATLABVERSION. The number is derived by calling V
% = ver('Matlab'); V = V.Version; and converting the result into a
% numb... |
037393fc77e9c605cea2db6a2dda2495ab01619c673d7eeb623d5bd9c46cf65b | MATLAB | 1,060 | 44 | function plot_shadow(x,y,error,color)
% plot_shadow(x,y,error,color): Plot a line with the errorbar as a shadow
%
% Syntax
% plot_shadow(x,y,error,color)
% e.g. plot_shadow(1:20,10*rand(1,20),rand(1,20),color('blue'))
%
% Input
% x: a vector
% y: a vector with the same size of x
% color: color of li... |
d42ba1dce16aebfc612c916eea4c8a32e0c9e2a35004540731c848e2e214e328 | MATLAB | 1,060 | 26 | function scrf=ea_applyscrfmat(mat,native,sides)
scrf=native;
for side = sides
% coords
scrf.coords_mm{side}=mat*[native.coords_mm{side},ones(size(native.coords_mm{side},1),1)]';
scrf.coords_mm{side}=scrf.coords_mm{side}(1:3,:)';
% trajec
scrf.trajectory{side}=mat*[native.trajectory{side},ones... |
49b4e54fa63f18534183f3cb1c4a8b3508a3c43bed932109b302a02d5954aeb6 | MATLAB | 1,061 | 22 | function [h,fv]=ea_plot_fiber(thisfib,numpol,show,options)
% small function selecting to either draw polygonized tube or thin line.
switch options.prefs.d3.fiberstyle
case 'tube'
h = streamtube({thisfib(1:3,:)'}, options.prefs.d3.fiberwidth, [1 numpol]);
streamFaceColors = [];
streamFaceCol... |
96d76c51732c93e7dfb0a150b5204e7437115802d65024cd622c845ca2779599 | MATLAB | 1,061 | 33 | function out = D_dklcolor( fparam, img , imgR, imgG, imgB, typeidx )
% CHROMATIC MECHANISMS IN LATERAL
% GENICULATE NUCLEUS OF MACAQUE
% BY A. M. DERRINGTON, J. KRAUSKOPF AND P. LENNIE
% from the abstract:
% (a) an axis along
% which only luminance varies, without change in chromaticity, (b) a 'constant B' axis... |
bae5c8cccd78332a67dc805275c1d5c8a961b81d1828f9702a51fb47222e0289 | MATLAB | 1,061 | 49 | function st = type( x, usegeo )
df = x.dof_;
if nargin > 1 && usegeo,
geo = any( df < 0 );
else
geo = false;
end
df = abs( df );
s = x.size_;
len = prod( s );
if len == 1,
isstruct = 0;
nzs = len;
st = 'scalar';
else
isstruct = ~isempty( df ) & ( sum( df ) < ( 2 - isreal( x.basis_ ) ) * le... |
2bd13f1576515437013fa5812827d7e328ff24a9d2a03de0585314e9f1b56eb5 | MATLAB | 1,062 | 30 | function handles = refresh_delete(handles, deletId)
handles.savingflag = 0;
spId = deletId(deletId<=handles.id);
dendId = deletId(deletId>handles.id)-handles.id;
if ~isempty(spId)
handles.id = handles.id-length(spId);
handles.roi_seed(spId,:) = [];
handles.roi(:,:,spId) = [];
handles.trace(:,spId) = [];... |
38a2962f077cce917c0c5b86d0363a26c6ecc75b6e4c5e124f3239a4db33a27a | MATLAB | 1,064 | 34 | function out = coord2freq_1D(T, w, padN)
%% coord2freq_1D.m
%
% Calculates the 1D continuous Fourier transform of T.
%
% Inputs: T : array of 1D transfer function or signal in coordinate space
% size(T) = [1, length(w)]
% w : vector of temporal frequencies
% padN : number e... |
6a66350820fe93e2f526c09bc092808b1af8f7cc763946effdff9c89a75ec3a3 | MATLAB | 1,064 | 33 | function [xx_s,xx_f,yy_s,yy_f,zz_s,zz_f,xx_us,xx_uf,yy_us,yy_uf,zz_us,zz_uf] = construct_grid(grid_size,mot_uf,d1,d2,d3,min_patch_size)
xx_s = 1:grid_size(1):d1;
yy_s = 1:grid_size(2):d2;
zz_s = 1:grid_size(3):d3;
xx_f = [xx_s(2:end)-1,d1];
yy_f = [yy_s(2:end)-1,d2];
zz_f = [zz_s(2:end)-1,d3];
if xx_f(end)... |
1f20330134b5a08af2ff6f5022651f19608daca38c04bc372abefe2be560d81f | MATLAB | 1,065 | 42 | addpath (genpath('eeglab2022.1/'));
eeglab
load("dataset_ds005284.mat");
all_windows = cell(length(data),1);
selected_channels = {'C3','C4','CZ','PZ'};
for subi=1:length(data)
EEG = data{subi};
EEG = pop_select(EEG, 'channel', selected_channels);
fs = 250;
EEG = pop_resample(EEG, fs);
EE... |
a44091ce13d12d9111e131efa33740300560a0a044bf22749c301b919a3448a2 | MATLAB | 1,065 | 38 | %% Figure 9 main
% RUN fig9_analysis, then return here
fig9_analysis
% Load map
load('allenDorsalMap.mat');
% Params
cmap = 'L20';
smoothSD = 0.15;
%% Panel B:
% Distance matrix of area-specific GMM components
plotGMMDistances(dists, subpopGMMs)
%% Panel C:
% CCF with log probabilities for Anterior subpop (#1)
plot... |
c37c7fb17171f9f8b2bcf28c9f65bd79d9adb228fb97b0207e97afe76d46e9f3 | MATLAB | 1,065 | 34 | function [node,face,elem]=meshabox(p0,p1,opt,nodesize)
%
% [node,face,elem]=meshabox(p0,p1,opt,maxvol)
%
% create the surface and tetrahedral mesh of a box geometry
%
% author: Qianqian Fang, <q.fang at neu.edu>
%
% input:
% p0: coordinates (x,y,z) for one end of the box diagnoal
% p1: coordinates (x,y,z) for th... |
ca5bac4c88d6808acf0de758a406d27accaf4398863723cc7aed43d5e9aa0aaa | MATLAB | 1,065 | 50 | function [d, V] = center(X, V, dim)
%CENTER subtracts a vector from each row of a matrix
%
%data utility to simplify subtracting each row of a matrix by a vector
%
% d = center(X, V, dim)
% X is a m x n matrix
% V is a 1 x n vector. defaults to column sum of X
% dim is a scalar equal to 1 or 2. 1 to subtract a row vect... |
f6d489255499e51d899865d8959c7c055f3143239b4be5b21b35ee12d05e11f0 | MATLAB | 1,065 | 44 | %clinspace - Linearly spaced vector of circular values (angles).
%
% USAGE
%
% x = clinspace(n,range)
%
% n number of values
% range optional: 1 for [-pi,pi[ (default)
% 2 for [0,2pi[
%
% SEE ALSO
%
% See also isradians, wrap.
%
% Copyright (C) 2013 by ... |
492f08e6e204e4b887adc27a851696ea0d71074c93683d3bece041cc416c44e9 | MATLAB | 1,067 | 39 | function cvx_optval = matrix_frac( x,Y )
%MATRIX_FRAC Internal cvx version.
narginchk(2,2);
if ndims( Y ) > 2 || size( Y, 1 ) ~= size( Y, 2 ), %#ok
error( 'Second argument must be a square matrix.' );
elseif ndims( x ) > 2 || size( x, 2 ) > 1, %#ok
error( 'First argument must be a column vector.' );
els... |
f2ff3f4f155a616d55fc9c65e0294773f1b8ee8ff035ddef013c1bb7744f960e | MATLAB | 1,067 | 36 | function outcoords = ea_fsl_apply_normalization_to_points(varargin)
% Non-linear point mapping between anat and mni using FSL(img2imgcoord)
% For linear transformation, please use ea_fsl_img2imgcoord directly
% mm to mm
options = ea_getptopts(varargin{1}); % varargin{1} is patient folder
incoords = varargin{2};
% INV... |
1411d139f36def1316a29c5638f03b1ef07f1b7aa4dffa14cf53c74d2fbb9ee1 | MATLAB | 1,069 | 31 | function varargout=ea_explorer_stats_spearman(varargin)
% Function to estimate a certain mass univariate test (see below) as used
% in explorer apps.
% - Expects valsin as V x N matrix where
% V is the number of
% voxels/streamlines/etc and
% ... |
2cbf40c37a58490f16d8910eaf282949f0969ba3d6db1709687d45092e3d0fe4 | MATLAB | 1,069 | 37 | function [node,face,elem]=meshasphere(c0,r,tsize,maxvol)
%
% [node,face,elem]=meshasphere(c0,r,tsize,maxvol)
%
% create the surface and tetrahedral mesh of a sphere
%
% author: Qianqian Fang, <q.fang at neu.edu>
%
% input:
% c0: center coordinates (x0,y0,z0) of the sphere
% r: radius of the sphere
% tsize: ma... |
318e8fab12d86f3f7092aaecfe0cbdc925b4740d3c6489fb15ac59e2628e78ae | MATLAB | 1,069 | 37 | function plotsig(C,sig,t,f,c)
% Function to plot C where it is higher than a threshold sig
% useful for plotting coherence
% Usage: plotsig(C,sig,t,f)
% Inputs:
% C: input array t x f - also works for a single vector
% sig: significance level
% t: t axis grid for plot
% f: f axis grid for plot.
% c: color to u... |
43afd5b2592166a44e9683ce55179465484edda603944a6b74d8bd2d4c1d0ac7 | MATLAB | 1,069 | 27 | function s = spm_existfile(filename)
% Check if a file exists on disk - a compiled routine
% FORMAT s = spm_existfile(filename)
% filename - filename (can also be a relative or full pathname to a file)
% s - logical scalar, true if the file exists and false otherwise
%____________________________________________... |
aca722d0f1a29ba8352084be069746b7f80c951cfb2aa8ae8e002bfbc30fbe17 | MATLAB | 1,069 | 27 | function sanity_check_cdata(cifti)
%
%this calls cifti_diminfo_length, but that seems to work even without being on path
if ~isfield(cifti, 'cdata')
error('cifti structure is missing cdata field');
end
if ~isfield(cifti, 'diminfo')
error('cifti structure is missing diminfo field... |
5a42cac652f707b00c7331a11fbeddb9262c1eea3d76b4db1e06e33f3d659c7f | MATLAB | 1,070 | 42 | function Z = zscore_matrix(data, group, controlCode)
%
% Usage:
% Z = zscore_matrix(data, group, controlCode)
%
% Description:
% Z-score data relative to a given group (author: @saratheriver)
%
% Inputs:
% data (double array) - Data matrix (e.g., thickness data),
% size = [n_subject x n_region] group (doub... |
32f731aac3d42987087b46dd5aa123da025fca5d70f3349644829ac07bf279c3 | MATLAB | 1,071 | 33 | function is_kgraph = is_kuratowski_graph(A,varargin)
% IS_KURATOWSKI_GRAPH Test if a graph can be collapsed to K_3,3 or K_5
%
% is_k = is_kuratowski_graph(A) checks if A can be reduced to K_3,3 or K_5
% by repeated edge contractions. If so, then is_k=1, otherwise is_k=0.
%
% ... = is_straight_line_drawing(A,...) takes... |
953954cea54a4047dbab68319938f4875c26294c25cf0a1849d16eb22d817517 | MATLAB | 1,071 | 43 | function plotROIsummary(Cin,ROI,template_red)
%might need to get the frameratefrom this computer and merge that data?
%why is it mad
[imwidth,imheight,roinum]=size(ROI);
figure;
hold on;
imframerate=5.3;%get value from notebook or xml file
tvec=linspace(1,numel(Cin(1,:)),251)/5.3;
for k=1:roinum%iterate... |
0c0c1ca607c82fb2656d634584d3539bcef6d4f38392d88126059cdef2b41072 | MATLAB | 1,072 | 30 | function varargout=ea_explorer_stats_pearson(varargin)
% Function to estimate a certain mass univariate test (see below) as used
% in explorer apps.
% - Expects valsin as V x N matrix where
% V is the number of
% voxels/streamlines/etc and
% ... |
5a2fbdc64e222d13350113314fe57f2bce1985e8b01cb52f47730806a39af789 | MATLAB | 1,072 | 37 | function b = ShowBatch(bfile)
%ShowBatch - Show data sets in a batch job.
%
% USAGE
%
% b = ShowBatch(bfile)
%
% bfile batch file listing the parameters for each iteration
%
% See also StartBatch, GetBatch, BatchInfo, CancelBatch, CleanBatches, Store, Recall.
%
% Copyright (C) 2007-2013 by Michaël ... |
83c53453922a68b8ed054a0f579c74e15ad5a05d882f68c7b4ab5ad32ddd57ab | MATLAB | 1,072 | 38 | function lambda = CBIG_ArealMSHBM_initialize_concentration(D)
% lambda = CBIG_ArealMSHBM_initialize_concentration(D)
%
% This function finds initialize point for concentration parameter with given feature dimension
%
% Input:
% - D: feature dimension
%
% Output:
% - lambda: initialize point for a given feature dim... |
2dff85892c7dcd88323945e57c9588e2cdf29b6e33b80883161a33954b32b2d7 | MATLAB | 1,073 | 35 | [files_on_disk, url_on_neurovault, mycollection, myimages] = retrieve_neurovault_collection(504);
%%
data_obj = fmri_data(files_on_disk);
%% Prepare behavioral data vector - low/med/high
% We don't have ratings attached in Neurovault, so we'll do this instead.
behavior_hml = zeros(size(data_obj.dat, 2), 1);
x = cel... |
82ed2eaef32f2805147d0d69a64eae41d7be4174e4392b3b65a150c2dbfad58b | MATLAB | 1,073 | 43 | function setColorbar(hA, cbLabel, gap, cbW)
if nargin < 3
gap = 0.04; % space between plot & bar
end
if nargin < 4
panelPos = get(gca, 'Position');
cbW = 0.04*panelPos(3); % colorbar width
end
% Label is provided
% Ticks and ticklabels are computed from figure
minVal = hA.CLim(1);
maxVal = hA.CLim(2);
... |
d13831e767824f9bb9c32014765c2965b102ae9aa4d769e4c0de1cc7723d9297 | MATLAB | 1,073 | 29 | function Visible=CheckPointOutInside3D(P3,V,F)
ka=0; kb=0; kc=0; lista=[]; listb=[]; listc=[];
P4a=P3+[ 123456781 9831542342 5831542342];
P4b=P3+[-124342343 3234454234 3831542342];
P4c=P3+[ 648832349 5415435923 -1831542342];
for k=1:size(F,1)
CF=F(k,:);
O1=V(CF(1),:); O2=V(CF(2),:); O3=V(CF(3),:);
... |
721524dd81d19d6b2635671b5d720f08796b2e3755dc5e08bb366f346258c1ce | MATLAB | 1,074 | 35 | % Builds a norm minimization tradeoff curve
%
% This script solves a family of problems of the form
% minimize || A*x-b ||_1 + gamma * || x ||_Inf
% for varying values of gamma. For gamma = 0, this is simply an
% unconstrained norm minimization; for gamma = Inf, x = 0 and
% || A x - b || = || b || are optimal. Vary... |
a95c26b367d52373dc9c78239ba8387115d363b174f9d11391abf8bf12704a73 | MATLAB | 1,074 | 33 | function [data,sampling]=readdat
%
% function for reading *.mat, *.wav and *.au files
% *.mat files have to contain variables data and sampling in order for the
% returns to work properly
%
[fname,pname]=uigetfile('*.*');
strindex=findstr(fname,'.plx');
if ~isempty(strindex);
error('This file format can be read with... |
db3d5ccef35980acb246386512231058ad7c26757f7ffbbcd0c4b454547b8f79 | MATLAB | 1,074 | 29 | % [data, names] = TDT.load(folder, channels)
% Parses a project folder recorded with TDT DAQ / Synapse and returns a data
% matrix where columns correspond to channels listed in names.
% Includes all streams listed as long as they match in size with the first stream.
% 2019-02-01. Leonardo Molina.
% 2025-11-24. ... |
8785a3e7ce083e0690e036975d6fbf5500d463461cd3a2c93f9176242c5ed864 | MATLAB | 1,075 | 35 | function nativemni = ea_getnativemni
% Returns 1 for "MNI space" or 2 for "Native Space" handle in main LEAD GUI
% __________________________________________________________________________________
% Copyright (C) 2017 University of Pittsburgh (UPMC), Brain Modulation Lab
% Ari Kappel
nativemnistr = [];
nativemni=... |
05687e1b14f1f83e6216658dc64eb2ae3cb587ac8a711acedbe7ac7575dece99 | MATLAB | 1,076 | 28 | function bz_MakeXML(basepath)
% Starts from a basepath to make a .xml file. Assumes presence of
% .SessionMetadata.mat and .AnimalMetadata.mat
%
% Brendon Watson 2017
if ~exist('basepath','var')
basepath = cd;
elseif isempty(basepath)
basepath = cd;
end
basename = bz_BasenameFromBasepath(basepath);
%%
if exi... |
3b875eb663fe6f71f7947fe65bf4b5c69883b16339c0524c0d4a000985604820 | MATLAB | 1,076 | 33 | function plotCombinedGradientMapCCF(dorsalMaps, allROIs, metricFields, smoothSDPts, smoothSDImg, cmapInfo)
% Creates a binned and smooth map of cell metric values from the fields in
% metricField, then computes the spatial gradient of each map, combines
% them via the quadratic mean, and plots as an RGB image
% Figure... |
4fdff9720553ca6ff665cf2898cf59c0db54235d6c5c38e544817d256fcebf0e | MATLAB | 1,076 | 44 | function cvx_optval = lambda_sum_largest( x, k )
%LAMBDA_SUM_LARGEST Internal cvx version.
narginchk(2,2);
n = size( x, 1 );
if ndims( x ) > 2 || n ~= size( x, 2 ), %#ok
error( 'First input must be a square matrix.' );
elseif ~isnumeric( k ) || numel( k ) ~= 1 || ~isreal( k ),
error( 'Second inpu... |
5a374f09e92a956e193c8eabce9cc34911cea63777a054eb3d5b661618930c36 | MATLAB | 1,076 | 33 | %% Figure 9 supp 5
% RUN fig9_analysis, then return here
fig9_analysis
% Load map
load('allenDorsalMap.mat');
% Params
smoothSDPts = 0.24;
smoothSDImg = 0.15;
colorGrad = [0, 255, 195]./256;
% Metrics to combine
metricFields = {'lpSP1', 'lpSP2', 'lpSP3', 'lpSP4'};
%% Panel A:
% Gradient Map with log probabilities fo... |
fc710b22a7e79678e81cd35ebb7854fe49c62a5b25b19390bd551a7f03fafce3 | MATLAB | 1,076 | 26 | % eeglabexefolder - return the exe folder for EEGLAB. This function is only
% relevant for the compiled version of EEGLAB.
%
% Author: Arnaud Delorme, SCCN & CERCO, CNRS, 2008-
% Copyright (C) 15 Feb 2002 Arnaud Delorme, Salk Institute, arno@salk.edu
%
% This program is free software; you can redistr... |
135e6ae270a0ac62a6eae93fac3589a007e45aab664c9e2314dfa2d321153ac8 | MATLAB | 1,077 | 43 | % To use: Create variable called figtitle with figure name,
% and set 'Tag' property of figure to the value of figtitle/figstr.
% Then run this. Used in canlab_second_level scripts
f_ext = '.svg'; % file extension - .svg, .png, etc.
% Try to find figure by tag - works for any figure, not just o2 fmridisplay
% objec... |
62c85328c4333cfc787b2e64eb74f3ab0181fe6cbad689d0bcde3c0e690502db | MATLAB | 1,078 | 36 | %%****************************************************
%% corrmat: find the nearest correlation matrix
%% to a given symmetric matrix.
%%
%% [blk,At,C,b] = corrmat(H);
%%
%% min || X - H ||_F
%% s.t. diag(X) = e, X psd.
%%
%% min t
%% s.t. diag(X) = e
%% svec(X) + y = svec(H),
%% X... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.