MATLAB: I have to do matrix with ‘single’ vectors

datadoubleMATLABmatrix

Hi everyone,
I done a matrix with 'single' vectors. The problem is that when I do the matrix, matlab changes the values of each vector. For example, the first column represents the years and when I insert the Years vector in the matrix the value changes from 1985 to 0.0198500, this for each column. I'm attacching my code and the matrix below. Is there a way to do a matrix without that matlab changes the values?
Data_table = table(time_date, time2, Hs_buoy, Tm_buoy, Dm_buoy);
HH = single(cell2mat(Data_table.time2(:,:)));
YYMMDD = vertcat(time_date{:});
Years = single(YYMMDD.Year);
Months = single(YYMMDD.Month);
Days = single(YYMMDD.Day);
Hs_tot = cell2mat(Data_table.Hs_buoy(:,:));
Tm_tot = cell2mat(Data_table.Tm_buoy(:,:));
Dm_tot = cell2mat(Data_table.Dm_buoy(:,:));
data_matrix = [Years Months Days HH Hs_tot Tm_tot Dm_tot];
and then the matrix:
data_matrix =
1472×7 single matrix
1.0e+05 *
0.0198500 0.0000100 0.0000100 0 0.0000088 0.0000426 0.0028428
0.0198500 0.0000100 0.0000100 0.6000000 0.0000073 0.0000370 0.0027256
0.0198500 0.0000100 0.0000100 1.2000000 0.0000072 0.0000359 0.0027142
0.0198500 0.0000100 0.0000100 1.8000000 0.0000062 0.0000360 0.0027929
0.0198500 0.0000100 0.0000200 0 0.0000039 0.0000345 0.0027787
0.0198500 0.0000100 0.0000200 0.6000000 0.0000027 0.0000305 0.0027401
0.0198500 0.0000100 0.0000200 1.2000000 0.0000027 0.0000247 0.0026128
0.0198500 0.0000100 0.0000200 1.8000000 0.0000030 0.0000262 0.0025042
0.0198500 0.0000100 0.0000300 0 0.0000031 0.0000269 0.0024614
0.0198500 0.0000100 0.0000300 0.6000000 0.0000032 0.0000271 0.0024086
0.0198500 0.0000100 0.0000300 1.2000000 0.0000050 0.0000291 0.0023772
0.0198500 0.0000100 0.0000300 1.8000000 0.0000047 0.0000325 0.0023501
0.0198500 0.0000100 0.0000400 0 0.0000039 0.0000314 0.0023373
0.0198500 0.0000100 0.0000400 0.6000000 0.0000037 0.0000297 0.0023687
0.0198500 0.0000100 0.0000400 1.2000000 0.0000045 0.0000297 0.0023972
0.0198500 0.0000100 0.0000400 1.8000000 0.0000051 0.0000331 0.0023486
0.0198500 0.0000100 0.0000500 0 0.0000047 0.0000336 0.0023129
Thank you so much.

Best Answer

Give the command
format long g
The content of the matrix is not changing, only the display of it is. Notice the
1.0e+05 *
which means that the values below that need to be multiplied by 1.0e+05 to understand the values that are stored.
That kind of output with a multiplier at the top is used with format short in order to support a more compact output with limited space.
Related Question