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
 removing columns and rows

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
DanieleOrigin Posted - 12/01/2015 : 08:46:38 AM
Hi to everyone!
i'm trying to make some ripetitive processes automatic with labtalk. i attached my file in photos.
what i want to automatize is:
-duplicate in an other sheet
in the new sheet i want
-removal of the columns A, B, E, F, G
-removal of the rows from 1 to 2247 and the row called Sparklines (that is in yellow)
-substitute a group of yellow cell with new fields (as you can see in the second photo)
-confirm the operation with a pop-up mask

i've tried to automatise but i just managed to removed the columns.
can someone please help me, writing here the command i have to write?
thanks in advance and sorry for my bad english.


RAW FILE
http://www.originlab.com/ftp/forum_and_kbase/Images/Cattura5.PNG" border="0">
11   L A T E S T    R E P L I E S    (Newest First)
SeanMao Posted - 12/09/2015 : 10:05:21 PM
Hi,

After plotxy command line, add these two lines:


page.title=1; // Change window to display Long Name
page.longname$ = strSht$; // Set Long Name


Regards!

Sean

OriginLab Tech.
DanieleOrigin Posted - 12/09/2015 : 05:47:09 AM
Thanks! My team is really enthusiast!

they ask me another question: is it possibile to add automatic plot?
i managed to obtain a plot looking on the site with
plotxy iy:=(3,1) plot:=200;
but how can i obtain that plot with the same name of the worksheet it come from? (for example worksheetname+1 instead of Graph1, i haven't find a solution)
thanks for time you have been dedicating to us!

regards
SeanMao Posted - 12/08/2015 : 9:22:34 PM
Hi,

Try to replace the wcopy 1! 2! command line with:


string strSht$ = wks.name$+"_1";
wcopy 1! 2!;
wks.name$=strSht$;


The short name of your sheet contains spaces so it does not work at first.

Regards!

Sean
DanieleOrigin Posted - 12/08/2015 : 6:20:58 PM
Sean you are a boss!
the routine now is perfect, the only out-of-order command is

string strSht$ = wks.name$+"_1";
wcopy 1! [%H]%(strSht$)!;

in the place of

wcopy 1! 2!; // Duplicate 1st sheet to 2nd sheet

because when i use it, the new sheet (the duplicated one) has the name "0" and it is blank (it has just the yellow labels filled).
anyway you help us!
thanks a lot!

Daniele
SeanMao Posted - 12/06/2015 : 9:14:54 PM
Hi,

Q1:

type -b "Data manipulation is done!"; // Display a dialog with text


You can put this line at the end of data manipulation.

Q2:
string strSht$ = wks.name$+"_1";
wcopy 1! [%H]%(strSht$)!;


Just replace the wcopy 1! 2! to the code above. This will add "_1" to the sheet name of 1st one since it is forbidden to have two sheet the same name.

Regards!

Sean

OriginLab Tech.


DanieleOrigin Posted - 12/04/2015 : 2:08:43 PM
you are the best, dear sean!
thank you very much! it will change my work and the work of my team.
then, just one more thing...
-how can i obtain a final pop-up mask (to confirm to my team that the labtalk procedure has done properly)?
-how to duplicate the sheet mantaining the same name (instead of "Sheet 1")?
thanks in the name of whole my team.
SeanMao Posted - 12/04/2015 : 04:36:17 AM
Hi,

Sorry that I just found out this wks.deleterows() function is Origin 2016 SR0 new feature.

You can try:



range r2 = col(C)[1]:col(D)[2247];
delete r2;



Regards!

Sean
DanieleOrigin Posted - 12/03/2015 : 05:14:44 AM
thanks a lot SeanMao!!
it is almost perfect, but i have problem with rows: when i start the labtalk script, i don't know why the program doesn't remove the rows.
other commands are perfect.
can you please help me?
i'm running origin 9.2
SeanMao Posted - 12/03/2015 : 01:17:54 AM
Hi,

The LabTalk command is as following:


wcopy 1! 2!; // Duplicate 1st sheet to 2nd sheet
range r1 = (col(a),col(b),col(e),col(f),col(g)); 
delete r1; // Delete A, B, E, F, G
wks.deleteRows(1, 2247); // Remove row 1 to row 2247
wks.labels(-S); // Remove Sparkline
col(C)[L]$ = "E vs SCE"; // Label columns
col(D)[L]$ = "I";
col(C)[U]$ = "v";
col(D)[U]$ = "A/cm2";
wks.addcol(Log); // Add new column 
csetvalue col:=col(Log) formula:="log(abs(col(D)))"; // Set Column Formula


Just copy and paste it in Script Window and hit Enter to run.

Regards!

Sean

OriginLab Tech.
DanieleOrigin Posted - 12/02/2015 : 12:30:09 PM
You are right but I need to keep the original data in a sheet and the elaborated data in a second sheet (unfortunately).
If someone can help me in doing this, it will be wonderful.
kfauth Posted - 12/02/2015 : 05:13:10 AM
I would like to think that at least partially (if not all) can be done directly when importing. If you use the ASCII import wizard, then you can set it up to do what you want. Especially, you can get rid of the header information and you can deselect the automatic creation of sparklines. Whether you can do a partial import (starting from some specified row) -- I am almost sure you can configure that, too.

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