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
 Put variable numeric value to X-Function argument

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
AKazak Posted - 02/19/2021 : 10:43:52 AM
OriginPro 2021b (64-bit) Beta 6 9.8.5.111
Windows 7 Pro x64 SP1

Greetings!

A simple, but important question: how does one put a variable numeric value to X-Function argument?

For example, this piece of code doesn't work:
plot_gboxindexed -r 1 irng:=[%(page.name$)]"%(wks.name$)"!3:%(wks.nCols)


How do I put the value of wks.nCols after the colon?

Thank you.

---
Andrey
4   L A T E S T    R E P L I E S    (Newest First)
AKazak Posted - 02/20/2021 : 04:01:57 AM
quote:
Originally posted by cpyang

0 was not generally implemented before, but in 2021b we try to cover all cases to allow 0, like

wcol(0)=col(A)
and in such case <end> cannot be used. <end> was only supported in range notation and in 2021b, 0 will work the same as <end> for range, but 0 can also be used like

layer -d 0
to delete the last sheet.

CP




Thank you.
Very handy syntax and I will be using it in my code.

---
Andrey
cpyang Posted - 02/19/2021 : 6:34:29 PM
0 was not generally implemented before, but in 2021b we try to cover all cases to allow 0, like

wcol(0)=col(A)
and in such case <end> cannot be used. <end> was only supported in range notation and in 2021b, 0 will work the same as <end> for range, but 0 can also be used like

layer -d 0
to delete the last sheet.

CP
AKazak Posted - 02/19/2021 : 3:14:24 PM
quote:
Originally posted by cpyang

% convert string expression to a string, so you should use $ to convert a numeric expression to a string, so try

plot_gboxindexed -r 1 irng:=[%(page.name$)]"%(wks.name$)"!3:$(wks.nCols)


better yet, use 0 as end


plot_gboxindexed -r 1 irng:=[%(page.name$)]"%(wks.name$)"!3:0


0 as end was not as fully implemented before 2021b, so might need to use <end>

You can read more about % and $ here

https://www.originlab.com/doc/LabTalk/guide/Substitution-Notation

CP



I will study more about % and $ @ https://www.originlab.com/doc/LabTalk/guide/Substitution-Notation.
Thank you for the suggestion.

As for 0 and <end>: Do both act in the same way? Can I use any?

---
Andrey
cpyang Posted - 02/19/2021 : 11:37:15 AM
% convert string expression to a string, so you should use $ to convert a numeric expression to a string, so try

plot_gboxindexed -r 1 irng:=[%(page.name$)]"%(wks.name$)"!3:$(wks.nCols)


better yet, use 0 as end


plot_gboxindexed -r 1 irng:=[%(page.name$)]"%(wks.name$)"!3:0


0 as end was not as fully implemented before 2021b, so might need to use <end>

You can read more about % and $ here

https://www.originlab.com/doc/LabTalk/guide/Substitution-Notation

CP


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