LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a tab with same values in different sections

Hello all,

 

I'm facing a problem : I'd like to create a tab with parts with the same data...I don't think I'm clear so let me illustrate my problem :

 

To start, I have a 1D tab and I'd like to add to this tab a row with the following data : 111111 then 222222 , 333333 etc etc....in order to get a 2D tab.I can have access to the size of the tab with the same number..

A finally, I'd like to know, for each section with the same number the maximum value for the second column of my tab...

Then finally I'd like to put all the max in one tab...I'm asking a lot I know

 

Anyway, any help would be much appreciated

 

I attached to my post a picture of what I would like to do, because I'm not sure my explanation is clear

 

Regards

0 Kudos
Message 1 of 11
(2,491 Views)

I am assuming this is what you want and tab to you is a column?

max values.png


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
Message 2 of 11
(2,473 Views)

Hello,

 

First of all, thanks a lot for your answer...

I think you well understood my problem, the thing is I have some trouble understanding your picture...

Let me clarifiy my need because my previous explanation was a little bit fuzzy...

 

To start, I record data from a force transducer during a defined number of pneumatic chamber cycles. At the end, I get a 1D tab with all the force measurements, with no distinction in regard to the number of the cycle. So, what I wanted to do is :

1 - Get the size of the tab

2 - Divide by the number of the cycles, in order to obtain the size of each block

3 - For each block,find the max value 

4 - Write each max value in a txt file

 

I tried to use part of your code but I'm not sure about the fact that I get the expected result. When I test my code, I alway get the same max value, which is weird...

 

I attached a part of my code...

 

Again, thanks a lot for your answer

 

 

0 Kudos
Message 3 of 11
(2,450 Views)

I think when you write "tab" you may be referring to what is called in English an "array." 

 

In your for loop you operate on the same data "Cycles demandes" times, so your max will always be the same.  You need to change the Reshape Array to Array Subset and move it inside the loop. Then on each iteration of the loop you need to change the start index by "Cycles demandes", probably by a shift register.

 

Lynn

Message 4 of 11
(2,441 Views)

Hello,

 

You're right about the word "tab" : it means array Smiley Embarassed

Anyway, your post has been a great help...I've made some modifications...

That should do the trick, right ?

 

Regards

0 Kudos
Message 5 of 11
(2,426 Views)

@Keno wrote:

Hello,

 

You're right about the word "tab" : it means array Smiley Embarassed

Anyway, your post has been a great help...I've made some modifications...

That should do the trick, right ?


 

Please attach real code instead of pictures. Do you really need all these local variables?

 

You still have some representation problems. The "cycles demades" should be an integer. All indexing operations should be blue!

 

I still think that .aCe.'s solution is simpler. You need to reshape to a 2D array instead of a 1D array and the rest will fall into place.

 

 

Here's 8,2 version of the important code.

 

(Of course of the array size is not divisble by the segment lenght, you need to decide how to handle it.)

Download All
Message 6 of 11
(2,411 Views)

Hello,

 

I had some trouble understanding the code of .aCe. ...Now, it's crystal clear...I think my VI is working now..Thank you all!!

About local variables, I'm using them because the code here is part of a state machine, and I don't know a better way to call the variables...If you have a better solution, I'm all ears...

 

And regarding this remark "Of course of the array size is not divisble by the segment lenght, you need to decide how to handle it." 

What I do actually is dividing the array size by the number of cycles in order to obtain the segment length because I consider that, for each cycle, the number of samples acquired will be the same, as the cycle of my pneumatic cylinders are regulated with specific time...Am I wrong to consider this ?

 

Anyway, thanks a lot all of you for the help!!!

 

 

 

 

0 Kudos
Message 7 of 11
(2,390 Views)

Just forgot to attach my code 

0 Kudos
Message 8 of 11
(2,387 Views)

Keno wrote:

About local variables, I'm using them because the code here is part of a state machine, and I don't know a better way to call the variables...If you have a better solution, I'm all ears...


LabVIEW doesn't really use "variables". (local variables just point to front panel objects and their use forces additional data copies in memory and potentially causes race conditions).

In a state machine, you typically keep data and state information in shift registers. If you would share your code, maybe we could give more specific recommendations.

 


Keno wrote:

And regarding this remark "Of course of the array size is not divisble by the segment lenght, you need to decide how to handle it." 

What I do actually is dividing the array size by the number of cycles in order to obtain the segment length because I consider that, for each cycle, the number of samples acquired will be the same, as the cycle of my pneumatic cylinders are regulated with specific time...Am I wrong to consider this ?



Sorry, I don't understand youre description. If the experimental conditions always ensure that the number of elements in the input array is an integer multiple of 8, you don't have a problem. If you cannot ensure that, the current code will drop the incomplete tail. (e.g. if the array has 18 elements, only 16 elements will be processed). It would be possible to instead pad to 24 elements in order not to lose the last two elements. Your pick!

0 Kudos
Message 9 of 11
(2,362 Views)

Thanks a lot for all these advices...

I think there will have a lot to say about my program...But I'm willing to improve my labview programing, so here it is...

 

Don't hesitate to critize and give me advice

 

Thanks a lot

 

PS : as information, the program will command two pneumatic cylinders to test a folding/unfolding function...

 

 

0 Kudos
Message 10 of 11
(2,354 Views)