11-10-2008 06:58 AM
Hi,
I need some help regarding the smooth commnad.
I have this script :
Dim MyFileNames, iCount,date, row,
Call FileNameGet("ANY", "FileRead","D:\BOF-MIU\BOF Archive\", "CSV data (*.CSV),*.csv", "All.lst", True, "Data selection")
MyFileNames = Split(FileDlgFileName,"|")
For iCount = 0 To Ubound(MyFileNames)
FileName = NameSplit(MyFileNames(iCount), "N")
Call GroupCreate(FileName)
Call GroupDefaultSet(GroupCount)
Call DataFileLoadSel(MyFileNames(iCount), "CSV", "[1]/[3-4]")
ChnName(CNoXGet(GroupCount, 1)) = "Opening Force"
ChnName(CNoXGet(GroupCount, 2)) = "Travel Distance"
' until here it is ok, but after that I try something but with no succes
'-------------------------------------------------------------------------------
'Call ChnSmooth(CNoXGet(GroupCount, 1),"Opening Force",12,"maxNumber") '... Y,E,SmoothWidth,SmoothType
'Call ChnSmooth(CNoXGet(GroupCount, 2),"Travel Distance",12,"maxNumber") '... Y,E,SmoothWidth,SmoothType
'R1 = CMax(Ch("Travel Distance"))
'Row = PNo("Travel Distance", R1)
'Call DataBlDel("Travel Distance", Row, 2000, 1)
'----------------------------------------------------------
'Call PicLoad("D:\BOF-MIU\Scripts\BForce_Multiload.TDR")
'Call PicUpdate
'-----------------------------------
next
Please tell me how can I smooth a group channel?
How can I delete data from the max value of a group channel?
Thanks for your time.
Marius
Solved! Go to Solution.
11-10-2008 03:14 PM
Hi Marius,
Your VBScript runs fine on my DIAdem 11.0. Could you please post the exact error message that you get when you run the VBScript on your DIAdem?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
11-11-2008 03:06 AM
Hi Brad,
My problems apear when I try to analyze (smooth and cut) the channels ( I load more then one file).
Like you see in the picture 1( from the attachement) the script will smooth only one group of channels.
I need to smooth and cut all the channels that I load it in to the report.
In picture 2 you can see how it is the report with out the smooth and cut, and in picture 3 you can see how the report have to be , but with more curves of diferent colors.
Please tell how can I smooth and cut all the channels from the group.
Thank you,
Marius
11-11-2008 09:13 AM
Hi Marius,
The problem was in your channel referencing. When you ask DIAdem to do something to or with a data channel and provide only the channel name (no Group information) DIAdem simply finds the first channel in the DataPortal that matches that channel name. So you were looping through all the groups but in several operations manipulating always the channels from the first Group. Here's code that references by channel number that appears to work correctly on my computer when loading 3 files:
For iCount = 0 To Ubound(MyFileNames)
FileName = NameSplit(MyFileNames(iCount), "N")
Call GroupCreate(FileName)Call GroupDefaultSet(GroupCount)
Call DataFileLoadSel(MyFileNames(iCount), "CSV", "[1]/[3-4]")ForceCh = CNoXGet(GroupCount, 1)
TravelCh = CNoXGet(GroupCount, 2)ChnName(ForceCh) = "Opening Force"
ChnName(TravelCh) = "Travel Distance"
Call ChnSmooth(ForceCh, ForceCh, 12, "maxNumber")Call ChnSmooth(TravelCh, TravelCh, 12, "maxNumber")
R1 = CMax(TravelCh)Row = PNo(TravelCh, R1)
Call DataBlDel(TravelCh, Row, 2000, 1)'Call PicLoad("D:\BOF-MIU\Scripts\BForce_Multiload.TDR"
'Call PicUpdate
Next ' iCount
Brad Turpin
DIAdem Product Support Engineer
National Instruments
11-11-2008 03:13 PM
Hi Brad,
Thank you for your help, now it is working perfect.
Sorry if I stress you, but I want to learn more about Diadem and programing , and I am only at the begining. Sorry if I will stress you further.
Thank you again,
Marius