Not recognising named input argument
Show older comments
This is the head of my function:
function results = spectral_coi(seeds, labels, rr_k, d, n)
arguments
seeds cell % seeds for COI clusters
labels (:, 1) uint8 % labels ( x samples)
end
arguments (Repeating)
rr_k double {mustBeNumeric} % input arrays x k ( x samples x timepoints)
end
arguments
d.idx_seed logical {mustBeNumericOrLogical} = true % are seeds as indices (or in physical units)
d.output_type (1, :) string ...
{mustBeMember(d.output_type, {'all', 'phase', 'power', 'spectral'})} ...
= 'all'
d.transform string ...
{mustBeMember(d.transform, {'native', 'fftw3'})}...
= 'native'
d.verbosity uint8 = 0 % provide feedback?
d.z_pvl double = 0.05 % cluster pval
n.time (1, :) double {mustBeNumeric} % timepoints for reference to seeds physical units
n.f_s double {mustBePositive} % sampling frequency, return normalized frequencies if not provided
n.lof double {mustBePositive} % lowest frequency to calculate (Hz)
n.hif double {mustBePositive} % highest frequency to calculate (Hz)
n.pl {mustBeInteger} % num permutations
end
I call it like this:
results = spectral_coi({[140, 9]}, stim, dat, "output_type", "phase", ...
"idx_seed", false, ...
"is_fbk", false, ...
"transform", "native", ...
"verbosity", 2, ...
"time", time, "f_s", f_s, "hif", 15, "lof", 2, "pl", 2);
Yet rr_k is now
rr_k =
1x7 cell array
Columns 1 through 3
{1078x399 double} {[NaN]} {[NaN]}
Columns 4 through 7
{[NaN]} {[0]} {[NaN]} {[0]}
Suggesting that it has intepreted the inputs up until "transform" as a repeating input. Instead it should have ofcoursed recognised the named inputs like it did with everything afterwards. What is going on? Why start recognising inputs at "transform"?
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!