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 for Programming
 LabTalk Forum
 Find number of rows per column

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
psgst Posted - 10/09/2006 : 10:19:08 AM
I want to cycle over several columns in a for-loop (which I have), but for each cycle (each cycle = processing 1 column) I want to find the number of rows containing data in that one column. Is there a function that does this?

3   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 11/08/2006 : 09:50:49 AM
If you have many columns or there are very many rows in the columns, you can speed up the process by just using the GET command :
loop(ii,1,wks.ncols) {
get wcol(ii) -e last;
type Column $(ii) has $(last) rows.;
}


Mike Buess Posted - 10/09/2006 : 2:25:24 PM
If column mm contains no missing values you can get the row count from nRows = sum.n. You code looks fine but vector math is much easier and quicker...

window -a perWks;
for(mm=1; mm<=wks.ncols; mm++)
{
sum(%(binWks,mm));
%(percWks,mm) = 100 * %(binWks,mm) / sum.total;
}

Mike Buess
Origin WebRing Member
psgst Posted - 10/09/2006 : 10:31:53 AM
In fact, I'll post my block of code here because I'm not sure if its going to work properly, and could do with some feedback on it. I can't test it myself until I know how to find the number of rows. Basically I've got a worksheet of binned data, and I'm trying to find the frequency by percentage to plot, so I'm looping through each row in each column and placing its percentage value in another worksheet, then I will plot my graph from the worksheet percWks.


window -a percWks;
for (mm = 1, mm <= nCol; mm++) // for number of columns
{
sum(%(binWks,mm));
colSum = sum.total;
nRows = // how do I do this?!

for (nn = 1, nn <= nRows; nn++) // for number of rows
{
percWks_$(col($(mm)[nn])) = (binWks_$(col($(mm)[nn])) / colSum) * 100;
}
}


Is this code valid?


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