I tried to migrate an old Labview project to a new version of Labview and ran into a weird issue - it crashes without any error message when executing one particular Matlab code, or it crashes with an error "Exception: Access violation (0xC0000005) at EIP=0x00007FFE770585EC". This issue is not consistent and sometimes I get the error message and sometimes I don't. I tried to isolate the issue and found out that if I have multiple outputs as 1-D Array of Real and I return arrays of integers, Labview crashes. However, if I change outputs Data Types to 1-D Array of Complex, Labview doesn't crash. This issue is not present if I have just one output. I have attached a simple VI which crashes. If you change the Data types to 1-D Array of Complex, it doesn't crash anymore.
Why is this happening?
Labview 2023 Q1 (64-bit) 23.1f276
Matlab R2023a (64-bit) 9.14.02254940
The issue you're experiencing with LabVIEW crashing when executing a particular MATLAB code, especially when the output of MATLAB is a 1-D Array of Real with integer values, can be attributed to a type conversion problem between LabVIEW and MATLAB.
When you define the output data type as a 1-D Array of Real in LabVIEW and the MATLAB code returns integer values, there can be a conflict in how the data is interpreted and processed. LabVIEW expects real values (floating-point numbers), but when MATLAB returns integers, it can lead to compatibility issues.
LabVIEW and MATLAB use different data representations and memory allocation methods, which can cause compatibility problems when exchanging data between the two environments. The crash you're experiencing may be a result of a memory access violation that occurs when LabVIEW tries to interpret the integer values returned by MATLAB as real values.
By changing the output data type to a 1-D Array of Complex in LabVIEW, you might be avoiding the direct type conversion between integer and real values, which could be preventing the crash from occurring.
The issue you're experiencing with LabVIEW crashing ...
Please make it absolutely clear when using AI to generate an answer, while you are not adding any original content.
Here's how Google Bard would answer the same question:
I can see that you are having an issue with your Labview project. The error message "Exception: Access violation (0xC0000005) at EIP=0x00007FFE770585EC" indicates that there is a problem with the memory access. This can be caused by a number of things, such as a corrupt file, a hardware problem, or a software bug.
In your case, you have isolated the issue to the fact that you are returning arrays of integers from a Matlab code. This is likely causing the memory access problem because integers are stored in a different way than complex numbers.
To fix this issue, you can try the following:
I hope this helps! Let me know if you have any other questions.
There's a few of them making new accounts today on this board. Best to report it and move on.
Edit: Just to be clear, I think the OP's question is legitimate, it's the reply Altenback is talking about that's the spammer. Sorry OP but I don't have an answer to your question, but I can say that when going back and forth between two programs like this you'll need to make sure your data types match up on both sides. I can't open your file (don't have LV2023) so if you backsave it (File - Save for Previous, say 2020?) then more people can open it.
My magic 8 ball says you're not returning consistent numbers of data points between runs, and setting the output to Complex allocates more memory for the returning array (since it's twice the number of actual values). This might be why it's inconsistent as well; sometimes your buffer happens to be big enough, but sometimes it's not.
I don't use the Matlab connector thing, but with other DLL interfaces you have to give the DLL a memory space to work in. The DLL then writes to that memory space. If it tries to write too big of a value, you'll get an access violation (since you tried to write to memory that doesn't "belong" to you). Just a guess though since I can't see your code and haven't used that toolkit 🙂
The post is not really spam if there are no hidden links and other questionable content, but there is a high chance that the poster is a spammer trying to gain some respect before posting real spam or adding a spam signature to the profile that will magically appear on all their old posts.
Just keep reporting suspicious posts. The moderators are well aware of the situation and can neutralize the threats. 🙂
Thank you for the answer. I also had an idea that it is related to memory. But I don't know how to solve it without using Complex outputs.
I have attached my VI saved in a previous version (2020).
I'm not a spammer, however, that AI-generated answer look like one.