Fprintf Wavestats ?

I have no idea how to start to tackle this, but it seems the sort of thing someone else must have solved. Ideas ?

REgards

Mike

Hi Mike,

Perhaps one approach is to use capturehistory functionality.

CaptureHistory(refnum, stopCapturing )
The CaptureHistory function returns a string containing text from the history area of the command window since a matching call to the CaptureHistoryStart function.
Parameters
refnum  is a number returned from a call to CaptureHistoryStart. It identifies the starting point in the history for the returned string.
Set stopCapturing  to nonzero to indicate that no more history should be captured for the given refnum. Subsequent calls to CaptureHistory with the same refnum  will result in an error.
Set stopCapturing  to zero to retrieve history text captured so far. Further calls to CaptureHistory with the same reference number will return this text, plus any additional history text added subsequently.

My test example

 

•Make/D fred
•fred = enoise(1)
•variable refnum = captureHistoryStart()
•wavestats fred
  V_npnts= 128; V_numNaNs= 0; V_numINFs= 0; V_avg= -0.0139845; 
  V_Sum= -1.79002; V_sdev= 0.554909; V_sem= 0.0490475; 
  V_rms= 0.552914; V_adev= 0.4755; V_skew= 0.0761902; 
  V_kurt= -1.14278; V_minloc= 109; V_maxloc= 80; V_min= -0.986793; 
  V_max= 0.970051; V_minRowLoc= 109; V_maxRowLoc= 80; 
  V_startRow= 0; V_endRow= 127; 
•string thehistory=captureHistory(refnum,1)

 
•print thehistory

returns.  Not sure why the wavetstats command is at the end.

  variable refnum = captureHistoryStart()
V_npnts= 128; V_numNaNs= 0; V_numINFs= 0; V_avg= -0.0139845; 
V_Sum= -1.79002; V_sdev= 0.554909; V_sem= 0.0490475; 
V_rms= 0.552914; V_adev= 0.4755; V_skew= 0.0761902; 
V_kurt= -1.14278; V_minloc= 109; V_maxloc= 80; V_min= -0.986793; 
V_max= 0.970051; V_minRowLoc= 109; V_maxRowLoc= 80; 
V_startRow= 0; V_endRow= 127; 
wavestats fred

 

 

Andy

@hegedus- I thought I had documented the reason the command is at the end, but I can't find it.

The command history has quite a bit of complex code that puts the command itself into the history in the right place. You will notice that the command stays in the command line until the command has finished running successfully, and then it is inserted into the history above any printout from the command that has appeared between when you hit Enter and when the command has finished running.

I didn't wan't to try to reproduce that complicated code for CaptureHistory because all the complexity of the history would have to be reproduce with quite a bit of complexity added due to the fact that CaptureHistory can happen at any time. So CaptureHistory stores everything put into the history, but in the chronological order in which it was added to the history, not in the order in the history text.

I should perhaps clarify that in the documentation.

I added CaptureHistory for our own internal testing framework- I use it to capture curve fitting history reports so that I can test that (complicated) aspect of curve fitting. That test has more than once saved me from releasing broken curve fitting changes!

In reply to by thomas_braun

I am generating 11 waves 5000 points long and filling these with calculated values from a Monte Carlo style routine.  I then run the routine with different start parameters.  I thought that it would be useful to have an automatic way of saving the WaveStats in a text file for later reference. I thought it could be easy :-)

I think the suggested approach by Andy (hegedus)  is probably to complicated for what I need.  I will therefore just use internal functions to generate my own stats.  Thanks for approach which I wasn't aware of and will bear in mind for the future.

 

Thanks for the explanation. Have a look at Save, this allows to save waves as text or binary.

In this case I would consider summarizing the 11 waves as a matrix (i.e. with Concatenate), then use Wavestats/PCST to obtain a labelled wave and then use Save.

If you save as text file make use of the /U flag to write the row labels to file.

Hi,

To add to ChrLie's suggestion.  You could add some data points with dimension labels to include the start parameters that you used in the monte carlo simulations.  That way you have all the relevant info in one place.

Andy