LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Manipulation

Solved!
Go to solution

Some help needed in array manipulation.

Sorry I'm new to labview.

i had done this at the attachment below.(sorry i dont know how to upload picture so i upload the whole VI file.)

i have deleted the row of the array if there's repeated(Car Number).

but it needs to store twice first and then the array is delete.

My problem now im facing is how to make it store onces and delete the repeated row of array.

Now my output(example):

Index      Pillar        Car Number

1             A              1234             (this row will be delete after storing the same car number twice)

2             B              1234

3             B              1234

4                                                  (and here there will be a blank which i dont know the reason)

 

Could some people give me some guideance on this.

my ideal outcome would be something like this:

Index      Pillar        Car Number

1             A              1234             (this row will be delete after storing the same car number twice)

2             B              1234  

 

without any blanks.

i had also try using the function replace array subset.

but i doesnt know how to write the remaining array back.

Example:

Index      Pillar         Car number

1              A               1234

2              B               2345

3              C               3456

if there's repeated:

Index      Pillar         Car number

1              A               1234

2              B               2345

3              C               3456

4              D               1234
the outcome i had done will be like this:

Pillar

D

B

C

D

how to make it in a way where it will not store twice and copy back the index and car number col.

Thanks

 

 

 

Download All
0 Kudos
Message 1 of 27
(5,632 Views)

Use the Delete from Array function if you need to delete a row from the array.

 

You need to rethink the architecture of your program.  It is very file intensive right now.

 

You have a while loop that runs every 50 msec.  In that loop you have two read text file functions, one write text file, two read spreadsheet file and one write spreadsheet file.  I wouldn't be surprised if you had these functions stepping all over each other.

 

You should look at an event driven architecture.  At the beginning of your program, read in your file.  Store that data in a 2-D string array.  Have an event structure that handles different events such as the search and store you are doing now.  Only write out the data to the file when you do your store command, or when your program ends.  There is no need to do all these functions 200 times per second.  You're just beating up your hard drive right now.

Message 2 of 27
(5,621 Views)

that what im doing now.

i write to text file when to store.

and write to spreadsheet when overwriting.

0 Kudos
Message 3 of 27
(5,607 Views)

Divineapple wrote:

that what im doing now.

i write to text file when to store.

and write to spreadsheet when overwriting.


The problem, as Ravens Fan indicated, is that you're doing a whole lot more. Too much more in terms of file I/O. 

 

I don't completely understand the problem. With the file you uploaded, what is it that you want to do with it? What is the result supposed to be?

0 Kudos
Message 4 of 27
(5,595 Views)

sorry if my english is bad.

this attachment is the function replace array subset that i used. at the top right.

at the file path, open the testcar text file.

at the input "pillar" enter any string you want, and the car number, enter the car number which was in the text file.

you can see what i meant after seeing that.

Example:

Pillar: B2

Car Number: SIO5678Y

(to store)

 

in the text file, it will be like this:

it will overwrite it and the output will be this in the text file.

B2 SIO5678Y SIO5678Y

 (blank)

 (blank)

follow by the remaining of the array.

and at the end it will store  B2 SIO5678Y again.

 

i want to overwrite and not to store it again if it's repeated.

and change the pillar to the new pillar input ,not the whole row.

 

 

Download All
0 Kudos
Message 5 of 27
(5,591 Views)

The VI you posted appears to be the same exact one that you posted before. Did you actually make any changes?

 

I'm sorry, but I still don't understand what you're trying to do. Using your example with Pillar=B2 and Car Number=SIO5678Y, what does 

it will overwrite it and the output will be this in the text file.

B2 SIO5678Y SIO5678Y

 (blank)

 (blank)

follow by the remaining of the array.

and at the end it will store  B2 SIO5678Y again.

mean? It makes no sense to me. Are you trying to replace the "Pillar" column whenever the "Car Number" column equals a specific value? What does "storing the same car number twice" mean? Please post an "after" file of what the file should look like with Pillar=B2 and Car Number=SIO5678Y.

 

0 Kudos
Message 6 of 27
(5,557 Views)
0 Kudos
Message 7 of 27
(5,544 Views)

@smercurio_fc

i did change the program abit at the case loop at the checking part( top right of the program)

but i think you got my point.

 

let me explain about my project.

this seems easy but i have no knowledge about labview(first time using it).

 i have to do a project that is able to store the area of the car, where it is park. and to do a search where they input the car number(thru serial com). and the output will be the area of the car is park.Example. (Area: Basement 2    Car Number:SGG1234X)to store

                                                       (Car Number:SGG1234X)search the car number

                                                        (Area:Basement 2) output

i did setup a database using microsoft access but i do not know how to search through it for the data. so i done it in excel file and save it in text format.

im able to store and search but if there's repeated car number it will not show anything.( not though serial com yet as i have not figure out how to setup.)

 im currently stuck on replacing the Area(pillar) col. whenever the "Car Number" column equals a specific value where the specific value equal to the car number which is in the database.

i'll be glad if there's a video example on how do a setup on serial com.

 

 

thanks for your help for trying to understand the problem of the program.

apologize if my english is poor.

 

 

0 Kudos
Message 8 of 27
(5,504 Views)
Solution
Accepted by topic author Divineapple

Okay, Let's quit messing around.

 

Here is what I was trying to explain what to do.

 

Message 9 of 27
(5,496 Views)

Thanks Ravens Fan.

 

0 Kudos
Message 10 of 27
(5,489 Views)