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
 Origin Forum
 getn-function, cell value

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
RedAndWhite Posted - 07/12/2012 : 10:15:48 AM
Hi,

Is it possible to access cell values with the getn-function directly?

I am currently using the following code, but that way i am getting a lot of variables to use.

win -a book1

aa$ = cell(4,42)$;
bb$ = cell(5,42)$;
.
.

getn
(name-1) aa$
(name-2) bb$
.
.

I tried

(name-1) cell(4,42)$

but it doesent work.

Thanks,
Stefan


5   L A T E S T    R E P L I E S    (Newest First)
Hideo Fujii Posted - 07/13/2012 : 6:25:07 PM
Hi Stefan,

There is no tutorial, but LabTalk Guide has the explanation of "substitution notations",
$(...) and %(...) in the LabTalk help:

LabTalk Programming> Guide> Language Fundamentals> Special Language Features> Substitution Notation

Or, the same online:
http://wiki.originlab.com/~originla/ltwiki/index.php?title=LabTalk:Substitution_Notation

Hope this helps.

--Hideo Fujii
OriginLab
RedAndWhite Posted - 07/13/2012 : 3:52:39 PM
Hi Hideo,

Thanks you very much. I am pretty new in scripting, so there are a lot of problems rising ;)

Is there any good tutorial for learning the notations, for example, like "$", "%" and "!" ???


Stefan
Hideo Fujii Posted - 07/13/2012 : 11:25:03 AM
Hi Stefan,

Sure, as LabTalk is an interpreter language, you can compose a variable name, etc.
in a string way. For example,
aa1$="A";
aa2$="B";
aa3$="C";
for(ii=1; ii<=3; ii++) {
  cell(ii,1)$ = aa$(ii)$;
};
should work. Please note that the $(...) notation to convert a number to a string.
Also, I used "ii" instead of "i" because it is a system variable in Origin.

--Hideo Fujii
OriginLab
RedAndWhite Posted - 07/13/2012 : 02:53:36 AM
Hi Hideo,

Thanks for your reply.

I thought about another way. Is it possible to have a changing/running variable, like aa1, aa2, aa3,...
and put such into a loop, like:


for(i=1; i<=20; i++)
{
cell(i,40)$ = aa(i)$;
};


Stefan
Hideo Fujii Posted - 07/12/2012 : 6:27:55 PM
Hi Stefan,

GetN command takes only variable names there as the obtained values from the interaction will be set to these variables.

One possible way you may consider is to define a macro such as:
///////////////////////
def mycells {
  aa$ = cell(%1,42)$;
  bb$ = cell(%2,42)$;
  getn (name-1) aa$ (name-2) bb$;
  cell(%1,42)$=aa$;
  cell(%2,42)$=bb$;
}
////////////////////
Then, when you run the following macro calling command with arguments:

  mycells 4 5;

Hope this helps.

--Hideo Fujii
OriginLab

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