engEvalString like function you can use from within a MatLab M file?

조회 수: 2 (최근 30일)
I was wondering if there was a wrapper or a function like engEvalString that I could call from inside an M file. Currently we are using engEvalString through JMatLink.dll and it’s doing what we want for the most part, but every time we run a test case it takes a long time to run. It opens and closes a new instance of MatLab every time it runs. Normally that wouldn’t be too bad but our copies are on a network so it takes awhile to rune everything.
I want to get away from the dll and do everything with one instance of MatLab open. engEvalString worked almost perfectly for us, but it sets the Inport blocks perfectly. So if there’s a function that does that same thing as engEvalString that I can use from an M file, please let me know. Thanks
P.S. I tried to use engEvalString in the M file but since it takes an Engine pointer it didn’t go over to well. Eval didn't do what I needed it to do either.

채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 5월 24일
I am not familiar with JMatLink, but engEvalString should not open a new instance of MATLAB. It is the engOpen and engClose command that control the starting/closing of the MATLAB instance. All other engine commands issued in between those two calls should use the same instance of MATLAB (assuming you're using the same Engine pointer throughout your code).
Also, the eval command is indeed the MATLAB equivalent of engEvalString. What issues did you run into with it?
  댓글 수: 3
Kaustubha Govind
Kaustubha Govind 2012년 5월 24일
Lucas: I read the comment on your other post, and it looks like the error you get from Simulink is about the output of the MATLAB Function block, and not the input coming from the workspace:
Data type mismatch. Output port 1 of 'TestInt32/ejs_in_Ejs_In1/FromWS' is a signal of data type 'double'. However, it is driving a signal of data type 'int32'.
So I'm confused about why you make the assumption that the error is about the Inport1=10 value that is getting passed to the model.
Kaustubha Govind
Kaustubha Govind 2012년 5월 24일
Lucas: So would you consider your issue resolved (so to speak), since you seem to be using a different approach.
Again, I still think the error is due to the MATLAB Function block in that model returning a double value instead of the expected int32 value - is this block generated by JMatLink? Because I don't see how the value set to the Inport affects the output of the MATLAB Function block.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by