LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Basic question about arrays

Hello everyone. I have have an array where i can write two different strings for my scale, and read it after. The array looks like this :array1.png 

 

 

I have to make measurements and transfer the data to excel, so i want my array to look like the picture shown to the right array1.png

 

How do i do that ?. My VI is uploaded

Best regards

Oesen
0 Kudos
Message 1 of 12
(2,839 Views)

A simple way of getting from your first array to the second array is as follows:

 

Array question.JPG

 



Never say "Oops." Always say "Ah, interesting!"

Message 2 of 12
(2,831 Views)

@Oesen wrote:

Hello everyone. I have have an array where i can write two different strings for my scale, and read it after. The array looks like this :array1.png 

 

 

I have to make measurements and transfer the data to excel, so i want my array to look like the picture shown to the right array1.png

 

How do i do that ?. My VI is uploaded


The operation you're looking to create is trivial at best...

 

Auto-index the array using a for loop. Initialize to shift registers to hold the data for your two new arrays, one to contain the acceleration/force data and one for the Data and Time. Use some kind of a string token to see which array the element should be added to. In this instance you could look for the character g . Using a case structure, see whether the array element contains the character g. If it does add it to the acceleration/force data using the build array function, if it doesnt add it to the Data and Time array.

 

Alternatively, you could append every second element to one array and the other elements to the other array.

 

Simples

 

Give it a go, should be very straight forward

0 Kudos
Message 3 of 12
(2,827 Views)

Hi Oesen,

 

Use Decimate 1D array function to seperate the data and then a build array function.

See the attachement and check whether it meets your requirements.

 

Beat Regards,

Gogineni

CLAD

______________________________________________
Kudos are welcome
0 Kudos
Message 4 of 12
(2,809 Views)

Hmmm... When i use that procedure, it says error at the end, when i wire it to the shift register ?

 

array1.png

Best regards

Oesen
Message 5 of 12
(2,793 Views)

Hi Oesen,

 

Array 2 is an 1D array where as the resultant array as per your requirement is a 2D array.

Right click and add dimension to make a 2D array

 

Gogineni

______________________________________________
Kudos are welcome
0 Kudos
Message 6 of 12
(2,780 Views)

@Oesen wrote:

Hmmm... When i use that procedure, it says error at the end, when i wire it to the shift register ?


That's because 'Array' is a 1D array whilst 'Array 2' is a 2D array, so they cannot be stored in the same shift register (different data shape/size).  I would chose to remember only one of the arrays (probably the first, since that holds the raw data) and simply reconstruct the other array as and when needed.

 

 

Another possible option is to only work with a 2D array, but you would have to work out which row/column to instert the new element whenever you enter new data.



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 7 of 12
(2,778 Views)

What do you exactly mean with "remember" ? 🙂

Best regards

Oesen
0 Kudos
Message 8 of 12
(2,714 Views)

If you always want the date/time after taking a measurement, your code makes no sense. Add a second write and read to the Measurement Value Change event. then you can have one indicator for the weight and one for the date/time. Change the mechanical action and get rid of that select statement. In the event, build a 1D array and have a 2D array as the shift register value.

 

It also seems silly to have front panel controls for the different commands. You want the user to be able to screw things up? That is what it seems like,

 

p.s. It is also silly to specify a read termination character and then use the VISA Bytes at Serial Port.

Message 9 of 12
(2,704 Views)

@Oesen wrote:

What do you exactly mean with "remember" ? 🙂


By "remember", I mean to store one of the arrays in the shift register.

 

However, Dennis' suggestion of storing the 2D array (in the shift register) and simply appending the 1D array of new data to it (each time it is read) is probably better.



Never say "Oops." Always say "Ah, interesting!"

Message 10 of 12
(2,682 Views)