(CEC2017 benchmark functions) MATLAB R2016b error : Matlab has encountered an internal problem and needs to close
32 次查看(过去 30 天)
显示 更早的评论
I have an issue when I run my mex file. If you have resolved this kind of issue, please help me to fix the issue.
I'm trying to use following code (CEC2017 benchmark functions):
mex cec17_func.cpp -DWINDOWS
This code starts as follows:
// #include <WINDOWS.H>
#include <stdio.h>
#include <math.h>
#include <malloc.h>
#include <mex.h>
double *OShift,*M,*y,*z,*x_bound;
int ini_flag=0,n_flag,func_flag,*SS;
#define INF 1.0e99
#define EPS 1.0e-14
#define E 2.7182818284590452353602874713526625
#define PI 3.1415926535897932384626433832795029
void sphere_func (double *, double *, int , double *,double *, int, int); /* Sphere */
void ellips_func(double *, double *, int , double *,double *, int, int); /* Ellipsoidal */
void bent_cigar_func(double *, double *, int , double *,double *, int, int); /* Discus */
void discus_func(double *, double *, int , double *,double *, int, int); /* Bent_Cigar */
void dif_powers_func(double *, double *, int , double *,double *, int, int); /* Different Powers */
void rosenbrock_func (double *, double *, int , double *,double *, int, int); /* Rosenbrock's */
void schaffer_F7_func (double *, double *, int , double *,double *, int, int); /* Schwefel's F7 */
void ackley_func (double *, double *, int , double *,double *, int, int); /* Ackley's */
void rastrigin_func (double *, double *, int , double *,double *, int, int); /* Rastrigin's */
void weierstrass_func (double *, double *, int , double *,double *, int, int); /* Weierstrass's */
void griewank_func (double *, double *, int , double *,double *, int, int); /* Griewank's */
void schwefel_func (double *, double *, int , double *,double *, int, int); /* Schwefel's */
void katsuura_func (double *, double *, int , double *,double *, int, int); /* Katsuura */
void bi_rastrigin_func (double *, double *, int , double *,double *, int, int); /* Lunacek Bi_rastrigin */
void grie_rosen_func (double *, double *, int , double *,double *, int, int); /* Griewank-Rosenbrock */
void escaffer6_func (double *, double *, int , double *,double *, int, int); /* Expanded Scaffer¡¯s F6 */
void step_rastrigin_func (double *, double *, int , double *,double *, int, int); /* Noncontinuous Rastrigin's */
void happycat_func (double *, double *, int , double *,double *, int, int); /* HappyCat */
void hgbat_func (double *, double *, int , double *,double *, int, int); /* HGBat */
/* New functions Noor Changes */
void sum_diff_pow_func(double *, double *, int , double *,double *, int, int); /* Sum of different power */
void zakharov_func(double *, double *, int , double *,double *, int, int); /* ZAKHAROV */
void levy_func(double *, double *, int , double *,double *, int, int); /* Levy */
void dixon_price_func(double *, double *, int , double *,double *, int, int); /* Dixon and Price */
void hf01 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 1 */
void hf02 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 2 */
void hf03 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 3 */
void hf04 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 4 */
void hf05 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 5 */
void hf06 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 6 */
void hf07 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 7 */
void hf08 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 8 */
void hf09 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 9 */
void hf10 (double *, double *, int, double *,double *, int *,int, int); /* Hybrid Function 10 */
void cf01 (double *, double *, int , double *,double *, int); /* Composition Function 1 */
void cf02 (double *, double *, int , double *,double *, int); /* Composition Function 2 */
void cf03 (double *, double *, int , double *,double *, int); /* Composition Function 3 */
void cf04 (double *, double *, int , double *,double *, int); /* Composition Function 4 */
void cf05 (double *, double *, int , double *,double *, int); /* Composition Function 5 */
void cf06 (double *, double *, int , double *,double *, int); /* Composition Function 6 */
void cf07 (double *, double *, int , double *,double *, int); /* Composition Function 7 */
void cf08 (double *, double *, int , double *,double *, int); /* Composition Function 8 */
void cf09 (double *, double *, int , double *,double *, int *, int); /* Composition Function 7 */
void cf10 (double *, double *, int , double *,double *, int *, int); /* Composition Function 8 */
void shiftfunc (double*,double*,int,double*);
void rotatefunc (double*,double*,int, double*);
void sr_func (double *, double *, int, double*, double*, double, int, int); /* shift and rotate */
void asyfunc (double *, double *x, int, double);
void oszfunc (double *, double *, int);
void cf_cal(double *, double *, int, double *,double *,double *,double *,int);
void cec17_test_func(double *, double *,int,int,int);
...
This C++ code includes 30 benchmark functions. For functions 1 to 10 and also 21 to 28, MATLAB runs truely but for functions 11 to 20 and also, 29 and 30, Matlab shows : "Error: Cannot open input file for reading " in cammand window and then it apears "Matlab has encountered an internal problem and needs to close " . i don't know what's wrong.
MATLAB crash file:C:\Users\zgb\AppData\Local\Temp\matlab_crash_dump.12896-1:
------------------------------------------------------------------------
Access violation detected at Tue Sep 28 08:05:07 2021
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Current Graphics Driver: Unknown hardware
Default Encoding : windows-1252
Deployed : false
Graphics card 1 : NVIDIA ( 0x10de ) NVIDIA GeForce 840M Version 30.0.14.7212
Graphics card 2 : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics 5500 Version 20.19.15.5171
Host Name : MyLaptop
MATLAB Architecture : win64
MATLAB Entitlement ID: Unknown
MATLAB Root : F:\Program Files\MATLAB\R2016b
MATLAB Version : 9.1.0.441655 (R2016b)
OpenGL : hardware
Operating System : Microsoft Windows 10 Pro
Processor ID : x86 Family 6 Model 61 Stepping 4, GenuineIntel
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : Version 10.0 (Build 19043)
Fault Count: 1
Abnormal termination:
Access violation
Register State (from fault):
RAX = 0000000000000000 RBX = 000000000000000a
RCX = ffffffffd72a3dd0 RDX = 0000000036362f70
RSP = 00000000043f9960 RBP = 00000000043f99e0
RSI = 000000003635f4c0 RDI = 0000000600000004
R8 = 000000000000000a R9 = 0000000036372660
R10 = 0000000036362fb8 R11 = 0000000000000064
R12 = 0000000036363390 R13 = 0000000036372660
R14 = 0000000200000000 R15 = 0000000000000004
RIP = 000000000cee3ba7 EFL = 00010206
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault):
[ 0] 0x000000000cee3ba7 F:\Program Files\MATLAB\R2016b\bin\cec17_func.mexw64+00015271
[ 1] 0x000000000cee6e89 F:\Program Files\MATLAB\R2016b\bin\cec17_func.mexw64+00028297
[ 2] 0x000000000cee753b F:\Program Files\MATLAB\R2016b\bin\cec17_func.mexw64+00030011 mexFunction+00000239
[ 3] 0x00000000fc5fc5d1 F:\Program Files\MATLAB\R2016b\bin\win64\libmex.dll+00116177 mexRunMexFile+00000129
[ 4] 0x00000000fc5fb2e2 F:\Program Files\MATLAB\R2016b\bin\win64\libmex.dll+00111330 mexFeature_mexver+00001794
[ 5] 0x00000000fc5fa506 F:\Program Files\MATLAB\R2016b\bin\win64\libmex.dll+00107782 mexUnlock+00020182
[ 6] 0x00000000160d46de F:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00018142 Mfh_file::dispatch_fh_impl+00000434
[ 7] 0x00000000160d44b6 F:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00017590 Mfh_file::dispatch_fh+00000062
[ 8] 0x00000000160d5827 F:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00022567 Mfunction_handle::dispatch+00001015
[ 9] 0x0000000016a28c29 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00887849 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00798773
[ 10] 0x0000000016a3728f F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00946831 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00857755
[ 11] 0x0000000016a37b75 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00949109 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00860033
[ 12] 0x0000000016a39151 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00954705 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00865629
[ 13] 0x0000000016a39c95 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00957589 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00868513
[ 14] 0x0000000016a3932f F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00955183 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00866107
[ 15] 0x0000000016a3940d F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00955405 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00866329
[ 16] 0x0000000016a28041 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00884801 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00795725
[ 17] 0x00000000169a9eab F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00368299 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00279223
[ 18] 0x00000000169a9740 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00366400 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00277324
[ 19] 0x0000000016a31efe F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00925438 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00836362
[ 20] 0x0000000016a3195a F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00923994 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00834918
[ 21] 0x0000000016a31979 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00924025 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00834949
[ 22] 0x00000000160d46de F:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00018142 Mfh_file::dispatch_fh_impl+00000434
[ 23] 0x00000000160d44b6 F:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00017590 Mfh_file::dispatch_fh+00000062
[ 24] 0x00000000160d5827 F:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00022567 Mfunction_handle::dispatch+00001015
[ 25] 0x0000000016a2bfbd F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00901053 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00811977
[ 26] 0x00000000169ffbc0 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00719808 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00630732
[ 27] 0x0000000016a3728f F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00946831 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00857755
[ 28] 0x0000000016a37b75 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00949109 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00860033
[ 29] 0x0000000016a39151 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00954705 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00865629
[ 30] 0x0000000016a39c95 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00957589 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00868513
[ 31] 0x0000000016a3932f F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00955183 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00866107
[ 32] 0x0000000016a3940d F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00955405 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00866329
[ 33] 0x0000000016a28041 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00884801 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00795725
[ 34] 0x00000000169a9eab F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00368299 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00279223
[ 35] 0x00000000169a9740 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00366400 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00277324
[ 36] 0x00000000169a3f8f F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00343951 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00254875
[ 37] 0x00000000169a3aa1 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00342689 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00253613
[ 38] 0x00000000169a3991 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00342417 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00253341
[ 39] 0x0000000016b303e9 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+01967081 boost::serialization::singleton<boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive,foundation::msg_svc::eventmgr::BaseEvent> >::get_instance+00003353
[ 40] 0x0000000016b30372 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+01966962 boost::serialization::singleton<boost::archive::detail::oserializer<boost::archive::polymorphic_oarchive,foundation::msg_svc::eventmgr::BaseEvent> >::get_instance+00003234
[ 41] 0x00000000169f2a61 F:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00666209 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00577133
[ 42] 0x0000000015ecb3bd F:\Program Files\MATLAB\R2016b\bin\win64\m_interpreter.dll+00504765 inEvalCmdWithLocalReturn+00000065
[ 43] 0x00000000fb608ced F:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00101613 mnGetPrompt+00012957
[ 44] 0x00000000fb609ba3 F:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00105379 mnParser+00001091
[ 45] 0x0000000015ca6841 F:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00223297 mcr::runtime::setInterpreterThreadToCurrent+00025585
[ 46] 0x0000000015ca57d7 F:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00219095 mcr::runtime::setInterpreterThreadToCurrent+00021383
[ 47] 0x0000000015ca5853 F:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00219219 mcr::runtime::setInterpreterThreadToCurrent+00021507
[ 48] 0x0000000015ca6141 F:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00221505 mcr::runtime::setInterpreterThreadToCurrent+00023793
[ 49] 0x00000000fd01d347 F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00578375 iqm::UserEvalPlugin::pre+00030679
[ 50] 0x00000000fd029e7c F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00630396 iqm::UserEvalPlugin::pre+00082700
[ 51] 0x00000000fd017480 F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00554112 iqm::UserEvalPlugin::pre+00006416
[ 52] 0x00000000fd02c99a F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00641434 iqm::UserEvalPlugin::pre+00093738
[ 53] 0x00000000fcff9a37 F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00432695 iqm::PackagedTaskPlugin::PackagedTaskPlugin+00000727
[ 54] 0x00000000fcffa08f F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00434319 iqm::PackagedTaskPlugin::execute+00000575
[ 55] 0x00000000fcff9aa9 F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00432809 iqm::PackagedTaskPlugin::PackagedTaskPlugin+00000841
[ 56] 0x00000000fcff9f04 F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00433924 iqm::PackagedTaskPlugin::execute+00000180
[ 57] 0x00000000fcfd42fa F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00279290 iqm::Iqm::setupIqmFcnPtrs+00071530
[ 58] 0x00000000fcfd41d3 F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00278995 iqm::Iqm::setupIqmFcnPtrs+00071235
[ 59] 0x00000000fcfb9e5a F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00171610 iqm::Iqm::deliver+00003274
[ 60] 0x00000000fcfbad2f F:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00175407 iqm::Iqm::deliver+00007071
[ 61] 0x0000000100108173 F:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01147251 services::system_events::PpeDispatchHook::dispatchOne+00019059
[ 62] 0x000000010010c3a3 F:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01164195 sysq::addProcessPendingEventsUnitTestHook+00001923
[ 63] 0x000000010010c580 F:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01164672 sysq::addProcessPendingEventsUnitTestHook+00002400
[ 64] 0x000000010010d685 F:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01169029 sysq::getCondition+00002917
[ 65] 0x000000010010e4b2 F:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01172658 svWS_ProcessPendingEvents+00000162
[ 66] 0x0000000015ca6b7d F:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00224125 mcr::runtime::setInterpreterThreadToCurrent+00026413
[ 67] 0x0000000015ca726a F:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00225898 mcr::runtime::setInterpreterThreadToCurrent+00028186
[ 68] 0x0000000015c9e385 F:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00189317 mcr_process_events+00010293
[ 69] 0x0000000015ca02d2 F:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00197330 mcr_process_events+00018306
[ 70] 0x0000000015b8bd0e F:\Program Files\MATLAB\R2016b\bin\win64\MVMLocal.dll+00245006 mvm_server::inproc::LocalFactory::terminate+00070846
[ 71] 0x00000000fa942cd9 F:\Program Files\MATLAB\R2016b\bin\win64\mvm.dll+01125593 mvm::detail::initLocalMvmHack+00000521
[ 72] 0x00000000fa9432a5 F:\Program Files\MATLAB\R2016b\bin\win64\mvm.dll+01127077 mvm::detail::SessionImpl::privateSession+00000373
[ 73] 0x00000000fa9434b1 F:\Program Files\MATLAB\R2016b\bin\win64\mvm.dll+01127601 mvm::detail::SessionImpl::privateSession+00000897
[ 74] 0x0000000140006fd5 F:\Program Files\MATLAB\R2016b\bin\win64\MATLAB.exe+00028629
[ 75] 0x0000000140007661 F:\Program Files\MATLAB\R2016b\bin\win64\MATLAB.exe+00030305
[ 76] 0x00007ffaf7f47034 C:\WINDOWS\System32\KERNEL32.DLL+00094260 BaseThreadInitThunk+00000020
[ 77] 0x00007ffaf95c2651 C:\WINDOWS\SYSTEM32\ntdll.dll+00337489 RtlUserThreadStart+00000033
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
Thank you for your help.
1 个评论
AJIT KUMAR MAHAPATRA
2024-4-13
编辑:AJIT KUMAR MAHAPATRA
2024-4-13
I was also facing the same problem like you. But i tried as follows and worked normally. you may try as i have mentioned below:
Open the cec17_func.cpp file in matlab or notepad
Go to the body of void cec17_test_func(double *x, double *f, int nx, int mx,int func_num) funtion where it is defined.
Inside the function body, look at the statements where the input files for 2017 problems are accessed or opened using fopen command. before the fopen command the corresponding file name to be opened is generated using sprintf function. in those 'sprintf' statements specify the full path name of the that file as i am mentioning below:
suppose the working directory of your matlab program files which you want to execute is : F:/MY_PROGS_FOR_CEC2017
specify the full path as shown below :
/* Load Matrix M*/
sprintf(FileName, "F:\\MY_PROGS_FOR_CEC2017\\input_data\\M_%d_D%d.txt", func_num,nx);
fpt = fopen(FileName,"r");
if (fpt==NULL)
{
printf("\n Error: Cannot open input file for reading \n");
}
The above code is from the cec17_func.cpp file
after modifying, save the cec17_func.cpp file. Then execute the Mex command as follows:
mex F:\MY_PROGS_FOR_CEC2017\cec17_func.cpp -DWINDOWS
After executing mex command, run your programs to solve the cec17 problems
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!