Controlling two FreeMaster instances from one MATLAB script

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Controlling two FreeMaster instances from one MATLAB script

跳至解决方案
5,280 次查看
Ahmed_Abd_El-Hafez
Contributor III

Hello NXP team,

I want to make a MATLAB script file that can access, monitor and control two FreeMaster instances. I read the section talking about this in the user guide but still have problems and the example attached was for one FreeMaster and didn't work with me for the two FreeMaster instances. The .m file that I am trying to build , is till now only opens the two files but can't write or read from them. It gives this error:

Dot indexing is not supported for variables of this type.

Error in SingleScriptControlling2FM (line 15)
bSucc = pcm1.ReadVariable('SpeedActRpm');

Does any one have a script for this purpose or can help with this error?

Thank you in advance.

Ahmed

1 解答
3,956 次查看
MichalH
NXP Apps Support
NXP Apps Support

Hello Ahmed, 

I confirm your script (the mmult_test() function) works as expected on my side. I tried on two Windows 11 systems. On a corporate PC with strict security rules, the Excel will not let the script to launch the FreeMASTER processes, so I had to run them manually first:

pcmaster /sharex TRQ
pcmaster /sharex SPD

Then the script was able to get access to running instances. Followed by a message:

MichalH_0-1718367771180.png

...which is obvious as I have an empty project in the TRQ instance.

 

In the 2nd experiment using my home PC, the Excel was able to launch and control the instances. I'm really not sure what can be blocking the access on your side. Can you try the same on a different PC?

Regards,
Michal

 

在原帖中查看解决方案

0 项奖励
回复
24 回复数
634 次查看
Ahmed_Abd_El-Hafez
Contributor III

Thank you Michal. I attached the excel file.

I tried opening the two instances manually and then run the VBA code to locate them but it also couldn't.

 

0 项奖励
回复
625 次查看
Ahmed_Abd_El-Hafez
Contributor III

Hello Michal,

Have you checked the script? the problem still exists.

Ahmed

0 项奖励
回复
3,957 次查看
MichalH
NXP Apps Support
NXP Apps Support

Hello Ahmed, 

I confirm your script (the mmult_test() function) works as expected on my side. I tried on two Windows 11 systems. On a corporate PC with strict security rules, the Excel will not let the script to launch the FreeMASTER processes, so I had to run them manually first:

pcmaster /sharex TRQ
pcmaster /sharex SPD

Then the script was able to get access to running instances. Followed by a message:

MichalH_0-1718367771180.png

...which is obvious as I have an empty project in the TRQ instance.

 

In the 2nd experiment using my home PC, the Excel was able to launch and control the instances. I'm really not sure what can be blocking the access on your side. Can you try the same on a different PC?

Regards,
Michal

 

0 项奖励
回复
574 次查看
Ahmed_Abd_El-Hafez
Contributor III

I tried it on another PC and it works.

Thank you very much ,Michal.

0 项奖励
回复