cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-105943%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3Ecreare%20una%20matrice%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-105943%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3Evoglio%20creare%20un%20array%20num%2C%20ma%20come%20potrei%20farlo%3F%20esempio%3A%20se%20ho%20una%20tabella%20di%20dati%2C%20voglio%20usare%20il%20valore%20medio%20delle%20prime%20due%20colonne%20e%20il%20massimo%20delle%20ultime%20sei%20colonne%20per%20creare%20un%20array%2C%20ma%20non%20ci%20sono%20riuscito.%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Ea%3Dmean(%3Acolumn%201)%3B%0Ab%3Dmean(%3Acolumn%202)%3B%0Ac%3Dmax(%3Acolumn%203)%3B%0Ad%3Dmax(%3Acolumn%204)%3B%0Ae%3Dmax(%3Acolumn%205)%3B%0Af%3Dmax(%3Acolumn%206)%3B%0Ag%3Dmax(%3Acolumn%207)%3B%0Ah%3Dmax(%3Acolumn%208)%3B%0A%0Aarray1%3D%5Ba%2Cb%2Cc%2Cd%2Ce%2Cf%2Cg%2Ch%5D%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Eil%20file%20jsl%20che%20ho%20scritto%20%C3%A8%20sbagliato%2C%20come%20potrei%20correggerlo.%20Grazie%20mille.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-106093%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERi%3A%20creare%20un%20array%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-106093%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EGrazie%20mille!%20%C3%88%20un'ottima%20soluzione!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-105953%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERi%3A%20creare%20un%20array%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-105953%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EEcco%20un%20modo%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENamesDefaultToHere(1)%3B%0A%0A%2F%2F%20Make%20some%20data%0Adt%20%3D%20NewTable(%22Test%22%2C%0A%20%20NewColumn(%22Col%201%22%2C%20Formula(RandomNormal()))%2C%0A%20%20NewColumn(%22Col%202%22%2C%20Formula(RandomNormal()))%2C%0A%20%20NewColumn(%22Col%203%22%2C%20Formula(RandomNormal()))%2C%0A%20%20NewColumn(%22Col%204%22%2C%20Formula(RandomNormal()))%2C%0A%20%20NewColumn(%22Col%205%22%2C%20Formula(RandomNormal()))%2C%0A%20%20NewColumn(%22Col%206%22%2C%20Formula(RandomNormal()))%2C%0A%20%20NewColumn(%22Col%207%22%2C%20Formula(RandomNormal()))%2C%0A%20%20NewColumn(%22Col%208%22%2C%20Formula(RandomNormal()))%2C%0A%20%20%26lt%3B%26lt%3B%20addRows(10)%0A%20%20)%3B%0A%20%20%0A%2F%2F%20Get%20the%20statistics%20into%20a%20column%20vector%20using%20data%20table%20subscripting%0AmyStats%20%3D%20Matrix(%7B%0A%20%20%20%20Mean(dt%5B0%2C%201%5D)%2C%0A%20%20%20%20Mean(dt%5B0%2C%202%5D)%2C%0A%20%20%20%20Max(dt%5B0%2C%203%5D)%2C%0A%20%20%20%20Max(dt%5B0%2C%204%5D)%2C%0A%20%20%20%20Max(dt%5B0%2C%205%5D)%2C%0A%20%20%20%20Max(dt%5B0%2C%206%5D)%2C%0A%20%20%20%20Max(dt%5B0%2C%207%5D)%2C%0A%20%20%20%20Max(dt%5B0%2C%208%5D)%0A%20%20%20%20%7D)%3B%0APrint(Round(myStats%2C%203))%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
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