LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extracting row array

Solved!
Go to solution

Hi guys

 

I was learning about arrays and came across a exercises tutorial on ni.com. I am provided with a 2D array and have to be able to retrieve any given row or column array from it. Now the simple way would be to use the index array function, however, i tried doing the same using a while loop as shown in the atached vi, i want to get the 3rd row array, could anybody tell me where I may be going wrong..

 

 

0 Kudos
Message 1 of 15
(4,691 Views)
Solution
Accepted by topic author cquark

cquark wrote:

i want to get the 3rd row array, could anybody tell me where I may be going wrong..


In your program, the outer For loop will return a value of 79 which you are comparing it with 2 (i hope you are trying to get the 3rd row) in the next while loop. That's the error. Why you don't want to use an index array? Ok as per your method try the attached(change the while loop only). Post back.

 

Message Edited by Mathan on 11-02-2009 07:37 AM
0 Kudos
Message 2 of 15
(4,674 Views)

Hi mathan

 

thnx a ton!!, i was able to get the required row and column

 

0 Kudos
Message 3 of 15
(4,649 Views)

LabView 8.5

 

Hey guys, unfortunately I´m an "advanced" beginner in LV... hope I´m right here to get a little help....

I know how to extract rows from arrays, but i also would like to write each row for example 3 times and show it on the front pannel...

For ex. I´ve got 

§§§§§

$$$$$

&&......      now i want to have 

 

§§§§§

§§§§§

§§§§§

$$$$$

$$$$$

$$$$$

&&&&&

&&.....   and so on.... could anyone give me an example?

0 Kudos
Message 4 of 15
(4,468 Views)

(Even as an "advanced" beginner, you should never add a new question to an existing thread that is marked as solved.)

 

Here's one possible solutions. I can think of a dozen other ways to do this. 

 

 

 

The primitive inside the loop is "initialize array", the last function is "reshape arrray". you should be able to figure out the rest. Try it! 

Message Edited by altenbach on 04-18-2010 10:22 AM
Message 5 of 15
(4,461 Views)

Hi,

 

Another solution:

triple.png

 

The wizard of arrays was faster then me Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 15
(4,455 Views)

Since the question was "for example 3 times", I would assume the number of repetitions should be a control.

 

Building the array in a shift register is more compact, but I worried about possibly memory re-allocations. In principle, the compiler should be able to figure out the final size in your code from first principles, but I am actually not sure that it does in a case like that. 😉 Would be worth investigating.

 

In my code, the final size of the 2D array is know when the loop starts, so the full array size will be pre-allocated. (The reshape function requires another allocation). Since this is for display on a front panel, I assume that the arrays are small and we don't have to worry about performance. 😉  

Message 7 of 15
(4,447 Views)
Gracias, hombres!
0 Kudos
Message 8 of 15
(4,439 Views)

mmm, i think, because i startet here, now i should continue here just for this...

 

Sorry, these solutions i´ve already had figured out on myself....i did not ask correctly:D

I want to read rows (not elements) from a textfile and each row should be written a few times as said before... in this example just one row is written, not each line....

 

so i´ve got many lines like

7212.34,  0.90....

7213.74,  0.91....

 

and it should be

7212.34,  0.90....

7212.34,  0.90....

7213.74,  0.91....

7213.74,  0.91....

 

here´s the working prog, but not as i wanted...and a testfile 

 

 

 

Download All
0 Kudos
Message 9 of 15
(4,430 Views)

Try something like this:

 

Try the attached (LabVIEW 8.5) example.

Message Edited by altenbach on 04-18-2010 08:32 PM
Download All
Message 10 of 15
(4,414 Views)