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"
|