Borrar filtros
Borrar filtros

How can I convert a variable whose value is double to integer or to float?

118 visualizaciones (últimos 30 días)
How can I convert a variable whose value is double to integer or to float? So I think I can fix the problem:
Undefined function 'roundn' for input arguments of type 'double'.
Error in plot_litho_061015 (line 58) drawLine([0 roundn(z1),2], [0 min(z1)]); hold on; % Vertical line at x = 0;
ps: z1 value= 2601x1double

Respuesta aceptada

bio lim
bio lim el 21 de Jul. de 2015
z1 = rand(2601,1);
int_z1 = int8(z1);
I don't really understand what you mean by "float". Are you refering to single-precision? If so,
single(z1)
In general, MATLAB functions usually require doubles.

Más respuestas (1)

SIFISO NICHOLUS
SIFISO NICHOLUS el 9 de Mayo de 2022
double Z = 2.55555

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by