LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Closing MatLab Issue

Hello, I am running into an issue where the runtime of each loop iteration increases when only opening and reading .mat files using the "MATLAB" data plugin. Attached is a VI replicating what we are seeing in a much larger analysis VI. It continuously opens the same .mat file and calculates the runtime. Opening task manager shows the memory slowly increase while the VI runs. As default, the VI's graph shows the results I got after stopping the while loop after 2002 iterations.

 

I have read that not closing the Read Data Storage can lead to memory leaks, which I have tried separating the Read and Close Data Storage parts with a Flat and Stacked Sequence Structure, but I keep getting the same error message (Error -2553). I don't understand why the error occurs since it is my understanding that these structures should execute the Close after Reading. Error also happens in the final iteration of a For and While Loop when the Close is outside the loop. Attached is a VI with these cases that I have tried.

 

I also attach a single .mat file to use to test.

 

Any help on this issue would be appreciated.

0 Kudos
Message 1 of 3
(93 Views)

That is a very large amount of references you open, i'm not surprised it'll eventually lead to problems. Open once outside any loop.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 3
(25 Views)

We have to open several thousand .mat files and analyze them all, so there is no other way but to open them inside a while loop as it iterates through all found inside a directory.

0 Kudos
Message 3 of 3
(17 Views)