LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Numerical Classification

Everyone, please lend me your wisdom.

( I am not good at English . )

 

There are several arrays, and I want to group identical values together, remove duplicates, and output the organized result.

 

Environment : Windows / LabVIEW2018

 

mxarai_1-1765176210423.jpeg

 

 

Numerical Classification.vi ‏1 KB
Download All
0 Kudos
Message 1 of 10
(229 Views)

Hi mxarai,

 


@mxarai wrote:

There are several arrays, and I want to group identical values together, remove duplicates, and output the organized result.

 

mxarai_1-1765176210423.jpeg


  • Can you explain how you "organize" the output data? Which condition(s) do you want to apply? (Example: why does "2" belong to group2 instead of group3?
  • What do the colors in your example image indicate?
  • Why does your VI only has a filesize of 1kB? Typically VI files are larger…
  • Having files stuck in virus scan is no good sign: ask the moderators to clean up the files…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(225 Views)

(Other attachments are currently also stuck in the virus scan. Most likely a site problem that the web team needs to fix)

 


@mxarai wrote:

There are several arrays, and I want to group identical values together, remove duplicates, and output the organized result.


LabVIEW does not support ragged 2D arrays (e.g. where the lengths of rows differ as in your data). What is the actual data structure? Does each element have also other metadata, such as color? How is that stored?

You can remove duplicates without having to group them together first. (there is even a VI for that!)

As has been said, your final "organization" is too unclear. What are the rules?

0 Kudos
Message 3 of 10
(202 Views)

Hi GerdW,

 

We apologize.
The VI file has been updated.

 

Best regards,

mxarai

0 Kudos
Message 4 of 10
(200 Views)

Hi everyone,

What I want to do.

mxarai_0-1765182545956.jpeg

 

mxarai_1-1765182682867.png

 

mxarai_2-1765182714315.png

Best regards,

mxarai

0 Kudos
Message 5 of 10
(167 Views)

Hi mxarai,

 


@mxarai wrote:

What I want to do.

mxarai_0-1765182545956.jpeg


Case1:

  • What defines which input row is placed into which output row?

 

Case2:

  • What defines which input row is placed into which output row?
    Why is row 1&3 grouped, and why do you group rows 2,4,6 together?
    Why is row 5&7 placed into output row 3?
  • Does "organize" also include sorting the data in each row by value?
  • Why do you "remove duplicates", but still keep two "0" values in output row 1?

You REALLY need to explain all this "organization stuff" a lot better!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 10
(157 Views)

My 2 cents guess is :

 

Is the row contain a number already existing in one of the output rows ?
    - Yes : Integrate the row into the same output row.

    - No : Create a new row.

Order the line after removing all duplicates (except 0 ?).

But then I would have some questions, like for this input :

0;1;2;3

4;5;6;7

1;4

 

Where should you put the third row ? In both output rows or only in the first ?

0 Kudos
Message 7 of 10
(149 Views)

Hi everyone,

 

What defines which input row is placed into which output row?

--> For convenience, we have assigned numbers to the groups.

便宜上、グループに番号を付けました。

Processing is performed sequentially starting from the first line of input.

入力1行目から順番に処理をしています。

If no common numbers are found, it becomes a single group.

共通する数字が見つからない場合は、1個のグループになります。

 

Since “0” does not exist, please ignore it if it occurs.

"0"は存在しないため、発生した場合は無視してください。

 

Looking from Input 2 to Input 1 shows double counting, so it is unnecessary.

入力2から入力1を見るとダブルカウントになるため、これは不要です。

 

Why is row 1&3 grouped, and why do you group rows 2,4,6 together?

--> The number 7 appears in 1 and 3 lines.

1行目と3行目に共通して7がある。

-->The number 12 appears in 2 and 4 lines.

2行目と4行目に共通して12がある。

The number 13 appears in 2 and 6 lines. 

2行目と6行目に共通して13がある。

Since even one associated number is common, I want to group rows 2, 4, and 6.

1個でも関連付いた数字が共通にあるため、2,4,6行はグループ化したい。

 

Why is row 5&7 placed into output row 3?

-> As a result of processing sequentially from line input1, it was the third one as a group.

input1の行から順次処理をした結果、グループとして3つ目だった。

 

Does "organize" also include sorting the data in each row by value?

--> yes

 

Why do you "remove duplicates", but still keep two "0" values in output row 1?

--> If possible, remove the “0” and leave the field blank. When aligning with groups containing more numbers, I thought groups with fewer numbers would require padding with ‘0’. If a “0” is appended, subsequent processing will ignore it.

""は可能なら消して空欄にしたい。数の多いグループに合わせると、数の少ないグループは"0"埋めが必要と思いました。""が付く場合には、この後の処理で""を無視します。

 

As indicated in the initial post, neither the input nor the result contains “0”.

初回投稿で示した通り、入力と結果は""は存在しません。

 

Best regards,

mxarai

 

0 Kudos
Message 8 of 10
(81 Views)

@mxarai wrote:

What I want to do.

mxarai_0-1765182545956.jpeg

 

mxarai_1-1765182682867.png

 

 

 


 

So, these are arrays of strings (not numeric) and in the front panel image you have an empty string as sentinel value for "no number". However, in the first image, these have miraculously turned into zeroes.

 

Most likely, all operations should be done on strings directly, but then we need to be careful about invisible differences such as the presence if non-printable characters. Of course you seem to want the outputs sorted in numerical, not lexical order, which raises another can of worms.

 

I would recommend to switch to a more reasonable data structure, e.g. a 1D array of clusters where each cluster contains a row of numeric integers. Now the rows can differ in length.

 

For the algorithm, you could use a MAP where the key is the row number and the value is a SET of integers. The rest will be easy.

 

Can you take a step back and post the full requirements document? What is the purpose of the processing? Where does the input come from and how is the output used?

 

 

 

0 Kudos
Message 9 of 10
(75 Views)

Hi altenbach;

 

So, these are arrays of strings (not numeric) and in the front panel image you have an empty string as sentinel value for "no number". However, in the first image, these have miraculously turned into zeroes.

--> As long as the result matches the expected value, either string processing or numerical processing is acceptable. The values are integers from 1 to 500.

期待値通りの結果となればよいので、文字列処理または数値処理はどちらでもよいです。1から500の整数です。

 

 

Most likely, all operations should be done on strings directly, but then we need to be careful about invisible differences such as the presence if non-printable characters. Of course you seem to want the outputs sorted in numerical, not lexical order, which raises another can of worms.

--> If processing becomes simpler, sorting is unnecessary.

処理がシンプルになるのであれば、並べ替えは不要です。

 

I would recommend to switch to a more reasonable data structure, e.g. a 1D array of clusters where each cluster contains a row of numeric integers. Now the rows can differ in length.

-->

I am attaching the input file input.txt (tab-delimited). Delete or ignore “0” when grouping.

入力ファイル input.txtTAB区切り) を添付します。"0"を削除または無視してグルーピングを行います。

I am attaching the input file grouping.txt (tab-delimited).

出力ファイル grouping.txtTAB区切り) を添付します。

 

For the algorithm, you could use a MAP where the key is the row number and the value is a SET of integers. The rest will be easy.

--> So far, I've given examples of “how we do it manually.” If grouping can be done as expected, changing the algorithm is also acceptable.

これまで、"手作業の場合はこうしている"という例を挙げました。期待値通りにグルーピングできればアルゴリズム変更もOKです。

 

Can you take a step back and post the full requirements document? What is the purpose of the processing? Where does the input come from and how is the output used?

--> The goal is to examine the attached input file line by line and group each line if it contains even one identical value. This is the simplest possible expression.

添付のinputファイルを行単位で見ていき、同じ数値が1個でも含めば行単位でグルーピングすることが目的です。これ以上、シンプルな表現はできません。

 

 

The intended use of the output involves further subdividing each group. Each individual numerical value is associated with a correlation coefficient. In other words, the values can be considered IDs. The first line of the attached “grouping.txt” file lists 29 values. We will create a 29x29 correlation coefficient table. The plan is to group values based on coefficients exceeding a certain threshold. For example, 5 groups could be formed from the 29 values. Some values may not exceed the threshold and thus remain ungrouped. That's all.

出力の使い方は、それぞれのグループをさらに細分化することを考えています。数値の11個には相関係数が紐付いています。つまり、数値はIDといえます。添付"grouping.txt"1行目は、29個並んでいます。29x29の相関係数表を作ります。一定値以上の係数値でグルーピングする作業を考えています。例えば、29個から5グループが作られます。幾つかは一定値を超えずにグループに属さないものもあるでしょう。以上です。

 

Best regards,

mxarai

I'm struggling with English expressions.

 

 

 

Download All
0 Kudos
Message 10 of 10
(18 Views)