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
 Extracting Result of polyarea Command
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

BennettS

6 Posts

Posted - 11/02/2018 :  08:05:58 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2018b (64-bit)
Operating System: Windows 7

What ist the correct way to get the result from the polyarea command into an usable form to write it into a cell?
As far as I understood, the value of the "area" Output gets written in the result window, but is not accessible from the script window in an easy way.
So either asking for the value with a simple

area=;

after running the command or using it in a similar form to one of these methods

csetvalue col:=[Fit]Sheet1!col(A)[1] formula:="area";
[Fit]Sheet1!Cell(1,2) = area;

does not work.

Thanks for your help.

BennettS

6 Posts

Posted - 11/07/2018 :  05:22:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
A bit more digging got me the the rd Option for X-functions, but

polyarea iy:=(col(4),col(10)) type:=abs rd:=[Result]sheet1!;

does not lead to any result, although I can't tell of that's a specific problem with only polyarea or more general.
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 11/07/2018 :  11:59:24 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi BennettS,

I don't see "rd" parameter in the polyarea x-function in:
https://www.originlab.com/doc/X-Function/ref/polyarea

As far as I tried, the following code worked:
polyarea iy:=(col(1),col(2)) type:=abs area:=myarea;
range rr=[Result]!col(1);
rr[1]=myarea;
Make sense?

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 11/07/2018 5:13:33 PM
Go to Top of Page

BennettS

6 Posts

Posted - 11/08/2018 :  04:51:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hideo,

your solution works perfectly, thank you.
So the output from this X-function has to be stored immediately on execution and accessing the result log is not possible with Labtalk?

As for the rd option, I found it as a general remark here
https://www.originlab.com/doc/LabTalk/guide/XF-Input-and-Output
and tested if it was usable in this case too.
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 11/08/2018 :  11:55:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi BennettS,

Yes, this x-function sets the result to the specified (numeric) variable.

If you want to print something to Result Log, you can redirect the destination by setting the
"type.redirection" property to 16 like:
type.redirection=16;     //Output is redirected to Result Log
type -a Area: $(myarea,.3);  //or to print worksheet contents, run type.wks(Result);
type.redirection=32768;  //Output is set back to default
https://www.originlab.com/doc/LabTalk/ref/type-obj

Please try.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 11/08/2018 2:44:53 PM
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