cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • 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
mostarr
Level IV

Finding the Location of a Column Name Amongst a List of All the Column Names in a Data File

As the post subject implies, I'm trying to find the loc # of a col identified by name in a given data file. I have the column name. Here is my code:

 

column_names = datatable << Get Column Names();
Write(column_names); column_position = loc(column_names, "ARBITRARY COLUMN TITLE/NAME"); Write(column_position);

Write(column_names) works but Write(column_position) outputs an empty matrix []. I don't know why this doesn't work. Any thoughts? I copy pasted the title of the column name, replaced for confidentiality but here denoted by "ARBITRARY COLUMN TITLE/NAME", so it should match exactly.

 

Mike

2 REPLIES 2
mostarr
Level IV

Re: Finding the Location of a Column Name Amongst a List of All the Column Names in a Data File

I did look up the info at <https://www.jmp.com/support/help/en/16.0/index.shtml#page/jmp/get-column-names.shtml> but it didn't help with the bug.
jthi
Super User

Re: Finding the Location of a Column Name Amongst a List of All the Column Names in a Data File

You might have to add String to << get column names also try using Contains() instead of Loc().

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
colNames = dt << Get Column Names(String);
Close(dt, no save);
Contains(colNames, "height");
-Jarmo

Recommended Articles