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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Plotting only recently imported books

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Clairekun Posted - 02/18/2014 : 02:45:14 AM
Origin Ver. and Service Release (Select Help-->About Origin): 9
Operating System: Windows 7

Hello,

This might have been asked before, but I failed to find the post.

I have a script where a dialog prompts me to select files to import. I would like to know if there is a way to plot those new books exclusively.

This is my script:

quote:

string fns; //Replace filepath with the actual path
dlgfile g:=*.txt m:=1 f:=fns$ t:="Select CV data" init:="F:\" ;

int n = fns.GetNumTokens(CRLF); //Gets the info from those files
impasc fname:=fns$ //Import command
options.ImpMode:=3 //Import to new books
options.Sparklines:=2 //Sparklines if there are over 50 data cells
options.Names.AutoNames:=0
options.Names.FNameToBk:=1 //Enable partial renaming: file name to workbook (file extension included)
options.Names.FNameToBkFrom:=1 //Position of the first letter in partial renaming
options.Names.FNameToBkTo:=-4 //Position of the last letter in partial renaming. -4 removes the last 4 letters; in this case, file extension
options.Names.FNameToSht:=0
options.Names.FNameToBkComm:=0
options.Names.FNameToColComm:=0
options.Names.FPathToComm:=0
options.FileStruct.NumericSeparator:=0 //Decimals are after a dot (90.25). For 90,25 write 1 instead.
options.FileStruct.Delimiter:=2; //Columns are delimited by a tab or space in the original ASCII file.

//Column editing and plotting

doc -ef W
{
string str$ = page.label$;
plotxy iy:=(1,3) plot:=200 ogl:=[<new>];

page.label$ = str$; // Set the graph Long Name the same as the workbook name
page.title=1; // Show just the Long Name
label -r legend; //Remove all legends
};



I must say the original importing script was for all data files in a folder, so the script you can see for plotting includes also older books in my project. Thus, I end up with duplicated plots.

I would need to modify the script so that only the files I just imported were plotted.

What can I do?

Thank you.
2   L A T E S T    R E P L I E S    (Newest First)
Clairekun Posted - 02/19/2014 : 04:34:51 AM
Since I have many data files, importing to new sheets would make browsing among them a bit uncomfortable, so I tried the last one.

It works like a charm, thank you :)
greg Posted - 02/18/2014 : 09:31:05 AM
If you set import mode to Start New Sheets (4), then your plotting need only loop over the sheets in the current book:

string strBk$ = %H;
loop(ii,1,page.nlayers)
{
win -a %(strBk$);
page.active = ii;
plotxy iy:=(1,3) plot:=200 ogl:=[<new>];
// new naming code
label -r legend; //Remove all legends
}

You would probably need to change your import naming options and resolve how the graphs would be named.

Another option is to do the imports individually in a loop and plot after import. This option makes use of your renaming:

string fns; //Replace filepath with the actual path
dlgfile g:=*.txt m:=1 f:=fns$ t:="Select CV data" init:="F:\" ;

int n = fns.GetNumTokens(CRLF); //Gets the info from those files
loop(ii,1,n)
{
file$ = fns.GetToken(ii,CRLF)$;
impasc fname:=file$ // IMPORT JUST ONE FILE
options.ImpMode:=3 //Import to new books
options.Sparklines:=2 //Sparklines if there are over 50 data cells
options.Names.AutoNames:=0
options.Names.FNameToBk:=1 //Enable partial renaming: file name to workbook (file extension included)
options.Names.FNameToBkFrom:=1 //Position of the first letter in partial renaming
options.Names.FNameToBkTo:=-4 //Position of the last letter in partial renaming. -4 removes the last 4 letters; in this case, file extension
options.Names.FNameToSht:=0
options.Names.FNameToBkComm:=0
options.Names.FNameToColComm:=0
options.Names.FPathToComm:=0
options.FileStruct.NumericSeparator:=0 //Decimals are after a dot (90.25). For 90,25 write 1 instead.
options.FileStruct.Delimiter:=2; //Columns are delimited by a tab or space in the original ASCII file.
// NOW PLOT
string str$ = page.label$;
plotxy iy:=(1,3) plot:=200 ogl:=[<new>];
page.label$ = str$; // Set the graph Long Name the same as the workbook name
page.title=1; // Show just the Long Name
label -r legend; //Remove all legends
} // Next file

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000