Transferring data between two computers by mouse clicking a pushbutton using MATLAB GUI
2 views (last 30 days)
Show older comments
Maurice Rohracker
on 23 Mar 2017
Answered: Anoop Somashekar
on 31 Mar 2017
Hi I want to transfer data consitantly by mouse clicking a pushbutton in MATLAB GUI. Therefor I created a server (Server.m) and a client function (Verbraucher.m). The client function should open when the data is available and the server function has to open and close all secenonds, because in the same code is again a live-plot in a MATLAB GUI. But for some reasons the code doesn't work. Although I transfered data between two computers using the Server and Verbraucher file manually. For better understanding a added the functions and files.
2 Comments
Geoff Hayes
on 24 Mar 2017
Maurice - can you clarify what you mean but the code doesn't work. Which portion of the code is failing? Transferring the data from one machine to another? Updating the live plot?
If you are observing any errors, please copy and paste the full error message to this question.
Accepted Answer
Anoop Somashekar
on 31 Mar 2017
I ran the attached code and was able to send /receive the data between client and server. I was also able to recreate the error 'SIZE must be greater than 0' by passing an empty vector to the function Verbraucher i.e. Verbraucher([]). Since an empty vector is also a double, the BytesAvailable property at the server side will be greater than zero. You could add an extra check before performing an 'fread' as shown below:
if elements > 0
data = fread(reader,elements,'double');
end
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!