Invalid Matrix TokenHi. I didn't find anything about this beside <https://community.jmp.com/t5/Discussions/invalid-matrix-token/td-p/2111> (a terribly formatted post) and nothing in the Scripting Index. What is an "invalid matrix token" error? What does it mean?
When I try to instantiate a matrix in my script like
m = [i j];
where and are numerical variables, it throws the error and points at i.
I think that's all the context I can give. Let me know if any clarification specifically is in order, I can try to help you help me.
Cheers,
Mike
Automation and ScriptingRe: Invalid Matrix TokenHi there,
@jthi provided an answer with hard to find syntax. I am adding on a bit as an FYI. Being a senior citizen, I still like the concept of allocating space for matrix stoage and releasing unused. It saves the need to concatenate, and might be a time savings especially for potentially large matrices.
Also, I think a simple method to create matrices is to use JMP's J function, it is listed in the Scripting Index > Functions > Matrix.
Below is a simple script demonstrating its use. FYI.
Names Default To Here( 1 );
m1x2 = J( 1, 2, 0 ); // a 1x2 matrix of zeros
m2x1 = J( 2, 1, Empty() ); // a 2x1 matrix all empty values
Show( m1x2, m2x1 );
imax = 100;
jmax = 1000;
//like an ALLOCATE or DIM
mm = J( imax, jmax, Empty() );
//within the program logic and counting say imax = 5 and jmax =3;
imax = 5;
jmax = 3;
//like a redimension
mm = mm[1 :: imax, 1 :: jmax];
Show( mm, N Col( mm ), N Row( mm ) );
Re: Invalid Matrix TokenFor Matrix Concatenation JMP Help will most likely have the answers JMP Help - Matrix Concatenation
Also remember to set the value to old matrix if you want to change the value
Names Default To Here(1);
i = 1;
k = 1;
m1 = Matrix({{i, k}}); //(1x2)
Write(m1);
Write("\!N");
m1 |/= [2 2]; //or m1 = m1 |/ [2 2]; or m1 = VConcat(m1, [2 2]);
Write(m1);Re: Invalid Matrix TokenOkay will do, sorry about the unneccesary post down there, didn't see your response here. Thank you greatly!Re: Invalid Matrix TokenI am having trouble concatenating using Concat() or |/ my starting array and additional elements. When I Write() the output, it is equivalent to the starting array, nothing was concatenated (result is [0 0]).Re: Invalid Matrix TokenPlay around with this example:
Names Default To Here(1);
i = 1;
k = 1;
m1 = Matrix({{i, k}}); //(1x2)
m2 = Matrix({{i}, {k}}); //(2x1)
Show(m1, m2);and check the Construct Matrices From Lists from the link I provided earlier.
Re: Invalid Matrix TokenThanks, @jthi. That works!
Can you comment briefly on dimensionality? I think I figured it out, {{}{}} is a 2x0, but I don't know how to make a 0x2.
Mike
Re: Invalid Matrix TokenCannot exactly explain the error message. Most likely related to this Construct Matrices and in the end:
Construct Matrices from Expressions
To construct matrices from expressions, use Matrix(). Elements must be expressions that resolve to numbers.
Names Default To Here(1);
i = 1;
k = 1;
m = Matrix({{i, k}}); //[1 1]