John R. answered 08/20/24
California-Based Software Developer | Practical Coding Tutor
There aren't any open-source Java libraries that I am aware of; however, that doesn't mean it can't be done. There are several ways in which you can work with Simulink from Java depending on what your needs are, one such method which would work if you already have the '.slx' or '.mdl' files at hand, would be to use MATLAB to convert and export these files to XML, for which there are a plethora of open-source libraries available and you should have no trouble parsing the data you're after making it available for use within your Java application. Option 2, should you have access to MATLAB, and you are needing to parse dynamically generated content, you can use MATLAB's engine API for Java, which allows you to run MATLAB code from within Java, making it so you can interact with Simulink programmatically to obtain the values you need for your Java application. The third option, which isn't exactly parsing Simulink from within Java does provide a way of obtaining the values you're after, which is how I would go about solving this dilemma, would be to create a custom MATLAB script to calculate the desired values and have it output the solutions to '.xml' for parsing from within the Java application.