LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Different elements in two 1 D array

Solved!
Go to solution

Nghtcrwlr wrote:

Thnx for your help. I was not aware of the indexing stuff.. now it wrks. but still there is some difference in final answer...

for example suppose there is only 1 value of r ; r = 3. and theta = 90,180,270,360

 

SO complex numbers should be when  r=3 and theta =90 (1.5708 rad) ----->0+3i . the Re part of the answers is different in two cases.  See attachmenet

 

I think since it is anyway zero, that difference doesnt affect, right? What could be the reason for that difference in results?

 


Since it is nearly impossible to enter multiples of PI manually wilth full DBL precision, you should maybe do the input in degrees instead and convert to radians in the code.

 

 

You should also right-click the indicator and change the display format to something reasonable, e.g. 3 decimal digits as I have done. In automatic formatting (default), you'll get e-format if the values are sufficiently close to zero.

 

Message Edited by altenbach on 12-16-2008 08:43 AM
Download All
0 Kudos
Message 11 of 31
(1,425 Views)

Hello altenbach...

 

Thankyou very much. I made it already.. changed the figure to 3. now its wrking.

I have another question regarding 2d array.

 

I am having a 2D array with values. ( see figure) I need to take the first value of the array (index 0,0)for the first time and then elemnt in index (0,1) and then elemnt in index (1,0) and so on ..Lets say i need to do it for many time as the size of array.in figure 6 times...I tried to do it in a for loop. but it gives me only the same value for al the 6 times the loop runs.

 

Can anyone help?

 

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 12 of 31
(1,413 Views)

Simply reshape your 2D array to a 1D array with a size corresponding to the product of the sizes.

 

Then autoindex on a FOR loop and you'll get the elements in the desired order, one per iteration intil you run out of elements. 😄 

 

Message Edited by altenbach on 12-16-2008 10:10 AM
0 Kudos
Message 13 of 31
(1,395 Views)

hello   Nghtcrwlr,

 

tell me if i stink feet,  :smileysurprised:

 

definetifly , i'am too slow...

Message Edité par tinnitus le 12-16-2008 12:15 PM
Message Edité par tinnitus le 12-16-2008 12:16 PM
CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 14 of 31
(1,392 Views)

Hello altenbach...

 

That way it worked. Thanx..

 

Now am getting 4 1d arrays. Now i need the first values of all those arrays together, second elements of all those arrays together and so on till the number of arrays. I tried to put an index array in a for loop. but didnt work. Any hints?

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 15 of 31
(1,365 Views)

Hi tinnitus

 

Thnx for the help...actually i wanted the values in a sequence but not in time intervals. Smiley Happy

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 16 of 31
(1,364 Views)

Nghtcrwlr wrote:

Now am getting 4 1d arrays. Now i need the first values of all those arrays together, second elements of all those arrays together and so on till the number of arrays. I tried to put an index array in a for loop. but didnt work. Any hints?


Autoindex all four arrays into the same FOR loop.

 

If it does not work, show us your code so we can see what the problems is.

0 Kudos
Message 17 of 31
(1,359 Views)

Hello ALtenbach

 

I have attached the code. and also what is to be done is mentiond. Now i need to take the values of first column of this array and take each elements and perform some calculations. and so on for the next columns the same....  Please help me!

 

Thnx

Message Edited by Nghtcrwlr on 12-16-2008 03:44 PM
Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 18 of 31
(1,354 Views)

You really should do a few tutorials first. Simplify!!!

 

  • Your FOR loop is not needed at all.
  • The rouding operations need to be done only once, and not multiple times. You can branch the wire later.
  • Youre not really tellin us what kind of "processing" you want to do, but if you transpose the 2D array, you'll process an original column at a time using autoidenxing. Inside the loop you can you a second FOR loop or an "index array" node (resized to four outputs) to get to the elements. 

 

Here's a quick draft on how it could look like.

 

Message Edited by altenbach on 12-16-2008 02:16 PM
0 Kudos
Message 19 of 31
(1,328 Views)

Hello Altenbach

 

I have modified the vi as u mentioned. The "processing" which i mentione dis as below: the output of the for loop ( as in the attachmenet u posted "Process columns PNG") is a two 2D arrays. One array containing the real part and the other imaginary part. Both arrays are shown in attahment.Now i want to take the values of array 1> column 1 >element 1 and array 2>colum 1>elemnt 1   i.e as shown in attahment [(0,2).(1,2) (1,1),(0,1)] ... Second colum of both arrays (1,3)(2,3)(2,2)(1,2).. and so on.. these values together make an index number for an array. I want to use these index numbers to exract ements from an array.

 

Hope you understood the problem.

Message Edited by Nghtcrwlr on 12-16-2008 04:44 PM
Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 20 of 31
(1,321 Views)