Not enough input arguments for function length()

1 view (last 30 days)
Liangliang Xu
Liangliang Xu on 18 Nov 2020
Answered: Rik on 18 Nov 2020
I DONT REALLY UNDERSTAND WHAT IS GOING ONE.
I use length([1 2 3]) along it runs well, but by putting into this code it constantly reports errors.
Somebody can explain the situation to me? please!

Answers (1)

Rik
Rik on 18 Nov 2020
You are calling the a4_q3b function without input arguments. You did not give it any value for x, so when you try to use it, your function exits with an error. You are not providing an input to your function, so your function can't provide the input to length. The error has nothing to do with the length function and everything to do with how you call your function.
%this should work better:
a4_q3b([1 2 3],[4 5 6])
Also note that you probably want to use numel instead of length.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!