How to remove trailling numbers when using the update function (database toolbox)
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Blue
il 20 Ott 2023
Risposto: Sulaymon Eshkabilov
il 20 Ott 2023
Hi,
Im using the update function from the database toolboox to update data in an Oracle database
conn = database(env, user, pass)
tablename = 'depth_table';
whereclause = 'where set_id = 1';
p_var = 'depth_p';
d = [1,1,1,1]';
p = table(0.01 * ones(height(d), 1), 'VariableNames', {'depth_p'});
update(conn, tablename, p_var, p, whereclause)
The problem is that the 0.01 value in Matlab becomes 0.010000000003456346 in Oracle (its a simple number field in Oracle). How can I stop this from happening ?
Thank you
0 Commenti
Risposta accettata
Sulaymon Eshkabilov
il 20 Ott 2023
Maybe to store data in a single() format instead of double (default in MATLAB), and also, round up the values, e.g.:
t = linspace(0, 2*pi, 10);
t = round(t, 3, 'significant'); % Round to 3 significant digits
ts = single(t);
F = sin(t);
F = round(F, 3, 'significant'); % Round to 3 significant digits
Fs = single(F);
T = array2table(ts');
T.Fun = Fs'
0 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!