hi guys ,
I am trying to update a 3d graph dynamically, now its easy to plot the 3d graph when all the values are know . In my case ,check the vi, i have three axis distance wavelength and power. The wave lenght and distance are fixed that is i am taking the wavelength from 1596,35 - 1596,95 and distance from 33572,649 - 34085,735 which in the vi are included as contants .. the power i am measuring from the txt filed which i have attached. Now i want to update the graph in the for loop when the values are being read from the txt file.
let me know if anyone has idea how to do this
Solved! Go to Solution.
To update the plots every time a new point from the power file is added to the array, you will want to put the output array, the plot helpers, and the plots themselves inside the for loop. You will also want to right-click the plots and select "Advanced">>"Synchronous Display", which will force the front panel objects to be updated for every point added (at the cost of execution speed). As you have it now, the plot helpers are waiting to execute until they receive the full output array, which is passed after the for loop is complete.
I'm also curious; why do you need to see it updating for every point?
the reason i want to see it at every point is that , since i am performing experiments with lasers , updating the plot helps me to see in real time the power value of the returned light waves . In short it helps me see reflections of light wave at different distance at real time. as u can see now .. right now i am just updating the graph once i have all the values with me . Execution Time is not a factor for me since i have to wait for the osciloscope to return me the power values .... i will try your suggestion. I will let you know if i have problems.
I did put the 3d graph in the loop and gave the values to the plot helpers but still i cant see the 3d graph being updated as the for loops executes. the 3d graph inside the loop seems to not even display anything .. I am a little bit not sure if I am giving the values correctly . I have updated the vi .. kindly have a look.
I would start by taking a look at the built-in LabVIEW example "3D Surface Plot.vi". You can thow a while loop around that whole block diagram and see that the chart updates while the VI is running (you can change the inputs from the front panel). You can use the example as a template and build your application around it. Best of luck!
Alternatively, you might look into using an intensity graph instead of a 3D plot. Color is the third dimension on an intensity chart, and since it isn't an XControl, you should be able to control it more easily. Cheers!
You wired an empty constant to the inner mesh plot helper.vi - so, the "3d mesh 2" didn't receive any data at all.
I tidied up your blockdiagram and wired the inner mesh plot helper.vi correctly as you did for the outer mesh plot helper.vi
Then I realized Labview is executing this vi so quickly so the "3d mesh 2" has no chance to update the GUI
So, I put in the wait until next ms multiple to give the "3d mesh 2" 100 ms to update. Know you should be able to see the 3d graph being updated as the for loop executes.
There's sometimes a time-lag from iteration to iteration; but mostly each iteration lasts 100 ms. Maybe a "timed loop" will be more accurate.
Thanks for your help. But the problem I am seeing with this is that rite now I am just playing with sample data , that is the loop is just being operated 13 times .... but in my real work its much larger and if i keep storing all the data in a 2D array , the array will keep on getting bigger and bigger .. which will result in slowing the processing time even more ..... what I am trying to achive is that once the data from single run is ploted its not stored in the array ...soo in this way i will just be ploting the data but if i do it like this ...the plot doesnt update ... i am attaching the vi again with the changes
If you are writing new data to the chart every iteration, it shouldn't be saving the old data. Have you worked from that built-in example? You can see that it updates very nicely if you put the whole thing in a while loop.
I think nolsqun86 didn't mean the chart, he was writing about the array which grows due to the "insert in array.vi"
I made this attempt to replace the "insert array.vi" with "replace arry subset.vi":
The "3d Meshdatatype.lvclass: Plot Helper.vi" seems to require at least a 2d Array with two rows filled to be used for the z-matrix input.
So, I use "initialize arry.vi" to create a buffer with x rows and 1999 columns;
the "quotient & remainder.vi" produces a sequence due to the dominator e.g. dominator = buffer size = x e.g. x = 2 --> 0-1-0-1-0 ...
in order to replace row 0 and 1 from the buffer with new data from the "power array".
I do have no clue, if the data is plotted correctly in the 3d surface plot
in terms of interpolation & scaling issues.