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
 Comments row

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
bafaneh Posted - 08/08/2011 : 4:00:47 PM
Origin Ver. and Service Release (Select Help-->About Origin): 8.5
Operating System:xp

Hi,

In the following code, I import data into a book, but the comments row is blank. What line am I missing to do this?

Thanks:

// Find files
string path$ = "C:\Documents and Settings\akudsi\Desktop\Basheer\Data for Basheer";
findfiles ext:="U7*.csv";

// Import all the files into one book
newbook;
impasc Options.Impmode:=4 Options.Names.FNameToColComm:=0 Options.Names.FPathToComm:=0;
// save the book name
string strBkName$ = page.name$;



-Basheer
16   L A T E S T    R E P L I E S    (Newest First)
DaisyZiete Posted - 09/07/2011 : 01:59:06 AM
I find this useful.

impASC options.FileStruct.NumericSeparator:=0 options.Hdr.AutoSubHdr:=0 options.Hdr.SubHdrLns:=3. options.Hdr.LNames:=0. options.Hdr.Units:=0. options.Hdr.CommsTo:=3.;

affiliate marketing healthy eating sweating sickness excessive sweating get rid of hemorrhoids what does mrsa look like
bafaneh Posted - 08/17/2011 : 4:52:24 PM
Oops, that was a typo. So, it should work otherwise, right? It's not...
greg Posted - 08/17/2011 : 1:27:07 PM
nlbegin iy:=(33.23) func:=gauss nltree:=ParamTree;
should be
nlbegin iy:=(33,23) func:=gauss nltree:=ParamTree;
bafaneh Posted - 08/16/2011 : 7:09:11 PM
Hi,

My nonlinear curve fitting script is not working. I took it from the scripting guide. Here is the example from the guide:

// Begin non-linear fitting, taking input data from Column 1 (X) and
// Column 2 (Y) of the active worksheet,
// specifying the fitting function as Gaussian,
// and creating the input parameter tree named ParamTree:
nlbegin iy:=(1,2) func:=gauss nltree:=ParamTree;
// Optional: let the peak center be fixed at X = 5
ParamTree.xc = 5; // Assign the peak center an X-value of 5.
ParamTree.f_xc = 1; // Fix the peak center (f_xc = 0 is unfixed).
// Perform the fit calculations:
nlfit;
// Optional: report results to the Script Window.
type Baseline y0 is $(ParamTree.y0),;
type Peak Center is $(ParamTree.xc), and;
type Peak width (FWHM) is $(ParamTree.w);
// end the fitting session without a Report Sheet
nlend;


Here is mine: (I don't care about the 'optional' stuff) I just want it to do a basic Gaussian nlfit and output the summary to a new sheet or even to a new column of the existing sheet).

//nlfit;
nlbegin iy:=(33.23) func:=gauss nltree:=ParamTree;
ParamTree.f_xc = 0;
type Baselin y0 is $(ParamTree.y0),;
type Peak Center is $(ParamTree.xc), and;
type Peak width (FWHM) is $(ParamTree.w);
nlfit;
nlend;


Thanks,
Basheer
bafaneh Posted - 08/15/2011 : 6:40:01 PM
Hi,

Thanks for your response. I used the following script for another column that I wanted and I was wondering how I can change '25' to 'endvalue' so that if I don't have a fixed amount of rows (i.e. it changes with each dataset I bring in) it knows how many rows there are, and just loops until there are no more filled rows.

for (ii=1; ii<=25; ii++)
{
cell(ii,25) = (cell(ii+1,23) - cell(ii,23))/(cell(ii+1,33) - cell(ii,33));
};

Thanks again,
Basheer
Hideo Fujii Posted - 08/12/2011 : 09:55:47 AM
Hi Basheer,

You have excessive semicolons for the For command, and the left brace '{' ; Therefore, it should be:

for(ii=1; ii<=25; ii++)
{
cell(ii,27) = cell(ii,33)-cell(19,33);
};

--Hideo Fujii
OriginLab
bafaneh Posted - 08/11/2011 : 6:44:30 PM
This is the loop I am using to make values for a column.

for(ii=1; ii<=25; ii++);
{;
cell(ii,27) = cell(ii,33)-cell(19,33);
};

This is not giving me any errors, but it is not outputting anything.

Do you see anything wrong with this?

I want column 27 to be column 33 - a cell from column 33, (e.g. 1,27 = 1,33 - 19,33, then 2,27 = 2,33 - 19,33)
bafaneh Posted - 08/11/2011 : 5:24:45 PM
I am not actually putting units or comments, etc into those rows, I am simply using them as titles for the data below.

This is how I want it to look:


Unit name: Serial Station Channel 0, etc...
Units: Number Baratron HW, CW, etc..
Long name: (---) Mean RMS, etc..

I still cannot figure out how to follow the commands to generate script, but I will keep trying.

Thanks for your help
-Basheer
Hideo Fujii Posted - 08/11/2011 : 11:09:28 AM
Hi Basheer

> it did not put all of the titles of the columns in the comments, long name, and units, like I wanted.

I don't see any Unit line in your pasted sample file.

>> I just want to make sure the comments row is filled with (---) Min value, max values, etc.
>> Serial Station Channel 0 Channel 0 Channel 0 Channel 0 Channel 0 Channel 0 Channel 0 Channel 0 Channel 1 Channel 1
>> Number Number Baratron Baratron Baratron Baratron Baratron Baratron Baratron Baratron HW HW
>> (---) Min. Value Min. Val. Index Max. Value Max. Val. Index Mean RMS 3rd Moment (Normalized) 4th Moment Normalized) Min. Value Min. Val. Index
>> 0 0 7.09 229000 6.95 345000 7.02 0.02 0.0594 2.81 7.62 47100

You can specify the record number at "Header Lines> Units" (or "Long Names") option branch in the ASCII import dialog box, then you can generate the script command as I wrote in my previous mail. Please try.

--Hideo Fujii
OriginLab
bafaneh Posted - 08/10/2011 : 8:33:12 PM
Also,

I was wondering about how I can make a loop to create a column where the operation would be: (x1-x2)/(y1-y2) where the x and y values are from two previous columns.

I had an idea about the logic: I could do the subtractions and create a column where its values are those subtractions, and then do the division of those two new columns for my final column, and delete the old ones that just were there for subtracting.

How could I go about this?

-Basheer
bafaneh Posted - 08/10/2011 : 7:48:02 PM
Hi,

Thank you for your response. I ran that line by itself and it imported all of my data, but it did not put all of the titles of the columns in the comments, long name, and units, like I wanted. The script I had before did so, except for the comments row, which is what I am trying to have done.

Also, after I run file, import, single, and click the drop down (tiny triangle(?)) and use <last used>, I cannot find the option to generate script. Where is this located? And I do see how it is handy. :D

-Basheer
Hideo Fujii Posted - 08/09/2011 : 5:27:56 PM
Hi bafaneh,

How about the following impASC command?

impASC options.FileStruct.NumericSeparator:=0 options.Hdr.AutoSubHdr:=0 options.Hdr.SubHdrLns:=3. options.Hdr.LNames:=0. options.Hdr.Units:=0. options.Hdr.CommsTo:=3.;

I got this long command by the following way:
1) From the user interface, import a sample file ("File: Import: Single ASCII" menu) using appropriate import options such as:
- Auto Determine Subheadder Lines = OFF
- Number of Subheader Lines = 3
- Long Name = 0, Units = 0
- Comments From = 3, To = 3
Make sure the import result is what you expected.

2) Again, run "File: Import: Single ASCII" menu, and press a tiny triangle button, and choose "<Last Used>", flyout, then "Generate Script" flyout.

You get the script command for this import settings in the Script window. Please try this. Don't you see this is very handy? :-)

--Hideo Fujii
OriginLab
bafaneh Posted - 08/09/2011 : 4:16:33 PM
I actually don't want to have the file name appear anywhere in the book, except as the sheet title (it is doing that). I just want to make sure the comments row is filled with (---) Min value, max values, etc.


Serial Station Channel 0 Channel 0 Channel 0 Channel 0 Channel 0 Channel 0 Channel 0 Channel 0 Channel 1 Channel 1
Number Number Baratron Baratron Baratron Baratron Baratron Baratron Baratron Baratron HW HW
(---) Min. Value Min. Val. Index Max. Value Max. Val. Index Mean RMS 3rd Moment (Normalized) 4th Moment Normalized) Min. Value Min. Val. Index
0 0 7.09 229000 6.95 345000 7.02 0.02 0.0594 2.81 7.62 47100
Hideo Fujii Posted - 08/09/2011 : 12:47:28 PM
Hi Basheer,

Regarding the first issue, could you please confirm if my understanding is correct, or not?

So, do you want to put the information that would be obtained by the options: Options.Names.FNameToColComm:=1 Options.Names.FPathToComm:=1, to the first row of the worksheet's data area, not in the header row of the "Comment"? But, if it is the case, I'm not sure why you want to do that in which advantage.... Could you please explain?

Maybe you can show some sample lines of your CSV file here to show your file structure?

--Hideo Fujii
OriginLab

bafaneh Posted - 08/08/2011 : 6:30:08 PM
Hi,

I also want to either delete various specified columns from my data, or copy the ones I want to keep into a different sheet or book. What is the best way to go about this? Could you give me an example script of using colcopy and/or using a loop?

-Basheer
bafaneh Posted - 08/08/2011 : 4:43:08 PM
Sorry, what I meant to ask is how do I change the options of putting filename into col comm into putting the actual row I have in the data into the comments row.

Thanks.

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