キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

changing array size without initialize

解決済み
解決策を見る

Hello,

 

I'm try to change array size dinamically.

 

I do a calibration of an instrument and from time to time I read 3 parameters and try write to an empty array (not zeroed), and caclulate interpolation polinom according to my measured data,

 

The array must be empty because I use the same array as input to calibration procedure and it can not contain the zero but only measured values and it grow as my measurement flows.

 

I hope that my question is clear,

 

Regards,

Sasa

0 件の賞賛
メッセージ1/12
7,907件の閲覧回数

Hi

 

What problem you are facing?

According to your question is the array not becoming clear every time?

Please state all the aspects

 

 

0 件の賞賛
メッセージ2/12
7,897件の閲覧回数

Hi Sasa,

 

your question ins't clear at all...

 

You read 3 parameters. That is fine. But how do you write to an empty array?

Why do you need an empty array "as input to calibration procedure"? When it is empty why should it contain "zero" values?

Why does it grow when you "write to the array"?

 

Please explain in more detail and attach a (sample) VI!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 件の賞賛
メッセージ3/12
7,891件の閲覧回数

Thanks for very fast reply.

 

how do I write to an empty array ?

Nohow, but I would like to do it. I will try to explain.

 

My calibration procudure accept  X , Y , Z, (never equal to zero ) and calculate interpolation polinom as function Z=f(X,Y).

The array should contain those three values many times and the rest should be empty. I the rest of array is not empty e.g equal to zero because previous initialization then the calibration procedure will take this value and calculate bad function.

One way is to eliminate/delete zero values/row from 2D array and i'm trying that now.

 

 

The better would be that during my measurement I collect data X,Y, Z, in this way.

1. measurement . array=x1, y1, z1

 

2.meas                array=x1, y1, z1

                                    x2, y2, z2

 

3.meas               array=x1, y1, z1

                                   x2, y2, z2

                                   x3, y3, z3

 

and so....

 

As you ca see during my meas. the array grow and keep history.

As my measurement continue  I get more value and more precious interpolation polynom and I can decide on fly which point I should measure again to be even better. I know that array must/should be initialized before becuse of memory allocation but I dont wont to be filled with zero eg it can not be as

                            array=x1, y1, z1

                                      x2, y2, z2

                                      0,  0,   0

 

 

I atach vi, not to much useful

Thanks in advance

Sasa

 

 

 

 

 

 

 

0 件の賞賛
メッセージ4/12
7,875件の閲覧回数
解決策
受理者 sasko

Hi Sasa,

 

two possible solutions come to my mind:

1) Use BuildArray to "grow" your array of measurement points. Add only "non-zero" points to the array...

2) Search the forum for threads on "delete elements from array", you will find something like this...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 件の賞賛
メッセージ5/12
7,864件の閲覧回数

 


sasko wrote:

I atach vi, not to much useful


 

A few comments to your VI.

 

 

  • Use a shift register, not a pile of local variables to keep the array. Why is the array terminal not even connected to the code???
  • Unless you want to display the array on the front panel, you don't even need it if you keep the data in a shift register.
  • You VI cannot easily be stopped because you don't have a stop event.
  • The terminal of latch action booleans should be inside the respective event case.
Attached is a simple example how you could do this more efficiently. (LV 8.0)

 

0 件の賞賛
メッセージ6/12
7,844件の閲覧回数

Thank you altenbach for sugestions,

 

I do agree that I should use a shift register, only my final program will use case structure. also latch actions can not be inside of event.

 

please find attached a screen

 

thanks again

 

S

 

 

0 件の賞賛
メッセージ7/12
7,817件の閲覧回数

 


sasko wrote:

I do agree that I should use a shift register, only my final program will use case structure. also latch actions can not be inside of event. 


 

Noooo. This is all wrong! Never hide an event structure inside a case structure. Why do you even need the event structure? There is a 0 ms timeout so it will execute the same event case as if "save data" has been pressed. Are there other event cases?

 

I would strongly recommend to re-think your code once more. There are a lot of useless constructs. Can you attach the VI instead of a picture?

0 件の賞賛
メッセージ8/12
7,799件の閲覧回数

Hello altenbach

 

Yes , it was another event connected with "highest order" but I give up and did not remove event structure.

 

I attach main VI, the whole project is much bigger

 


Regards

 

S

0 件の賞賛
メッセージ9/12
7,789件の閲覧回数

Hi Sasa,

 

I was interested to help on your problem - but that interest went drastically down after opening your VI...

 

That is just a bunch of local variables, wires crossing left and right, numerous stacked structures - and all of that several times the size of my notebook screen. No way...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 件の賞賛
メッセージ10/12
7,785件の閲覧回数