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
 text in column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

uli_15

Germany
Posts

Posted - 12/10/2008 :  11:12:46 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and SR (Select Help-->About Origin): 7.5 SR6
Operating System: Win XP SP2

Hello,

I have a worksheet "parameter" which contains names in the first column (which has the column name "names" as well) and values of parameters in the other columns. For example, I have "n266" in the first column.
Imagine I have another worksheet named "n266at1V". After extracting teh first 4 characters, i.e. "n266", I would like to find the corresponding paramter values by comparing the string "n266" with the content of the first column of the wks "parameter". However, I do net get it to work.
And it seems to be independent of the nature of the first column in "parameter", i.e. if it is an X, Y or caption type column.

If it would be numeric, I could access it via $(parameter_names[j])
but this does unfortunately not work.

Can you help?

Regards,
Uli

VincentLiu

China
Posts

Posted - 12/11/2008 :  12:58:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Uli,

Could your paste your codes here? Or you can send your codes through

http://www.originlab.com/www/company/qform.aspx?s=1&

Then we can see whether can solve the problem.

Best regards,
Vincent Liu
OriginLab Technical Services
Go to Top of Page

uli_15

Germany
Posts

Posted - 12/16/2008 :  04:59:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
[quote]Originally posted by uli_15

Origin Ver. and SR (Select Help-->About Origin): 7.5 SR6
Operating System: Win XP SP2

Hello,

I have a worksheet "parameter" which contains names in the first column (which has the column name "names" as well) and values of parameters in the other columns. For example, I have "n266" in the first column.
Imagine I have another worksheet named "n266at1V". After extracting teh first 4 characters, i.e. "n266", I would like to find the corresponding paramter values by comparing the string "n266" with the content of the first column of the wks "parameter". However, I do net get it to work.
And it seems to be independent of the nature of the first column in "parameter", i.e. if it is an X, Y or caption type column.

If it would be numeric, I could access it via $(parameter_names[j])
but this does unfortunately not work.

Can you help?

Regards,
Uli


Hello Vincent Liu,

I cannot paste all the code cause it is a rather large script.
I will try to explain the part of the code I pasted below.
Within the script, a worksheet "namepara" is created which contains names in the first column and values (of parameters) in the other columns. The names in the first columns are from the type "n123". And there are worksheets with data (which is also plotted) which have names like e.g. "n123at1V".
As I would like to sort the project by putting worksheets and corresponding graphs into subfolders, I would like to use a loop where the name of a worksheet (e.g. "n111at0V") or rather the first 4 characters ("n111") is compared with the content of the first column of "namepara".

This part of the code is:
>>>

j=1;
doc -e W
{
for (j=1;j<AnzahlDateien;j+=1)
{
if(%[%H,5]==namepara(1)[j]
{
type -c namepara(5)[j];
wks.col2.label$=namepara(5)[j];
wks.col3.label$=namepara(5)[j];
};
};

>>>

Therein, AnzahlDateien is just the number of worksheets.
The problem is that I cannot access the information namepara(1)[j]. The name of the first column is "ame", so I also tried namepara_ame[j] but did not succeed.

I hope I could make it more clear...

Regards,
Uli
Go to Top of Page

VincentLiu

China
Posts

Posted - 12/18/2008 :  04:13:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Uli

You may try to replace your codes with following codes:

doc -e W
{
 %A = %[%H,5]; // part name of the Current worksheet
 for (j=1;j<AnzahlDateien;j+=1) 
 {
  %B = namepara_ames[j]$; //The 1st column's name is "ames";
  if("%A"=="%B")
  {
  %W = namepara_5thCol[j]$;//Assume the 5th column's name is "5thCol";
  type -c %W;
  wks.col2.label$=%W; 
  wks.col3.label$=%W;
  }
 }
}

To use the codes, please first change the 5th column's name "5thCol" to the real name.

Please pay attention to the following things:

1. To know more about accessing the dataset elements, please select Help-> Programming-> LabTalk Language Reference-> Overview of the LabTalk Language-> Data Types-> Datasets-> Accessing Dataset Elements. In that page, you can see there are 4 different methods to access the cell contents.

2. To know more about comparing strings, please select Help-> Programming-> LabTalk Language Reference-> Overview of the LabTalk Language-> Data Types-> String Variables-> String Comparison. According to this, we need to write the comparison line to "%A" ="%B", not %A = %B.

3. You missed a ")" in the beginning of "if" structure in original codes.

Hope these can be helpful.

Best regards,
Vincent Liu
OriginLab Technical Services

Edited by - VincentLiu on 12/18/2008 04:17:19 AM
Go to Top of Page

uli_15

Germany
Posts

Posted - 12/18/2008 :  05:04:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by uli_15

Origin Ver. and SR (Select Help-->About Origin): 7.5 SR6
Operating System: Win XP SP2

Hello,

I have a worksheet "parameter" which contains names in the first column (which has the column name "names" as well) and values of parameters in the other columns. For example, I have "n266" in the first column.
Imagine I have another worksheet named "n266at1V". After extracting teh first 4 characters, i.e. "n266", I would like to find the corresponding paramter values by comparing the string "n266" with the content of the first column of the wks "parameter". However, I do net get it to work.
And it seems to be independent of the nature of the first column in "parameter", i.e. if it is an X, Y or caption type column.

If it would be numeric, I could access it via $(parameter_names[j])
but this does unfortunately not work.

Can you help?

Regards,
Uli



Hello VincentLiu,

just yesterday I found the fault which was to use
namepara_ame[j] instead of namepara_ame[j]$.
By the way, the comparison %[%H,5]==namepara_ame[j]$ works fine
in my script, but I will change it now to "%[%H,5]"=="namepara_ame[j]$"

Thanks a lot for your support,
Uli
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