Hi
I'm trying to stream data into matlab using the TCP library and while I'm getting data it is quite laggy. If I monitor the data using a program like Putty there is no lag. So I was wondering if there were settings or something I could change in matlab to make this work better/be less slow. For those curious here is my code for streaming data.
%Matlab script for reading from TCP/IP server
%Clear Console and workspace
close all;clear all; clc;%Set Up Connection
rhost = '18.111.48.184';rport = 23;disp('Welcome to Real Time TCP/IP Data Logger!')disp('Attempting to connect to:')disp(rhost)x = ['port: ',num2str(rport)];disp(x)t = tcpip(rhost,rport);t.InputBufferSize = 300000;%wait for connection
disp('Connecting...')fopen(t); %Open the socket
disp('Connected.')disp('To stop connection press Ctrl+C')%start collecting data line by line
disp('Collecting Data...')while (t.BytesAvailable > 0) data = fscanf(t) %One line of data
disp(data)enddisp('Data Collected')fclose(t)fdelete(t)clear t
Best Answer