DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Read number of channels dynamically

Hi ,

 

I have a test file in .dat format.  Normally we will have 4 channels. Time, Accleration1 and Accleration2, Upper Limit and Lower limit.

 

Where I plot Time v/s Accleration1 and Accleration2.

 

In future, test file may contain Accleration 3, Accleration 4, .. Accleration 10. So, how can I make a script to dynamically read the number of channels that are loaded to a data portal and plot all of them on report.   (whichever is existing. )

 

I read in help to use globusedchn. How can i use it in script.

Should I have to use ny looping statements? please help.

 

 

0 Kudos
Message 1 of 3
(3,703 Views)

Hello RSH,

 

There is a function in DIAdem REPORT to do exactly what you are asking for, which is to dynamically plot n number of channels in a file based on however many channels are contained in a file.

 

First of all, we need to make sure you data is stored as Waveforms, not channels which is done by using the "Numeric Channels <-> Waveform Channels" function in DIAdem ANALYSIS (this can be done in a Script too):

 

RSH0.png

 

Once all your channels are Waveforms, we can move on to REPORT.

 

Go to the Settings menu in "REPORT" and switch on the "Curve Expansion" mode:

 

RSH1.png

 

RSH2.png

 

RSH3.png

 

I have thre Waveforms loaded called "Noise", Noise1" and "Noise2" in my DataPortal

 

RSH5.png

 

In your Axis Layout, delete the group reference and add a "*" to the end of the channel name:

 

RSH6.png

 

Here is the result, which will dynamically add channels based on how many "Noise*" channels are in the DataPortal:

 

RSH Final.PNG

 

Hope that helps,

 

     Otmar

Otmar D. Foehner
0 Kudos
Message 2 of 3
(3,683 Views)

Hello Otmar,

 

I worked out your reply, and working great for my raw channels. If I have any calculations to be done before plotting them, like

Calculations are: Filter, rename, Delete Pre data and post data (keep 0 till 70 data points),  I tried this code:

 

L1 = GlobusedChn    ' Assume Number of channels are 3

 

for intloop = 1 to L1

 

T1 = ChnName(1)

T2 = ChnName(2)

T3 = ChnName(3)

 

Call ChnCFCFiltCalc(T1,T2,"/Deceleration 1","CFC_60",0,"EndPoints",10)

Call ChnCFCFiltCalc(T1,T3,"/Deceleration 1","CFC_60",0,"EndPoints",10)

 

Next

 

But, I am very weak in programming. How can i aarange this process in any conditional loops??

 

IF there are 3 channels, dynamically 1 to GlobusedChn must be assigned to T1 till T3   (if GlobusedChn = 3) and do respective alculations and plot.

 

Does Curve expansion which u said earlier works same for this too??

 

0 Kudos
Message 3 of 3
(3,675 Views)