Error: invalid call problem
14 ビュー (過去 30 日間)
古いコメントを表示
I'm creating a pre function and an error occured, here is my script:
%func to calc tmax of a projectile motion
function[tmax]=Time_of_Flight(U,angle);
[converted_trig]=rad_angle(angle)
tmax=2.*U.*converted_trig./9.81;
%func to convert radian to degree
function[converted_trig]=rad_angle(angle)
converted_trig =sin((angle.*pi./180));
When I'm run the source code, I get error:
>> Time_of_Flight
error: Invalid call to angle. Correct usage is:
-- angle (Z)
error: called from
print_usage at line 98 column 5
Time_of_Flight at line 4 column 17
0 件のコメント
回答 (1 件)
Walter Roberson
2022 年 1 月 10 日
In order to explain that, we will need to know which MATLAB release you are using.
I have not seen those messages in a long time, and I would have to go back and test to see exactly what is going on.
Indeed, my memory must be failing me at the moment, as I would really have though that those were messages from Octave rather than from MATLAB. Octave is a different programming language that is not compatible with MATLAB in this matter, so if you are using Octave you would need to inquire at an Octave help forum.
3 件のコメント
Walter Roberson
2022 年 1 月 10 日
If you were using MATLAB then you would have received a quite different message indicating that you had not provided enough input arguments. In MATLAB if you define a parameter then inside the function, references to that name will give you a "not enough parameter" message unless you pass in enough parameters.
To put it another way: you are running the function without supplying parameters, but you are expecting that the program will be able to find values for those parameters somewhere. MATLAB has a well-defined result in such cases. Octave... I have no idea what its search rules are.
Reminder: the purpose of Octave is to bankrupt Mathworks, so if you want help with Octave you have come to the wrong place.
参考
カテゴリ
Help Center および File Exchange で Octave についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!