# Revision history [back]

### How to get data of Mat?

I want to get data of Mat. I found many pages with info. But i still have questions.

http://jayrambhia.wordpress.com/2012/06/23/get-data-from-mat-cvmat-in-opencv/ http://docs.opencv.org/trunk/doc/tutorials/core/how_to_scan_images/how_to_scan_images.html

I have it.

Mat lung_left( image_gray, Rect( 55, 100, 195, 290));
for( int i=0; i< lung_left.rows; i++){
for( int j=0; j< lung_left.cols; j++){
cout<<lung_left.at<float>(i,j)<<"\t";
}
}


In console, i got it: 26e+008 -1598.2 -5.2332e-06 ...

but if use it: " lung_left.at<float>(i,j) = 0; " in the cycle and print, i got it: 0 0 0 0 ...

It's strange, i can change values using .at<>(i,j) but i can't print the values rightly.

 2 retagged berak 29468 ●4 ●75 ●291

### How to get data of Mat?

I want to get data of Mat. I found many pages with info. But i still have questions.

http://jayrambhia.wordpress.com/2012/06/23/get-data-from-mat-cvmat-in-opencv/ http://docs.opencv.org/trunk/doc/tutorials/core/how_to_scan_images/how_to_scan_images.html

I have it.

Mat lung_left( image_gray, Rect( 55, 100, 195, 290));
for( int i=0; i< lung_left.rows; i++){
for( int j=0; j< lung_left.cols; j++){
cout<<lung_left.at<float>(i,j)<<"\t";
}
}


In console, i got it: 26e+008 -1598.2 -5.2332e-06 ...

but if use it: " lung_left.at<float>(i,j) = 0; " in the cycle and print, i got it: 0 0 0 0 ...

It's strange, i can change values using .at<>(i,j) but i can't print the values rightly.