
MATLAB function 'nearest' does not work.
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
when I call the function "nearest()" I obtain the error message: "Check for incorrect argument data type or missing argument in call to function 'nearest'." I am using R2021b.
The following toolboxes are installed:
- MATLAB Version 9.11 (R2021b)
- Aerospace Toolbox Version 4.1 (R2021b)
- Deep Learning Toolbox Version 14.3 (R2021b)
- Financial Toolbox Version 6.2 (R2021b)
- Image Processing Toolbox Version 11.4 (R2021b)
- MATLAB Report Generator Version 5.11 (R2021b)
- Mapping Toolbox Version 5.2 (R2021b)
- Optimization Toolbox Version 9.2 (R2021b)
- Parallel Computing Toolbox Version 7.5 (R2021b)
- Statistics and Machine Learning Toolbox Version 12.2 (R2021b)
The MATLAB documentation for "nearest()" (https://de.mathworks.com/help/fixedpoint/ref/nearest.html) does not say anything about required toolboxes though.
Why does MATLAB not execute tht function "nearest()" correctly?
Thanks for your help.
1 Kommentar
Stephen23
am 13 Jun. 2022
Bearbeitet: Stephen23
am 13 Jun. 2022
"The MATLAB documentation for "nearest()" (https://de.mathworks.com/help/fixedpoint/ref/nearest.html) does not say anything about required toolboxes though."
You can always identify the toolbox from both the URL and from the contents browser hierarchy:

Antworten (2)
Steven Lord
am 13 Jun. 2022
I find two functions named nearest in MathWorks products when I search the documentation.
One is the nearest method for graph and digraph objects, which is part of MATLAB. As stated on that page, the first input argument G must be a "graph object | digraph object". If it isn't, you cannot successfully call this method. [You could call the method if one of the later inputs was a graph or digraph object, but if that first input isn't one the method will error out.]
One is the nearest method for fi objects, which is part of Fixed-Point Designer. The one input to this method must be a "Input fi array, specified as scalar, vector, matrix, or multidimensional array." If you try to call this with a normal double precision array as input, it will not work: MATLAB will not call this method.
Which of these methods were you hoping to call and what data did you pass into your nearest() call? Or were you hoping to do something else and hoped that a function named nearest() would let you achieve your goal?
4 Kommentare
Stephen23
am 13 Jun. 2022
which nearest -all
nearest(1.2)
Steven Lord
am 13 Jun. 2022
Huh. That suggests the documentation may need to be updated. I'll note that to the documentation staff for Fixed-Point Designer.
Star Strider
am 13 Jun. 2022
1 Kommentar
Star Strider
am 13 Jun. 2022
I didn’t see Fixed-Point Designer Toolbox in the list in the original post (and I still don’t see it there), so I didn’t link to functions in it.
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!