Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What does double (a (::,1)) mean in Matlab?
What does double (a (::,1)) mean in Matlab?
Double (a (:,1)) in Matlab refers to the forced conversion of all elements on the 1 page of the three-dimensional matrix A into a double double precision numerical type.

For a two-dimensional matrix, two dimensions are rows and columns, while the dimensions of a three-dimensional matrix are rows, columns and pages (or layers); A (::,1) means all rows and all columns on 1 page, that is, all elements on 1 page.

A is a three-dimensional matrix, a (:,1) is a two-dimensional matrix, and the third dimension is 1, Double (A (:,1)) turns this matrix into double precision.

Extended data:

Matters needing attention

In matlab, in order to ensure the accuracy, the data type of the calculated image matrix I will change from unit8 to double. ?

If we run imshow(I) directly, we will find that a white image is displayed. This is because imshow () displays images in the range of 0~ 1 for double type, that is, when it is larger than 1, it displays white, while imshow displays uint8 type in the range of 0~255.

The solution is as follows:

1、imshow(I/256); % Convert the image matrix to 0- 1?

2、imshow(I,[]); % Automatically adjust the range of displayed data?

Inshow (Unit 8 (1)); % to unit 8