How to evaluate a matrix on the fly?<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />I am sure there is a simple answer to this problem but I can't figure it out. I am trying to compute distance between two objects using a distance matrix. I can't get the following JSL code to work:
dt = Open (dist matrix.jmp);
m = dt << Get All Columns As Matrix();
dt2 = Open(students.jmp);
col = Column("Prefect No");
B=col<
n=nrow(dt2);
a=j(n,1,0);
for(i=1,i<=n, i++, a=m[b,4]);
show(a);
I keep getting an error when evaluating m[,]. I tried Eval and other things but it doesn work.
Can anyone help?
Re: How to evaluate a matrix on the fly?I saved my dataset back to excel and brought it back into JMP. Now that dataset when is made into a matrix is in the correct order. I must have reset the default order of the columns when I recreated it in JMP. So now everything works. Thanks for the help.
Re: How to evaluate a matrix on the fly?Got an example data set? I had one and tried the following code, and it had the correct order. It replaced character values with '1's though, which is along the lines of what I'd expect.
dt = current data table();
m = dt << Get All Columns As Matrix();
show(m);
Re: How to evaluate a matrix on the fly?I figured out what the main error was. Some of the rows had missing values and when JMP tried to evaluate the missing subscript it bombed. So I used the following code:
for(i=1,i<=n, i++, if((not(is missing(A[i]))), C[i]=m[A[i],8], C[i]=.));
It works fine.
Now my only issue is that when I use
m = dt << Get All Columns As Matrix();
The subsequent matrix m is not in the order that I have it in the dataset. So trying to figure out how to keep the original order. Any ideas?