LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array scalar issue

Hi All,

 

I'm new to labview, I have looked a the training material for arrays but I cant get my head around this problem.

 

 

You have connected a scalar (non-array) data type to an array of the same data type. This type conflict may be resolved by building the scalar type into an array. Check for a tunnel on a loop that has indexing incorrectly disabled.
The type of the source is double [64-bit real (~15 digit precision)].
The type of the sink is 1D array of
double [64-bit real (~15 digit precision)].

 

 

How do I convert scalar data so I can store it in an array?

0 Kudos
Message 1 of 5
(4,592 Views)

Converting method depend of reason you need store data in array.
One of one is here:

array.png

0 Kudos
Message 2 of 5
(4,573 Views)

When you multiply two scalars, you get a scalar.  The operations you are trying to do (summing the entries in an array and dividing by the number of entries) is to find the average value of number in an Array.  Well, where's your Array?  You only have a scalar.

 

If you have pairs of Scalars (i.e. if RPM and Pressure were equal-sized arrays), you could use a For loop to form an array of their products (as Artem was showing you).  If only one of them is an Array, you can simply do a multiply, since the product of an Array and a Scalar is simply "Array times Scalar" (every Array element is multiplied by the single Scalar).

 

Note that if you only have one RPM and Pressure, you can multiply them and say "Gee, what's the average of my sample of one product?  Oh, it's just the number I have", and skip taking the average (hence avoiding programming in an Error) ...

 

Bob Schor

Message 3 of 5
(4,551 Views)

Thanks guys for the help,

 

That has now clicked with me! 

0 Kudos
Message 4 of 5
(4,520 Views)

It sounds like you are on your way but I wanted to give you a link to something I told another beginnger user about scalars and arrays.

 

http://forums.ni.com/t5/LabVIEW/conversion-from-double-to-1d-array-of-double/m-p/2972525#M854742

 

Basically you want to have an understanding of what the data represents.  If I take a single reading from a DMM, then I have a scalar value, if you multiply that by 5 you still only have a single scalar value.  But if I said I want some history, and I want you to take a reading once every second for 5 seconds, then you have 5 values, or an array with 5 elements in it each separated by 1 second.  You can still multiply this array by a scalar, and if you do that multiplier will be applied to each value in the array.

 

If you really only have one value (scalar) why does it need to be an array with one element?  There are legitimate reasons, but until you understand what the data represents, then understanding what you need to do to get your desired result can be a bit difficult.

0 Kudos
Message 5 of 5
(4,487 Views)