취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

Typedef control array of cluster not propagating defaults to output wire

해결 완료!
솔루션으로 이동

I might find later that I'm missing something very simple here, but so far I am perplexed.

 

I have a typedef which is a cluster of double. The cluster of double must return all NaN values as a default.

If I wire out the type definition through the indexing tunnel on a for loop, the resulting wire returns all zeros rather than NaN.

 

This is a problem because the program I'm trying to make can return 0 as a valid value; I use NaN to denote that no valid values were returned. See the screenshot where indexing the resulting array gives a cluster of all zeros. Sample code is also attached. This should be a pretty easy task; I know I've done this on multiple occasions and had several programs that relied on this behavior. I think I broke something?

 

AllisonSCJ_0-1637248062331.png

AllisonSCJ_1-1637248077950.png

 

 

Using Labview 2022, Windows 10
0 포인트
1/5 메시지
1,817 조회수

The arrays output from the loop contain neither NaNs nor zeros, they are empty.

Your subarray shows zeros because the elements have 0 as their default value.

Default values do not propagate from typedefs to existing instances.

However when you create a new instance, it will inherit the default value from the typedef.

"If you weren't supposed to push it, it wouldn't be a button."
0 포인트
2/5 메시지
1,796 조회수

My receiving indicator is of the same typedef, which has my expected default set. Based on your final statement, shouldn't the resulting empty array still show the expected defaults?

Using Labview 2022, Windows 10
0 포인트
3/5 메시지
1,793 조회수

@AllisonSCJ wrote:

My receiving indicator is of the same typedef, which has my expected default set. Based on your final statement, shouldn't the resulting empty array still show the expected defaults?


No.  Reread what I wrote.

"If you weren't supposed to push it, it wouldn't be a button."
0 포인트
4/5 메시지
1,787 조회수
솔루션
주제 작성자 AllisonSCJ이(가) 승인함

Consider making your type definition into a class instead.

 

With classes, the default value is part of the type and any changes to that will apply to all areas where default values are created.

 

With type definitions, the default value you put in the control is what will appear when you do things like put a new version of it onto a front panel or block diagram, but any changes to defaults will not propagate to existing controls or constants, and they will never apply in certain situations (like exiting a case or event structure with the "use default value if unwired" option enabled).

0 포인트
5/5 메시지
1,771 조회수