0

is there any good way how i can import a Excel file with signal values (40,000 values, ~100 minutes measurement time) and simulate a signal over time with it?

I want to reconstruct the simulation with timestamp and Signal values.

I've two columns:

  • Timestamp for every value (it isn't equidistant)
  • Signal-Value

The timestamp should be nearly synchron with the simulationtime.

Maybe someone has a good "to start" idea?

Thank you!

Update #1 (based on the comments):

@Wouter de Kort: I got data from measurement over time. I got for every timestamp a value. The data looks something like this (without backslash):

Time (s) // Value

154,51 // 49,33

154,71 // 49,46

154,92 // 49,72

155,11 // 49,64

I only want to look from the beginning to the end of the data over a time (the time, the measurement in real took). Like a Sinus Generator, but in this case i've a specific signal and the values has to be at a specific time.

How can i export it to CSV? And what are the benefits using CSV with C# instead of Excel?

Update #2:

My case is, to get every (e.g.) 100ms a new value through a variable which i can use for my visualization program i already have.

Community
  • 1
  • 1
William
  • 15
  • 1
  • 7
  • 1
    Can you please elaborate on what you want to do? Can you show some sample data? What is the result you expect from your code? What does reconstructing a simulation mean? Machine learning or just looping through some data and running some code? – Wouter de Kort Jan 22 '18 at 08:17
  • Export it to a CSV or something similarly easy to read, should be easy going from there. – Chris Jan 22 '18 at 08:28
  • I would suggest to concentrate on the very first part of your task: to find a way to import just ANY data (like contents of a single cell as a string) from Excel file into your application. – rs232 Jan 22 '18 at 08:39
  • I will answer @update #1 – William Jan 22 '18 at 08:48

1 Answers1

0

Take a look at this: Importing Excel into a DataTable Quickly There's an importing example directly from an Excel spreadsheet without the need to convert to CSV.

You can also use OfficeOpenXml. It provides a way to access cell data like so:

using OfficeOpenXml;
...
var pck = new ExcelPackage(fileName);
var ws = pck.Workbook.Worksheets.ElementAt(0);  // first worksheet
ws.Select();
var value = ws.Cells[row, col].Value;           // corresponds to some Excel cell value
Petras Purlys
  • 1,093
  • 6
  • 18
  • I want to generate a signal based on the values. So my case is, to get every (e.g.) 100ms a new value through a variable which i can use for my visualization program i already have. – William Jan 22 '18 at 09:18