Why Does My Matlab Function Say Input Argument 'u' is Undefined?

  • Context: MATLAB 
  • Thread starter Thread starter shaqdiesel
  • Start date Start date
  • Tags Tags
    Beginner Matlab
Click For Summary
SUMMARY

The error "Input argument 'u' is undefined" occurs in MATLAB when a function is called without providing the required input argument. In the provided function coloca(u), the variable u must be defined and passed when calling the function. For example, calling coloca(1) will resolve the error by supplying a value for u.

PREREQUISITES
  • Basic understanding of MATLAB functions
  • Familiarity with MATLAB syntax for function calls
  • Knowledge of variable scope in MATLAB
  • Experience with MATLAB error messages and debugging
NEXT STEPS
  • Review MATLAB function definition and calling conventions
  • Explore MATLAB variable scope and how it affects function inputs
  • Learn about MATLAB error handling and debugging techniques
  • Investigate MATLAB documentation on function arguments and input validation
USEFUL FOR

Beginner MATLAB users, students learning programming concepts, and anyone troubleshooting function input errors in MATLAB.

shaqdiesel
Messages
1
Reaction score
0
need urgent help

I'm a beginner using matlab, I saw this function working:

function une=coloca(u)
num=1:256;
val=288-(u*3000);
une(1,:)=val;
une(2,:)=num;

but when I try to use it, this error appears:

? Input argument "u" is undefined.

Error in ==> une at 3
val=288-(u*3000);

What could be the problem? Could someone help me ?
 
Last edited:
Physics news on Phys.org


How do you call the function?
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
7K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
Replies
1
Views
18K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
9K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
9K
  • · Replies 12 ·
Replies
12
Views
3K