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
 Forum for Origin C
 Writing fit results to graph

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
hauli Posted - 10/09/2006 : 01:45:06 AM
Origin Version (Select Help-->About Origin): 7.5
Operating System: Windows XP

Hi,

within an Origin C code I want to write the results of a fit
into a Text-box; therefore I use thw following code

gly.LT_execute("label -n Text EC50: " + 10^(NLSF.p3) + "µg/ml");

this works and writes the antilog of my parameter NLSF.p3 + "µg/ml" into a textbox. But I need two other things:

(1) fix the parameter output to 1 digit; (i.e. EC50: 25.3 µg/ml, not EC50: 25.32655696658 µg/ml as with my code)

(2) I need to add the lower and upper confidential intervals as well; that means from the created parameter worksheet (parameters1) I need to add 10^"LConfLimit" and 10^"UConfLimit". the values of LConfLimit and UConfLimit can be found in the last two columns of the Parameters-worksheet.

Thanks for any advice, help or examples

Hauli



Edited by - hauli on 10/09/2006 07:10:36 AM
9   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 10/25/2006 : 07:54:10 AM
Use wksResults.ShowLabels() after you set the label text.

Mike Buess
Origin WebRing Member
hauli Posted - 10/25/2006 : 06:01:49 AM
Thank you Deanna, catching the names before doing the NLSF fits worked great.

As I am now trying to automate all my calculations in Origin, I come along with a lot of questions. Thank you for being patient

The following script creates a new wks, names it "Results", and sets the label of column A to "Condensate"; it works, but the Label is not displayed automatically, as I want. Any suggestions?

Worksheet wksResults;
wksResults.Create();
string newName = "Results";
wksResults.GetPage().Rename(newName);
string strName1="Condensate";
wksResults.Columns(0).SetLabel(strName1);

Thanks in advance
hauli


Edit:
I simply overcame the problem by using a worksheet template, with specified settings (Column Labels visible)



Edited by - hauli on 10/25/2006 07:21:17 AM
Deanna Posted - 10/24/2006 : 06:06:08 AM
The reason for the program to run non-stop is that NLSF always creates worksheets.

One possible solution is to save the names of the existing worksheets before doing the NLSF, and then use the names to get access to the worksheets. It will be something like what I have written in this post:
http://www.originlab.com/forum/topic.asp?TOPIC_ID=5183

Deanna
OriginLab Technical Services
hauli Posted - 10/24/2006 : 03:52:11 AM
Dear Deanna!

Thank you very much for the well working suggestions.

I have another question:

Within a Origin C function I perform a NLSF fit to all existing worksheets of my project. Therefor I use the "foreach" statement.

The problem is that the C function doesnot stop after having performed the fits for all wks but goes on to perform fits for the parameter worksheets and NLSF worksheet, as in my code.

How to stop the function? or how to avoid this. I think it is very simple. Maybe by counting the existing wks and then performing this number of fits. Thank you for any suggestions.

Hauli

Deanna Posted - 10/19/2006 : 10:21:38 PM
Sure. It is possible. Let's use a label button for the hyper link.

1. Create a Origin C file with Code Builder and put the function test_OpenExcel() in the file. Add the file to Workspace by using Ctrl+W or from the menu File: Add to Workspace. Build the file.

2. Return to the Origin Workspace. Click the Text Tool button.

3. Click at the desired text entry point on your Origin window (graph, worksheet, etc.). And then type the path and the file name, for example, "f:\temp\book1.xls" (without the quotation marks please).

4. Select the text label and then right-click with your mouse. Choose Label Control...

5. In the dialog, choose button-up for Script, Run after. And enter the following script under Ctrl-TAB for TAB

%a = text1.text$;
test_OpenExcel(%a);

Please pay attention to the Object Name shown in this dialog. If it is not text1, you will have to change the first line of the code. For example, if Object Name is Text2, the line should be changed into: %a = Text2.text$;
Click OK to close the dialog.


6. Click the button. This should open the Excel file in Origin.

Enjoy :)

Deanna
OriginLab Technical Services

Edited by - Deanna on 10/19/2006 10:26:32 PM
hauli Posted - 10/19/2006 : 02:14:11 AM
Hi All,

I have another question concerning Excel Import:

I need to write the Data Source (Path of my *.xls file (ie D:\...\Test.xls)) into a text label of the created Graph.
(1) What is the proper definition of the Path?
(2) Is it possible to create a hyperlink? So that by clicking on the text label Excel is opened?

Thanks in advance,

Hauli

Deanna Posted - 10/11/2006 : 9:43:15 PM
There is a good example in the file <i>page.h</i>, which locates in a subfolder of the Origin program folder: \OriginC\System\page.h


/**
It opens an .XLS file lpcszWorkbookFile as an Origin worksheet.
Parameters:
lpcszWorkbookFile=pathname of the .XLS file.
nSheetIndex=the index of the Excel sheet to open as Origin worksheet (other sheets are ignored).
If negative, it opens only the active ("top") sheet.
Return:
TRUE if success, otherwise FALSE.
Example:
void test_OpenExcel_2(string strWorkbookPathname)
{
WorksheetPage wpg;

BOOL bOK = wpg.OpenExcel(strWorkbookPathname, -1);

out_int("OK = ", bOK);
if (!wpg)
{
out_str("Invalid page!");
}

out_str(wpg.GetName());
}
*/


All columns of the Excel sheet will be opened. You can simply ignore or delete the columns that you do not need.

The header files in OriginC subfolder contain other good examples for Origin C. I hope everyone that is using Origin C will find them helpful.

Deanna
OriginLab Technical Services
hauli Posted - 10/11/2006 : 02:17:27 AM
Hi,

Thank you for the solution, it works great!

May I come up with another question:
I want to import an Excel file containing 5 sheets (Sheet1, Sheet2 .. Sheet5); each sheet should be used to create a new Origin Worksheet with the same name. So
(1)are there any examples on how to do this?
(2)I only want to import the first two columns (Column A and B) of the Sheets; the rest is messy data, not needed for further analysis

Hauli

Mike Buess Posted - 10/09/2006 : 08:27:56 AM
Hi Hauli,

(1) Use normal C formatting...

string str;
str.Format("%.1f",10^(NLSF.p3));
gly.LT_execute("label -n Text EC50 " + str + " \g(m)g/ml");

(2) LConfLimit = NLSF.p3 - NLSF.c3; UConfLimit = NLSF.p3 + NLSF.c3;

Mike Buess
Origin WebRing Member

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