cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lwx228
Level VIII

Can text formatted content be written to the matrix and matched?

Can text formatted content be written to the matrix and matched?
For example, "Big Class" and "Big Class Families" match specified data by name.
1. "Big Class" Delete the "weight" column of "Big Class", write the "name" and "height" column into matrix ar, and add 2 columns to this matrix to store the "weight" data of matching "Big Class Families" and the following calculation results.
2. Use the corresponding "weight" data in "Big Class Families" in the form of matrix.
3. Get the "weight" of the match divided by the "height" in the matrix ar.

d1 = Open( "$SAMPLE_DATA/Big Class.jmp" );
d2 = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
d2 << Sort( By( 2 ), Order( Descending ), replace table );
d1 << delete columns( "weight" );
ar = d1 << GetAsMatrix( {1, 4} );
br = d2 << GetAsMatrix( {2, 6} );

This is just for illustrative purposes.

 

Thanks Experts!

2 REPLIES 2
Georg
Level VII

Re: Can text formatted content be written to the matrix and matched?

I think for use of text and numbers together, a table is the best container.

In a matrix there will not fit any text.

So why not use join of both tables to match the data by name?

In this case the join is not well defined, because there are two "ROBERT".

 

d1 = Open( "$SAMPLE_DATA/Big Class.jmp" );
d2 = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
d2 << Sort( By( 2 ), Order( Descending ), replace table );
d1 << delete columns( "weight" );

d1 << Join(
	With( d2 ),
	By Matching Columns( :name = :name ),
	Drop multiples( 0, 0 ),
	Include Nonmatches( 0, 0 ),
	Preserve main table order( 1 )
);
Georg
lwx228
Level VIII

Re: Can text formatted content be written to the matrix and matched?

OK, thank you! Let me ask you another example.