Ni.com is currently experiencing issues that may cause some pages to fail.
Support teams are actively working on the resolution.
Ni.com is currently experiencing issues that may cause some pages to fail.
Support teams are actively working on the resolution.
07-24-2018 11:14 AM
Hi,
I have a array cluster from I used to plot to and XY graph that I now wish to save to file. What would best way to save it (as a txt or csv) in a save as dialog style ie user prompted to enter filename before saving?
Solved! Go to Solution.
07-24-2018 02:10 PM
I prefer XML.
07-24-2018 02:22 PM
If you are plotting a graph, then you probably have X-Y pairs. I would think that it would be easy to convert the array of clusters to a 2D array of Dbls. Hmm, I thought I remembered an Array to Spreadsheet and Spreadsheet to Array set of functions (in addition to Read/Write Delimited Spreadsheet File), but maybe they were dropped 4-5 years ago since I never used them ... But there are still Read/Write Delimited Spreadsheet File that can read/write .csv files (you need to specify the comma as a delimiter, unless you prefer the default value of <tab>).
I agree that XML can be nice, but it has its own idiosynchrasies ..
Bob Schor
07-24-2018 04:23 PM
@paul_cardinale wrote:
I prefer XML.
With results almost as cryptic as the xml produced, you could flatten to string and save it to config file!
07-25-2018 01:54 AM
Hi,
I've been trying some stuff and for now the most convenient way for me is/was to use the invoke node ExporttoExcel as I get the plot data as displayed instead of just the cluster array.
However what is inconvenient is that
1. PC need excel (not exactly a prob! 🙂 )
2. User need to explicitly do Save as
Ideally what I would want to achieve is
ExporttoExcel invoke node - > SaveAs Dialog -> user enters filename -> file saved as csv
OR
ExporttoClipboard invoke node ->Save As Dialog -> user enters filename -> csv file created ->data pasted into file by labview before close
Are either achievable?
07-25-2018 04:33 AM
Hi,
If you want to save array data to excel, the easiest way would be to use one of LabVIEW's 'write data to' functions. As you already have array data, this will be the simplest solution to your problem.
If your issue is related to avoiding the report generation toolkit. There is a support page that explains how to use the write data to excel functions without a report generation toolkit here.
Regarding your question on whether you can use the export to clipboard or excel invoke nodes, it is possible to do so using the export to clipboard invoke node. As you can see in the code below, you can access your clipboard data after using the Export to Clipboard Invoke node, but you would then still need to use one of the functions mentioned above to save the data to file.
As you had access to this array of data on the block diagram already, this process is a little redundant. I would suggest to just simply use the write to data function right from the beginning.
07-25-2018 11:36 AM
unfortunately that does not work for me (unless I'm doing it wrong!)
I have multiply xy plots and using "ExporttoExcel invoke node" or "ExporttoClipboard" (and paste in excel) invoke nodes I get a neatly speadsheet with each plot on seperate columns. Here what I would like more is the user prompt to save the file...
With the cluster of array I tried using a for loop to go through each element, unbundled it into a 2D array and added it file using the "Write delimited Spreadsheet VI" but ended up with only 2 columns (ie all plots were added onto came colunms) ! How do I add columns to my file?
07-25-2018 02:41 PM
You know the structure of your data, you know what you would like for the appearance of the file, and you have some code that does "the wrong thing". We can guess what you want, but you have the ability to show us by attaching your code (no pictures, please, just VIs), perhaps attaching some data, and/or attaching a text file that you create (perhaps with NotePad) that is an example of what you hope to achieve.
I understand that you are talking about multi-line plots. Are these Charts (i.e. only the Y value is really important) or X-Y Graphs? If you are talking about multiple lines-on-a-plot, do you want the points arranged as Rows or as Columns? Do you want a Header Column/Row (e.g. Plot 1, X / Plot 1, Y / Plot 2, X / Plot 2, Y)? What if you have multiple plots? Each one gets its own File? You put them all on the same file with another Header (Plot 1, Plot 2, etc.) to separate them?
Before starting a LabVIEW (or any programming) task, it is a good idea to plan what you want to do in sufficient detail that when you get stuck on how to do it, you can provide a clear idea of the "what", almost always more important than the "how". So much for philosophy ...
Bob Schor
07-26-2018 04:51 AM - edited 07-26-2018 04:53 AM
@Bob_Schor wrote:
You know the structure of your data, you know what you would like for the appearance of the file, and you have some code that does "the wrong thing". We can guess what you want, but you have the ability to show us by attaching your code (no pictures, please, just VIs), perhaps attaching some data, and/or attaching a text file that you create (perhaps with NotePad) that is an example of what you hope to achieve.
I understand that you are talking about multi-line plots. Are these Charts (i.e. only the Y value is really important) or X-Y Graphs? If you are talking about multiple lines-on-a-plot, do you want the points arranged as Rows or as Columns? Do you want a Header Column/Row (e.g. Plot 1, X / Plot 1, Y / Plot 2, X / Plot 2, Y)? What if you have multiple plots? Each one gets its own File? You put them all on the same file with another Header (Plot 1, Plot 2, etc.) to separate them?
Before starting a LabVIEW (or any programming) task, it is a good idea to plan what you want to do in sufficient detail that when you get stuck on how to do it, you can provide a clear idea of the "what", almost always more important than the "how". So much for philosophy ...
Bob Schor
Was expecting for someone to comment like that! 😉
I do not have some code that does the wrong thing so to speak... been iterating through possibilities with no success... so really building on the fly...
However to answer you other comment:
What I am constructing is a VI where the user construct plots that is then added to an XY plot (used as preview here). those constructed waveforms will then be used to control an NI-DAC.
The way I have done it so far is that once the constructed plots are added to the XY plot they are adjusted so ALL have the same X width (so yes, they can then be considered as charts at that point).
the last step which I am struggling with so far is saving the XY plots to a file so that it may be recalled. Ideally I would like all in one file. if not .csv then TDMS will do but just do not know how to transfer ALL the plots (with headers) to file. Please help
07-26-2018 07:00 AM
hi sherzaad,
doesn't sound too complicated,
your logic already converts/adjusts the data,
which means you only have to write this data to something.
have a look at "Write Delimited Spreadsheet.vi" for CSV,
or for TDMS search in the examples coming with labview (e.g. "TDMS Write Events Data.vi").
read up on TDMS http://www.ni.com/tutorial/9334/en/
regards