07-31-2023 10:38 AM
My labview program runs my experiment machine and spits out the data in a waveform. i am developing a matlab application that analyzes the said data of the waveform so i am looking for a quick way to get the waveform from labview to matlab. my idea is to save the waveform data to a constant textfile and then load the data on matlab with a click of a button. So i tried the write waveform to textfile.vi and it gave me an error so i switched it to export waveform to speadsheet file.vi and fed the filepath as a constant textfile saved on my desktop as seen in the picture. i tried it and it worked however i need it to delete the current(previous run) data and replace it with the waveform of the current run. i set the append to file to false so that it replaces it however it gives a pop up asking the user if they want to replace it. How can i configure so that the pop up does not come up and labview replaces the textfile without asking?
07-31-2023 11:08 AM
And why not capture the data in MATLAB?
Here are some idea,
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000015BIPSA2&l=en-IN
https://forums.ni.com/t5/LabVIEW/Passing-data-from-LabVIEW-to-MATLAB/td-p/1910635
07-31-2023 12:07 PM
thank you for replying!
i have looked through the first link and essentially it is basically advising what I am currently doing which is to write the data to a file. The difference is it is telling to use the write to measurement file.vi and upon observing it you have to input a signal not waveform/data.(if there is any other way around this please let me know). Then the article talks about using producer consumer loops to simultaneously export data to matlab as the machine run. a) I am not well versed in lab view(started using it a week ago) and I dont have a lot of time b)it would be easier to debug/run/configure if i get all the data at once and then upload to matlab
additionally the forum/post you linked all essentially give the same solution of saving the data to a file and then loading in matlab. i was supposed to make the entire project on matlab but controlling the hardware in the machine proved to be too complex considering that the machine, labview application, and code for driving the hardware in the machine was made by a consulting company a long time ago and I dont have a lot of time left. Thats why I am continuning to use the labview application to run the machine and get the data and then use my matlab application to analyze with as little user input as possible/as seamless as possible.
if you have any advice, i would really appreciate it.
07-31-2023 12:46 PM
The easiest and simplest way is to write to file and read it in MATLAB.
How often does this MATLAB and LabVIEW data transfer has to happen? If intermittent, write to file, then run MATLAB and repeat.
If you need it to be continuous, probably a TCP/IP server/client structure would be more suited where the MATLAB is listening (waiting) for packets on a TCP/IP port, then LabVIEW sends data over the network (though local to the computer), MATLAB processes the data received and so on.
07-31-2023 01:38 PM
thank you for the reply. i will look more into the continuous streaming of data(if you know any videos or other helpful resources on streaming i would appreciate it). regardless, i thought you cant write a waveform to a textfile using write to file because write to file takes in text as input not waveform/data. Anyhow, I found a loophole by using an open/create/replace function, setting it to replace, and inputing the constant textfile. this essentially deletes the information of the file (by deleting the current file and creating an empty file of the same name essentially deleting it) and then i do export waveform to spreadsheet, input the same textfile path(now an empty file) and then set the append to file to True, thus replacing the file with new data at every run and removing the replace file pop up. Thank you for the help!