cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • See how to design an experiment, explore factor-response relationships, assess tradeoffs, and ID best settings. Register for Sep. 11 Mastering JMP.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
ravi_sasjmp
Level II

Max value of each row across multiple columns JMP10

When I run below script in JMP 10, I get an error message that says - argument should be matrix{1} in access or evaluation of 'Loc Max' , Bad Argument ...

Looks like data table indexing is a feature in JMP13. What would be the work around in JMP10?

dt = New Table( "Untitled",
New Column( "a", Numeric, Set Values( [1, 33, 1] ) ),
New Column( "b", Numeric, Set Values( [2, 2, 2] ) ),
New Column( "c", Numeric, Set Values( [333, 1, 0] ) ),
New Column( "maxval", numeric ),
New Column( "maxcol", Numeric )
);

colnames = dt << getcolumnnames;

For Each Row(
r = Row();
// 1::3 means columns 1 through 3. {a,b,c} would also work.
location = Loc Max( dt[ r, 1 :: 3] ); // location of maximum value in array
maxval = dt[r, location];
maxcol = colnames[location] << getname;
);

 

Thanks!

1 REPLY 1

Re: Max value of each row across multiple columns JMP10

You can get the values as a matrix first and then grab each row from the matrix instead of the data table:

dt = New Table( "Untitled",
	New Column( "a", Numeric, Set Values( [1, 33, 1] ) ),
	New Column( "b", Numeric, Set Values( [2, 2, 2] ) ),
	New Column( "c", Numeric, Set Values( [333, 1, 0] ) ),
	New Column( "maxval", numeric ),
	New Column( "maxcol", Numeric )
);

colnames = dt << getcolumnnames;

values = dt << Get As Matrix;

For Each Row(
	r = Row();
	// 1::3 means columns 1 through 3. {a,b,c} would also work.
	location = Loc Max( values[r, 1 :: 3] ); // location of maximum value in array
	maxval = dt[r, location];
	maxcol = colnames[location] << getname;
);

Recommended Articles