Problem in reading the variable in Function file.
3 次查看(过去 30 天)
显示 更早的评论
I am running a program on Genetic algorithm in MATLAB, for which I have written two function files for Constraint function & Objective function. For which I am reading a set of data from a excel file by following command.
As = xlsread('Steel Table','I1:I66');
Then reading it in function file by following command.
function [c ceq] = optim_cost_var4_const(x)
As = x(1);
But when I am ruining the program following error message is displayed.
??? Input argument "x" is undefined.
Error in ==> optim_cost_var4_const at 2
As = x(1);
I have also tried by assigning the variable as global still its not working. Please help me out.
0 个评论
回答(1 个)
Image Analyst
2013-2-15
Well what did you pass in to optim_cost_var4_const() when you called it???? Let's see the line where you actually call/execute the optim_cost_var4_const() function so we can see what variable you're passing in to it (if any).
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Report Generator 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!