The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Import+plot
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Beltza

Spain
1 Posts

Posted - 07/02/2014 :  1:45:04 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 9.0.0 SR2
Operating System: Windows 7 Ultimate 64 bit.
Hello. I got started with Labtalk recently and I have some problems. I want to write a script which will import some data and then plot it in the same graph and in the same layer. For this moment I have this sctipt for importing data:
dlgPath;
cd path$;
findFiles ext:=s*.txt;
impASC;

It calls a dialog window where I choose those .txt files I need to plot. Than I need to write another to plot the third and the ninth coloumn of all the books I have imported. I was thinking about using something like
for (ii = 1; ii <= count; ii ++)
{ plotxy iy:=[Bookii](Sheet1)!(3,9) plot:=200;
layer -n
}

and then join all the layers in one, but unfortunately in labtalk it does not work. Could somebody help me with this task, please? Thanks to everybody in advance.

greg

USA
1378 Posts

Posted - 07/02/2014 :  2:27:07 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
First, your script hasn't done anything to set 'count'.
Second, it doesn't make sense ( in Origin terms) to create new graph layers and then somehow get each plot into one layer.

Here, I create the graph window first, then loop over all the names gathered by 'findfiles' (delimited by Carriage Return, Line Feed - CRLF) and add the desired data to the graph layer:

dlgPath;
cd path$;
findFiles ext:=f*.dat;
win -t plot line; // line, scatter, linesymb, etc. e.g. your template
range raGr = !; // Point to the GraphLayer
for (ii = 1; ii <= fname.GetNumTokens(CRLF); ii ++)
{
newbook; // or newsheet
file$ = fname.GetToken(ii,CRLF)$; // Get next filename
impASC file$; // import it
plotxy iy:=(3,9) plot:=200 ogl:=raGr; // add to the plot
}
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000