mqtt library incompatible with simulink

7 views (last 30 days)
I'm attempting to leverage the mqtt library here within simulink to allow publication of information to an external interface that another component will read from (e.g., a locally hosted artemis queue that supports mqtt, which another component reads from and acts upon).
There are a few issues:
1) try/catch is not supported in simulink
2) the library mentioned above does not support simulink compilation. See below error
P-file 'C:\Users\Kyle Huggins\Documents\MATLAB\simulink_additions\mqqt\+mqttio\@Mqtt\Mqtt.p' is not authorized for compilation. To support compilation, please consider using 'coder.allowpcode' in this file. When the file defines a MATLAB class, 'coder.allowpcode' should be added to the class constructor.
P-code function 'Mqtt.p' produced an error.
Component:MATLAB Function | Category:Coder error
The 'matlab.mixin.CustomDisplay' class does not support code generation.
P-code function 'Mqtt.p' produced an error.
Component:MATLAB Function | Category:Coder error
Parsing failed.
Function 'mqtt.m' (#346.5133.5139), line 129, column 7:
Launch diagnostic report.
Since that is p-code, I'm unable to modify it to support compilation. I'm aware that there are thingspeak blocks that are available via the android toolbox, but this appears to support writing to channels on the thingSpeak domain. I'm interested in writing to a local queue, and am not doing anything related to IoT flavored applications.
Is there a possible solution given the current setup, or should I work on some other means of linking in external applications? Or is there a more appropriate method to go about this?
Please see attached file for a reproduction of the issue. Requires mqtt and a local mqtt compatible messaging service such as apache artemis.

Accepted Answer

Kyle Huggins
Kyle Huggins on 12 Sep 2018
Solved by making creating a matlab wrapper that called the function I wanted and made it extrinsic, a la

More Answers (0)


More Answers in the  ThingSpeak Community


Find more on Write Data to Channel in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!