LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to do 3D plotting using Excel Command in LabWindows

New User to LabWindows 6.0 and would like to plot 3D graph using ExcelRpt Command. Would appreciate if anyone out there willing to share your experience.


Message Edited by Charmaine on 01-18-2008 12:43 AM
0 Kudos
Message 1 of 2
(3,254 Views)
Hello Charmaine,

To use the Excel Report Instrument in LabWindows/CVI, you will need to first load the instrument.  Go to Instrument >> Load and navigate to the ExcelReport.fp instrument under toolslib/activex/excel.

Here is some example code I whipped up to fill an array with random numbers and plot it as a 3d surface in Excel.

            for (row = 0; row < ROWS; row++){
                for (col = 0; col < COLS; col++){
                    multi[row][col] = Random (0, 100);
                }
            }
            ExcelRpt_ApplicationNew (VTRUE, &RptApp);
            ExcelRpt_WorkbookNew (RptApp, &RptWkbk);
            ExcelRpt_WorksheetNew (RptWkbk, -1, &RptWksht);
            ExcelRpt_WriteData (RptWksht, "A1: D5", ExRConst_dataDouble, ROWS, COLS, multi);
            ExcelRpt_ChartAddtoWorksheet (RptWksht, 72, 144, 360, 360, &RptCht);
            ExcelRpt_ChartWizard (RptCht, RptWksht, "A1: D5", ExRConst_Gallery3DSurface, 0, ExRConst_Rows, 0, 0, 0,
                                  "My 3d Chart", NULL, NULL, NULL);

And here are the includes and variable declarations:

            #include "excelreport.h"
            #include "toolbox.h"
            #include <cvirte.h>       
            #include <userint.h>
            #include "MyExcelReportTest.h"

            #define ROWS 5
            #define COLS 4

            static CAObjHandle RptCht;
            static CAObjHandle RptWksht;
            static CAObjHandle RptWkbk;
            static CAObjHandle RptApp;
            static int panelHandle;
            double multi[ROWS][COLS];
            int row, col;

This should give you a start for 3d plotting.  I hope this helps.
Regards,


Marty H.
National Instruments
0 Kudos
Message 2 of 2
(3,215 Views)