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
 Origin Forum
 Import quoted numeric strings as numbers

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
hpdab Posted - 01/24/2005 : 4:38:52 PM
I'm using Origin 7.5 to plot data collected with some legacy data acquisition software which saves the data as quoted strings with comma delimiters, for example, a record of the log time and some temperatures might look like

"0.1667","123","345","456"

I've looked over the Import wizard settings & cannot figure out how to convince Origin to import the quoted strings as numbers. I can import in Excel first, then cut&paste into the Origin data window, but I would rather just import the file directly. I also tried searching the knowledge base with no luck.

Thanks for any help or suggestions.
5   L A T E S T    R E P L I E S    (Newest First)
hpdab Posted - 01/31/2005 : 10:15:24 AM
Mike, nilaysoft - thanks a lot! This is tremendous, and I really appreciate your help.
Mike Buess Posted - 01/26/2005 : 10:56:13 AM
Meanwhile, nilaysoft's add-on worked fine in my tests. Well done!

http://www.originlab.com/fileexchange/details.aspx?fid=92

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/26/2005 10:57:46 AM
eparent Posted - 01/26/2005 : 10:08:54 AM
An option to remove quotes when importing data is planned for the Import Wizard in Origin version 8. This has been trackered and has Id #6355.


nilaysoft Posted - 01/25/2005 : 9:45:08 PM
I have created an OPK add-on for you by combining Mike's subroutine. With this add-on, you can import you legacy data very conveniently.

Steps:
1. Download: File Exchange > Category:Import > Import quoted numeric strings as numbers

2. Drag the downloaded "import_quoted.opk" and drop it onto OriginPro window.

3. A new toolbar button is created. Clike this button and select one or multiple files to import.

4. Done.
Mike Buess Posted - 01/25/2005 : 07:22:36 AM
The easiest solution to this old problem is to import as text and remove the "" later. I assume you know how to do the first part with the Import Wizard. The second part can also be accomplished with the Wizard as follows...

On the Wizard's Save Filters page check the Save Filter option and specify the location. Then check "Specify advanced filter options" at the bottom and click Next. Enter the following script in the LabTalk code section...

get col(1) -e nrows;
loop (i,1,nrows) {
loop (j,1,wks.ncols) {
%A=cell(i,j)$;
cell(i,j)$=%A;
};
};

This method is not particularly fast since it strips the "" one cell at a time. But it's much better than going through Excel.

...The following Origin C method is much faster.
void remove_all_quotes()
{
Worksheet wks = Project.ActiveLayer();
Dataset dd;
StringArray sa;
string str;
foreach (Column cc in wks.Columns)
{
dd.Attach(cc);
dd.GetStringArray(sa);
str.SetTokens(sa,'|');
str.Remove('"');
str.GetTokens(sa,'|');
dd.PutStringArray(sa);
}
}


After you've compiled the function just replace the LabTalk script at the top of this message with the single command

remove_all_quotes;

Note that all columns must be text+numeric in order for this to work.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/25/2005 4:58:08 PM

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