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: 

Excel DataPlugin: GetCellBlock zeilenweise

Hallo zusammen,

 

ich versuche gerade ein Excel DataPlugin zu schreiben das eine Excel Datei einliest bei dem die Kanaldaten zeilenweise und nicht wie sonst meist üblich spaltenweise abgelegt wurden.

 

Gbt es einen Methode die GetCellBlock entsprich, di daten aber zeilenweise einliest damit ich die Daten folgendermassen einlesen kann?

 

  For i = oCurrSheet.MinPosition.Row to oCurrSheet.MaxPosition.Row
    Name = oCurrSheet.GetCellValue(i,1)
    Unit = oCurrSheet.GetCellValue(i,2)
    Set oNewChannel = oCellBlock.Channels.Add(Name)
    Set DAChannel = oChnGroup.Channels.AddDirectAccessChannel(oNewChannel)
    Call DAChannel.Properties.Add("unit_string",Unit)
  Next

 

Die Exceltabelle sieht folgendermassen aus:

 

Excel Tabelle

 

Grüsse,

Elmar

 

 

0 Kudos
Message 1 of 5
(4,121 Views)

Hallo Elmar,

 

solch eine Funktion gibt es meines Wissens nach nicht.

 

Aber kann die Tabelle nicht einfach vor dem Import transponiert werden?

 

Transponieren (Vertauschen) von Daten aus Spalten in Zeilen oder umgekehrt

 

Ich hoffe das hilft dir.

 

Grüße

Tenshinhan

--------------------------------------------------------------------------------------------------------
Work with NI Hard- and Software for about 15 years now.

Certified LabVIEW Developer & TestStand Developer/Architect

--------------------------------------------------------------------------------------------------------

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 2 of 5
(4,092 Views)

Hi Elmar,

 

How long are these horizontal channels?  The only option you have with DIAdem 2015 and earlier is to create an empty channel and assign the channel values one at a time in a VBScript loop in the DataPlugin.  If there aren't too many values in each channel, this will proceed quickly-- the spreadsheet ready already loads all cell values from the whole workbook into RAM when the DataPlugin starts.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 5
(4,077 Views)

Hi Brad,

 

these files have 300-600 channels (Rows) with with thousands of measurement points (normally not more than about 30,000).  I think this is to much to read it cell by cell in a loop.

I think I'll try to transpose the files by a matlab script, as suggested by Tenshinhan before we copy it to the DataFinder server.

 

Best regards,

Elmar

0 Kudos
Message 4 of 5
(4,034 Views)

Hi Elmar,

 

I agree.  That would indeed load very slowly.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 5 of 5
(4,021 Views)