Problem in reading the variable in Function file.

3 ビュー (過去 30 日間)
Rupesh
Rupesh 2012 年 11 月 26 日
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.

回答 (1 件)

Image Analyst
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).

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by