arduino在matlab中的多个实时绘图

arduino在matlab中的多个实时绘图,matlab,arduino,Matlab,Arduino,我希望你能帮助我 我已经将3个传感器连接到Arduino上,同时将数据发送到串行端口 arduino代码是 unsigned int pres; unsigned int temp; unsigned int fluidrate; void setup() { Serial.begin(9600); } void loop() { pres = analogRead(0); temp = analogRead(1); fluidrate = analogRead(2); Seria

我希望你能帮助我

我已经将3个传感器连接到Arduino上,同时将数据发送到串行端口

arduino代码是

 unsigned int pres; 
 unsigned int temp; 
 unsigned int fluidrate;
 void setup()
{
Serial.begin(9600);
}
void loop()
{
pres = analogRead(0);
temp = analogRead(1);
fluidrate =  analogRead(2);
Serial.print(pres);
Serial.print("\t");
Serial.print(temp);
Serial.print("\t");
Serial.print(fluidrate);
Serial.print("\n");
delay(1000);
} arduino串行监视器中的数据为

257    7    14
273    23   46
327    77   154
340    90   180
345    95   190
352    102  204
Matlab代码是

clear all
clc
arduino=serial('COM8','BaudRate',9600);
fopen(arduino); 
 x=linspace(1,100);
 numcols = 1; 
 y = {};
 for i=1:length(x);    
 data =fscanf(arduino,'%f'); 
     IncomingString = char(data);
     IncomingString = regexp(IncomingString, '\s*', 'split');
     pres(i,1)= IncomingString(1,1); 
     temp(i,1)= IncomingString(1,2); 
     fluidrate(i,1)= IncomingString(1,3); 
 end
fclose(arduino);
Plotpres = str2double(pres);
figure(1)
plot(Plotpres);
title('pressure'); xlabel('Samples'); ylabel('pres in bar');
Plottemp = str2double(temp); 
figure(2)
plot(Plottemp);
title('temperature'); xlabel('Samples'); ylabel('temp in C');
Plotfluidrate = str2double(fluidrate); 
figure(3)
plot(Plotfluidrate);
title('fluidrate'); xlabel('Samples'); ylabel('fluidrate in l/min');
我得到错误???使用==>regexp时出错第一个参数(字符串)必须是一维字符数组或字符串单元格数组

==>monitorsystem在11 IncomingString=regexp(IncomingString,“\s*”,“split”)时出错


请帮助我获取输出

看起来IncomingString不是预期的大小。字符串的格式是什么?为什么要用
%f
表示整数?此外,fscanf已经将ascii数据转换为double,不要认为
char(data)
在这种情况下返回任何有用的内容。请告诉我们什么是
数据
,以及您希望如何处理它。