How can i use ' libisloaded() ' function and ' addpath' function in SIMULINK?

4 views (last 30 days)
Hi, I have a project using RPLIDAR A1M8, Dynamixel MX-64 and two motors with encoder to make 3D scan with 2D lidar.
Connectting and using each thing was not that problem. and I made it act step by step (scan -> turn lidar -> move -> scan ....).
I tried it to act parallel but I can't load library in parpool. It showed error.
So I'm trying to make it in Simulink. (I think it will be more convenient because motor PID file is simulink file.)
But it showed error too.
when I use
this mfile is
if not(libisloaded('hardwarex'))
switch (computer)
case 'PCWIN64'
%loadlibrary('hardwarex', @hardwarex_proto);
[notfound,warnings]=loadlibrary('hardwarex', @hardwarex_proto);
case 'PCWIN'
[notfound,warnings]=loadlibrary('hardwarex', @hardwarex_proto);
[notfound,warnings]=loadlibrary('hardwarex', 'hardwarex.h', 'includepath', 'MAVLinkSDK', 'includepath', '/usr/local/include', 'includepath', 'sbgECom/src', 'includepath', 'sbgECom/common', 'includepath', '/usr/local/include/sbgECom/src', 'includepath', '/usr/local/include/sbgECom/common', 'includepath', 'rplidar_sdk/sdk/sdk/include', 'includepath', 'rplidar_sdk/sdk/sdk/src', 'includepath', '/usr/local/include/rplidar_sdk/sdk/sdk/include', 'includepath', '/usr/local/include/rplidar_sdk/sdk/sdk/src');
%libfunctions hardwarex -full
libisloaded and addpath were problem when this file was processed.
I got this file in github.

Answers (1)

Aghamarsh Varanasi
Aghamarsh Varanasi on 11 Mar 2021
You can call this MATLAB Script in the 'PreLoadFcn' callback of Simulink.
Refer to this documentation page to learn more about Model Callbacks.


Find more on Modeling 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!