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
 ocmath_adjave_smooth function

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
newuser_ca Posted - 06/29/2012 : 2:02:28 PM
OriginPro 8.6 in Win7.

I am using ocmath_adjave_smooth() function to smooth data in Origin C. But the result turned out to be different from what I got from the worksheet(from menu Analysis -> Signal Processing -> Smoothing, choose "Adjacent-Averaging", and "10" for points of window).

Here are the Origin C codes:
Column col(wks, 1);
vector<double>& vecValue = col.GetDataObject();
vector vecValueSmooth;
vecValueSmooth.SetSize(vecValue.GetSize());
ocmath_adjave_smooth(vecValue, vecValueSmooth, vecValue.GetSize(),5);


Please see the attached pictures for my worksheet and the results from Origin C. what is wrong wich my codes?
Thanks.



Here is the result from Origin C:
2   L A T E S T    R E P L I E S    (Newest First)
newuser_ca Posted - 07/03/2012 : 10:47:09 AM
It worked.

Thanks a lot!
Sophy Posted - 07/02/2012 : 12:32:29 AM
Hi,

Thanks for reporting this issue, and we assume this should be fixed in Origin 9.0.

Notes, before, we assume user should never get a object reference from column object and pass it directly to another function as double pointer, as in Origin C compiler, reference and double pointer are stored in different structure in memory, so such kind of that cast is problematic, and in 8.6, you can modify your code to make it work like the following:

Column col(wks, 1);
vectorbase& vb = col.GetDataObject();
vector vecValue = vb; //make a temp vector, never use reference of column object data and cast to double* directly
vector vecValueSmooth;
vecValueSmooth.SetSize(vecValue.GetSize());
ocmath_adjave_smooth(vecValue, vecValueSmooth, vecValue.GetSize(),5);


Hope it will help, thanks.

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