Errors in ASAP2 Generation: Attempt to call a non-function value

11 views (last 30 days)
I'm trying to get simulink to generate an ASAP2 data exchange interface. When I try to build the model, I keep getting this error
--------------------------------------------------------------------------------------------------------------------------
### Creating ASAP2 file: "filename".a2l
Error: File: C:\Program Files\MATLAB\R2020a\rtw\c\tlc\mw\asap2lib.tlc Line: 1325 Column: 56
Attempt to call a non-function value: ASAP2UserFcnWriteStructMeasurement Main program:
==> [00] C:\Program Files\MATLAB\R2020a\rtw\c\tlc\mw\asap2lib.tlc:FcnLoopThruDWorks(1325)
[01] C:\Program Files\MATLAB\R2020a\rtw\c\tlc\mw\asap2lib.tlc:SLibASAP2WriteDynamicContents(31)
[02] C:\Program Files\MATLAB\R2020a\rtw\c\tlc\mw\asap2main.tlc:<NONE>(88)
Error: File: C:\Program Files\MATLAB\R2020a\rtw\c\tlc\mw\asap2lib.tlc Line: 1325 Column: 43
Values of NULL type cannot be expanded Main program:
==> [00] C:\Program Files\MATLAB\R2020a\rtw\c\tlc\mw\asap2lib.tlc:FcnLoopThruDWorks(1325)
[01] C:\Program Files\MATLAB\R2020a\rtw\c\tlc\mw\asap2lib.tlc:SLibASAP2WriteDynamicContents(31)
[02] C:\Program Files\MATLAB\R2020a\rtw\c\tlc\mw\asap2main.tlc:<NONE>(88)
---------------------------------------------------------------------------------------
Does anyone know how to fix this?

Answers (1)

Mrutyunjaya Hiremath
Mrutyunjaya Hiremath on 24 Oct 2023
The error seeing appears to be a TLC (Target Language Compiler) error when MATLAB/Simulink tries to generate an ASAP2 file. TLC errors can sometimes be a bit cryptic, but from the error messages you provided, it seems that there is an issue with a function call or the value being used within the `asap2lib.tlc` file, which is part of MATLAB's code generation process.
Here are some steps that can take to troubleshoot and potentially resolve this issue:
  1. Update MATLAB: If you are not using the latest patch/update of MATLAB R2020a, consider updating it. Sometimes these types of errors are fixed in subsequent patches.
  2. Check for External Customizations: Ensure you haven't made any custom modifications or added any custom TLC scripts that might be interfering with the ASAP2 generation process.
  3. User-defined Function: From the error, it appears there is a call to `ASAP2UserFcnWriteStructMeasurement` which may not be functioning as expected. Ensure that if this is a custom-defined function, it's correctly defined and accessible.
  4. Model Settings: Ensure that your model's settings related to ASAP2 generation are correctly configured. Sometimes, misconfigurations or inconsistencies in settings can lead to such errors.
  5. Use a Simplified Model: Try generating the ASAP2 file for a simpler Simulink model to see if the issue is related to your specific model or a general MATLAB issue. If a simple model works fine, incrementally add complexity to isolate the problem.
  6. MATLAB Support: Given that the error arises from MATLAB's internal files (`asap2lib.tlc`), it might be worthwhile to contact MathWorks support. They might be aware of this issue and could offer a direct solution or workaround.
  7. Fresh MATLAB Installation: As a last resort, if nothing else works, consider reinstalling MATLAB. Sometimes, corrupted installations or certain files can lead to unexpected errors.
Finally, when dealing with such errors, always ensure backups of work and important files. This way, can experiment with different solutions without the fear of losing any data.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!