From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple pictures export from Report via script

Hi

I have datas divided on groups. These groups contains several channels. Example names from Data Portal:

[1]/Angle
[1]/Torque

[2]/Angle
[2]/Torque

[3]/Angle
[3]/Torque

and so on.

I found example scripts which I adopted for my needs.
I needed to average all those channels and a part of this script responsible for this action works fine.
Here piece of code:

------
' Subroutine for data analysis
sub sDoAnalysis
 
dim i

iMyIntVal = 10  ' Variable for dialog control

if SudDlgShow("Input_1","c:\SudExample") = "IDCancel" then
    iMyIntVal = 0

end if

For i=1 to iMyIntVal

STATSEL(1)       ="No"
STATSEL(2)       ="No"
STATSEL(3)       ="No"
STATSEL(4)       ="No"
STATSEL(5)       ="No"
STATSEL(6)       ="Yes"
STATSEL(7)       ="No"
STATSEL(8)       ="No"
STATSEL(9)       ="No"
STATSEL(10)      ="No"
STATSEL(11)      ="No"
STATSEL(12)      ="No"
STATSEL(13)      ="No"
STATSEL(14)      ="No"
STATSEL(15)      ="No"
STATSEL(16)      ="No"
STATSEL(17)      ="No"
STATSEL(18)      ="No"
STATSEL(19)      ="No"
STATSEL(20)      ="No"
STATSEL(21)      ="No"
STATSEL(22)      ="No"
STATCLIPCOPY     =0
STATCLIPVALUE    =0
STATFORMAT       =""
STATRESCHN       =1
Call STATBLOCKCALC("Channel","1-","'["& i &"]/Angle' - '["& i &"]/Torque") '... STATDIREC,ROWNOSTR,CHNNOSTR

if i=1 then

Call Formulacalc("Ch('[1]/Angle') := Ch('[1]/Angle') - ChD(1,'Arithm_mean')")
Call Formulacalc("Ch('[1]/Torque') := Ch('[1]/Torque') - ChD(2,'Arithm_mean')")

else

Call Formulacalc("Ch('["& i &"]/Angle') := Ch('["& i &"]/Angle') - ChD(1,'Arithm_mean"& i-1 &"')")
Call Formulacalc("Ch('["& i &"]/Torque') := Ch('["& i &"]/Torque') - ChD(2,'Arithm_mean"& i-1 &"')")

end if

next 
 
end sub
------

iMyIntVal is defined as a Global variable

In user dialog box I can enter number of samples to process.
I have a diagram ready in the Diadem Report so I have to replace data channels and export the graphs to .png files one by one.
Example:

axis X -> [1]/Angle
axis Y -> [1]/Torque

--> export graph to sample_1.png

axis X -> [2]/Angle
axis Y -> [2]/Torque

--> export graph to sample_2.png

axis X -> [3]/Angle
axis Y -> [3]/Torque

--> export to sample_3.png  and so on.

How can I do this automatic via script based on number of samples that I enter in user dialog box ?

Thanks in advance.
 












0 Kudos
Message 1 of 2
(3,034 Views)
Hey Domin,

To start out with, I would recommend trying to use the script recording capability to record your actions and then try to emulate that code in your larger application.
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 2 of 2
(2,997 Views)