LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data type error - converting DBL to 1D Array

Solved!
Go to solution

Hello. I am new to Labview and currently trying to revive and edit a .VI that was built using Labview 2009. I would like to continue to use Labview 2009 if possible.

 

The purpose of this .VI is to shift the x,y coordinates of a circular target by randomly jittering the target position using a uniform distribution of +/- 10 deg around the starting location.

 

I have attached two files:

"number of pointsshiftedMaster_v2.vi" Is the original file. Where the "Shift" variable is a constant that can be entered on the front panel (example: 10 degrees). This file works but only allows me to shift the target position by a fixed value (does not allow me to jitter the target position using uniformly distributed random values).

 

"number of pointsshiftedMaster_v3.vi" is the new edited file where I have attempted to implement the desired changes. I am hoping to make it so that the jittered target position only occurs when the "Two Target (RS)" condition is "True". When "False" I want the .VI to function the same as the original file "number of pointsshiftedMaster_v2.vi".

Currently, I receive the following error message:

"You have connected two terminals of different types. The type of the source if double [64-bit real (~15 digit precision)]. The type of the sink is 1-D array of double [64-bit real (~15 digit precision)]."

 

Hoping to find advice on how to change the data type or fix this file. Thank you in advance.

 

0 Kudos
Message 1 of 6
(841 Views)

Hi Beecl,

 


@Beecl wrote:

I have attached two files:

"number of pointsshiftedMaster_v2.vi" Is the original file. Where the "Shift" variable is a constant that can be entered on the front panel (example: 10 degrees). This file works but only allows me to shift the target position by a fixed value (does not allow me to jitter the target position using uniformly distributed random values).

 

"number of pointsshiftedMaster_v3.vi" is the new edited file where I have attempted to implement the desired changes. I am hoping to make it so that the jittered target position only occurs when the "Two Target (RS)" condition is "True". When "False" I want the .VI to function the same as the original file "number of pointsshiftedMaster_v2.vi".

Currently, I receive the following error message:

"You have connected two terminals of different types. The type of the source if double [64-bit real (~15 digit precision)]. The type of the sink is 1-D array of double [64-bit real (~15 digit precision)]."

 

Hoping to find advice on how to change the data type or fix this file. Thank you in advance.

 


Your first VI shows some lack of understanding: using an autoindexing tunnel would be sufficient instead of shift register+InsertIntoArray!

See this:

(You could simplify this even more using complex numbers. I left that part intentionally for Christian. 🙂 )

 

The second VI shows even more misunderstandings:

Now you create an array of 128 samples in that case structure, and insert that amount of samples with each iteration of the FOR loop into the array. Do you really want to insert 128 samples each time???

 

To answer your question: technically you need to insert a BuildArray function in the other case of your case structure so you create an array in both cases. But I guess using this approach will not give the expected result…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(818 Views)
Solution
Accepted by topic author Beecl

@GerdW wrote:

(You could simplify this even more using complex numbers. I left that part intentionally for Christian. 🙂 )


Exactly. Here's how that could look like (and yes, it can be simplified further!):

 

 

altenbach_1-1701737819675.png

 

 

(And please set typical default value for all controls.# of points=0, distance=0 are NOT reasonable! Also please don't maximize the diagram the the screen.)

 

And to add a +/- 10 degree jitter, just use a properly scaled dice.

 

altenbach_0-1701738859192.png

 

Message 3 of 6
(772 Views)

@altenbach wrote:

(and yes, it can be simplified further!):

.

Here's a quick cleanup. Same result:

 

altenbach_0-1701794116389.png

 


 

 

 


 

Message 4 of 6
(766 Views)
Solution
Accepted by topic author Beecl

Here's how you could display the data in an xy graph:

 

altenbach_0-1701794544729.png

 

Message 5 of 6
(730 Views)

Thank you - this worked great!

0 Kudos
Message 6 of 6
(542 Views)