Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
uday_guntupalli
Level VIII

Set Platform Preferences using a variable

All, 

     I am trying to set platform preferences dynamically based on User Input collected using a UI. 

     Essentially, the user specifies which Matlab version is installed on their machine and I am using that to construct a 32-bit and a 64-bit path to the root variable for Matlab on the users machine.  However, this repeatedly results in an error: 

 

Unexpected "\MATLAB\R2018a\". Perhaps there is a missing "," or ")".
Trying to parse arguments of function "MATLABROOT32".

 

        Any help or advice is appreciated. 

 

user_matlab_ver = '2018a' ; // for example 
matlab_32bit_path = "C:\Program Files (x86)\MATLAB\R2018a\"; matlab_64bit_path = "C:\Program Files\MATLAB\R2018a\"; Eval( Parse( Eval Insert("\[ Platform Preferences( PathVar( MATLABROOT32( ^matlab_32bit_path^ ), MATLABROOT( ^matlab_64bit_path^ ) ) );]\" ) ) ); ConnectToMatlab = Expr( matlab_conn = MATLAB Connect(); matlab_conn_flag = matlab_conn << Is Connected; ); ConnectToMatlab;

 

Best
Uday
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
uday_guntupalli
Level VIII

Re: Set Platform Preferences using a variable

Thanks to @gblatz , the following works: 

 

Eval(
	Parse(
		Eval Insert(
				" Platform Preferences( PathVar( MATLABROOT32( \!"^matlab_32bit_path^ \!" ), MATLABROOT( \!"^matlab_64bit_path^\!" ) ) );"
			   )
	     )
   );
Best
Uday

View solution in original post

2 REPLIES 2
Highlighted
uday_guntupalli
Level VIII

Re: Set Platform Preferences using a variable

Thanks to @gblatz , the following works: 

 

Eval(
	Parse(
		Eval Insert(
				" Platform Preferences( PathVar( MATLABROOT32( \!"^matlab_32bit_path^ \!" ), MATLABROOT( \!"^matlab_64bit_path^\!" ) ) );"
			   )
	     )
   );
Best
Uday

View solution in original post

Highlighted
vince_faller
Super User

Re: Set Platform Preferences using a variable

The issue you had with the quoted strings is one of the reasons I usually prefer Eval(Substitute()) or Eval(EvalExpr())

 

Eval(
	Substitute(
		Expr(
			Platform Preferences(
				PathVar(
					MATLABROOT32( "DV_ML32" ),
					MATLABROOT( "DV_ML64" )
				)
			)
		), 
		"DV_ML32", matlab_32bit_path, 
		"DV_ML64", matlab_64bit_path
		
	)
	
);
Vince Faller - Predictum
Article Labels

    There are no labels assigned to this post.