What is a double matrix?

I have data that I need to convert into a double matrix. How do I do that ?

5 comentarios

Awais Saeed
Awais Saeed el 11 de Dic. de 2021
Editada: Awais Saeed el 11 de Dic. de 2021
What is your data, its dimensions and data type?
Zach Hanses
Zach Hanses el 11 de Dic. de 2021
my date is the precipitation every three hours per day for 5 years. the dimensions are 1952x5, data type is single.
KSSV
KSSV el 11 de Dic. de 2021
You may proceed with the existing sinlge, Why you want to convert it to double ?
Zach Hanses
Zach Hanses el 11 de Dic. de 2021
I was told that using the double function will help in the process of getting the 5 year average for precipitation
Awais Saeed
Awais Saeed el 11 de Dic. de 2021
Decimal point data (aka floating pointer numbers) can be represented as either single precision numbers or double precesion numbers. Single precision data takes 32bits in memory while double precision data takes 64bits. The greater the number of bits, the higher the accuracy. But you can easy tell that double precision costs you more memory. Read more here.

Iniciar sesión para comentar.

Respuestas (3)

KSSV
KSSV el 11 de Dic. de 2021

0 votos

If it is a string, read about str2num, str2double.
If it is a single, use double.
If it is a sym class, use double.

3 comentarios

Zach Hanses
Zach Hanses el 11 de Dic. de 2021
double then the name of the data?
Zach Hanses
Zach Hanses el 11 de Dic. de 2021
double(precipitaiton) ?
KSSV
KSSV el 11 de Dic. de 2021
Editada: KSSV el 11 de Dic. de 2021
In MATLAB every variable has a class. You can get the class using the function class......the numbers i.e. floatingpoint numbers can be single or double. If your precipitation is a single, and you want it to double, yes use:
double(precipitaiton)

Iniciar sesión para comentar.

Awais Saeed
Awais Saeed el 11 de Dic. de 2021
A = magic(4) % data type is double
A = 4×4
16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1
s = single(A) % convert double to single
s = 4×4
16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1
d = double(s) % convert single to double
d = 4×4
16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1
whos
Name Size Bytes Class Attributes A 4x4 128 double d 4x4 128 double s 4x4 64 single
Walter Roberson
Walter Roberson el 11 de Dic. de 2021
retime() works fine with single precision.
dates = datetime('2000-01-01') + calmonths(0:3:35).'
dates = 12×1 datetime array
01-Jan-2000 01-Apr-2000 01-Jul-2000 01-Oct-2000 01-Jan-2001 01-Apr-2001 01-Jul-2001 01-Oct-2001 01-Jan-2002 01-Apr-2002 01-Jul-2002 01-Oct-2002
data = randn(size(dates), 'single')
data = 12×1
-0.9242 -0.7978 -0.6076 -1.3254 -0.8482 1.1801 -1.7518 -1.1227 -0.5025 -1.3097
TT = timetable(dates, data)
TT = 12×1 timetable
dates data ___________ ________ 01-Jan-2000 -0.92422 01-Apr-2000 -0.79782 01-Jul-2000 -0.60761 01-Oct-2000 -1.3254 01-Jan-2001 -0.84822 01-Apr-2001 1.1801 01-Jul-2001 -1.7518 01-Oct-2001 -1.1227 01-Jan-2002 -0.50246 01-Apr-2002 -1.3097 01-Jul-2002 0.87082 01-Oct-2002 0.73953
TT5 = retime(TT, 'yearly', 'mean')
TT5 = 3×1 timetable
dates data ___________ _________ 01-Jan-2000 -0.91377 01-Jan-2001 -0.63564 01-Jan-2002 -0.050449

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 11 de Dic. de 2021

Comentada:

el 11 de Dic. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by