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
 negative variable assignment... help pls.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

zskillz

USA
6 Posts

Posted - 10/11/2003 :  9:22:35 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
so I think that i must just be doing something stupid, but I cannot figure out how to assign a negative numeric value to a variable...

I am using originPro 7.

I have tried something along these lines in the script window...

a=-5;
type "($(a))";


and the readout is this

(--)



can anyone please tell me what the annoying little thing that I'm not doing is?

much appreciation!

-Z

cpyang

USA
1406 Posts

Posted - 10/11/2003 :  10:58:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
maybe you have a dataset called "a". Do a
list s;

and if you do see A as a dataset, you can delete it by

del a;



CP


Go to Top of Page

zskillz

USA
6 Posts

Posted - 10/12/2003 :  12:45:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
heh... perhaps it's just too late for me to understand, but does cpyangs' response answer my question... I'm having trouble understanding it.

-Z
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 10/12/2003 :  06:35:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
In script window,

list s

will list all the datasets in the current project. If "a" is one of the datasets, then you cannot use it as a variable, so you must delete this dataset first. You can also check if a variable is defined by

list -v

Once "a" is a dataset, you can make assignment like

a = -5;

but to access its value, you will need to do things like

type "$(a[1])"


CP




Go to Top of Page

zskillz

USA
6 Posts

Posted - 10/13/2003 :  11:13:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
ah.. thank you.. I was havnig trouble understanding what you said...

I will certainly try doing it again, but that is exactly how I tried assigning and printing the variable... I'm not sure why it wasn't working..

I'll try again and post if need be.

thanks
-Z
Go to Top of Page

verrallr@a

Canada
44 Posts

Posted - 10/14/2003 :  3:09:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If there is a danger that the letter a is already taken as a variable (or dataset), try using something that definitely isn't a variable; e.g. abzz.

abzz=-5;
abzz=;

works for me (the second statement simply prints out -5. I use Origin 7 on Windows NT.

R
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