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
 Looping over User Parameter

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 - 07/07/2021 : 12:22:02 PM
OriginPro 2021b (64-bit) SR2 9.8.5.212
Windows 10 21H1 x64

Greetings!

I want to fix User Parameters using LT.
For this purpose, I want to loop over visible User Parameters.
To do this I need to get the total number of defined items.

How do I get User Parameter count?

Thanks.

---
Andrey
8   L A T E S T    R E P L I E S    (Newest First)
AKazak Posted - 07/21/2021 : 05:53:48 AM
quote:
Originally posted by cpyang

We added wks.UPC (user parameter count) for 2022, so it can be

loop(i,1,wks.upc) {wks.userparam$(i)$=;};


CP




Great idea!
Looking forward to testing this.

---
Andrey
cpyang Posted - 07/15/2021 : 5:49:54 PM
We added wks.UPC (user parameter count) for 2022, so it can be

loop(i,1,wks.upc) {wks.userparam$(i)$=;};


CP
AKazak Posted - 07/08/2021 : 09:08:04 AM
quote:
Originally posted by cpyang

There is no difference on how they work. Loop command was introduced first to cover the most typical use of a loop and for command was added later to be like C language.

CP




OK, thank you for clarifying this.

---
Andrey
cpyang Posted - 07/08/2021 : 06:56:35 AM
There is no difference on how they work. Loop command was introduced first to cover the most typical use of a loop and for command was added later to be like C language.

CP
AKazak Posted - 07/08/2021 : 06:19:51 AM
I had another side question.
https://www.originlab.com/doc/LabTalk/guide/Looping-Over-objs provides many examples using both for and loop LT commands.
What are the principal differences between for and loop commands?

---
Andrey
AKazak Posted - 07/08/2021 : 05:51:59 AM
quote:
Originally posted by cpyang

Try

loop(i,1,10){wks.userparam$(i)=;};


And to find the count, try

nn=0;loop(i,1,10) {if(wks.userparam$(i)) nn = i;};nn=;


CP



Got it!
Thanks.

---
Andrey
cpyang Posted - 07/07/2021 : 2:42:51 PM
Try

loop(i,1,10){wks.userparam$(i)=;};


And to find the count, try

nn=0;loop(i,1,10) {if(wks.userparam$(i)) nn = i;};nn=;


CP
AKazak Posted - 07/07/2021 : 12:42:09 PM
I tried using the following snippet:
for(int j = 1; j <= 10; j++)
  {
   type wks.UserParam$(j)$;
  }

However, when j equals from 1 to 3 it returns units of the columns.
This seems to be odd since UserParam should return parameter names.

---
Andrey

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