LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with arrays

Solved!
Go to solution

Hi;

 

        I have 2 vectors of 2 dimensions each one, and i need take the element x,j  of the first vector(2D) , and the element x,j of the second vector (2D) to make another one .

I didnt find a component to work with this 2D vector , someone have any idea to help me pls ?

 

Thx 😃 

 

0 Kudos
Message 1 of 13
(3,206 Views)

Are you talking about vectors or arrays?

 

I am going to assuming you are working with arrays like your subject line says.

 

To get index X,Y of a 2-D array, you use the index array function.  When you wire a 2-D array into it, it gives you two index inputs, one for rows and one for columns.

 

Wire your X value into the top index and your Y value into the bottom index and you will get a single scalar element of the 2-D array.
If you only wire in the top index, you will get a 1-D array of whichever row you picked.  If you only wire in the bottom index, you will get a 1-D array of whichever column you picked.
Message Edited by Ravens Fan on 07-17-2009 01:58 PM
0 Kudos
Message 2 of 13
(3,196 Views)

You also said "to make another one". Presumably you're talking about making a new 2D array. Use Build Array for this. You'll need to use it twice. Once to take your 2 elements and make a 1D array, and then again to convert the 1D array to a 2D array.

 

Just out of curiosity... what are you planning to do with a 2D array of just one element?

0 Kudos
Message 3 of 13
(3,187 Views)

Isnt only 1 element ... its several elements ...

i want to show on a table or something else all this elements .. the first array 2D its the frequency , the second its the magnitude ..

Has a lot of values on a .txt .. im opening the .txt , reading all , take the frequencies in 1 array 2D, and the mag in another array 2D ...

But i need put the frequency[0,0] for example togheter with the magnitude[0,0] and show all the information on the screen after it .

I used the index array inside 2 while loops , the first i use the counter to increment the row , and the second counter to increment the collumn , but isnt working very well =\ .. 

0 Kudos
Message 4 of 13
(3,183 Views)
Well, that's different. Even with this, you don't need loops to do what you want. However, you said you're reading a text file. In what way? Is this a delimited text file? If so, are you using the Read from Spreadsheet File? That should return the 2D array that you want directly without you needing to do anything. Perhaps you can show us this file?
0 Kudos
Message 5 of 13
(3,172 Views)
0 Kudos
Message 6 of 13
(3,151 Views)
Im saving the freq and mag in a .txt cuz i need that the array vector show all information without erase nothing or overwrite .
0 Kudos
Message 7 of 13
(3,148 Views)

The file is formated this way :

 

 

 

    Freq1 <TAB> Mag1;Freq2<tab>Mag2;.....;Freq9<tab>Mag9 <Carriege Return>

0 Kudos
Message 8 of 13
(3,143 Views)

Way too much code, even for LabVIEW 6, which is what you seem to be using.

 


The file is formated this way :

 

    Freq1 <TAB> Mag1;Freq2<tab>Mag2;.....;Freq9<tab>Mag9 <Carriege Return>


Just so I'm clear... Does this mean the next line has 9 frequency/magnitude pairs as well, and you just want a 2D array with column 1 being the frequencies (from all the rows) and column 2 being the magnitudes (from all the rows)? Is it possible for a line (like the last one) to have less than 9 pairs?

 

0 Kudos
Message 9 of 13
(3,138 Views)

Yes(1st question)  ,  and no , the program that test the module ll put and read 9 markers on the signal ...

0 Kudos
Message 10 of 13
(3,135 Views)