Why am I getting Error 60

image

The procedure just squares two 3x3 matrices and repeats this n- times

function mxrand( m , n )
{
    x = Matrix( m, n );
    x = MxSetBlock( x, 0, m - 1,  0, n - 1, mtRandomA( ) );
    return x;
}

// define dimentions
dims = MxFromString( "{{3,3,3}}" );
_TRACE( MxToString( dims ) );

// initialize two  3x3 matrixes of random numbers
n = MxGetSize( dims , 1 );

for( j = 1; j < n ; j ++ )
{
    rows = dims[0][j];
    cols = dims[0][j - 1];
    w = mxrand( rows, cols );
    VarSet( "w" + j , w );
}


count = 0 ;

while( count < 10 )
{


    for( j = 1; j < n ; j ++ )
    {
        w = VarGet( "w" + j );

        wsquared = w ^ 2;

    }

    count ++ ;
}

I ran the formula in the editor and it does NOT generate any error.

Apparently you are running other formula/modified formula or running it in some non-standard way.

But if you are getting error message on your end then the error means what it says - you try to create matrix that has requested size greater than 2GB (536870912 elements). Note that copying matrices also involves creation.

You should DEBUG your code because quite obviously it is not doing what you thing it is doing. It is definitely creating larger matrices than you think it does.

You might be passing Nulls or some other not-a-numbers as dimensions.

Thank you @Tomasz,

I know that if you cannot replicate, its hard to pinpoint what's wrong

I'm running the formula the standard way,

I have stripped the code of all the unnecessary.
all 3 matrices are created correctly,
if I set the while loop iterations to 1 - the error disappears,
also reinstalled AB just in case and actually running the latest beta.

image

w1 = w2 = w3 = Matrix ( 3, 3 ,1 ); 

for( j = 1; j < 4 ; j ++ )
{
	w = VarGet ( "w" + j ); 
	_TRACE ( MxToString ( w )); 
}

iterations = 10 ; 
count = 0 ;

while( count < iterations )
{
    for( j = 1; j < 4 ; j ++ )
    {
       w = VarGet ( "w" + j ); 
       wsquared = w ^ 2;
    }

    count ++ ;
}

This looks like VC2017 compiler problem.

If you try this code in 32-bit version (VC6.0 compiler) it works perfectly fine. If you try with VC2005 it works fine. But VC2017 acts up.

Current solution: use 32-bit any version or use 6.20 official x64 (64bit).

On 64-bit version due to compiler differences you can not now retrieve matrices using VarGet. You can only use VarGet to retrieve scalar, array and text.

Once solution working with 64 bit compiler is found the limitation will be lifted (probably in 6.28.0)