Transferring data between two computers by mouse clicking a pushbutton using MATLAB GUI
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Maurice Rohracker
am 23 Mär. 2017
Beantwortet: Anoop Somashekar
am 31 Mär. 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 Kommentare
Geoff Hayes
am 24 Mär. 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.
Akzeptierte Antwort
Anoop Somashekar
am 31 Mär. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!