From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

A weird behaviour in the matlab communication with Labview

Hello,

I am using a Matlab node in Labview (not the math script because I was confused between them). I managed to make the code work. It is calling a function from m file and do some calculation in the Matlab script. Yesterday I had to interrupt te calculation to restart the computer, so I killed Labview calculation. Now, each time I run my code in Labview I hear the usual error sound of Matlab and the code finishes without result. The weird thing is that to make it work, I have to execute another code in Matlab using the Matlab code like the Lorenz attractor existing in the examples.

As I am using the Matlab node in a loop, sometimes Labview freezes and crashes.

I am not sure but I feel that some files from matlab-Labview communication were corrupted when I killed Labview. That time, Labview tried to reset but did not manage.

Do you have an explanation of this and how I can solve it?

Cheers,Zied

Zied

0 Kudos
Message 1 of 13
(7,105 Views)

Hello,

I am using a Matlab node in Labview (not the math script because I was confused between them). I managed to make the code work. It is calling a function from m file and do some calculation in the Matlab script. Yesterday I had to interrupt te calculation to restart the computer, so I killed Labview calculation. Now, each time I run my code in Labview I hear the usual error sound of Matlab and the code finishes without result. The weird thing is that to make it work, I have to execute another code in Matlab using the Matlab code like the Lorenz attractor existing in the examples.

As I am using the Matlab node in a loop, sometimes Labview freezes and crashes.

I am not sure but I feel that some files from matlab-Labview communication were corrupted when I killed Labview. That time, Labview tried to reset but did not manage.

Do you have an explanation of this and how I can solve it?

Cheers,Zied

Zied

0 Kudos
Message 2 of 13
(7,157 Views)

Hello,

I moved my post to mathscript section as I didn't get an answer here. I hope the moderate can delete my post here to avoid duplication.

0 Kudos
Message 3 of 13
(7,104 Views)

Hello again,

Please is anyone here can help me to fix the communication problem between Labview and Matlab.

Cheers,

Zied

0 Kudos
Message 4 of 13
(7,068 Views)

Hello,

Is there a way to manage and control the communication between Labview and Matlab to avoid memory conflict and files corrupted.

Thanks,

Zied

0 Kudos
Message 5 of 13
(7,045 Views)

Hi Zied,

 

It may be useful to post a snippet of your code. Also, has your function not worked as intended since LabVIEW originally crashed?

Andrew B.
Application Engineer
National Instruments.
http://www.ni.com/support
0 Kudos
Message 6 of 13
(7,029 Views)

Hello,

The code calling Matlab itself is working fine and I tried to put it a while loop and run it overnight for hundreds of cycles and it was fine but in the moment I included as a subvi in my main vi, it crashes after few iterations. The weird thing is that this subvi refuses to work from the first run and stop without error or result and I have to run the example from Labview to run after.

I put the faulty VI called jieren_lya with the m files needed and also theLorenzz attractor that I have run beforehand to make my code run thereafter.

Cheers,

Zied

0 Kudos
Message 7 of 13
(7,020 Views)

Hi Zied,

 

I'm a bit confused as to what exactly is happening. To make sure I understand this correctly. The VI titled "jieren_lyap.vi" runs fine by itself, but if you make it a subVI and call it from the main VI, the program freezes. Is this correct? The main VI that you're calling the program from, is it constantly changing the input values for the subVI? I don't see any while loops on the "jieren_lyap.vi" as you had mentioned in the previous post. I tried duplicating your problem, but I don't have Mathworks matlab on my computer, so I can't actually run the matlab code.

Andrew B.
Application Engineer
National Instruments.
http://www.ni.com/support
0 Kudos
Message 8 of 13
(7,000 Views)

Hello,

The VI titled "jieren_lyap.vi" runs fine only if I run the example in Labview library titled Lorenz attractor. If I run jieren_lyap first, it stops without error but also without result, making an error noise common in Matlab.

I think this is the key to understand the instability when I run it as a subvi (indeed, the subvi is running in a loop that changes the input each time.

You need mathscrip toolkit to be able to run it.

Thanks,

Zied

0 Kudos
Message 9 of 13
(6,987 Views)

Hi Zied,

 

I'm still not sure that I fully understand what is happening. What do you mean that it runs fine, only if you run the example in the LabVIEW library titled Lorenz attractor? I see the Lorenz attractor VI that you're referring to, but I don't understand what you mean by it runs fine only if you run that example. Do you run the example first, then run jieren_lylap, and it runs correctly? If you are concerned about a potential software corruption, have you tried reinstalling the mathscript toolkit?

Andrew B.
Application Engineer
National Instruments.
http://www.ni.com/support
0 Kudos
Message 10 of 13
(6,964 Views)