LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Report Generation Tool Error with Excel

Solved!
Go to solution

LV2019

Murph_0-1588174484889.png

Hard to find an error when you don't know what is causing it.

 

 

0 Kudos
Message 1 of 18
(3,562 Views)

Read (carefully) the Help text for the Function that failed, Excel Update Graph.

Note  The Excel Update Graph VI only updates graphs you create using the LabVIEW Report Generation Toolkit for Microsoft Office. The VI does not update graphs you create in Excel manually.

I interpret this to mean you need to do Excel Insert Graph before you can do Excel Update Graph.

 

Bob Schor

0 Kudos
Message 2 of 18
(3,524 Views)

The graph was created with Labview.

I am only trying to update the data in it.

0 Kudos
Message 3 of 18
(3,518 Views)

@Murph wrote:

The graph was created with Labview.

I am only trying to update the data in it.


I don't think you can do that, nor do I understand why you would want to do that.  If you are using the Template as a "Template", this means (to me) that whatever is written on the Template is considered "already filled in", and you only "fill in the Blanks" by writing in empty cells.

I just looked at your Template, and see you have a Graph with Data.  Were you planning to add data (say, another plot) to the Graph?  Replace the Graph with a new Graph?  Something else?

 

I think (whatever you decide you want to do) the only thing you will be able to do is to create a new graph and put it in the Report.  For this reason, you probably do not want the old graph as part of the Template.  However, since I don't know enough about what you are trying to do, and how the Template Graph enters into this, I don't have any suggestions at the present time ...

 

Bob Schor

0 Kudos
Message 4 of 18
(3,507 Views)

The style of the Graph in the template is what the user wants (visually).

What I am intending to do is clear the existing dat in the graph then update with new data

0 Kudos
Message 5 of 18
(3,453 Views)

My advice would be to remove the Graph from the Template.  You don't need it.  Once you create the rest of the Report (and thereby "know" where you have blank space), create the Graph and put it on the Report.  There are numerous examples on the forum showing how to do this, including one I know quite well -- search this forum for Revised Excel Example, and you'll see an Excel Report with an added Graph.

 

Bob Schor

0 Kudos
Message 6 of 18
(3,440 Views)

Thank you.

I guess I misinterpreted Update graph.

I removed the graph from the template and generate a new one. It works but there is one remaining problem

I have searched and cannot find how to get the report generation tool to duplicate the graph made in LV.

The Y data is good but the X data ( time ) is formatted as si notation in the excel report, not like it should be from the graph.

I have attached the data generator and excel template.

Download All
0 Kudos
Message 7 of 18
(3,399 Views)

The problem is in your first loop.  There are several things "wrong" here.  The first is having a Cluster of two elements both named "appended array 2".  Do you know how to "build" a Cluster by dragging an empty Cluster onto the Front Panel and putting two Numeric Controls that you label "X" and "Y" inside it?  Aren't those "better" names than the same name for the X and Y elements?

 

But that's not the problem.  What did you want to store in X?  Looking at your second loop, where you create the X coordinate for the plot by multiplying the X "value" by "i", the loop index, the only sensible value for X is the time between successive measurements.  You could compute this in the first loop, but instead you compute the elapsed time since the loop started (which also makes a reasonable value for X, as long as you don't multiply it by "i").  Instead, you save the Real representation of the TimeStamp, or the number of nanoseconds since 1 Jan 1904 UTC (a very big number, which you proceed to multiply by 0, then by 1, then by 2 ...).

 

Your code is doing precisely what you tell it to do.  Tell it to do something more sensible, please.

 

Bob Schor

 

Another 

0 Kudos
Message 8 of 18
(3,367 Views)

Thank you. What I sent was not the correct version.

I cleaned up the X/Y names and the mult by i wasn't supposed to be there however I am still getting the same problem.

Download All
0 Kudos
Message 9 of 18
(3,350 Views)

Sigh.  I'm sorry I'm not at your University, where you could come and talk with me for 15 minutes and I could try to explain the many "wrong paths" you are taking.  I can see that you are trying to fix this piece of code, so I'm going to give one last try at putting you on the right path.  If you choose to follow my advice, it will "seem wrong" ("Why should I start all over?"), but should lead you to a working solution, and, better, should give you some steps to take when starting your next project.  It is important to follow all the steps, especially the first one:

  1. Start over!  Do not look at, or use any of the code, in your current VIs.  Follow all of the steps,
  2. You are simulating data taken by a DAQ device at 4 Hz (250 ms per sample).  Write a VI (from scratch, without opening or looking at your earlier Chalkboard code) that generates a suitable random (or sinusoidal, or something else) data.
  3. Before plotting your data, learn the difference between a Chart and a Graph.  Also, it would be a good idea to learn how DAQ devices generally acquire and present data to you, the User.  Many DAQ devices, such as A/D converters, are built to sample data at some frequency (e.g 4 Hz, or 4 kHz), and generally gives you a number of samples at a time (for example, you might be sampling at 1 kHz and sampling 1000 samples at a time -- the DAQ device would give you 1000 samples every (1000 samples) /(1000 samples/sec) = 1 sec.  
    1. Ask yourself the question of scaling your example up from 4 Hz to 4 kHz, and whether you want to plot 4000 graphs each second, plotting first 1 point, then 2, then 3, then ... .
    2. Also ask yourself how often you want your plot to update, particularly as the sampling rate increases.  Think about what might slow down your program (hint -- generating random numbers is very fast, but operations that are not "logic" or "arithmetic", but involve interactions with inherently slower devices, such as I/O or human beings, might not be as fast).
    3. A related question is "Do you want to, or need to, plot every point as it is acquired, or could you "bunch" them somehow and plot a bunch at a time?  Might there be a built-in LabVIEW Data Type (starting with the letter "W") that is tailor-made for this purpose?
  4. Now suppose you have some sampled data (let's say 100 points of data).  You want to plot them.  If you were plotting them by hand, how would you label the axes?  I'm going to assume you'd make the X axis "Time", and would plot each data point some "delta-t" to the right of the preceding point.  How would you label the X Axis coordinates?  Do you want "Absolute" time, or "Relative" time?  Do you know what these terms mean?  Ask yourself this question -- what is the label of the origin of the X Axis?  Is it 0 (seconds, or milliseconds, or days), or is it some representation of "25 May 2020, 9:01 am"?  What is important to the viewer of the plot?
  5. When you write this code, try to keep it "compact and neat", with wires running as straight as possible from left to right, with as few bends as reasonable.  This makes your code more readable, and the possibilities of spotting mistakes easier.  Do not scatter useless Indicators around in your code -- it is alright to put in a few for debugging purposes, but for a simple "quick look", learn about putting a Probe on a wire so you can view its behavior and the values it carries at run time.

Did you notice that Excel was not mentioned here?  Until you can generate "clean" data and make a Chart (or Graph) that you'd like to plot in Excel, it only complicates things to drag the Report Generation Toolkit into this routine.

 

But, once you've done all of the above, and have a Plot in your simple routine that looks pleasing to you, especially the labeling of the X axis, you are ready for a "Revised Excel Example" that will help you with the next part.  But before we get there, here's a question:  Why are you including a (blank) Template as part of your code?  With a Template, you need to either know the Template in advance so that you can put your data in the right part of the Worksheet (without, one hopes, overwriting part of the Template), or use a blank Template, as you have done, which is completely unnecessary.  What I recommend is to use no Template and generate the entire Worksheet with the RGT, including all of the Row and Column labels.

 

Here's a suggestion that will get you started (but only do this after you've done the first part of this "assignment", above -- I'll be personally very unhappy with you, and unlikely to give you any more help, if you omit this most important set of 5 steps).  Go to the top of this Forum and type "Revised Excel Example" into the Search bar.  You won't find an "exact" match, but the first match, probably from 2014, is the one you want.  Learn from this Example how to create your Excel Report, once you have your Data and know how to plot (particularly how to generate the X array).

 

Bob "Professor" Schor

 

Message 10 of 18
(3,334 Views)