From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert 1D array to scalar

Solved!
Go to solution

I am using PMD-1208LS to obtain 2 inputs through 2 different channels, using AInScFg.vi

How ever, the values obtained in in 1D array [of numeric(single 32-bit real)].

After applying several equations to the array it still 1D array but [of numeric(double 64-bit real)], now I want to send it to output channel using From Eng.vi --> Aout.vi.

The problem is, that can on happened if my data is in the scalar data type [data of sink is unsigned word (16bit)] not array type?

 

So how can I convert 1D array to scalar (word)?

 

Thank you

0 Kudos
Message 1 of 12
(11,094 Views)

Index Array??????....Smiley Indifferent

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 2 of 12
(11,090 Views)

thank you for the fast replay,

using an index array will let me return only one element of the array ?

what about if i have 1D array, size:1200

is index array will return all the 1200 elements if i left the index undefined?

0 Kudos
Message 3 of 12
(11,088 Views)

Oh..Smiley Sad  You mentioned 2 inputs from two channels.

Anyway my fault. You can use for loop...You can send one element at a time..and for loop will run for number= Array size

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
Message 4 of 12
(11,080 Views)

In this case problem solved,

however I thought there was a single block that can do the mission faster instead of using a while loop 😉

Thanks a lot for your effort.

0 Kudos
Message 5 of 12
(11,070 Views)
Of course you have other options. The simplest would be to take the mean of the array.
Message 6 of 12
(11,056 Views)

What is happening here is that I am taking 1200 samples per sec from 2 channels which means 600 per each channel in a while loop for 20m sec.

Those 1200 sample are obtained using PMD1208-LS as a 1D array (contains the 1200), so I had to split that array into two array 1D each (600 samples each).

Then I did my calculations and when I am wiring the final output 1D array (size of 600) to the "From Eng" then to "Aout" to give it to my real system using PMD1208-LS.

Its keep telling me wrong wired terminal as their type doesn't match as the type of the source is 1D array of unsigned word 16-bit int. , and the type of the sink is unsigned word 16-bit.

 

So the problem is how can I extract the elements from the array and feed it to the "from Eng" one by one as if it is continuous.

 

Any suggestions ?

 

1D array to word (scalar).png

0 Kudos
Message 7 of 12
(11,040 Views)
Solution
Accepted by topic author rozoro

You can do it the way I suggested or Gaurav's method. Up to you.

0 Kudos
Message 8 of 12
(11,018 Views)

I am attaching my labview code. I want to convert 1D array of data into scalar values. I tried using index but the output value was not the same as input. I want to give this scalar value to a meter.

 

Please help

0 Kudos
Message 9 of 12
(10,105 Views)

I have attached a file that converts all the data in an array to scalar. understanding this file would enable you to use the concept in your project.

 

Kedar G M 

gmkedar24@icloud.com

Mtech Student, IITK

0 Kudos
Message 10 of 12
(3,027 Views)