Why am I getting the error "If the working dimension of MAX or MIN is variable in length, it must not have zero length at runtime."?
8 views (last 30 days)
Show older comments
MathWorks Support Team
on 8 Mar 2021
Answered: MathWorks Support Team
on 8 Mar 2021
What is the cause for error:
If the working dimension of MAX or MIN is variable in length, it must not have zero length at runtime.
What is the working dimension of MAX or MIN? How can I resolve this error?
Accepted Answer
MathWorks Support Team
on 8 Mar 2021
The reason for this error is that ‘max’ and ‘min’ functions do not support variable-size empty inputs where the dimension to operate along is variable and takes on zero length at run-time.
Generally, the supported empty inputs for ‘max’ and ‘min’ functions include:
1) Fixed-size empty inputs
2) Variable-size empty inputs when the dimension to operate along has positive length
3) Variable-size empty inputs when the dimension to operate along has constant zero length
It may be helpful to make a logical decision (e.g. if else statement) before calling ‘max’ or ‘min’ function to ensure that the variable dimension is not of zero length at run-time.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!