MATLAB Answers

prevent sqlwrite from rounding numbers

1 view (last 30 days)
Jan H
Jan H on 18 Sep 2020
Hi everyone! I'm trying to write a table into a Access-database using sqlwrite and I have two problems.
1. Part of the table is a UNIX-timestamp which looks like this in the table: 1.570555200000000e+09 (Well it looks like this: 1.5706e+09 before double clicking it).
After the export to Access using sqlwrite it looks like this in the database: 1570560000
But it should look like this: 1570555200.
How can I prevent rounding the number? Rounding destroys the timestamp.
2. The rest of the table are numbers. After the export to Access they have different numbers after the point. Some have two and some have three numbers after the point.
Is it possible to specify the numbers after the point?
Many thanks in advance!!

  0 Comments

Sign in to comment.

Answers (1)

Kiran Felix Robert
Kiran Felix Robert on 8 Oct 2020
Hi Jan,
To avoiding rounding and data truncation by sqlwrite you can store the data as a string. This will also preserve the precision.
Kiran Felix Robert

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!