Values from workspace change

1 view (last 30 days)
Joel Schelander
Joel Schelander on 25 Feb 2021
Answered: Steven Lord on 25 Feb 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]

Accepted Answer

Steven Lord
Steven Lord on 25 Feb 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.

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!