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
 number of elements of a 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

carsten

Switzerland
78 Posts

Posted - 12/11/2007 :  11:08:12 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin):
Operating System:

How can I get the number of elements of a column of type TEXT?

Carsten

Mike Buess

USA
3037 Posts

Posted - 12/11/2007 :  12:55:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Same as Numeric or Text+Numeric column...

get col(columnName) -e npt;
npt=; // # of elements?

Mike Buess
Origin WebRing Member
Go to Top of Page

RedAndWhite

8 Posts

Posted - 06/27/2012 :  5:08:26 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Is it also possible to only get the number of element in a specific region of a column? Like the number of elements in column A in rows 10 to 100.

Stefan
Go to Top of Page

Kathy_Wang

China
159 Posts

Posted - 06/27/2012 :  10:45:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi RedAndWhite,

Is the number of elements equivalent to the size of your data selection?
If so, you may define your data selection as a range and get its size.

For example:

//Define your specific region as a range variable
range rr=col(1)[10:100];
//x is the range size
int x=rr.GetSize();
x=;


Kathy
Originlab
Go to Top of Page

greg

USA
1378 Posts

Posted - 07/11/2012 :  2:13:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Of course Kathy's example can be simplified to
100 - 10 + 1 = 91

But there are nuances to your question ..
If you mean you want the number of cells with text, then this will do the job:
range ra = col(2);
count = 0;
start = 10;
end = 100;
loop(ii,start,end)
{
if(ra[ii]$!="--") count++;
}
count=;

You can use the discfreqs X-Function to get a unique list of values.
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