How to remove trailling numbers when using the update function (database toolbox)
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Blue
el 20 de Oct. de 2023
Respondida: Sulaymon Eshkabilov
el 20 de Oct. de 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 comentarios
Respuesta aceptada
Sulaymon Eshkabilov
el 20 de Oct. de 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 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!