Author |
Topic |
|
reepingk
Canada
18 Posts |
Posted - 03/05/2018 : 7:11:41 PM
|
I'm trying to import some data from some files and the line that contains the column labels is surrounded by quotes. It looks something like this.
" Frequency Power Time"
(Yes, the line starts with a space after the quote)
But origin likes to consider that whole quoted thing as one long name, so the first column gets labeled " Frequency Power Time" while the rest don't have labels.
What can I do about this?
I'm in origin 2017 on windows 10. |
|
JacquelineHe
287 Posts |
Posted - 03/06/2018 : 02:34:52 AM
|
Hi,
Do you use the Import ASCII tool to import your files?
And you hope to set the Frequency, Power, Time for three column Long Name, right?
When you import files, do you check "Show Options Dialog" to open the import dialog? You can set the "Space" as "Delimiter" in the dialog.
If this is not you wanted, could you please show more detail about your question?
Thanks Jacqueline OriginLab |
|
|
reepingk
Canada
18 Posts |
Posted - 03/06/2018 : 11:10:10 AM
|
quote: Originally posted by JacquelineHe
Hi,
Do you use the Import ASCII tool to import your files?
And you hope to set the Frequency, Power, Time for three column Long Name, right?
When you import files, do you check "Show Options Dialog" to open the import dialog? You can set the "Space" as "Delimiter" in the dialog.
If this is not you wanted, could you please show more detail about your question?
Thanks Jacqueline OriginLab
Jacqueline! Thank you, however it doesn't... quite work. I didn't try to change the delimiter because it's on the "data" page, and since the data was getting separated into columns just fine, I didn't see a reason to change the delimiter.
I've been using the the import wizard because the import Ascii doesn't quite work right (these files have massive headers, ~70 lines long, so the auto import ascii doesn't... quite get it right.)
Anyway, remember how I mentioned that the line starts with a space after the quote? Yeah that's messing it up. While the columns DO have long names now, they're all shifted over by one (so column A doesn't have a long name, column B is "Frequency", C is "Power". (And since I don't have a column D, the "Time" name gets erased? (I'm assuming)
I have no issue fixing this in Origin C if that's the easy way around it. Honestly, I would be happy just assigning names to these columns manually (well... automatically so that I don't have to do it for EVERY improt but with manual names) (they're never going to change, and the filter is going to be specific to this type of file only.)
EDIT: I can get it to work if I skip the first X characters per line... but that's non ideal because then it screws up all the comment/user parameters/etc lines. I need to be able to skip the first X characters for JUST the long names. |
Edited by - reepingk on 03/06/2018 12:21:43 PM |
|
|
JacquelineHe
287 Posts |
Posted - 03/07/2018 : 04:03:48 AM
|
Hi,
I want to make sure you want to import your files by GUI (dialog), but not Origin C code, right?
Maybe because there is a space after the first quote, so when you import, Origin do not detect the Long Name as you hope.
If you want to import mutiple files, and there are three columns in all files (Column A, B & C). The columns' Long Name are the same Frequency Power & Time
I suggest you can enter the following script to Scripts: Script after Each File Imported edit box in the impASC dialog. Then it will rename the Long Name for the columns automatically after import.
wks.col1.lname$=Frequency; // rename the Long name for the first column in active sheet
wks.col2.lname$=Power;
wks.col3.lname$=Time;
Also, you can save this import setting to a dialog theme.Then you can reuse it without enter the script again. About dialog theme, plesae refer to this help page: https://www.originlab.com/doc/Origin-Help/Dialog-Theme
Thanks Jacqueline OriginLab |
|
|
reepingk
Canada
18 Posts |
Posted - 03/07/2018 : 12:34:12 PM
|
quote: Originally posted by JacquelineHe
Hi,
I want to make sure you want to import your files by GUI (dialog), but not Origin C code, right?
Maybe because there is a space after the first quote, so when you import, Origin do not detect the Long Name as you hope.
If you want to import mutiple files, and there are three columns in all files (Column A, B & C). The columns' Long Name are the same Frequency Power & Time
I suggest you can enter the following script to Scripts: Script after Each File Imported edit box in the impASC dialog. Then it will rename the Long Name for the columns automatically after import.
wks.col1.lname$=Frequency; // rename the Long name for the first column in active sheet
wks.col2.lname$=Power;
wks.col3.lname$=Time;
Also, you can save this import setting to a dialog theme.Then you can reuse it without enter the script again. About dialog theme, plesae refer to this help page: https://www.originlab.com/doc/Origin-Help/Dialog-Theme
Thanks Jacqueline OriginLab
Yes, I was using the GUI to import the files. And your solution is absolutely perfect, thanks so much! |
|
|
reepingk
Canada
18 Posts |
Posted - 03/07/2018 : 3:29:57 PM
|
quote: Originally posted by reepingk
quote: Originally posted by JacquelineHe
Hi,
I want to make sure you want to import your files by GUI (dialog), but not Origin C code, right?
Maybe because there is a space after the first quote, so when you import, Origin do not detect the Long Name as you hope.
If you want to import mutiple files, and there are three columns in all files (Column A, B & C). The columns' Long Name are the same Frequency Power & Time
I suggest you can enter the following script to Scripts: Script after Each File Imported edit box in the impASC dialog. Then it will rename the Long Name for the columns automatically after import.
wks.col1.lname$=Frequency; // rename the Long name for the first column in active sheet
wks.col2.lname$=Power;
wks.col3.lname$=Time;
Also, you can save this import setting to a dialog theme.Then you can reuse it without enter the script again. About dialog theme, plesae refer to this help page: https://www.originlab.com/doc/Origin-Help/Dialog-Theme
Thanks Jacqueline OriginLab
Yes, I was using the GUI to import the files. And your solution is absolutely perfect, thanks so much!
One last question. How would I use the above code to put a greek letter in for units? I've figured out that "wks.col1.unit$=" will change the units column, but I can't seem to make it work with "ohms". I can change the column to the ohm symbol manually by selecting a capitol "W" and clicking the "change to greek" button, but if I then copy the ohm symbol, I just get the "W", so I can't make it work in the code. |
|
|
cpyang
USA
1406 Posts |
|
reepingk
Canada
18 Posts |
|
|
Topic |
|
|
|