cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
masonlee98
Level I

How to read-in singular lines of a txt file and pull data from that file

The goal of my code is with each iteration of a for loop it will read in a singular line from a txt file, put that data into a variable, and put that variable into a line of code that will pull data from a database.

I have a matlab code that pulls data from an excel sheet and trims the data into a certain number of characters and puts it into a txt file. I can easily change the matlab code to output this data differently if that would be easier for JMP to read in. 

I have attached my non-working code.

2 REPLIES 2
gzmorgan0
Super User (Alumni)

Re: How to read-in singular lines of a txt file and pull data from that file

Hmmm, your request is unclear to me.

 

Is your plan run the database extraction fro JMP or Matlab?

 

JMP can read an Excel file.  JMP can also extract data from an Excel file using the Excel Wizard (JMP13 and higher) or using SQL.  JMP has ben able to use an Excel workbook as a database since JMP 9. However, to use SQL to extract Excel and you have 64 bit JMP and 32 bit Excel, a one time special setup is needed to define the machine DSN. 

 

That said, this line of JSL from your script

Pnames = open("$Desktop/EPI-1310-EML_V004Pnames.txt");

is opening a table and Pnames is the refernce for that table and Pnames[i] makes no sense.

Does the Pnames.txt file have a header a column header?  If not, then uses this code like this

Opendt = Open( "$SAMPLE_IMPORT_DATA/EOF_comma.txt", Table Contains Column Headers( 0 ) );

If you do not have a header, and you Pnames.txt file is multiple lines, where each line is a parameter name, then to get the names use  Name = :Column 1[i] .

 

Yo need to show what Pnames.txt  and Pset.txt look like. 

 

 

 

masonlee98
Level I

Re: How to read-in singular lines of a txt file and pull data from that file

name = :Column 1[i]; solved the probelm I was having.

Thank you for the quick response.