Values from workspace change

1 vue (au cours des 30 derniers jours)
Joel Schelander
Joel Schelander le 25 Fév 2021
I have a vector with values:
DH=[0 0 0 0 0 0 3.95 1009.15 0]
I insert the DH in a matrix
TimeofHomeArrival=[Home; DateVector(:,4).'; DateVector(:,5).'; DateVector(:,6).'; DH];
The values in the matrix are however now different than from the workspace
TimeofHomeArrival(5,:)=[ 0 0 0 0 0 0 4 127 0]

Réponse acceptée

Steven Lord
Steven Lord le 25 Fév 2021
Home is an int8 array. When you combined the int8 data with the double data, the double data was converted to int8. See this documentation page and the "Largest and Smallest Values for Integer Classes" section on this documentation page for more information.
If you want to make TimeOfHomeArrival a double array you'll need to convert the int8 data into double by calling double on it.

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by