09-01-2017 04:19 AM
Hello everyone,
I want to plot a graph using file as input.Input file has 2 columns, X_axis - date,time & Y_axis - data.
File in string format is converted to array.Then,1D array is connected to the graph.Both X and Y axis in graph are set to 'AutoScale'.
I've attached the solution which I came to so far,please do suggest me the solution.
There might be some stupid mistakes as I'm v new to LabVIEW 🙂
Solved! Go to Solution.
09-01-2017 05:00 AM - edited 09-01-2017 05:04 AM
1) If you wire a length to delete from array, you get a 2d array (when input is 2d). So remove that (or use index array), so you get 2 1D arrays.
2) The dT is a scalar value, that specifies the time between every subsequent sample. You probably want to use an XY graph. The XY graph excepts an array of timestamps and an array of values (which is what you have). Or calculate the dT for one sample, and expect all dT's to be the same.
3) You're wiring an (array of) string to a (array of) doubles. That won't work (LV is not python) Insert a "Fract/Exp String To Number" function between the 2D, 1D or scalars to convert from string(s) to double(s). For the date\time you'll need some more advanced string parsing.
4) The date and time seem to be two columns. You need to somehow combine them.
09-01-2017 03:45 PM
I suspect you need to spend some time with the LabVIEW Tutorials, as there seems to be some basic ideas that you don't know/understand. I'm guessing that you did not write the attached VI -- it looks like an NI Example. Some things you should learn:
Spend more time with the Tutorials. Then try writing your own code, based on your new understanding.
Bob Schor
09-04-2017 04:27 AM
I have modified my program accordingly,still not able to plot the graph.
09-04-2017 04:32 AM - edited 09-04-2017 04:40 AM
Remove the while loop, and the two index array's in the while loop. That should at least enable the code to compile.
The first column is still a problem. You're formatting a string to double, but that only works if the string is a double. But the string is a timestamp.
To convert the string to a double, isn't that easy. It would be a lot easier if you could store the dT's (relative to T0) instead of the absolute timestamps. Then the fist column will be doubles, and everything should work.
To parse a timestamp string to double, you'll need to use Scan From String, and make a format string like "%<%Y-%m-%d %H:%M:%s>T". The help should provide help on that. Note that Scan From String does not work on arrays, so you need to put a for loop around it...
09-04-2017 05:41 AM
Thanks for the reply wiebe@CARYA!