LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Macro Plotter

Hello All,

I am having a challenge in implementing a macro in excel that plots the waveform graph. I have made use of the LabVIEW Excel macro Example with modifications. The challenges are:

1.       In Excel, both x and y values do not start from zero.

2.       The scale of the graph is narrow

3.       The program should stop running after the log switch is pressed and the graph is plotted in excel.

Note: project.xls sheet should be in same directory as VI before running.

 

Thanks.

0 Kudos
Message 1 of 6
(3,677 Views)

You did not include the Excel workbook...

 

Never mind. Just saw that you're using the project.xls workbook that's in the Examples folder.

Message Edited by smercurio_fc on 07-20-2009 03:58 PM
0 Kudos
Message 2 of 6
(3,667 Views)

@maxidivine wrote:

1.       In Excel, both x and y values do not start from zero.


 I'm not sure I understand what you mean by this.


2.       The scale of the graph is narrow


I don't understand what this means either. I assume you're referring to the fact that you're only seeing a "zoomed in" version of the graph. The reason for this is that the macro in the workbook has the range to graph hard-coded in it. It's only plotting the first six rows. You can either modify the macro so it determines the range based on the data (see Excel help on how to write macros), or have it so that you feed in the number of rows as an argument. 

 


3.       The program should stop running after the log switch is pressed and the graph is plotted in excel.


It should already do this, and it does. I suspect the problem you're having is when you're running it with the large array. Writing out 25000 cells one at a time using ActiveX will take forever. 

 

As an aside: What's wrong with the LabVIEW graphs?

 

Message 3 of 6
(3,660 Views)

Thaks a lot smercurio_fc,

 

LabVIEW graphs are fine. I wanted to use excel so that I can do some analysis on it. I have been able to plot the graphs in excel. I used two different excel files, each with different macro settings, to log the data and plot the graphs. It went on very well.

 

The challenge I now face however is that the logging process is just a portion of a large software and since I am using code from the excel macro example vi, which has about 5 sub Vis how do I incorporate all of the VIs into my main VI?

 

I can run the edited portion of the excel macro example vi that plots the graph in excel fine but integrating that whole code to my main Vi is a challenge. Do I save all the VIs separately into one directory?

 

Help pls.

 

Thanks.

 

0 Kudos
Message 4 of 6
(3,640 Views)

maxidivine wrote:

LabVIEW graphs are fine. I wanted to use excel so that I can do some analysis on it. I have been able to plot the graphs in excel. I used two different excel files, each with different macro settings, to log the data and plot the graphs. It went on very well.


I'm not sure why you would need two different Excel files to do the same thing. The only reason I can think of is that you have the graph range hard-coded in the macro so you use two different ranges. If that's the case I would recommend using the VBA language to determine the number of rows (easy to do) so you can dynamically set the chart area. 

 


 The challenge I now face however is that the logging process is just a portion of a large software and since I am using code from the excel macro example vi, which has about 5 sub Vis how do I incorporate all of the VIs into my main VI?

 

I can run the edited portion of the excel macro example vi that plots the graph in excel fine but integrating that whole code to my main Vi is a challenge. Do I save all the VIs separately into one directory?


I don't understand whether you're asking about file organization or how to use subVIs. If you're asking about subVIs then you would need to modify your version of "Excel Macro Example" so that it has inputs and output (controls and indicators) wired to the connector pane so you can feed data to it from the main VI. You would also need to eliminate the while loop. Please read the LabVIEW Help on how to create and use subVIs. If you're asking about file organization then you have the VIs in a LLB file. You would need to place this into your project's file directory hierarchy. You should consider, however, converting the LLB into individual files using the LLB Manager (Tools -> LLB Manager).

 

Message 5 of 6
(3,635 Views)

Thanks a lot for the responses. The reason why I am using two excel files is because I am working with different ranges, like you rightly pointed out. Regarding the sub VI's I would have another look at it as suggested.

 

Thanks for the input...my work is taking shape now.

 

I am very grateful.

 

 

0 Kudos
Message 6 of 6
(3,626 Views)