logging time and data and store it in a matrix

10 views (last 30 days)
Hello,
I am using a National Insturments device with analog inputs.
I want to meassure the voltage of a analog port and store the date and time (with every meassurement) in a matrix next to the data of the analog port.
example:
date time data
24/4/2021 12:53:20 1.13
24/4/2021 12:53:21 1.14
24/4/2021 12:53:22 1.15
What is the best way to achieve this?

Answers (1)

Star Strider
Star Strider on 24 Apr 2021
It is possible to use detectImportOptions and set the variables, however I find the following approach easier:
T1 = readtable('Niet hier Example File - 2021 04 24.txt');
date_time = T1.date+T1.time;
date_time.Format = 'dd/MM/yyyy HH:mm:ss';
data = T1.data;
T2 = table(date_time, data);
producing:
T2 =
3×2 table
date_time data
___________________ ____
24/04/2021 12:53:20 1.13
24/04/2021 12:53:21 1.14
24/04/2021 12:53:22 1.15
.
  2 Comments
Star Strider
Star Strider on 24 Apr 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Sign in to comment.

Tags

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!