필터 지우기
필터 지우기

Why am I getting error "Too many input arguments"

조회 수: 1 (최근 30일)
Randy Strauss
Randy Strauss 2020년 4월 8일
댓글: Randy Strauss 2020년 4월 8일
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...)

채택된 답변

Randy Strauss
Randy Strauss 2020년 4월 8일
I think I have to pass the instance into the method, sigh...
  댓글 수: 1
Randy Strauss
Randy Strauss 2020년 4월 8일
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...)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by