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

cancel
Showing results for 
Search instead for 
Did you mean: 

matrix\math manipulation

Solved!
Go to solution
Hi,
I'm tring to do in my code a matrix\math manipulation.
I have an array of X elements and i want to sum several of those elements. Every summerize will be tend to y, and every summerize will be in a diffrent column.
For example, i added a VI.
In the VI there is an array of 21 elements that i want to manipulate, also i wrote a metrix that show the result i want base on gussing\calculating in my brain.
I want to make a code that do what i'm doing in my brain.
thanks,
asaf
0 Kudos
Message 1 of 5
(2,536 Views)

Can you explain more clearly?

 

What is the array you are starting with?

 

I don't know what you mean by "guessing/calculating in your brain".  We're not mind readers, so we can't guess what is going on in your brain.

0 Kudos
Message 2 of 5
(2,534 Views)

i did a misstake with the summrize in the metrix (i added a fixed VI).

 

the elements i get comes in 1D array. in my front pannel i set the array size and the value of the elemnts. the size and value are variables.

 

"guessing/calculating in your brain".

lets say... i have wood beams. every wood beam size is 4.1 meter and i want to slice from every beam diffrent sizes (like in the 1D array, a slice of 2 meter, of 0.76 meter, of 1.5 meter...).

i want to sum several elements/slices and the result would be as near as possible to L=4.1, also i want to remain with as much as possible of leftovers.

2+2+0.1=4.1

0.76+1.6+1.6+0.1=4.06

0.76+0.76+0.76+1.5+0.1+0.1=3.98

1.5+1.5+0.76=3.86

1.5+1.5+0.76=3.86

0.76+0.76=1.52

0 Kudos
Message 3 of 5
(2,526 Views)
Solution
Accepted by topic author asaf1108

Hi asaf,

 

I just read over this and got your VI. Are you still having an issue with this? 

 

I'm still a bit unclear on what you are trying to do. In order to clarify this, I opened your VI using LabVIEW 2011, but I see that you have a broken wire. I'm not really sure what this is for. I see that you're using the summarize all elements in the array VI. This function will take everything in your array (in this case, the array fo 21 elements) and will return the value of the sum. If your goal is to feed this into a matrix of 2Darray, you can just use the "Insert Into Array" function. 

 

I think it would help to go back to the original problem statement and clarify some things from it. From a really high level, you said that you have an array of 21 elements that you want to manipulate. How are you wanting to manipulate it. I see the sums are supposed to end up in the matrix, but what determines what row/column it goes in? I think it will help for you to use the various array functions that can be found by right clicking on the block diagram » Programming » Array.

 

This Development Zone Article shows a bit on how to create arrays and clusters. It explains a bit more about the various array functions. You could also try using the context help or clicking "detailed help" in that window to find out more about the function.

 

Hope this helps!

Lea D.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 5
(2,495 Views)

You have described the classic "Cutting Stock" problem.  To help us help you we need to know if this is homework or if you work in a sawmill.

 

The following site is very useful, I am sure you can search for cutting stock and find more info:

http://www.neos-guide.org/NEOS/index.php/NEOS_Wiki

Message 5 of 5
(2,485 Views)