Why do I receive an error when trying to compile an M-Function in MATLAB Compiler 3.0 (R13) that calls the IMPORTDATA function?

1 view (last 30 days)
I have a simple MATLAB function that uses the IMPORTDATA function. When I try to build a stand-alone program with the MATLAB compiler, I receive many warnings, and then the following error:
wk1read.obj : error LNK2001: unresolved external symbol _mlfNWk1const
myFunc.exe : fatal error LNK1120: 1 unresolved externals
MBUILD.BAT: Error: Link of 'myFunc.exe' failed.
??? Error using ==> mbuild
Unable to complete successfully
??? Error: An error occurred while shelling out to mbuild (error code = 1).
Unable to build executable (specify the -v option for more information).
Error in ==> D:\MATLAB6p5\toolbox\compiler\mcc.dll

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The IMPORTDATA function uses MATLAB Object Oriented Programming paradigms. MATLAB Compiler 3.0 (R13) did not support the compilation of MATLAB Objects.
In addition, IMPORTDATA calls functions that use Java. MATLAB functions that use Java cannot be compiled using MATLAB Compiler 3.0.
As a workaround, use the LOAD command or utilize MATLAB's low-level file I/O capabilities such as FSCANF, FREAD, FPRINTF, and FWRITE.
More detailed information on the use of these functions is available in the MATLAB documentation, accessible from the MATLAB command prompt with the command:
doc
Note that MATLAB Compiler 4.0 (R14) and above do support compiling functions, such as IMPORTDATA, that use Java.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!