MATLAB: Issue with textscan and decimal places

dataformattingMATLABtextscanudp

Hi, I currently have an android app that is constantly sending data over udp into matlab.
However I am getting this error whenever I tilt my device : Error using horzcat Dimensions of matrices being concatenated are not consistent.
The values range from -180 to 180 with 2 decimal points.
This is my code to receive and read the data :
fopen(UDPComIn);
csvdata=fscanf(UDPComIn);
scandata=textscan(csvdata,'%5.2f %5.2f %5.2f','Delimiter',',');
data=[scandata{1},scandata{2},scandata{3}];
set(sensorbar,'YData',data(1,:))
However the data I am getting either results in an error or (example) 1.1200,3.1300, 4.1200.
Is there a way to receive data that varies in dimensions and plot it, or must they all be the same?
Regards

Best Answer

See if adding ‘'CollectOutput',1’ to your textscan call makes improves things:
data = textscan(csvdata,'%5.2f %5.2f %5.2f','Delimiter',',', 'CollectOutput',1);
and then deleting the separate ‘data’ assignment (the following line).