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.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

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

I need help to make this loop work

Hello everybody.

Names Default To Here( 1 );
dt = Current Data Table();
For ( i = 1951, i <= 2021, i++, 


	gb = dt << Bivariate(
		Y( :PRCPC ),
		X( :Mes ),
		Fit Each Value( {Line Color( {208, 64, 86} )} ),
		Fit Line( {Line Color( {45, 177, 53} )} ),
		Fit Spline( 20.13724, {Line Color( {64, 110, 211} )} ),
		Where( :Any == [i]),
		SendToReport(
			Dispatch( {}, "Bivar Plot", FrameBox, {Frame Size( 486, 411 )} ),
			Dispatch( {}, "Linear Fit", "Summary of Fit",OutlineBox, {Close( 1 )} )
		),

	);
	gb << Save Picture( "/Users/mgc/Desktop/" || :Any == [i] || ".png", PNG );
	
),

. Thank you in advance

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: I need help to make this loop work

In your Where() clause, you need to remove the {} around the "i" variable.

In the Save Picture, you need to convert the value of "i" to a character before it can be concatenated to the string.

Names Default To Here( 1 );
dt = Current Data Table();
For ( i = 1951, i <= 2021, i++, 


	gb = dt << Bivariate(
		Y( :PRCPC ),
		X( :Mes ),
		Fit Each Value( {Line Color( {208, 64, 86} )} ),
		Fit Line( {Line Color( {45, 177, 53} )} ),
		Fit Spline( 20.13724, {Line Color( {64, 110, 211} )} ),
		Where( :Any == i),
		SendToReport(
			Dispatch( {}, "Bivar Plot", FrameBox, {Frame Size( 486, 411 )} ),
			Dispatch( {}, "Linear Fit", "Summary of Fit",OutlineBox, {Close( 1 )} )
		),

	);
	gb << Save Picture( "/Users/mgc/Desktop/" || char(i) || ".png", PNG );
	
);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: I need help to make this loop work

In your Where() clause, you need to remove the {} around the "i" variable.

In the Save Picture, you need to convert the value of "i" to a character before it can be concatenated to the string.

Names Default To Here( 1 );
dt = Current Data Table();
For ( i = 1951, i <= 2021, i++, 


	gb = dt << Bivariate(
		Y( :PRCPC ),
		X( :Mes ),
		Fit Each Value( {Line Color( {208, 64, 86} )} ),
		Fit Line( {Line Color( {45, 177, 53} )} ),
		Fit Spline( 20.13724, {Line Color( {64, 110, 211} )} ),
		Where( :Any == i),
		SendToReport(
			Dispatch( {}, "Bivar Plot", FrameBox, {Frame Size( 486, 411 )} ),
			Dispatch( {}, "Linear Fit", "Summary of Fit",OutlineBox, {Close( 1 )} )
		),

	);
	gb << Save Picture( "/Users/mgc/Desktop/" || char(i) || ".png", PNG );
	
);
Jim

Recommended Articles