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
 Selecting non-masked rows in a range

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
thiago.maf Posted - 06/12/2009 : 2:12:49 PM
Origin Ver. and Service Release (Select Help-->About Origin): 8.0 SR5
Operating System: Windows 7

Hi everybody,

I have worksheets with four columns.
I want to export all data that is not masked. Something like that:

* Set the active worsheet as a range;
* Exclude masked rows from this range;
* Save range to a file.

I'm in trouble to remove masked rows from my range. Anyone know anhything about it? I can't find any in Wiki or in this board? Did I miss something?

Thanks
10   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 06/14/2009 : 9:17:28 PM
When I tried, I saw txt file created, so you need to give some details on how you saw failure.

Can you try writing to a different location? as there might be limitation of creating TXT file on that D: root path? Can yuo try like putting it to

c:\test\myfile.txt


CP
thiago.maf Posted - 06/13/2009 : 10:15:00 PM
It work fine, but simply don't export in txt mode.
cpyang Posted - 06/13/2009 : 10:12:05 PM
I tried with some simple data and setting some cells in col(A) as missing values and it worked for me, so can you give some details on how it didnt work for you?

CP
thiago.maf Posted - 06/12/2009 : 4:43:09 PM
Nope.... doesn't work.
I've tried this.
greg Posted - 06/12/2009 : 4:39:54 PM
wxt test:="col(A)<i>==0" ow:=[<input>]<new name:=TempForExport>;
expasc iw:=TempForExport type:=1 path:="D:\MyData.txt" short:=0 long:=0 unit:=0 comment:=0;
layer -d;
thiago.maf Posted - 06/12/2009 : 4:32:24 PM
MUCH BETTER! Work well!

Can I ask some?
How can I save files in *.txt format?

http://www.originlab.com/www/helponline/origin8/en/X-Function/X-Function.htm#X-Function/expASC.html
This doesn't help.... =/

THANKS! A LOT!
greg Posted - 06/12/2009 : 4:11:09 PM
Assuming you want to maintain row integrity (i.e. you really have masked all column cells in any given row), then you need only examine one column and the whole thing can be done in three lines:

wxt test:="col(A)<i>==0" ow:=[<input>]<new name:=TempForExport>;
expasc iw:=TempForExport path:="D:\MyData.dat" short:=0 long:=0 unit:=0 comment:=0;
layer -d;
thiago.maf Posted - 06/12/2009 : 3:56:41 PM
Dudes.... this isn't a good way for me.

My worksheet is too big for this method, it's too much slow.

Anyone know another method, via range, that I have not to check every row?
How can I use FindMasks?

Thanks
thiago.maf Posted - 06/12/2009 : 3:51:04 PM
Here is the working code.

Thanks and sorry for the odd topic.

// Get number of rows in current sheet
irows = wks.maxrows;
// Save name of current sheet in %a variable
%a=%h;
// Create a new sheet
win -t;
%z = %h;
// Initialize counter
inum = 1;
// Loop over all rows of source sheet
for(ii=1; ii<=irows; ii++)
{
// If cell in 1st col is masked...
if( 1 != ismasked(ii, %(%a,1)) )
{
for (jj=1; jj<=wks.nCols; jj++) {
// Copy over to destiation
%(%h,jj,inum) = %(%a,jj,ii);
}

// Update counter
inum++;
}
}
wks.export.cntrl = 2;
save -wh %h %1;

win -c %h;
thiago.maf Posted - 06/12/2009 : 3:37:17 PM
Hi...

Sorry, I've found something here (http://www.originlab.com/forum/topic.asp?TOPIC_ID=3453) that could help me.
It's a bit different from what I've told here, but...

Here's my code:

// Get number of rows in current sheet
irows = wks.maxrows;
// Save name of current sheet in %a variable
%a=%h;
// Create a new sheet
win -t;
// Initialize counter
inum = 1;
// Loop over all rows of source sheet
for(ii=1; ii<=irows; ii++)
{
// If cell in 1st col is masked...
if( 1 != ismasked(ii, %(%a,1)) )
{
for (jj=1; jj<=wks.nCols; jj++) {
// Copy over to destiation
%(%h,jj,inum) = %(%a,jj,ii);
}

// Update counter
inum++;
}
wks.export.cntrl = 2;
save -wh %h "D:\Unicamp\Biofótons\Dados\1s08\Dados\Série T\Coordenadas\teste.txt";
win -c %h;
}

The last line (win -c %h) was supposed to close and del the created (temp) Workbook. But it close and del every workbook in the folder.
Plus, I've this error message: Error: "%
LabTalk expression error: 2"

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