how can I remove this error??
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Undefined function or variable 'Constraint'.
pop=AddConstraint(1, pop, nPop, FA_time_slots, nVar, app_Sch_FA);
BestCost=repmat(firefly,MaxIt,1);
1 Comment
Walter Roberson
on 20 Jun 2017
In a duplicate of the posting, KSSV comments,
It says AddConstraint doen't accept Structure class. YOu are inputting structure. Check the help part of the function to know more about inputs.
Answers (2)
Jan
on 19 Jun 2017
The error does not occur in the shown part of the code. Obviously it must be a line of code, which contains the term "Constraint" as a variable.
Use the debugger to find the cause of the problem:
dbstop if error
After typing this in the command line, run the code again. Now Matlab stops at the error and you can inspect the local workspace. Perhaps it is a typo only.
Note: Please post the complete error message in the future, which contains the failing line also.
Walter Roberson
on 20 Jun 2017
0 votes
AddConstraint is not a Mathworks function.
With the particular capitalization "AddConstraint" as compared to "addConstraint", it appears that AddConstraint may be a routine from the SpringLab File Exchange contribution. However, that routine only accepts 5 parameters and you are passing in 6 parameters, and the parameters look to have very different purpose.
A google search on some of the variables you use does not find anything. We are led to the conclusion that you have probably written your own function to add constraints, but that it is either in a different directory, or you have used the wrong name for it, or you have not written it yet.
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!