Index: trunk/psLib/test/math/tst_psStats07.c
===================================================================
--- trunk/psLib/test/math/tst_psStats07.c	(revision 5117)
+++ trunk/psLib/test/math/tst_psStats07.c	(revision 5155)
@@ -44,4 +44,38 @@
     /*  Allocate and initialize data structures                              */
     /*************************************************************************/
+    maskVector = psVectorAlloc( N, PS_TYPE_U8 );
+    maskVector->n = N;
+    myVector = p_psGaussianDev( MEAN, STDEV, N );
+    // Set the mask vector and calculate the expected maximum.
+    for ( i = 0;i < N;i++ ) {
+        if ( i < ( N / 2 ) ) {
+            maskVector->data.U8[ i ] = 0;
+            count++;
+        } else {
+            maskVector->data.U8[ i ] = 1;
+        }
+    }
+    psStats *mySampleStats = psStatsAlloc( PS_STAT_SAMPLE_MEAN |
+                                           PS_STAT_SAMPLE_MEDIAN |
+                                           PS_STAT_SAMPLE_STDEV |
+                                           PS_STAT_SAMPLE_QUARTILE );
+    mySampleStats = psVectorStats( mySampleStats, myVector, NULL, NULL, 0 );
+    printf("The Sample Mean is %.2f\n", mySampleStats->sampleMean);
+    printf("The Sample Median is %.2f\n", mySampleStats->sampleMedian);
+    printf("The Sample stdev is %.2f\n", mySampleStats->sampleStdev);
+    printf("The Sample quartiles are (%.2f %.2f)\n", mySampleStats->sampleLQ, mySampleStats->sampleUQ);
+    psFree(mySampleStats);
+
+    psStats *mySampleStatsWithMask = psStatsAlloc( PS_STAT_SAMPLE_MEAN |
+                                     PS_STAT_SAMPLE_MEDIAN |
+                                     PS_STAT_SAMPLE_STDEV |
+                                     PS_STAT_SAMPLE_QUARTILE );
+    mySampleStatsWithMask = psVectorStats( mySampleStatsWithMask, myVector, NULL, maskVector, 1 );
+    printf("The Sample Mean is %.2f\n", mySampleStatsWithMask->sampleMean);
+    printf("The Sample Median is %.2f\n", mySampleStatsWithMask->sampleMedian);
+    printf("The Sample stdev is %.2f\n", mySampleStatsWithMask->sampleStdev);
+    printf("The Sample quartiles are (%.2f %.2f)\n", mySampleStatsWithMask->sampleLQ, mySampleStatsWithMask->sampleUQ);
+    psFree(mySampleStatsWithMask);
+
     myStats = psStatsAlloc( PS_STAT_ROBUST_MEAN |
                             PS_STAT_ROBUST_MEDIAN |
@@ -49,20 +83,7 @@
                             PS_STAT_ROBUST_STDEV |
                             PS_STAT_ROBUST_QUARTILE );
-
-    maskVector = psVectorAlloc( N, PS_TYPE_U8 );
-    maskVector->n = N;
-    myVector = p_psGaussianDev( MEAN, STDEV, N );
     // Create a full outliers:
     myVector->data.F32[N/4] = -1000.0 * MEAN;
     myVector->data.F32[N/2] = 1000.0 * MEAN;
-    // Set the mask vector and calculate the expected maximum.
-    for ( i = 0;i < N;i++ ) {
-        if ( i < ( N / 2 ) ) {
-            maskVector->data.U8[ i ] = 0;
-            count++;
-        } else {
-            maskVector->data.U8[ i ] = 1;
-        }
-    }
     /*************************************************************************/
     /*  Call psVectorStats() with no vector mask.                            */
