Matlab 在循环外部显示保存的数据
下面是我当前的MATLAB代码。代码正常运行,但我想知道是否有一种方法可以在循环更新时显示循环外部的数据。ThingSpeak是我目前使用的一种方法,但我也想在MATLAB中看到它Matlab 在循环外部显示保存的数据,matlab,Matlab,下面是我当前的MATLAB代码。代码正常运行,但我想知道是否有一种方法可以在循环更新时显示循环外部的数据。ThingSpeak是我目前使用的一种方法,但我也想在MATLAB中看到它 a = Bluetooth('HC-05',1); a.ReadAsyncMode = 'continuous'; fopen(a); heartRateVar=0; temperatureVar=0; accVar=0; while (a.Status == 'open') rawData = f
a = Bluetooth('HC-05',1);
a.ReadAsyncMode = 'continuous';
fopen(a);
heartRateVar=0;
temperatureVar=0;
accVar=0;
while (a.Status == 'open')
rawData = fscanf(a,'%s');
idx = strfind(rawData,'_');
match = strtrim(rawData(1:idx-1));
test = strncmpi(match,'Celsius',2);
if(test==1)
temperatureVar=match;
elseif(test==0)
if(strncmpi(match,'BPM',2)==1)
heartRateVar=match;
end
end
%create arbitrary time stamps of same size as data points to send data
to thingspeak
stamps = [datetime('now')-minutes(length(match)-1):minutes(1):datetime('now')]';
%send data accompanied by timestamps to thingspeak
thingSpeakWrite(501358,{heartRateVar,temperatureVar,accVar},'WriteKey','JLS6DXUINWFGI6QD');
if(a.Status ~= 'open')
break;
end
end
谢谢 您可以通过在变量行上设置断点来使用调试模式并运行代码,也可以在屏幕上打印代码