Please help!

조회 수: 17 (최근 30일)
Mansour
Mansour 2012년 5월 10일
Hello All
I got this error while I tried to export cuckoo search Matlab code file which is provided in your website to c++ in this link http://www.mathworks.com/matlabcentral/fileexchange/29809-cuckoo-search-cs-algorithm/content/cuckoo_search.m
the error is:
>> coder -build Untitled2.prj ??? Undefined function or variable 'nest'. The first assignment to a local variable determines its class. Error in ==> cuckoo_search Line: 63 Column: 44 Code generation failed: Open error report.
the error appear wherever their are variables, I don't know way! Please how to overcome this error ??
I appreciate your advice !

채택된 답변

Friedrich
Friedrich 2012년 5월 10일
Hi,
please preallocate the output variables first, because the first appearance of nest is in a loop where you populate it,
nest(i,:)=Lb+(Ub-Lb).*rand(size(Lb));
Matlab Coder dont know the size/type of nest.
  댓글 수: 2
Mansour
Mansour 2012년 5월 10일
Thanks for replay, Friedrich!
Just more question, can I assign or initialize this variable to Zero at the beginning of program.
Friedrich
Friedrich 2012년 5월 10일
You can, if it doesnt change how the program works. Important for the ML Coder is that it know the size and datatype. So if you do something linke nest = zeros(??,??) (?? is the size you have to specify) than it should work fine.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by