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
 Worksheetaccelerator

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
xxfzero Posted - 01/22/2013 : 02:38:26 AM
Hello, everyone. Recently I get a problem:

1)I want add a hotkey to perform "statistics on row->last used" and I read "http://qhwiki.originlab.com/~originla/howto/index.php?title=QuickHelp:How_to_add_accelerators_in_Origin"

2)So I edit "origin.ini", adding "2=rowstats|CTRL+ALT+Z" into in its section "Worksheetaccelerator" and make a duplication of rowstats.oxf into user x-function directory.

3)It works, but 2 problems:

3a)It returns me a window as "statistics on row->open dialog" unlike"statistics on row->last used"

3b)Suppose you check the choices "mean"&"SD" and click OK, it will return you 2 columns, first is mean, second is SD, but it will not set SD column as yEr(y error bar), unlike "statistics on row->last used"

4)How can I do then? Add some parameters in origin.ini?


Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:
6   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 01/24/2013 : 10:18:12 PM
Hi,

That is a workaround to use rowstats to get what you want. Here are the steps:

1. Open X-Function Builder (menu is Tools: X-Function Builder), and load the built-in X-Function, rowstats, and then save it as a user-defined X-Function.
2. Open this saved rowstats X-Function in X-Function Builder, click the fifth button to go to the tree view, and change to following settings.
Description: rowstats:Descriptive statistics on row(s). The "rowstats", before the colon, will show as the menu item name.
Usage Context: expand it, and select Main Menus for Menus. Check Windows, and expand it to make sure Worksheet is checked.
3. Save it.
4. Click the fourth button to open Code Builder. Find the main function, rowstats. And then add the following code at the end of the function body.

	Worksheet wks = Project.ActiveLayer();  // get the active worksheet
	if(!wks)
		return;
	if(pSd == NULL)
		return;
	int nIndex = wks.GetNumCols() - 5 -1;  // column index of the SD column
	if(pMean == NULL)
		nIndex--;
	if(pSem == NULL)
		nIndex++;
	if(pMin == NULL)
		nIndex++;
	if(pMax == NULL)
		nIndex++;
	if(pSum == NULL)
		nIndex++;
	if(pN == NULL)
		nIndex++;
	Column col;
	col = wks.Columns(nIndex);  // get the SD column
	if(!col)
		return;
	col.SetType(OKDATAOBJ_DESIGNATION_ERROR);  // set as yErr

Compile the code and Return to Dialog.
Please note, to make this code work, you should keep all the output results in the same worksheet of the source data when using this X-Function.
5. Save the X-Function again.
6. Restart Origin, then you can find a new menu item (Statistics: Descriptive Statistics: rowstats).
7. Add hotkey for this menu item, such as "2=rowstats:0|CTRL+ALT+Z", and then have a try. As I have mentioned before, 0 here means "last used". And actually, if you have used this menu item at least once, you can find such thing, "1<Last Used> Ctrl+Alt+Z", when you try to reach this menu by mouse.

Hope it help.

Penn
xxfzero Posted - 01/24/2013 : 03:30:47 AM
Hi, Penn

Thank for your patient reply. I think I may consider some other methods.

Thank you

xxfzero
Penn Posted - 01/23/2013 : 03:58:31 AM
Hi,

Now, it is only able to add accelerators for those X-Functions that can be called from LabTalk, as such the FFT tool mentioned in the Quick Help page, if you open the dialog of this tool, you will see the title of the dialog is "Signal Processing\FFT:fft1", then fft1 after the colon means that this tool can be performed by calling X-Function fft1. However, when you open the dialog of Statistics on Rows, you will not see such things. Also, I have tried DescStats, and it does not work in my computer. So, currently, I am afraid it is impossible to run "Statistics on Rows" by hotkey.

Penn
xxfzero Posted - 01/22/2013 : 11:45:39 AM
quote:
Originally posted by Penn

Hi,

1. The rowstats is an X-Function, however, please note that "Statistics on Rows" from the menu does not call this X-Function. So, using rowstats X-Function is different from clicking the menu "Statistics on Rows". That is why rowstats will not set SD column as yEr as "Statistics on Rows" does. You can run "rowstats -d;" to open the rowstats dialog, and it is different from the one opened from menu.

2. If the menu item calls an X-Function, like the one (fft1) mentioned in the Quick Help page, you can set the popup menu offset to 0 to choose the last used theme, such as 3=fft1:0|CTRL+B. Please note, this offset is for popup menu (rowstats is not a menu item). For more info. of syntax, you can see the green comment lines under the WorkSheetAccelerators section in Origin.ini.

Penn




Hi, Penn

I'm rather grateful to your answer.

Yes, you're right. If someome click "Statistics on Rows", according to Origin's help, Origin actually invokes "DescStats_1.oxf", however, I find I add such as "2=DescStats_1|CTRL+ALT+Z" into worksheetaccelerator, it even doesn't work. (Meanwhile DescStats.oxf corresponding to "Statistics on Column" is OK. How can that be?)

Does it means that it is impossible for me to run "Statistics on Rows" by hotkey?

Thank you very much
Penn Posted - 01/22/2013 : 04:57:41 AM
Hi,

1. The rowstats is an X-Function, however, please note that "Statistics on Rows" from the menu does not call this X-Function. So, using rowstats X-Function is different from clicking the menu "Statistics on Rows". That is why rowstats will not set SD column as yEr as "Statistics on Rows" does. You can run "rowstats -d;" to open the rowstats dialog, and it is different from the one opened from menu.

2. If the menu item calls an X-Function, like the one (fft1) mentioned in the Quick Help page, you can set the popup menu offset to 0 to choose the last used theme, such as 3=fft1:0|CTRL+B. Please note, this offset is for popup menu (rowstats is not a menu item). For more info. of syntax, you can see the green comment lines under the WorkSheetAccelerators section in Origin.ini.

Penn
xxfzero Posted - 01/22/2013 : 02:40:42 AM
Thanks in advance

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