sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1e7fe4d7ef601fcee510cfeb924568b243be638c628c45fb089553f1a788f1db | MATLAB | 339 | 22 | function y=str2varname(x)
% Usage ... y=str2varname(x)
x=deblank(x);
cnt=1;
for mm=1:length(x),
if strcmp(x(mm),'-'),
y(cnt)='_';
cnt=cnt+1;
elseif strcmp(x(mm),' '),
% skip
else,
y(cnt)=x(mm);
cnt=cnt+1;
end;
end;
if (nargout==0),
disp(sprintf(' in-Str: %s',x));
disp(sprintf(' out-S... |
5b13a3670a1900028f519d7b8891781161244874ef6563a46bf8f2781741b4c9 | MATLAB | 339 | 10 | % streams = getStreams(folder)
% Parses a project folder recorded with TDT DAQ / Synapse and returns the
% name of the available streams.
% 2019-02-01. Leonardo Molina.
% 2025-11-24. Last modified.
function streams = getStreams(folder)
data = TDTbin2mat(folder, 'T1', 0, 'T2', 1);
streams = fieldnames(d... |
8003c6b91295cf98f13b32f0747d03213ac72cf1d4cad8c6e71f199ba68b6cec | MATLAB | 339 | 8 | outputPath = ".\PNG\";
mkdir(outputPath);
nameStr = ["cc_AC_sulcus_square", "cc_PFC_sulcus_square", "xx_AC_sulcus_square", "xx_PFC_sulcus_square"];
for i = 1 : length(nameStr)
IM = imread(strcat(nameStr(i), ".jpg"));
BW = imbinarize(rgb2gray(IM), 0.8);
imwrite(IM, strcat(outputPath, nameStr(i), ".png"), "png", "Alpha",... |
a661af4a41302ed42a6198255afd0859a56e6c10e2d82dff54c9c9e27172e694 | MATLAB | 339 | 9 | function base = findConcatBaseline(data,per)
% 'data' must be a vector of concatenated trial data for one ROI,
% shifted so min value = 0
% per is percent of lowest of all values to take as baseline
sorted = sort(data,'ascend');
lowestper = sorted(1:(ceil(per*length(sorted))));
base = me... |
da48fc0144eeed705014dee34288c1d84b855f762a246c3af01d7b1524d448a5 | MATLAB | 339 | 10 | function z = uplus( x )
% Disciplined convex/geometric programming information for UPLUS (+):
% Unary plus may be used in DCPs and DGPs without restrictions.
z = x;
% Copyright 2005-2016 CVX Research, Inc.
% See the file LICENSE.txt for full copyright information.
% The command 'cvx_where' will show where thi... |
b58afc8b71da0e5511688a686702d9f88b15b904d1a535419a3a37dc59ca19a8 | MATLAB | 340 | 11 | function y = lt( x, y )
if isa(x,'cvxin')||~isa(y,'cvxin')||y.active,
error( 'CVX error: improper use of the <in> pseudo-operator.' );
end
y.active = true;
y.value = x;
% Copyright 2005-2016 CVX Research, Inc.
% See the file LICENSE.txt for full copyright information.
% The command 'cvx_where' will show where th... |
da670213392e3cb845940d2cdec59f310017105b6cfd2d7bec674a02b97490a7 | MATLAB | 340 | 9 | function lastid = lasterrid
%LASTERRID Message ID associated with last error.
% LASTID = LASTERRID returns a string containing the identifier string
% corresponding to the last error message issued by MATLAB (see HELP
% ERROR for more information on message identifiers).
%
% See also LASTERR.
[lastmsg,... |
081c4ffd8511f5eb883655ad8342ad0525b713da68e06e2973417e4fb66c7421 | MATLAB | 341 | 10 | function quickCalciumExperiment(headpath,fileexpnum)
%use this one when the data has been analyzed before and saved.
%going to have to build something in to use set 1 or set2
cd('extracted2')
savefilename=strcat(fileexpnum,'_analysis2');
load(savefilename);
cd(headpath);
plotfluordirections(avgdiff,redtemps,ROIs,Xpix... |
21deb0b34ed5ec45901ae4eb9e041c534aeaade85e68dd84013060550e10555d | MATLAB | 341 | 18 | function plotfluordirections(avgfluor)
%plot the data averaged for each ROI
%show the ROI?
fn=fieldnames(avgfluor);
[numROIs,triallength]=size(avgfluor.(fn(1)));
fig=figure;
hold on;
for k=1:numROIs
for p=1:numel(fn)
plot(avgfluor.(fn{p})(k,:));
end
kwait=waitforbuttonpress;
clf(fi... |
63cba9a6e003c67983fb07e125fa0fc210bdfd71de1e6a143bb1014fba82f4a0 | MATLAB | 341 | 13 | function h = plot_regression(x,y)
h(1) = plot(x,y,'ko');
set(h,'MarkerFaceColor',[0.5 0.5 0.5],'MarkerEdgeColor','w');
hold all;
b = regress(y,cat(2,ones(size(x)),x));
xp = linspace(min(x),max(x));
yp = b(1)+b(2).*xp;
h(2) = plot(xp,yp,'k-');
[r p] = corr(x,y);
fprintf('r(%d)=%.2f, p=%.3f\n',numel(x)-2,r,p);
... |
8be3b4d1b6d822fc201c581d147be0406b206aabdcad8739e28130667bae230a | MATLAB | 341 | 15 | function S = NEXIS(p,b,delta,smalldel,Dsoma)
% p(1) = fsoma
% p(2) = fneurite': fneurite = (1-p(1))*p(2)
% p(3) = Din
% p(4) = Rsoma
% p(5) = De
% p(6) = tex
Dis = Dsoma;
t = delta - smalldel./3;
Ssphere = @(p,x) exp( -my_murdaycotts(delta,smalldel,p(4),Dis,x) );
S = p(1).*Ssphere(p,b) + (1-p(1)).*NEXI(b,t,p(6),p(3),... |
d6e84d2c87cba2ddd37547834cec5a05e09daca34f054e2c72cf62785024e4f1 | MATLAB | 341 | 8 | function map = xray(m)
%XRAY Inverted gray-scale color map.
% XRAY(M) returns an M-by-3 matrix containing an inverted gray-scale
% colormap (from white to black, rather than black-to-white).
% XRAY, by itself, is the same length as the current colormap.
if (nargin < 1), m = size(colormap,1); end;
m... |
849b32d112d2f1e0f31fceea420d243d04c3b02449e17fce7062b2ca50155419 | MATLAB | 342 | 14 | function b = loadobj(a)
% loadobj for file_array class
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: loadobj.m 1544 2008-05-06 10:34:36Z guillaume $
if isa(a,'file_array')
b = a;
else
a = permission(a, 'rw');
... |
d80bd932d0b743f4b2c58f9483c171b6ac407324325f595497daf750c8a4f709 | MATLAB | 342 | 13 | function clearXattr(folder, pattern, type)
% Clear extended attribute (most importantly 'com.apple.quarantine') of
% excutable or app to bypass Gatekeeper on macOS.
if nargin < 2
pattern = '*mac[ia]64';
end
if nargin < 3
type = 'f';
end
system(['find "', folder, '" -type ', type, ' -name "', pattern, '" -exe... |
fbffa4bf5d6b11d7679d4deea8b404d8b0c0937624b16720c503aa228eba50d6 | MATLAB | 342 | 13 | function c = ea_colormap(map)
%
% Small function to return colormap as a matrix without affecting your scene
% __________________________________________________________________________________
% Copyright (C) 2017 University of Pittsburgh, Brain Modulation Lab
% Ari Kappel
figH = figure('visible','off');
c = colorma... |
bdff06d9ed9cb5c58073bace9b69084babd48309ec950fa40006e65e73945be7 | MATLAB | 343 | 15 | function plotPETHs(tl, peths, tPts)
n = length(peths);
for i = 1:n
hax = nexttile(tl);
set(gca, 'YColor', [1,1,1])
hold on;
plotPETH(hax, peths(i), tPts);
xticklabels([]);
title(sprintf('%s %s: \n%i %s', peths(i).mouse, peths(i).session, peths(i).idxFOV, peths(i).area), 'FontWeight', 'normal'... |
59c333c22c5419770d292f5059b91ef7299e48c7843412c2f7c5d3f383ad9b8b | MATLAB | 344 | 16 | %%
%% Use this instead of gbvs() if you want slightly less predictive maps
%% computed in a fraction of the time.
%%
%%
function out = gbvs_fast( img )
params = makeGBVSParams;
params.channels = 'DO';
params.gaborangles = [ 0 90 ];
params.levels = 3;
params.verbose = 0;
params.tol = 0.003;
params.salmapmaxsize = 24;
... |
84c4e84e993665a230fbbc3bb42b77c3fd3ee07f1d6d2cccdcaee81f13af3aa9 | MATLAB | 344 | 14 | % Local Regression and Likelihood, Figure 2.3.
%
% Using different smoothing parameters.
load ethanol;
alp = [0.2 0.4 0.6 0.8];
f=['a','b','c','d'];
for (i=1:4)
figure('Name', sprintf( 'figure2_3%c: Changing smoothing parameters', f(i) ) );
fit = locfit(E,NOx,'alpha',alp(i));
lfplot(fit);
title(strcat('a = ',... |
973dd4586d7dbbdc48db47eda6a636e4b32e3827f6a1d660a572454b56603f87 | MATLAB | 344 | 14 | function [n,gains] = plx_chan_gains(filename)
import CMBHOME.PLX2Mat.*
% plx_chan_gains(filename): Read channel gains from .plx file
%
% [gains] = plx_chan_gains(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% OUTPUT:
% gains - array of total gains
% n - number of channels
[n,gains... |
fbffbe1635ab4b500a91edf587eabec1465cedbfd396336fa33cbef3a5d4f608 | MATLAB | 344 | 11 | function str_formatted = my_num2str(num)
% Return formatted string from number, if it is in range 1/thr < num < thr
thr = 100;
if num >= thr
str_formatted = strcat('>', num2str(thr));
elseif num <= 1/thr
str_formatted = strcat('<', num2str(1/thr));
else
str_formatted = num2str(nu... |
1c23279b48289c74b1056c45092882188ba7da743b5229fc167dc22dc697c895 | MATLAB | 345 | 20 | function [sphericalMean, sigma] = SphericalMeanFromSH(dirs, y, order)
y(y<eps) = eps;
[coef, X] = llsFitSH(dirs, y,order);
sphericalMean = coef(1, :) ./ sqrt(pi*4);
residuals = X*coef - y;
w = ones(size(residuals));
[n, ~] = size(y); m = size(coef, 1);
sigma = sqrt(n./(n-m)).*1.4826.*mad(residuals.*w, 1, 1... |
30bb244f193ce05efa8b1d13c3b29a2dc65ff67bd825eb74f06e44be793ef8d8 | MATLAB | 345 | 20 | function [newDB] = bz_updateSessionInfoFromSQL()
% USAGE
% [newDB] = bz_updateSessionInfoFromSQL()
%
% INPUTS
%
%
%
%
%
% INPUTS
%
%
%
% DESCRIPTION
% This function takes a directory path as input (from /Datasets/ folder)
% and searches through the SQL database for metadata to add to the
% sessionInfo .mat file/struct... |
8594fc38b77849955ff6a5ca2592094c6341f146c46deabd75a4a6fe9a90ab14 | MATLAB | 346 | 12 | function ind = SubplotSub2Ind(size, pos)
% 2D subplot position to 1d index (for subplot)
%
% pos is the row, col (top left corner is 1,1)
% size is the [rows, cols] of subplot
%ind = CMBHOME.Utils.SubplotSub2Ind(size(mat),[row col])
M = size(2);
if any(size-pos < 0), error('POS cannot be larger than SIZE'); end
ind ... |
c2bc5d884927e7eafa2c4fc707f2a2546390013d43b086ff6e54fe6399aa9a48 | MATLAB | 346 | 16 | function t = fieldnames(obj)
% Fieldnames of a file-array object
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: fieldnames.m 1143 2008-02-07 19:33:33Z spm $
t = {...
'fname'
'dim'
'dtype'
'offset'
'scl_... |
f8002af68a41bc2741661c72052b0f0875eda1e82e0f4298c5b67d3b3b9b84c2 | MATLAB | 346 | 17 | function ea_csremovedrawings(handles)
lineobj=getappdata(handles.checkstructures,'lineobj');
delete(lineobj);
arrhandles=getappdata(handles.checkstructures,'arrhandles');
for arr=1:length(arrhandles)
delete(arrhandles{arr});
end
tp_plots=getappdata(handles.checkstructures,'tp_plots');
for plt=1:length(tp_plots)
de... |
f21bcb2f5efa554852fd2f88d3884829b6fe68bfcf3bedcff65a9a30004e11a2 | MATLAB | 347 | 10 | function top
%TOP Simplifies 3-D axes.
% TOP deletes all lights in the current axes, turns off interpolated
% shading, and sets the view to overhead so that the surface looks like
% an image.
delete(findobj(gca, 'Type', 'light'));
shading flat;
lighting phong; % otherwise you see seams in ... |
1e38b3bdd939d1fa3ccab08b8986a4d3a03888849ea5d5e9f532418bb6c649b9 | MATLAB | 348 | 12 | function plotOnsetMapCCF(dorsalMaps, allROIs)
% Wrapper to plotMetricMapCCF
plotMetricMapCCF(dorsalMaps, allROIs, 'onset', 0.15, 'R4')
% Set sizes
formatCCFMap('time of half max (ms)', 1.2)
% Fix colorbar ticks
cb = get(gca, 'Colorbar');
cb.Ticks = [cb.Ticks(1) 0 cb.Ticks(end)];
cb.TickLabels = {cb.TickLabels{1}, 'cu... |
778e61f34cf3aa1079f1bb92a3b8fd8552b77089097fd7f300dc2a4d1a45932e | MATLAB | 349 | 17 | %%
aviobj = avifile('test.avi')
%%
aviobj = close(aviobj);
%%
m = aviread('test.avi');
s = cat(4,m.cdata);
d = 0.1;
for k = 1:size(s,4),
[a c] = rgb2ind(s(:,:,:,k),256);
if k == 1,
imwrite(a,c,'test.gif','gif','DelayTime',d);
else
imwrite(a,c,'test.gif','gif','writemode','append','... |
b2d6453d095843e2812b96340e3ede00275f21c73918098d1743cc3e185cf749 | MATLAB | 349 | 15 | % Local Regression and Likelihood, Figure 2.7.
%
% Example gcvplot. First argument to gcvplot is a
% vector (or matrix) of smoothing parameters.
% Remaining arguments are passed directly to locfit().
%
% Author: Catherine Loader.
%
% NEED: cpplot.
load ethanol;
alp = (0.2:0.05:0.8)';
figure('Name','fig2_7: Example gc... |
389a8d7ebf418b328478e64f40be91f88a2b1b49b72e6df244fbc07b2d74570d | MATLAB | 350 | 11 | function y = cvxobj()
global cvx___
if isempty( cvx___ ),
error( 'Internal cvx data corruption' );
end
cvx___.id = cvx___.id + 1;
y = class( struct( 'id_', cvx___.id ), 'cvxobj' );
% Copyright 2005-2016 CVX Research, Inc.
% See the file LICENSE.txt for full copyright information.
% The command 'cvx_where' will sho... |
628cecb6ec3a2f823ccba6400827e024723521b0744be4b266b7badadfefca48 | MATLAB | 350 | 9 | function base = findConcatBaseline2(data,per)
% 'data' is a matrix of concatenated trial data with one row per ROI,
% shifted so min value = 0
% per is percent of lowest of all values to take as baseline
sorted = sort(data,2,'ascend');
lowestper = sorted(:,1:(ceil(per*length(sorted))));
... |
6a3c4b3fed6a17e2d788bb2499c687b84bcb2ee5c7c83c4570158c3f43104674 | MATLAB | 351 | 19 |
% cleanmex
cd util
mex -maci64 myContrast.cc ;
cd ../
cd algsrc
mex -maci64 mexArrangeLinear.cc ;
mex -maci64 mexAssignWeights.cc ;
mex -maci64 mexColumnNormalize.cc ;
mex -maci64 mexSumOverScales.cc ;
mex -maci64 mexVectorToMap.cc ;
cd ../
cd saltoolbox/
mex -maci64 mySubsample.cc ;
mex -maci64 me... |
1e4c6896e1d7d7707fa6569879a405fcbf54ba86bcc733386f1b6022ef369164 | MATLAB | 352 | 9 | function [J, DATA, nirsOut] = computeJacobian(nirsIn, modulationMHz)
%COMPUTEJACOBIAN Wrapper around NIRFASTer jacobian_FD.
% modulationMHz : scalar modulation frequency in MHz (0 for CW)
if nargin < 2, modulationMHz = 0; end
[J, DATA] = jacobian_FD(nirsIn, modulationMHz);
nirsOut = nirsIn; % return in case ca... |
7351a1433a2776ddee0d55a47c43bb4dade61286e41dd468338a0f6d7fa607c2 | MATLAB | 352 | 5 | signatures_to_plot = {'GSR' 'Heart'}; % NPS, VPS, SIIPS, etc., etc.
myscaling = 'raw'; % 'raw' or 'scaled'
mymetric = 'dotproduct'; % 'dotproduct' or 'cosine_sim'
plugin_s... |
00bdd9497bccf06f30147d660902cee07b9b425faf9b36c774e4fca8b99e5b95 | MATLAB | 354 | 17 | function R = myPLS_cov(X,Y,num_groups,subj_grouping)
% Compute PLS cross-covariance matrix (stacked)
for iter_group = 1:num_groups
Ysel = Y(find(subj_grouping==iter_group),:);
Xsel = X(find(subj_grouping==iter_group),:);
R0 = Ysel.'*Xsel;
if ~exist('R')
R = R0;
else
... |
9e61d0e8cedbb08bbee83f919b77bb5a46b8f9042eb2b51b44f10845903cefe9 | MATLAB | 354 | 18 |
x2dl = @(x,y,sigma,n) 1/sigma^2 * x.^2 - log(besseli(n/2-1,y.*x/sigma^2)) + (n/2-1)*log(y./x);
%%
x2dl = @(x,y,sigma,n) 1/sigma^2 * x.^2*(1+0*y') - log(besseli(n/2-1,x*y'/sigma^2)) + (n/2-1)*log((1./x)*y');
x = 0.01:0.0051:1;
sigma = 0.05;
[~,idx] = min(x2dl(x',x'*2,sigma,12));
y = x(idx);
[~,idx2] = sort(y)... |
a356d10f2992d38e1bfea8d590fca4bc04bd2ba913c1e00b358afafed2624147 | MATLAB | 354 | 11 | % Local Regression and Likelihood, Figure 5.1.
% Author: Catherine Loader
%
% Density Estimation, for the Old Faithful Geyser Data.
load geyser;
fit = locfit(geyser,'alpha',[0.1 0.8],'ll',1,'ur',6);
figure('Name','fig5_1: Density estimation for the Old Faithful Geyser Data.' );
lfplot(fit);
xlabel('Old Faithful Erupti... |
acc4383996fb81897adbc03fad1b9a07235766c8c4adceef875f10198cf3613a | MATLAB | 354 | 18 | function [z, z_onetailed] = G_p2z( p)
% Convert p to z
%
% Input
% p, two-tailed p
if ~isnumeric( p)
error( 'Input must be a matrix.');
end
if any( p(:) < 0) || any( p(:) > 1)
error( 'P value must be a value between 0 and 1.');
end
z = icdf( 'normal', [p/2, 1-p/2], 0, 1);
z_onetailed = icdf( 'normal', [p,... |
dc6e94b051c1dfdacf5d21905b45b279e68e00ebc4bb937ccfb9fe977f44d0b4 | MATLAB | 354 | 9 | function plugin = plugin_convert(pluginOri)
for iRow = 1:length(pluginOri)
plugin(iRow).currentversion = pluginOri(iRow).version;
plugin(iRow).foldername = pluginOri(iRow).foldername;
plugin(iRow).status = pluginOri(iRow).status;
plugin(iRow).name = pluginOri(iRow).plugin;
plu... |
fac88a08424c2d99919d7346a5975dcc65edc7ca9603a061f6bc29250bc45d5a | MATLAB | 355 | 15 | function nSpikes = numberSpikes(theseSpikeTimes)
% JF, Count the number of spikes for the current unit
% ------
% Inputs
% ------
% theseSpikeTimes: nSpikesforThisUnit × 1 double vector of time in seconds
% of each of the unit's spikes.
% ------
% Outputs
% ------
% nSpikes: number of spikes for current unit
%
nSpik... |
063a3d79264cb3c36da10e876fb0282df72d4b92e8ed9b2885cb3e9cfde2a57f | MATLAB | 356 | 5 | function fnames=ea_getantsnormfuns
% this is a protocol of available ANTs normalization function names. These
% will be used for non-SPM normalizations.
fnames={'ea_normalize_ants','ea_normalize_ants_subcorticalfocus','ea_normalize_ants_macaque','ea_normalize_maget','ea_normalize_ants_multimodal','ea_normalize_maget_s... |
86bc8cf8df5667930298f55a5965f8ea47d1799aa7f762d10c4bfa3a243912ef | MATLAB | 358 | 5 | signatures_to_plot = {'VPS' 'VPS_nooccip' 'Empathic_Dist' 'Empathic_Care'}; % NPS, VPS, SIIPS, etc., etc.
myscaling = 'raw'; % 'raw' or 'scaled'
mymetric = 'cosine_sim'; % 'dotproduct' or 'cosine_sim'
pl... |
a84b914612d2a561b6d21a2ed7e9ba9fe598cafcb43675e8b8bb3243bc5c0f5e | MATLAB | 358 | 5 | signatures_to_plot = {'FM_Multisens' 'FM_pain' 'NPS'}; % NPS, VPS, SIIPS, etc., etc.
myscaling = 'raw'; % 'raw' or 'scaled'
mymetric = 'dotproduct'; % 'dotproduct' or 'cosine_sim'
pl... |
aba31cafc36c8c2f8b1eb984a42dc0e314588ab2dd9a6e3cd88ed9855cc3c24f | MATLAB | 358 | 5 | signatures_to_plot = {'PINES' 'Rejection'}; % NPS, VPS, SIIPS, etc., etc.
myscaling = 'raw'; % 'raw' or 'scaled'
mymetric = 'dotproduct'; % 'dotproduct' or 'cosine_sim'
pl... |
f2eb600eb97b5713ca90075786576a1162147f8e3999a695453be8be626ed049 | MATLAB | 358 | 11 | function display( x )
long = ~isequal(get(0,'FormatSpacing'),'compact');
if long, disp( ' ' ); end
disp([inputname(1) ' =']);
if long, disp( ' ' ); end
disp(x,' ')
if long, disp( ' ' ); end
% Copyright 2005-2016 CVX Research, Inc.
% See the file LICENSE.txt for full copyright information.
% The command 'cvx_where' ... |
4ed04542436105344428c579b7ec7640e8f8ebc9d5cee91b4bc800f9869e9f52 | MATLAB | 359 | 14 | function [n,gains] = plx_adchan_gains(filename)
import CMBHOME.PLX2Mat.*
% plx_adchan_gains(filename): Read analog channel gains from .plx file
%
% [n,gains] = plx_adchan_gains(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% OUTPUT:
% gains - array of total gains
% n - number of chan... |
580dcc80baf8393e31362a037a8169b653217f8186d5ea95185b0ebbfac88417 | MATLAB | 359 | 9 | function [AIS] = calculate_AIS(atoms)
% Calculate Active Information Storage based on atoms decomposition
% AIS(X1) = I(X1_t; X1_t+1) = Red→Red + Red→Un1 + Un1→Red + Un1→Un1
AIS = atoms.rtr + ... % Red→Red
atoms.rtx + ... % Red→Un1
atoms.xtr + ... % Un1→Red
atoms.x... |
d334ca9ca886454578a5db49310e6664d9c40af99c0bfd64dba5433a4732ce69 | MATLAB | 359 | 14 | function save_mrstruct_as_nifti(mr,fname)
nii = make_nii(mr.dataAy,mr.vox);
Q = diag([-1 -1 1 1]);
M = Q*mr.edges;
nii.hdr.hist.srow_x = M(1,:);
nii.hdr.hist.srow_y = M(2,:);
nii.hdr.hist.srow_z = M(3,:);
nii.hdr.hist.sform_code = 1;
nii.untouch = 1;
nii.hdr.hist.magic = 'n+... |
ee9d0fc7c2f3c077a00018d63f86c29a3c352196097816ea1ebdad27ec128427 | MATLAB | 359 | 19 | function g=lcv(varargin)
%
% likelihood cross-validation.
%
% returned vector consists of log-likelihood, trace(H), trace(H'H)
% and cross-validated deviance (-2 * cross-validated log-likelihood).
%
% Author: Catherine Loader.
fit = locfit(varargin{:},'ev','cros');
rs = rsum(fit);
df0 = rs(1);
df1 = rs(2);
llk = rs(3... |
f58d64853db00510334e7313801c7248dcf92c930d6dda5c0fe0468e135c676e | MATLAB | 359 | 13 | function [res] = plx_test_file_variations()
% trying functions with files with some header and strobed parameters
res.allTestsPassed = 0;
res=VerifyError('[a,b,c,d] = plx_info(''ts_freq_zero.plx\'',1);', res);
[a,b,c,d] = plx_info('strobed_negative.plx',1);
[a,b,c,d] = plx_info('waveform_freq_zero.plx',1);
... |
a2ec5fbb895a49b71e334f4451404c30e88dd66fb4d875807316c6617e7e7d96 | MATLAB | 360 | 12 | function ea_saveatlas(atlasFolder,atlasName,atlases)
if isfield(atlases, 'roi')
% disp(atlases.roi)
for roi=1:size(atlases.roi,1)
for side=1:size(atlases.roi,2)
atlases.roi{roi,side}=ea_roi2struct(atlases.roi{roi,side});
end
end
end
save([atlasFolder,filesep,atlasName,filesep... |
72c61a05225e543eda26a3597bdd5919bd6164575bdfc3f34f7e6d5b71a9d16d | MATLAB | 362 | 11 | % Local Regression and Likelihood, Figure 4.2.
% Author: Catherine Loader
%
% Local Likelihood (Logistic Regression), for the
% Henderson-Shepherd Mortality Data.
load morths;
fit = locfit(age,deaths,'weights',n,'family','binomial','alpha',0.5);
figure('Name','fig4_2: Logistic Regression for the Henderson-Shepherd Mor... |
7684b32d828fb31df2e3b70a65ec243357bd742090ff72b3e0ceced32aaf37d9 | MATLAB | 362 | 7 | function [dOD_hp, dOD_bp] = filter_signals(dOD, Fs, hp_hz, bp_hz)
%NIRSPROC.FILTER_SIGNALS Produce high-pass and band-pass filtered versions.
% [dOD_hp, dOD_bp] = FILTER_SIGNALS(dOD, Fs, hp_hz, bp_hz)
[b,a] = butter(3, hp_hz/(Fs/2), 'high'); dOD_hp = filtfilt(b, a, dOD);
[b,a] = butter(3, bp_hz/(Fs/2)); ... |
fc2c2b9ac3609ad229d1204ab962f07b21b00fe2d61d90603d7dc33c3ff19500 | MATLAB | 362 | 12 | function [rotation, yunitv] = ea_calc_rotation(y, head)
% Calc the rotation of y marker in the x-y plane
yvec = y - head;
yvec(3) = 0;
yunitv = yvec ./ norm(yvec);
rotation = rad2deg(atan2(norm(cross([0 1 0],yunitv)),dot([0 1 0],yunitv)));
% Rotation to right side is negative; Rotation to left side is positive
if y(1... |
449117e0e959b2bc49309b51b8bb320b9485881a33437bd22fa55e2070684e79 | MATLAB | 363 | 11 | function dist_ch = sd_distances(raw, link)
%NIRSPROC.SD_DISTANCES Compute source–detector distances (mm) per channel.
% dist_ch = SD_DISTANCES(raw, link)
nCh = size(link,1);
dist_ch = zeros(nCh,1);
for j=1:nCh
dist_ch(j) = norm(raw.nirs.probe.sourcePos3D(link(j,1),:) - ...
raw.nirs.probe... |
a3b12643dcc6c1dacf7a007c3bc96602dbc1a1b2aee7a01b67480f92f1e1db09 | MATLAB | 364 | 10 | function data_out = Trinh_baselinecorrection(data_in,baseline)
cfg = [];
cfg.demean = 'yes';
cfg.baselinewindow = baseline; % [begin end] (default = 'no')
cfg.channel = 'all'; % cell-array, see FT_CHANNELSELECTION
cfg.parameter = 'trial'; %field for whic
[data_out] ... |
b154951612d45e6c2201e21d11784caf5d3434ab37c5d9fb99a447d9b7ce734c | MATLAB | 364 | 10 | function y = vertcat( varargin )
% Disciplined convex/geometric programming information for VERTCAT:
% VERTCAT imposes no convexity restrictions on its arguments.
y = cat( 1, varargin{:} );
% Copyright 2005-2016 CVX Research, Inc.
% See the file LICENSE.txt for full copyright information.
% The command 'cvx_w... |
0c791012bdabada286e11c8054e85f327bee95f6b3b5584364b6302abf75be72 | MATLAB | 365 | 11 | % Local Regression and Likelihood, Figure 5.1.
% Author: Catherine Loader
%
% Density Estimation, for the Old Faithful Geyser Data.
load geyser;
fit = locfit(geyser,'alpha',[0.1 0.8],'ll',1,'ur',6);
figure('Name','fig5_1: Density estimation for the Old Faithful Geyser Data.' );
lfplot(fit);
xlabel('Old Faithf... |
10b3a620d4c3909a6e4327eb28df787023ee7d81665b9fb6f1d112873b0a0440 | MATLAB | 365 | 20 | % spher() - return the sphering matrix for given input data
%
% Usage:
%
% >> sphere_matrix = spher(data);
%
% Reference: T. Bell (1996) - - -
%
% S. Makeig CNL / Salk Institute, La Jolla CA 7-17-97
function sphere = spher(data)
if nargin<1 | size(data,1)<1
help spher
return
end
sphere = 2.0*inv(sqrtm(... |
467a77770789674218992a71719b0d81b8a0c2b461349acbef1f44dba4f041c2 | MATLAB | 365 | 17 | function ix = partitionindex( N , M )
binsize = floor( N / M );
leftover = N - binsize * M;
pad = zeros( 1 , M );
pad(1) = floor(leftover / 2);
pad(M) = ceil(leftover / 2);
ix = zeros( 2 , N );
curindex = 0;
for i = 1 : M
for j = 1 : binsize + pad(i)
curindex = curindex + 1;
ix( : ,... |
a41d5fccabe60f8fb663c602f611afed37c50b63145b531ac915bec6292fa581 | MATLAB | 365 | 14 | function out = numeric(fa)
% Convert to numeric form
% FORMAT numeric(fa)
% fa - a file_array
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: numeric.m 1143 2008-02-07 19:33:33Z spm $
[vo{1:ndims(fa)}] = deal(':');
out = s... |
883caf7ea8c262014106e979fb25b3c40f33ef38dc159d22b84f554e38e31168 | MATLAB | 366 | 24 | function y2=ybin(x,bsize)
% Usage ynew=ybin(x,binsize)
if bsize==1;
y2=x;
if nargout==0, show(y2), clear y2, end;
return;
end
ydim=length(x);
iend1=floor(length(x)/bsize)*(bsize);
y=x(1:bsize:iend1);
%[bsize iend1 iend2],
for mm=2:bsize,
y=y+x(mm:bsize:iend1);
end;
y2=y/bsize;
if nargout=... |
fe84f02d263c94f4db7ea52c8007dabaa0193d8d8f11ec956356bc7346ff9b8d | MATLAB | 367 | 21 |
function mimg = pick_reg_init(data)
dd = data;
for i = 1:size(data,3)
d0 = dd(:,:,i);
fd0 = fft2(d0);
dd(:,:,i) = real(ifft2(fd0./abs(fd0)));
end
dd = reshape(dd, [], size(dd,3));
CC = corrcoef(dd);
[CCsort, isort] = sort(CC, 2, 'descend');
bestCC = mean(CCsort(:, 1:20), 2);
[~, imax] = max(bestCC);
mi... |
254a00f6979ea2f46d9852dda053c24055dc81b01a7646f7c1e4238a15b1fd54 | MATLAB | 368 | 11 | function z = full( x )
% Disciplined convex/geometric programming information for FULL (+):
% This is effectively a "no-op", and can be used in DCPs and DGPs
% without restrictions.
z = x;
% Copyright 2005-2016 CVX Research, Inc.
% See the file LICENSE.txt for full copyright information.
% The command 'c... |
6cee61924011e387ad97bdb243c765db45804d6cd7dd9cd2ec10b3a95595e3d9 | MATLAB | 368 | 16 | function display(this);
disp(inputname(1));
if length(this) == 1
struct(this.EEG)
else
TMP = struct(this);
TMP2 = TMP(1).EEG;
fieldorder = fieldnames(TMP2);
for index = 2:length(TMP)
TMP2(index) = orderfields(TMP(index).EEG, fieldorder... |
e75607f26e9a75dd45b4ab61c6fecd215da1227b9eb86c15d766f8bb1140c6dc | MATLAB | 368 | 11 | function AddChronuxPackage
% Add the chronux pacage
if ~isempty(findstr('chronux', path)), return; end % check that it isnt already there
a = what('CMBHOME');
if length(a) > 1
addpath(path, genpath(fullfile(a(2).path(1:end-8), 'chronux'))); % adds chronux package
else
addpath(path, genpath(fullfile(a.path(1:... |
1d44aaace76ca6a8eadab3d7484d32e4e58db90dd9a3e1cabf08479879a2a7d6 | MATLAB | 369 | 17 | function [ crange ] = SpecColorRange( spec,range )
%[ crange ] = SpecColorRange( spec,range ) calculates a good color range for a
%spectrogram and sets the plot to the good range.
%
%
%DLevenstein 2017
%%
if ~exist('range','var')
range = [2.5 2.5];
end
[~,mu,sig] = zscore(spec);
crange = [min(mu)-range(1)*max(sig)... |
dc35d2c15736750ae2212018bb41990f2ec47297ebd87e002e4df6d13f171141 | MATLAB | 369 | 17 | function f=ea_fibers2connectome(fibs)
% small helper that will convert an nx4 matrix to lead-dbs connectome
% format 1.0
f.ea_fibformat='1.0';
f.fourindex=1;
f.fibers=fibs;
fidx=unique(fibs(:,4));
[h,ix]=ismember(fibs(:,4),fidx);
f.fibers(:,4)=ix; % make sure fourth column is 1:N format
cnt=1;
for fib=1:length(fidx)
... |
70ebffd0cdb60109cf1b4d139ab99dcf516b2b7387c24f794a2ceac5dd751a2c | MATLAB | 370 | 10 | function Handles = GCO_ListHandles()
% GCO_ListHandles Retrieve handles to all current GCO instances
% Useful for cleaning up GCO instances that are using memory,
% particularly when a script was interrupted.
% Example:
% GCO_Delete(GCO_ListHandles); % delete all GCO instances
GCO_LoadLib()... |
e89ed173c56035e76cc1bc38ea9301bcdcd2e57e2ad2ac4cc518626947a484c2 | MATLAB | 370 | 14 | function handles = dan_mark_epoch(handles)
% Label an epoch as bad
%%
% Authors: Dan Denis
% Date: 2021-07-14
%%
epochIdx = str2double(get(handles.current_epoch_number, 'String'));
if handles.psg.ar.badepochs(epochIdx) == 0
handles.psg.ar.badepochs(epochIdx) = 1;
elseif handles.psg.ar.badepochs(epochIdx) == ... |
71129ca0cbaea16570e3ca82f9da69a6bb090486f71413e3e1f643845260923b | MATLAB | 371 | 11 | function [classPredictions,scoreP]=getBinaryClassifiers(blockTagsAC,blockDatasetAC,mode,folderpath,featureNum)
classes = ['OC';'OH';'OW';'CH';'CW';'HW'];
for cla = 1:6
class1 = classes(cla,1);
class2 = classes(cla,2);
[sFeatures,fWeights,perfMat] = binaryClass(class1,class2,blockTagsAC,blockDat... |
7352087628f9b7b8e8f3122a1e80e79fd460383832c55b9b6c3475ebe8a83f31 | MATLAB | 371 | 14 | function [n,names] = plx_event_names(filename)
import CMBHOME.PLX2Mat.*
% plx_event_names(filename): Read name for each event type from a .plx file
%
% [n,names] = plx_event_names(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% OUTPUT:
% names - array of event name strings
% n - nu... |
9a1b288a81263f4dc50d69a47208cba7b1e86dc55b69e2536cc6e941d0bc3f7e | MATLAB | 372 | 12 | function display( x )
nm = inputname(1);
long = ~isequal(get(0,'FormatSpacing'),'compact');
if long, disp( ' ' ); end
disp([nm ' =']);
if long, disp( ' ' ); end
disp(x,' ',nm);
if long, disp( ' ' ); end
% Copyright 2005-2016 CVX Research, Inc.
% See the file LICENSE.txt for full copyright information.
% The comman... |
b7b1c1190c0e58572f40c717c55618bc6b3b6091a24d02a802487948aaac7143 | MATLAB | 373 | 16 | function matout = Cell2MatPlus(cellin)
% returns a matrix from cell cellin, where differently sized vectors are
% padded with NaNs
% andrew april 28 2010
if ~iscell(cellin)
matout = cellin;
return
end
max_el = max(cellfun(@numel, cellin));
cellout = cellfun(@(c) [c(:)', nan(1, max_el-numel(c))], cellin, 'Un... |
c432196ab4beeacd139226d2e9b1065b1c18499e2edd03f7d7a3f48465b9dfca | MATLAB | 373 | 11 | % Local Regression and Likelihood, Figure 4.2.
% Author: Catherine Loader
%
% Local Likelihood (Logistic Regression), for the
% Henderson-Shepherd Mortality Data.
load morths;
fit = locfit(age,deaths,'weights',n,'family','binomial','alpha',0.5);
figure('Name','fig4_2: Logistic Regression for the Henderson-Shep... |
e6078adcc4a2f591274feadd0e63d6d5835bc7d6b64911c365a311130f49f94c | MATLAB | 373 | 11 | function y = cvx_readlevel( x )
global cvx___
s = size( x.basis_ );
[ r, c ] = find( x.basis_ );
y = max( sparse( r, c, cvx___.readonly( r ), s(1), s(2) ), [], 1 );
y = cvx_reshape( y, x.size_ );
% Copyright 2005-2016 CVX Research, Inc.
% See the file LICENSE.txt for full copyright information.
% The comman... |
f8ade833e8c84e4a040661f9b68f1ab5f3cd25b950abbb8c852c87e211b34b8a | MATLAB | 373 | 14 | function [n,names] = plx_chan_names(filename)
import CMBHOME.PLX2Mat.*
% plx_chan_names(filename): Read name for each spike channel from a .plx file
%
% [n,names] = plx_chan_names(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% OUTPUT:
% names - array of channel name strings
% n - ... |
39f69dfbc8f8945aaf84c5504470f2b9470d2098a0ac196aa27c639dc1d3b4a2 | MATLAB | 374 | 17 | function a=myangle2(dx,dy)
% Usage ... a=myangle(dx,dy)
if (nargin==1),
a=atan((dx(2,2)-dx(1,2))/(dx(2,1)-dx(1,1)));
elseif (nargin==0),
gcf;
disp('click on two positions...')
dx=round(ginput(2));
a=atan((dx(2,2)-dx(1,2))/(dx(2,1)-dx(1,1)));
disp(sprintf('angle= %.2f (%.2f)',a*180/pi,a*180/pi+90)... |
fbe51c4005789f488f696330fff596c31df37e4cac432a893faf3221fd1ccb2e | MATLAB | 374 | 12 | function stimvec = build_stimvec(raw, Fs, T)
%NIRSPROC.BUILD_STIMVEC Build a T×1 impulse vector from stim onsets.
% stimvec = BUILD_STIMVEC(raw, Fs, T)
stimvec = zeros(T,1);
for k=1:numel(raw.nirs.stim)
if isempty(raw.nirs.stim(k).data), continue; end
idx = round(raw.nirs.stim(k).data(:,1)*Fs);
idx = i... |
19918809e4efb7943326eae276d16b96b18c6e8ea7e28e628a28b2e7fff93e8e | MATLAB | 375 | 16 | function plotTargets(hA, targetsXYZ, markerSize)
% Plot the spout targets in 3D space
if nargin < 3
markerSize = 30;
end
cmap = cmapTargs();
for targ = 1:size(targetsXYZ,1)
color = cmap(targ, :);
line(hA, targetsXYZ(targ,1), targetsXYZ(targ,2), targetsXYZ(targ,3), 'Marker', '.', ...
'MarkerSize',... |
41395f495c84819c25a9ec3f30142d4be8c3bb95777fdf874a104355912242b0 | MATLAB | 375 | 11 | function danalyzer_startup(danalyzer_path)
% Adds danalyzer to the MATLAB path
addpath(fullfile(danalyzer_path, 'gui'))
addpath(fullfile(danalyzer_path, 'gui', 'gui'))
addpath(fullfile(danalyzer_path, 'gui', 'montages'))
addpath(fullfile(danalyzer_path, 'gui', 'small_fun'))
addpath(fullfile(danalyzer_path, 'tools'))
a... |
0cf0fba624bf1108cc2afb8497af0d25e808cdc5fa11e584f88af18434160115 | MATLAB | 376 | 21 | load ../graphs/minnesota.mat
n = size(A,1);
k1 = 75;
k2 = 50;
%vs = ceil(size(A,1)*rand(1,k));
start1 = 1;
start2 = 800;
vs1 = start1:start1+k1;
vs2 = start2:start2+k2;
vs = [vs1 vs2];
C = approx_multiway_cut(A,vs);
gplot(triu(A),xy,':');
hold on;
gplot(triu(C),xy,'r-');
plot(xy(vs,1),xy(vs,2),'.');
hold off;
set(gca... |
31ce52ff74f99534f8e72e058d8574c0afcc3a39046293a40374278780d568ec | MATLAB | 376 | 15 | function y = cvx_id( x )
y = apply( @cvx_id, x );
switch class( y ),
case 'struct',
y = struct2cell( y );
y = max( [ -Inf, y{:} ] );
case 'cell',
y = max( [ -Inf, y{:} ] );
end
% Copyright 2005-2016 CVX Research, Inc.
% See the file LICENSE.txt for full copyright information.
% The comm... |
4d61c205c13e265537da897739646d74b889122772d319bf66b109d1db523361 | MATLAB | 377 | 15 | function set( ~, ~, ~ )
%uiextras.set Store a default property value in a parent object
%
% This functionality has been removed.
% Copyright 2009-2014 The MathWorks, Inc.
% $Revision: 979 $ $Date: 2014-09-28 14:26:12 -0400 (Sun, 28 Sep 2014) $
% Check inputs
narginchk( 3, 3 )
% Warn
warning( 'uiextras:Deprecated... |
7c2c050a6375f3397dc449c681c56d5cc80eb89a68cc398caf58f628d0adf2a7 | MATLAB | 377 | 14 | function t = numel(obj)
% Number of simple file arrays involved.
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: numel.m 1143 2008-02-07 19:33:33Z spm $
% Should be this, but it causes problems when accessing
% obj as a st... |
bf11050d9c0ae96b96b8c43e9953ad7e3e851876296d5835eb971e0c9d5bb2c7 | MATLAB | 377 | 10 | % Runs batch analyses and publishes HTML report with figures and stats to
% results/published_output in local study-specific analysis directory.
% Run this from the main base directory (basedir)
% Loads data, creates contrasts, extracts signatures and parcels
z_batch_publish_image_prep_and_qc
% Publishes analyses w... |
7664557f4cbc62ef187886a603edabec4b918ebeee7b93db7342a578e2a85e34 | MATLAB | 378 | 12 | function outputfolder = ea_getoutputfolder(sfile,con)
prefs = ea_prefs;
if strcmp(con, prefs.FTR_normalized) || strcmp(con, strrep(prefs.FTR_unnormalized, '.mat', '_anat.mat'))
con = 'Patient''s fiber tracts';
else
con = strrep(con, '>', '_');
end
outputfolder = [fileparts(sfile{1}), filesep, con, filesep];
if... |
42757822acc0f388949611a1c731211e5170d9dc53e74f8f8094fcb4fcae0de3 | MATLAB | 379 | 14 | %% Figure 9 supplement for reviewer responses
% RUN fig9_analysis, then return here
fig9_analysis
% Load map
load('allenDorsalMap.mat');
%% Plot likelihood maps for the GMM components
cmap = 'L20';
smoothSD = 0.15;
for i = 1:allGMMPCAspec.NumComponents
plotMetricMapCCF(dorsalMaps, allROIs, sprintf('lpAllComp%i_specPC... |
b228765b18aece53d250cdc51935f50b18749c0aee14d22e860529cf39e36609 | MATLAB | 379 | 12 | function inter=CheckFaceOrientations(F)
Edges1=F(:,[1 2]); Edges2=F(:,[2 3]); Edges3=F(:,[3 1]);
Edges=[Edges1;Edges2;Edges3];
Edges2=unique(Edges,'rows');
inter=false;
for i=1:size(Edges2,1)
Nn=sum((Edges2(i,1)==Edges(:,1))&(Edges2(i,2)==Edges(:,2)));
Ni=sum((Edges2(i,1)==Edges(:,2))&(Edges2(i,2)==Edg... |
d42568905ee95a90f8eee3a03c0af2c8f088a34f2830d738eea9bb140a47969b | MATLAB | 379 | 15 | function [] = chirpDetector(audioFile)
[b a]=butter(3,[25000./150000 75000./150000],'bandpass'); % create filter for chirp range
c=1;
for i = 1:150000:length(y)
spectrogram(double(y(i:i+150000)),1000,[],[],Fs,'yaxis');
pause(.1)
meanPower(c) = mean(filtfilt(b,a,double(y(i:i+150000))));
stdPower(c) = s... |
d7c83c807b1ed0cc44f089bd02dde289662751b86118e8f1be0bad3017456515 | MATLAB | 379 | 9 | % compile all mex cpp scripts
% Code has been updated (4/4/2011) to work with 64 bit compilers
mex -O -largeArrayDims GibbsSamplerLDA.cpp
mex -O -largeArrayDims GibbsSamplerAT.cpp
mex -O -largeArrayDims GibbsSamplerHMMLDA.cpp
mex -O -largeArrayDims GibbsSamplerLDACOL.cpp
mex -O -largeArrayDims GibbsSamplerLDA_NE... |
eae9c0cdb576ae688d6c0c2f1ad0d3b8eb616972d40f73f362b5d4e626fa97f1 | MATLAB | 380 | 12 | function [random,seed]=uniran(seed)
%UNIRAN is the uniform random generator used in mcdcov.m and ltsregres.m
%
% This function is part of LIBRA: the Matlab Library for Robust Analysis,
% available at:
% http://wis.kuleuven.be/stat/robust.html
seed=floor(seed*5761)+999;
quot=floor(seed/65536);
... |
109adbce6aec27417bb551de4e3f400b2cabc75de3e84dc8e599631f5d62ae0c | MATLAB | 381 | 12 | % Local Regression and Likelihood, Figure 5.2.
% Author: Catherine Loader
%
% Density Estimation, for the Old Faithful Geyser Data.
% identity link.
load geyser;
fit = locfit(geyser,'alpha',[0.1 0.8],'link','ident','ll',1,'ur',6);
figure('Name','fig5_2: Density estimation for Old Faithful geyser data' );
lfplot(fit);
... |
11adb1ad62c149ed324b5810352f750c3beac7bd841d803a03547495b2498a27 | MATLAB | 381 | 14 | function [n,names] = plx_adchan_names(filename)
import CMBHOME.PLX2Mat.*
% plx_adchan_names(filename): Read name for each a/d channel from a .plx file
%
% [n,names] = plx_adchan_names(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% OUTPUT:
% names - array of a/d channel name strings
... |
b7f3b40b53304dfa933e0f388fc896561b9ac7a4868c4c3b5bc61f65a0376e75 | MATLAB | 381 | 16 | function r_d = discretize_positions_into_bins(r, env)
%
% r: Nt*2; unit:m
% env: parameters of the environment
delta_x = env.bin_width;
delta_y = env.bin_width;
N = size(r, 1);
r_d = zeros(env.Nx*env.Ny, N);
for i = 1 : N
r_temp = zeros(env.Ny, env.Nx);
r_temp(floor(r(i,2)/delta_y)+1, floor(r(i,1)/delta_x)+... |
957edc342c70424aff57cb49779046650efcc49fe0770c22d26e02fff2599f0d | MATLAB | 382 | 11 | function v = vec( x )
% VEC Vectorize.
% VEC(X), where X is a vector, matrix, or N-D array, returns a column vector
% containing all of the elements of X; i.e., VEC(X)=X(:).
v = reshape( x, numel( x ), 1 );
% Copyright 2005-2016 CVX Research, Inc.
% See the file LICENSE.txt for full copyright information.
% ... |
595028f6d226091c4d004e5340bd4d031e2879be7c2c8a651bd90030a8c7f7b4 | MATLAB | 384 | 17 | function out = C_color( fparam, img , imgR, imgG, imgB, typeidx )
if ( nargin == 1 )
out.weight = fparam.colorWeight;
out.numtypes = 2;
out.descriptions{1} = 'Blue-Yellow';
out.descriptions{2} = 'Red-Green';
else
if ( typeidx ) == 1
out.map = safeDivideGBVS( abs(imgB-min(imgR,imgG)) , img );
else
... |
73c4630a4b594e7a4be229942dd3f2d18423f73235648ea63c4613d29c3c36d5 | MATLAB | 384 | 13 | function SS = sumofsquares(data,predicted)
% this function computes the sum of squared differences between the
% predicted values (e.g. a model output) and the data.
% predicted should be a row vector like data's rows (same number of
% columns).
squares = [];
for d = 1:size(data,1)
squares = [squares;(da... |
921b5aabf5689f399873d4d2f2579ea5ee4bd713518f691932812313d4da2711 | MATLAB | 384 | 8 | function outarray = fread_excepting(fid, sizeA, conversion, filename)
[temparray, readcount] = fread(fid, prod(sizeA), conversion); %matlab's fread can't handle more than 2 dimensions
if readcount ~= prod(sizeA)
error(['file appears truncated: ' filename]);
end
outarray = reshape(temparray, size... |
ff02e0fa58762ae4f3b01af60cff4ff268710fd0f6e82fe240698e58e0158ce7 | MATLAB | 384 | 14 | function Yf = split_frame(Y,patches)
df = diff(patches(1,:));
ndim = size(patches,2)/2;
Yf = zeros([df(1:2:end)+1,size(patches,1)],'like',Y);
otherdims = repmat({':'},1,ndims(Yf)-1+(size(patches,1)==1));
for i = 1:size(patches,1)
indeces = cell(1,ndim);
for j = 1:ndim
indeces{j} = patches(i,2*j-1):pat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.