turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Problem using MATLAB Get to retrieve matrices and ...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 3, 2017 8:42 AM
(845 views)

Using a series of complex nested functions initiated by one script (imagemeasure5.m), I have created two structure arrays in MATLAB. These structure arrays each contain two scalars and two 1 column, ~ 500 row matrices. the structure arrays are named outputa and outputb. My goal is to individually save the elements in these arrays to variables in JMP

Everything I've found online and in other questions indicates that once MATLAB is initialized and a script is run, MATLAB Get can be used to retrieve data types including matrices & scalars and save them into JMP variables. Here are the three ways I've tried to do it, with all my matlab initialization codes included:

Platform Preferences( pathvar(MATLABROOT( "C:\Program Files\MATLAB\R2016b" ))); Names Default To Here( 1 ); gui_directory = "'C:\Users\mredford\Desktop\MATLAB Import 3.1'"; mlconn = MATLAB Connect(); // Connects to Matlab MATLAB Init(); // Initializes Matlab MATLAB Submit( "clc,clear all,close all,imtool close all" ); MATLAB Submit( "cd " || gui_directory ); Try( MATLAB Send( ::jmp_previous_path ), show("Previous Image Path Not Found") ); MATLAB Submit( "imagemeasure5" ); scalefactorone = MATLAB Get( outputa.Xs); //trying to reference using structure array scalefactortwo = MATLAB Get(pixmermm); // attempting to reference using a simple saved scalar variable scalefactorthree = MATLAB Get("pixpermm"); //trying quotes since some sources said to

For some reason, however, whether I am referencing a simple named scalar in MATLAB, or the structure array, or any other type of normal MATLAB variable, the output of Matlab Get() is ALWAYS 1. I know I can save the MATLAB data to a file and import it instead, but since this program will likely be run hundreds of times that seems excessive.

I don't think there is a problem with my connection, as the script is running and storing the variables in the workspace of MATLAB just fine. I can't figure out why this syntax seemingly works for everyone else or where I am going wrong.

I don't really mind how at this point, I just need a good way to script automatic storage of these variables in JMP for further analysis.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 3, 2017 6:06 AM
(1517 views)

Solution

If anyone is interested, I contacted JMP tech support and the following steps solved the problem:

1. individually saving structure array components in matlab as variables and then exporting to JMP (which I'd tried)

2. Using environment variables & a slightly different syntax:

Set Environment Variable("MATLABROOT","C:\Program Files\MATLAB\R2016a"); //helps locate matlab MLroot = Get Environment Variable( "MATLABROOT" ); MATLAB Submit("\[imagemeasure5]\"); //submits measurement script

3. Switching to an older version of matlab

1 REPLY

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 3, 2017 6:06 AM
(1518 views)

If anyone is interested, I contacted JMP tech support and the following steps solved the problem:

1. individually saving structure array components in matlab as variables and then exporting to JMP (which I'd tried)

2. Using environment variables & a slightly different syntax:

Set Environment Variable("MATLABROOT","C:\Program Files\MATLAB\R2016a"); //helps locate matlab MLroot = Get Environment Variable( "MATLABROOT" ); MATLAB Submit("\[imagemeasure5]\"); //submits measurement script

3. Switching to an older version of matlab

This widget could not be displayed.