Clear Filters
Clear Filters

Why am I getting error "Too many input arguments"

1 view (last 30 days)
This is embarrassing... I can't figure out why it's saying "Too many input arguments."
Here's the definition. It seems to me that predict(...) takes 10 arguments:
classdef TrajectoryPredictor
% TrajectoryPredictor predicts a trajectory.
% Its predict() method returns data. Other methods are private.
properties
model
simParams
end
methods
function tp = TrajectoryPredictor(vehicleModel, simParams)
tp.model = vehicleModel;
tp.simParams = simParams;
end
function [trajectory_output, state_vector] = predict(...
measure_vector, measure_time, ...
previous_measure, previous_time, ...
previous_state_vector, waypoints, ref_traj, ...
lat0, lon0, alt0)
etc
Here's the instance creation and the call to predict(), with line numbers added:
122 predictor = TrajectoryPredictor(model, simParams);
123 [predicted_traj, state_vector] = predictor.predict(...
124 loc_now, t_now, ...
125 loc_prev, t_prev, ...
126 state_vector, waypoints, ref_traj, ...
127 lat0, lng0, alt0);
It sure looks to me like there are 10 arguments being passed. But I get:
Error using TrajectoryPredictor/predict
Too many input arguments.
Error in test_prediction>do_test_prediction (line 123)
[predicted_traj, state_vector] = predictor.predict(...
(It really should say how many it sees and the number(s) it expects...)

Accepted Answer

Randy Strauss
Randy Strauss on 8 Apr 2020
I think I have to pass the instance into the method, sigh...
  1 Comment
Randy Strauss
Randy Strauss on 8 Apr 2020
Either predictor has to be passed in,
or if it's called predictor.predict(...), it should omitted.
but it must be declared as the first parameter of the function in the definition...
(I prefered APL...)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!