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
 Extracting data from worksheet using longnames
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

HaroldPit

3 Posts

Posted - 11/22/2011 :  11:35:48 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Origin Pro 8.5.0G SR1
Operating System: WINXP

Hi everyone,

I'm looking for a way to extract columns whose longnames are equal to an alphanumeric input (like "abc12") from a worksheet. Is there a way to make wkx search through the longnames and only extract those columns that I specified?

Background: I have worksheets that have up to 100 datasets that each consist of up to 10 different subdatasets. Each of the 100 datasets has the same 10 subdatasets as columns "abc12" def34" "ghi78" and so on. I want to create a worksheet by extracting only columns with a longname "abc12". Is that possible? In the end they will be XYZconverted and then converted into a Matrix for 3D plotting.

Sam Fang

293 Posts

Posted - 11/23/2011 :  06:01:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can try following script.
---------------------------

int nc=wks.ncols;
%A=page.name$;
%B=page.active$;
newbook;
jj=1;
for(ii=1; ii<=nc; ii++)
{
string str$=[%A]%B!col($(ii))[L]$;
 if (str.CompareNoCase("abc12")==0)
 {
   range ra=[%A]%B!col($(ii));
   col($(jj))=ra;
   jj++;
  }
}

------------------------------------

Sam
OriginLab Technical Services
Go to Top of Page

HaroldPit

3 Posts

Posted - 11/24/2011 :  11:11:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Sam,

In the meantime I circumvented this problem by importing my data into discrete worksheets where all the columns are identical from worksheet to worksheet. But your code will come in handy for a similar problem I have.
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