LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to save number into array one by one?

Be patient.  You posted in the middle of the night for the US.  So there aren't as many people on the forums.  Why didn't you start your own new thread rather than posting into a 6 year old one?

 

Your question is not very clear.  Are you looking to delete duplicates?  Are you looking to be left with an array in order once the duplicates are deleted?

0 Kudos
Message 11 of 21
(2,375 Views)

First of all I could not find any link to create a discussion.

Let me clear the problem

say x is a 1D array having 100 elements

x=[45 45 46 46 46 47 47 46 47 48 48 49 49 49 49 50 51 51 ..............................] 100 elements

Now I want to extract the under line numbers and thier corresponding indices and store them separately.

I have used "delete arrary" but it keeps the unwanted numbers as zero.

Hope this time the problem is clear.

 

With Regards

Abhijit Das

IITG INDIA

0 Kudos
Message 12 of 21
(2,369 Views)

@Raju1 wrote:

First of all I could not find any link to create a discussion.

Let me clear the problem

say x is a 1D array having 100 elements

x=[45 45 46 46 46 47 47 46 47 48 48 49 49 49 49 50 51 51 ..............................] 100 elements

Now I want to extract the under line numbers and thier corresponding indices and store them separately.

I have used "delete arrary" but it keeps the unwanted numbers as zero.

Hope this time the problem is clear.


On top of the LabVIEW forum is a button labeled "new message". click it and follow the three step instriuctions. It is not difficult.

 

I don't see the rules you use to extract the indices. For example why do you ignore the first occurence of the number 49? Seems random.

 

There is no "delete array" function. "delete from array" does NOT keep zeroes. If you think it does, attach your code.

 

What kind of output do you want? An array of number plus an array of indices? An array of clusters, each containing a number and an index?

 

Your example has a very distinct pattern (e.g. your array is sorted!). Can we assume this to be true in general or should we assume that the array can be more random?

0 Kudos
Message 13 of 21
(2,365 Views)

Sorry for the mistake

It should be

x=[45 45 46 46 46 47 47 46 47 48 48 49 49 49 49 50 51 51 ..............................] 100 elements

 

I want [45 46 47 48 49 50 51 .......] and its indices [1 3 6 10 12 16 17.....] separately in arrays.

 

The array can be more random. The selected number will be 1 or 2 greater than the previous one. 

 

With Regards

-Abhijit Das

IITG, INDIA

0 Kudos
Message 14 of 21
(2,360 Views)
Sorry, I am currently posting via phone and cannot attach an example, But the code to do this should fit the size of a postage stamp. Try it! What is your LV version? Are the elements integers? There might even be an openG solution.
0 Kudos
Message 15 of 21
(2,353 Views)

Thanks for your replays-

My LabVIEW version is 7.

The numbers are integers.

 

With Regards

-Abhijit Das

IITG, INDIA

0 Kudos
Message 16 of 21
(2,351 Views)

Agree with altenbach. It's a pretty straightforward solution and you should have tried it (assuming you just want incrementing series of numbers from an array). Here's my solution. I'm sure you could optimize it.

 

Code.PNGcode2.PNG

Regards,

Prashanth N
National Instruments
0 Kudos
Message 17 of 21
(2,343 Views)

Here's a quick draft that is easier to copy from an image, because it has no case structures. 😉

 

 

0 Kudos
Message 18 of 21
(2,338 Views)

I am getting the expected results.

 

Thanks a lot.

-Abhijit Das

IITG, INDIA

0 Kudos
Message 19 of 21
(2,332 Views)

My take. 🙂

/Y

Remove duplicates with index.png

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 20 of 21
(2,320 Views)