cancel
Showing results for 
Search instead for 
Did you mean: 
Security Alert Log4j Security Vulnerability. Click here to know more.
cancel
Showing results for 
Search instead for 
Did you mean: 

Use MKS Java Api from MATLAB

swurm
1-Newbie

Use MKS Java Api from MATLAB

Hello PTC community,

i'm trying to call the MKS Java Api from MATLAB (Release 2010b 32 bit).

This is because I want to avoid having an external java-class since our main code is all in MATLAB and running Java classes in Matlab was never an issue before.

It all looks good at the beginning, however, when running the cmdRunner-Class, i encounter a Java exception.

Below is an excerpt of the code (MATLAB M-File format) that i'm trying to run. The full m-file with more information is also attached.

When I run the same code from an external Java class in the JRE, everything is working fine. (Thus it shouldn't be the connection to the server)

Is there somebody who could help me with this? Any help would be greatly appreciated.

Thanks,

Stefan

javaaddpath('C:\Matlab\WORK\mksapi.jar');

javaclasspath('-dynamic');

import java.util.List;

import com.mks.api.*

import com.mks.api.response.*;

import com.mks.connect.*;

ipf = IntegrationPointFactory.getInstance();

APIVersion=util.APIVersion(4,11); % Was also tested with 4,15

IntegrationPoint = ipf.createIntegrationPoint('SERVERNAME',7001,true,APIVersion); 

Session = IntegrationPoint.createSession('USERNAME','PASSWORD');

CmdRunner = Session.createCmdRunner();

% CmdRunner-Test:

CmdRunner.toString()

% Answer:

% com.mks.connect.HttpCmdRunnerImpl@2bce4f

cmd = Command(Command.SI,'about');

resp = CmdRunner.execute(cmd);

% Answer:

% ??? Java exception occurred:

%

% (no more information...)

1 ACCEPTED SOLUTION

Accepted Solutions
tdalon
4-Participant
(To:swurm)

Hi

You can have a look to the MATLAB code provided in the PTC "MathWorks Integration".

Download from https://support.ptc.com/

under Features "Mathworks Integration".

HTH.

Thierry

View solution in original post

2 REPLIES 2
KaelLizak
14-Alexandrite
(To:swurm)

Hello Stefan,

I suspect the intersection of Integrity & MatLab users is quite small here.  Please contact PTC Integrity Lifecycle Management Support‌ to open a case to investigate with you.

Regards,
Kael


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager
tdalon
4-Participant
(To:swurm)

Hi

You can have a look to the MATLAB code provided in the PTC "MathWorks Integration".

Download from https://support.ptc.com/

under Features "Mathworks Integration".

HTH.

Thierry

View solution in original post

Announcements

Windchill RVS Users


Please take our

Windchill RV&S Authoring with Formula Editor Survey