MATLAB: Round off problem in matlab

MATLAB

I have 4 variables each have 4 values (1×4) in it and I want to store all in value in 1 variable (4×4) but values are change when i do it.
MAV = [0.0924317411754942 0.0313003411430704 0.00365072354007141 0.00332056432198707]
waveLen = [172.697769103870 68.7603283596702 69.2536410243476 63.2141284111186]
zcdOut = [560 719 6155 6260]
slope_count = [478 212 4949 4830]
HG0_extracted_feature = [waveLen; MAV; zcdOut; slope_count]
it gives
173 69 69 63
0 0 0 0
560 719 6155 6260
478 212 4949 4830
note MAV values become zero, it round off waveLen, etc values…
how i correct it?
Thank you

Best Answer

Based on that display I suspect one or both of the variables zcdOut or slope_count are stored in an integer class. When you combine data stored in an integer class with data stored in a non-integer class, "all elements of the resulting matrix are given the data type of the left-most integer".
Consider converting the variable stored in an integer class to double before combining them into one array, so that the resulting matrix is also a double.
Related Question