LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert 1D array element to integer

Solved!
Go to solution

Does anyone know how I can extract the value (element) from a 1D array so that the output value is an integer ?  I'm having signal incompatibility problems (again).  I need to use the particular element from an array in various math blocks i.e. Add

0 Kudos
Message 1 of 14
(20,355 Views)

What is the data type of the array?

0 Kudos
Message 2 of 14
(20,349 Views)

The following is the error message that I'm receiving:

 

These cannot be wired together because their data types (numeric, string, array, cluster, etc.) do not match. Show the Context Help window to see what data type is required.
The type of the source is 1-D array of
    double [64-bit real (~15 digit precision)].
The type of the sink is double [64-bit real (~15 digit precision)].

 

I'm puzzled why LabVIEW is telling me that the data types do not match when the Source & Sink are the same (double 64-bit real) ? 

0 Kudos
Message 3 of 14
(20,310 Views)

One is an array and one is a scalar. That's not the same!

 

(What does your question have to do with whatever code you attached above?)

0 Kudos
Message 4 of 14
(20,303 Views)

@bunnykins wrote:

I need to use the particular element from an array...


I could be over simplifying things here, but it sounds like you just need to use the Index Array function.

GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 14
(20,296 Views)

I tried using Index Array but it still doesn't work.  The output from the Index Array is still in 1D array format.  I need the output to be a plain and simple integer or constant that I can then manipulate along with other constants in Add, Subtract blocks etc.

0 Kudos
Message 6 of 14
(20,280 Views)

Please post the VI you are having your problem with and tell us exactly where your problem is in the VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 14
(20,277 Views)
Solution
Accepted by bunnykins

@bunnykins wrote:

I tried using Index Array but it still doesn't work.  The output from the Index Array is still in 1D array format.


If the input is a 1D array, the output of index array is a scalar. (Only if the input is a 2D (or higher) array, and not all indices are wired, you don't get a scalar)

 

Make sure you are really wired to the output and not to the already wired input or similar.

Message 8 of 14
(20,271 Views)

Hi,

 

I faced the same problem as well but I don't really understand what you meant by "Make sure you are really wired to the output and not to the already wired input or similar."

 

Do you mind to explain in details?

 

Thanks! 😄

 

Regards,

Vanessa

0 Kudos
Message 9 of 14
(19,345 Views)

Please do not add to an old thread that is already marked as solved with a new problem. (if you had the same problem the above solution would be sufficient!)

 

Please attach your code and tell us exactly what you are trying to do and what kind of problem you have.

0 Kudos
Message 10 of 14
(19,340 Views)