Showing results for 
Search instead for 
Did you mean: 

Live Graph and memory of data

Hello all,


I have been struggling with this for a couple days now. I am trying to have motor poisition (millimeters read from Thorlabs interface) set as my X for my data; while the load cell (voltage/force) is used for the Y axis data points and then having a live graph. Along with this I would like all data points to be exported to excel for further analysis. I have gotten the load cell to work through a waveform chart but have not gotten it to communicate with the XY graph. Attached is my current setup.


I am using a Thorlabs (z825B) motor with a APT dc servo contoller with a NI DAQ and a meas loadcell.  So far I have the load cell exporting to excel (seperate VI w/ time as x axis) but have not tackled saving the position data from the motor.


The ideal VI would allow for me to change position (Manual input) and whatch my load cell react (chart). After stopping the software it would save a excel file of that "run".


How do I convert the SGL to a suitable type for the XY xchart?


How can I store the data to be looked at in excel?



Thank you all for your help,



Download All
0 Kudos
Message 1 of 5

I have a kind of usual rule that I do not try to help if someone uses Express VIs alongside with dynamic data. It is just too much effort for me.

I really advice you to have a look at the shipping examples coming with LabVIEW how to properly set up a code using the proper DAQmx functions. There are lots of examples. Try to progress step by step, so first only code the DAQmx part (and get the data as 2D array for the two channels and N samples), see how it works. You also have problems in your code with timing, you miss some basics. You should be able to use a simple XY Graph, and to "keep" data points, you could use a shift register.


Based on your code, you should take some more lessons of LabVIEW, check whether you have access to the Core 1 and 2. online training material (self-paced training).


About data logging: in this case as usual, I would use a Producer/consumer pattern and do the data logging in the consumer loop, saving values into a TDMS file. It is very handy to work with, and there is free plugin for Excel to open tdms files directly into excel worksheet...

0 Kudos
Message 2 of 5

OK, I'm forewarned by Blokk's response that you are (mis-)using the DAQ Assistant (I wrote an essay for one of my colleagues called "The Dreaded DAQ Assistant" a while ago) and (even worse!) Dynamic Wires.  These are fine for NI Travelling Road Shows, where Sales people come to colleges and try to demonstrate how quickly you can do something in LabVIEW, which usually goes over like a lead balloon, and never touches on the real strengths of LabVIEW, nor why it might be a better tool for an Engineer than, say, M**l*b, but that's another rant.


Do a Web Search for "Learn 10 Functions in NI-DAQmx", download the NI White Paper that it finds for you, read it, and stop using the DAQ Assistant.  When you use DAQmx Read functions, you'll have a (more logical) choice of outputs, depending on what you are sampling -- 1D Dbl, Waveform, 2D Dbl, 1D Waveform, etc.  


Now think about what it is you want to plot, namely Position vs Force, both of which are read from DAQ channels.  You are plotting them in a chart, which plots one or more channels against time, assumed to be uniformly advancing (which is why it is called a waveform chart).  You want to plot X vs Y -- this requires a LabVIEW X-Y graph.  Read the LabVIEW Help for Graphs, look at the examples, and incorporate this new knowledge into your design.


I don't know your background, but LabVIEW, while it is an Engineering tool (the "E" in LabVIEW is for "Engineering"), is also designed for the Scientist/Experimentalist.  When you are trying to figure out how to do something in LabVIEW (like create an XY graph of sampled data), "do an Experiment" and write a tiny throw-away VI that tests things for you.  For example, use a For Loop to create 10 "random" (or non-random, for that matter) X points and 10 Y points, bringing them out as 2 1D Arrays.  Figure out how to plot them against each other.  You should be able to do this fairly easily, will "learn how" to do this, and can then use this knowledge as a "known feature" of your larger program.  By breaking your larger program/project into smaller testable pieces, you will have a much easier time getting it to work.


Bob Schor

0 Kudos
Message 3 of 5

Thanks for directing me to the tutorials it helped a bunch. I now have data populating two columns in excel which was the end goal. BUT I am having a problem with sampling coming from the Thorlabs/APT Motor control  specifically for position. I have scoured around the help windows and even tried down sampling the DAQ which have only ended in error codes.


So far the posistion sampling rate in Excel is 1 sample per second.

The time stamp from the DAQ does not match the motors position.


Attached is the data and VI.


Please advise if possible!





Download All
0 Kudos
Message 4 of 5


The timestamp is associated with when the data was passed to your computers buffer from the daqcard and is a rough estimation of when the DAQ card might have made the measurement.  Take a look at this document.  I think it will clear up any confusion you may be experiencing.


How Accurate is the Timestamp of the Waveform Returned by my NI DAQmx Device?



0 Kudos
Message 5 of 5