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
 Origin Forum
 Import x, y; calculate log(y) and 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

ONeilll

33 Posts

Posted - 03/15/2017 :  03:43:44 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: 8G SR4 v8.0951
Operating System: W7

Hello!

I have the following import filter which imports and plots and x, z graph:
%A = page.info.system.import.filename$; //Get the filename
%B = %[%A, '.'];
plotxy iy:=((1,2)) plot:=200 ogl:=[<new template:= XRR_Templat name:= %A>]; // Plot data, rename the graph window

What I want to achieve is that x,y are importet and then log(y) is automatically calculated and plottet against x. Any ideas how to do that?

Thank you very much!

Kind regards
ONeilll

yuki_wu

896 Posts

Posted - 03/15/2017 :  05:09:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

After file imported, you need to add a column, and put the value of log (y) in the new column, then plot the graph. To achieve it, you can add a few lines of script in your import filter:

nn = wks.nCols; //Get the number of columns
wks.nCols = nn + 1; // Add a column in worksheet
col($(nn+1)) = log(col(2)); // Calculate the log value of column B
plotxy iy:=(1,$(nn+1)); //Plot x vs log(y)

Hope it helps.

Regards,
Yuki
OriginLab
Go to Top of Page

ONeilll

33 Posts

Posted - 03/15/2017 :  10:28:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Yuki,

thank you very much, your code works fine for me.

Kind regards
ONeilll
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