You do not need to pin. Just assign one element at a time to the native mat variable,
R
.
array<array<double>^>^ myarray =
{
{1,2,3,4},
{5,6,7,8}
};
mat R(2,4);
for (size_t i = 0; i < 2; i++)
{
for (size_t j = 0; j < 4; j++)
{
R(i, j) = myarray[i][j];
}
}