cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

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

create an array

i want to create a num array, but how could i do it? example: if i have a data table,i want to use mean value of the first two columns and  maximum of the last six columns to make an array, but i failed. 

a=mean(:column 1);
b=mean(:column 2);
c=max(:column 3);
d=max(:column 4);
e=max(:column 5);
f=max(:column 6);
g=max(:column 7);
h=max(:column 8);

array1=[a,b,c,d,e,f,g,h];

 the jsl file i written is  wrong, how could i correct it. thank you very much.

2 REPLIES 2
ian_jmp
Level X

Re: create an array

Here's one way :

NamesDefaultToHere(1);

// Make some data
dt = NewTable("Test",
		NewColumn("Col 1", Formula(RandomNormal())),
		NewColumn("Col 2", Formula(RandomNormal())),
		NewColumn("Col 3", Formula(RandomNormal())),
		NewColumn("Col 4", Formula(RandomNormal())),
		NewColumn("Col 5", Formula(RandomNormal())),
		NewColumn("Col 6", Formula(RandomNormal())),
		NewColumn("Col 7", Formula(RandomNormal())),
		NewColumn("Col 8", Formula(RandomNormal())),
		<< addRows(10)
		);
		
// Get the statistics into a column vector using data table subscripting
myStats = Matrix({
				Mean(dt[0, 1]),
				Mean(dt[0, 2]),
				Max(dt[0, 3]),
				Max(dt[0, 4]),
				Max(dt[0, 5]),
				Max(dt[0, 6]),
				Max(dt[0, 7]),
				Max(dt[0, 8])
				});
Print(Round(myStats, 3));
Yu
Yu
Level II

Re: create an array

thank you very much! It is an excellent solution!

Recommended Articles