# What is a double matrix?

137 visualizzazioni (ultimi 30 giorni)
Zach Hanses il 11 Dic 2021
Commentato: Awais Saeed il 11 Dic 2021
I have data that I need to convert into a double matrix. How do I do that ?
##### 5 CommentiMostra 3 commenti meno recentiNascondi 3 commenti meno recenti
Zach Hanses il 11 Dic 2021
I was told that using the double function will help in the process of getting the 5 year average for precipitation
Awais Saeed il 11 Dic 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.

Accedi per commentare.

### Risposte (3)

KSSV il 11 Dic 2021
If it is a single, use double.
If it is a sym class, use double.
##### 3 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
Zach Hanses il 11 Dic 2021
double(precipitaiton) ?
KSSV il 11 Dic 2021
Modificato: KSSV il 11 Dic 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)

Accedi per commentare.

Awais Saeed il 11 Dic 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
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Walter Roberson il 11 Dic 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
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Data Type Conversion in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by