i have two vectors
the first one is float as:
c=[2.5 4 6.5 4.5 3]; c1=[1 2 10 9];
when merge them as:
why c within c2 become [2 4 6 4 3]?
thanks in advance
No products are associated with this question.
I bet if you check class(c1) you will find it is an integer data type.
Because that's how MATLAB does it. If an integer is multiplied by a double, it gives a rounded integer result. Same thing if you combine them like you did. It does not promote the integer variable to the more general double like most languages, and like you would think - I don't know why, that's just the way it is. This was one of the most surprising things I learned when I was learning MATLAB. I can't find the explanation for this in the help - maybe someone else will say where it can be found.