05-18-2021 04:38 AM
Hi,
I made a code that sends serial data to labview through MATLAB.
After receiving all the data, the error 1 occurred at scan from string. But the data is saved well as a designated text file.
I don't know why this error occurs.
I attached my code and the error.
Thank you!
Solved! Go to Solution.
05-18-2021 06:36 AM
What is the data you are receiving?
05-18-2021 02:53 PM - edited 05-18-2021 02:55 PM
Too many questions that cannot be answered from a code picture. Please attach a simplified version of your VI containing typical default values in the controls!
05-19-2021 07:00 PM
Thank you for your reply!!!
=> 8
=> 10000
=> can you edit my code?
=> I wanna receive serial data from a moving instrument, so I'm practicing send serial data to LabVIEW
using MATLAB.
I attached my code file and saved data file. Thank you so much!!!! 🙂
05-19-2021 07:03 PM
I send continuous numbers from MATLAB for testing.
I attached a picture of saved data file.
Thank you!!
05-20-2021 06:40 AM
@jw121 wrote:
After receiving all the data, the error 1 occurred at scan from string.
Ok, I think I missed this point before. So I'm left to assume here that the Matlab code has a set number of points that it sends out. So how does the LabVIEW code know when it got it all the data? It appears you are getting a timeout at the VISA Read just because there is no data to read. So you get an empty string out from that. The Scan From String will therefore return an error because you cannot scan anything from an empty string. And the only way you will see that error is if you have Automatic Error Handling turned on.
So the way I see it, you just need the Scan From String in the error chain.
05-20-2021 11:45 PM
Thank you!
What is mean "you just need the Scan From String in the error chain."??
05-21-2021 06:51 AM
Wire the Error Out on the VISA Read to the Error In on the Scan From String. Then the Error Out on the Scan From String goes to the Error In on the Write Text File.
05-24-2021 01:35 AM
Thank you so much. It worked!!
I have another question.
Can I set start time of elapsed time when the serial data starts to come in?
Thank you.
05-24-2021 06:32 AM
@jw121 wrote:
Can I set start time of elapsed time when the serial data starts to come in?
Use the Iteration Terminal of your loop. If i = 0, reset.