LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best way to create diagonal array in order to avoid MEMORY IS FULL error created by using INITIALIZE ARRAY vi?

Using the values in a 1D array, I need to place them along the diagonal of a 2D array. Currently, I've been using INITIALIZE ARRAY VI to create 2D array of zeroes and then usE REPLACE ARRAY SUBSET to put the 1D array values on the diagonal. This works sometimes but I often get an error stating that the memory is full and that the application was stopped at INITIALIZE ARRAY.

I'd appreciate any advice on how to stop this from occuring.
Thanks and happy holidays,
Hunter (LabView 6.1 user)
0 Kudos
Message 1 of 9
(4,331 Views)
How large are these arrays? Could you post a picture of the code? Sounds like there is something in your code that makes the array grow or get initialized to the wrong size... or some other part of the code that causes a lack of available memory.
0 Kudos
Message 2 of 9
(4,331 Views)
Hello, Mads
How are things in Norway? I hope well.
Attached is a PDF of the VI diagram. Hopefully, it is clear. I'm not sure how to make a picture (jpg or bmp) of the diagram directly.
The input array to the far left can be very large (couple hundred by a couple hundred). The diagonal S* matrix that is created using the INITIALIZE ARRAY is usually much smaller (10 x 10). It all depends on the input array's characteristics.
0 Kudos
Message 3 of 9
(4,331 Views)
Cold and rainy!:-)

The pdf was a bit unclear. You can grab a picture by using pressing Alt+Print Screen and then paste the picture now on the clipboard into a picture application (if the diagram parts of interest is too large the print to html option is nice, but don't use to much lossy compression then). In this case though there's nothing really bad and obvious so it would be better to have the code. Could you post the VI, preferably with an example input (that will crash it:-))?

If you step through the execution with an input that gives a memory error can you identify which array initialization fires the error and if so can you intercept the dimentions of the array to be initialized?

If you can upload the code I'll see if I can debug i
t.
0 Kudos
Message 4 of 9
(4,331 Views)
Hi,

I am including a vi which generates 1 D array & places all elements diagonally into 2 D array. This will take more time if the size of 1 D array increases heavily.

Hope this works. Your feedbacks are welcome.

Best Regards,
Nirmal Sharma
India
0 Kudos
Message 5 of 9
(4,331 Views)
There is a VI named "Create Special Matrix.vi" (Mathematics>Linear Algebra>Advanced Linear Algebra) that creates identity and diagonal 2D arrays. Does it make what you want?


LabVIEW, C'est LabVIEW

0 Kudos
Message 6 of 9
(4,331 Views)
Weather is the same here, too.
Sorry about the PDF. I had forgotten about the PRTSCN option. See the attached JPG.
I'd send you an example input that is giving me problems but today, my computer seems to be behaving and the error hasn't popped up. This makes me believe that it's truly a memory problem with my machine.
This VI is a subVI used in several computationally intensive applications.
If you're still interested in playing with it, I will email it to you. Please send me your address. In fact, I see you're in the oil & gas industry and I'd like to hear what you're working on since I work in that industry as well.
Thanks again, Hunter (chc5e@virginia.edu)
0 Kudos
Message 7 of 9
(4,331 Views)
Hello, Nirmal
Thanks for the VI. Actually this is the same thing I've been trying. As I just wrote to Mads, I can't seem to generate this error today.
I'll let you know if it happens again.
Thanks again for the help.
Hunter
0 Kudos
Message 8 of 9
(4,331 Views)
Good suggestion, Jean-Pierre!
Yes, it does create a diagonal matrix.
As I just explained to Mads and Nirmal, today my computer seems to be behaving and I can't generate the error. Makes me think it is truly a memory issue.

However, I will try using this CREATE SPECIAL MATRIX VI since it may be more reliable.
Thanks for you help,
Hunter
0 Kudos
Message 9 of 9
(4,331 Views)