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

How do I Run a Matlab function from jsl Script.

I Have two pretty beefy codes, one in Matlab that does some very specific Matlab stuff that outputs a csv file. I then also have a jsl script that takes that CSV file and does a bunch of analysis and compiles it all into a journal. What I used to take a week doing, these two codes run will be done in 2 minutes. Perhaps I am getting greedy.

But I would love to run JUST my JSL script, where the begining of the script, launches the matlab code, returns the csv file to the jsl script and then the script does its thing. 

 

Ive been reading about integrating Matlab and have succesfully established a link and done some *simple* vector stuff to verifiy its working. 

 

However, I am unsure as to how to reference my Matlab function.

I've named the function jmp.

And in JSL

mc = MATLAB Submit("jmp" );

which returns

Unrecognized function or variable 'jmp'.

 

I then added my jmp function path to the the matlab enviroment so that it could be referenced outside of the directory. but I get the same error.

 

I also tried copying the function code into the "", but this was tricky because my code has many " and '. So the syntax kept on unselecting and selecting the code.

 

Any input would be appreciated.

 

Any input on running beefy matlab code from jmp?

1 REPLY 1
Byron_JMP
Staff

Re: How do I Run a Matlab function from jsl Script.

Its been a while since I work between JMP and Matlab.

The scripting index has this one specific example that would be useful to use as a template

Byron_JMP_0-1665678563431.png

 

in the example, this part of the code is particularly useful:

ml = MATLAB Execute(
	{v, m, a, d},
	{x, z, a, d},
	"\[
a = v * m; % matrix product
d = v / m; % = v * inv(m) called Right division
z = m \ v; % = m * inv(v) called Left division
x = m .* v; % element-wise product
]\"
);

note that bracketing text with special characters in   "\[   ]\"  makes JMP ignore ', and ".  

// for example
string = "\[ today is "wonderful" ]\" 

// returns a variable named string that contains
 // " today is \!"wonderful\!" "

// note wonderful is in quotes, and since the whole contents are a string,
// the whole string is in quotes too.
JMP Systems Engineer, Health and Life Sciences (Pharma)