1 int i,j; 2 for(i=0;i<M.rows;i++) 3 { 4 for(j=0;j<M.cols;j++) 5 { 6 //cout<<M.ptr<double>(i)[j] <<" "; 7 //cout<<M.at<double>(i,j)<<" "; 8 //cout<<((double*)M.data)[i*M.rows+j]<<" "; 9 } 10 cout<<endl; 11 }
赋值时候用第三种最快