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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 "Error! No column exists. Create it first."
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tony_lincoln

USA
Posts

Posted - 09/03/2006 :  12:01:20 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Dear Friends,
I am using the demo codes provided by OriginLab.com to do curve fitting (see the following codes). But when I run it with the input of one txt file name, it says "Error! No column exists. Create it first.".
In this txt file there are two columns, one is time, for x axis, the other column is collected data, for y axis.
Then I copied these two columns from txt file into the worksheet of origin software and saved this worksheet as *.ogw. But when I run the codes with this ogw file, the same error appears!
Where was wrong?
Thanks.
Tony

[/CODES]

void fit(String strCurve)
{
using NLSF = LabTalk.NLSF; // Point to the NLSF object
NLSF.Init(); // Initialize the fitter
NLSF.Func$ = "gaussamp"; // Assign fitting function
NLSF.FitData$ = strCurve; // Assign dataset name
NLSF.Execute("parainit"); // Perform automatic parameter initialization
NLSF.Fit(100); // Perform fit - up to 100 iterations
NLSF.PasteParams("p"); // Paste fit results to graph
}


void test()
{
string strFile = InputBox("Input the file full name please:");
fit(strFile);
}

[/CODES]

Mike Buess

USA
3037 Posts

Posted - 09/03/2006 :  05:39:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Tony,

Are you sure that's the complete code? It doesn't make sense because the test function passes a file path\name to the fit function but the latter wants a dataset name (wksName_colName). I have the feeling that the full code will import the text file to an empty worksheet and fit the second column. Anyway, since you already have the data in a worksheet you can do the following...

1. Select the Y column.
2. Enter the following code in the script window.

fit(%C); // fit the selected dataset
layer -a; // rescale graph

Mike Buess
Origin WebRing Member
Go to Top of Page

tony_lincoln

USA
Posts

Posted - 09/08/2006 :  7:36:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,
THanks a lot for your words. But how to select Y column automatically?
I used the codes in my Origin C codes:
Worksheet exp(strCurve);
NLSF.funcx$ = exp_A; //use as X dataset
nlsf.fitdata$ = exp_B;
But it did not work...
Thanks.
tony
Go to Top of Page

Deanna

China
Posts

Posted - 09/10/2006 :  9:33:57 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello, Tony.

The value assigned to nlsf.fitdata should be full name of the dependent variable, for example, Data1_A, where Data1 is the worksheetname and A is the column name.

I am not sure what strCurve is in your code. Is it the a full name? If you know the worksheet name (strWorksheetName) and column name (strColName) of the data to be fitted, you can use the following code to assign nlsf.fitdata$.

string strDSName;
strDSName.Format("%s_%s", strWorksheetName, strColName);
nlsf.fitdata$ = strDSName;


In addition, NLSF.funcx$ is for setting a column as the X column to create the end result dataset. It can be automatically generated and assigned; therefore, it is not a must to assign it.


Deanna
OriginLab GZ Office

Edited by - Deanna on 09/10/2006 10:11:20 PM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000