LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with array

Hallo ,

I have a problem with my array.

I have an 10 rows & 4 columns array , i multiply each element by 2 , then put each result in a new array, but I get an 1 row & 40 columns array.
To make it clear, i attached my Program (with some explanation in it).

Thanks for any help.
0 Kudos
Message 1 of 16
(3,839 Views)
Hi

I can't open your vi (LV7.0) so I attach you a simple example that may answer your question.

Hope this helps.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 16
(3,823 Views)
I know this probably isn't the best way, but it works.

Using the indexing feature (a really powerful feature of LabVIEW - right click on loop tunnel->enable indexing) means you can wire an array directly to a loop border, instead of having to get the size and wire it to N... Hope this helps!

Geoff
0 Kudos
Message 3 of 16
(3,820 Views)
Do you know that you can multiply arrays with values directly?

//Ulf
0 Kudos
Message 4 of 16
(3,816 Views)
see attached image...
//Ulf
0 Kudos
Message 5 of 16
(3,810 Views)
Hallo all,

Thank you very much for the quick answer.

And Geoff , thanks a lot, your solution solved my problem 🙂
But if you don't mind ,i would like to know why in your for-loop , u didn't specifed the number of iteration ? Ussualy one should define the number of iteration, so the for-loop can work (from my Labview Handbook). It must be a new programming technique for me.

Thanks a lot .

Maxwell
0 Kudos
Message 6 of 16
(3,811 Views)
Geoff

Could you post your vi as LV7.0 (Save with options...)
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 7 of 16
(3,804 Views)
It was what I was mentioning in my last message about indexing.

Notice how on the side of the loop border the tunnel (connection between array and loop) looks different? If you enable indexing on a loop, the loop automatically assigns the number of iterations to be the number of elements in the array. Hopefully this image makes things more clear...

You can do this by right clicking on the loop tunnel.. notice how the bottom tunnel has enable indexing available? If I were to right click on the top tunnel, it would say disable indexing.

Message Edited by Novatron on 06-29-2005 09:08 AM

0 Kudos
Message 8 of 16
(3,805 Views)
Here's it in 7.0
0 Kudos
Message 9 of 16
(3,795 Views)
Maxwell

Have a look at my vi or the picture ulf attached. This solution has several advantages in comparison to the one you want to use:

1. It needs less memory, because you do not have two for-loops
2. It's easier to understand
3. It's faster

So I suggest you to use our version.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 10 of 16
(3,792 Views)