Problem in reading the variable in Function file.

3 visualizaciones (últimos 30 días)
Rupesh
Rupesh el 26 de Nov. de 2012
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.

Respuestas (1)

Image Analyst
Image Analyst el 15 de Feb. de 2013
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).

Categorías

Más información sobre MATLAB Report Generator en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by